Skip to content

Commit

Permalink
bump versions + copied BumpVersions (& adjusted) and MergableManifest2
Browse files Browse the repository at this point in the history
from xtext utils.
  • Loading branch information
mehmet-karaman committed Dec 17, 2024
1 parent 7f15726 commit 37c1c67
Show file tree
Hide file tree
Showing 25 changed files with 1,311 additions and 193 deletions.
26 changes: 13 additions & 13 deletions org.eclipse.xpect.doc/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ Bundle-SymbolicName: org.eclipse.xpect.doc
Bundle-Localization: plugin
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.eclipse.xtext;bundle-version="2.4.0",
org.eclipse.xtext.common.types;bundle-version="2.4.0",
Require-Bundle: org.eclipse.xtext;bundle-version="2.34.0",
org.eclipse.xtext.common.types;bundle-version="2.34.0",
org.junit;bundle-version="4.10.0",
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.xtext.xbase;bundle-version="2.4.0",
org.eclipse.xtext.ui;bundle-version="2.4.0",
org.eclipse.xtext.common.types.ui;bundle-version="2.4.0",
org.eclipse.xtext.ui.codetemplates;bundle-version="2.4.0",
org.eclipse.xtext.ui.codetemplates.ui;bundle-version="2.4.0",
org.eclipse.compare;bundle-version="3.5.301",
org.eclipse.xtext.ui.shared;bundle-version="2.4.0",
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.xtext.xbase;bundle-version="2.34.0",
org.eclipse.xtext.ui;bundle-version="2.34.0",
org.eclipse.xtext.common.types.ui;bundle-version="2.34.0",
org.eclipse.xtext.ui.codetemplates;bundle-version="2.34.0",
org.eclipse.xtext.ui.codetemplates.ui;bundle-version="2.34.0",
org.eclipse.compare;bundle-version="3.10.0",
org.eclipse.xtext.ui.shared;bundle-version="2.34.0",
org.eclipse.ui.ide;bundle-version="3.22.100",
org.eclipse.jdt;bundle-version="3.7.0",
org.eclipse.jdt.junit;bundle-version="3.7.100",
org.eclipse.pde.ui;bundle-version="3.7.2",
org.eclipse.debug.ui;bundle-version="3.7.0",
org.eclipse.jdt.junit;bundle-version="3.16.300",
org.eclipse.pde.ui;bundle-version="3.15.100",
org.eclipse.debug.ui;bundle-version="3.18.300",
org.eclipse.xpect;bundle-version="0.1.0",
org.eclipse.xpect.ui;bundle-version="0.1.0"
Automatic-Module-Name: org.eclipse.xpect.doc
6 changes: 3 additions & 3 deletions org.eclipse.xpect.examples/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.eclipse.xtend.lib,
com.google.guava,
org.eclipse.xtext.xbase.lib,
org.eclipse.xtext.xbase.lib;bundle-version="2.34.0",
org.eclipse.xpect.xtext.lib;bundle-version="0.1.0",
org.eclipse.xtend.ide;bundle-version="2.4.0",
org.eclipse.xtext.xtext.ui;bundle-version="2.4.0",
org.eclipse.emf.codegen;bundle-version="2.8.0"
org.eclipse.xtext.xtext.ui;bundle-version="2.34.0",
org.eclipse.emf.codegen;bundle-version="2.23.0"
Automatic-Module-Name: org.eclipse.xpect.examples
12 changes: 6 additions & 6 deletions org.eclipse.xpect.ide/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Bundle-Version: 0.3.0.qualifier
Bundle-SymbolicName: org.eclipse.xpect.ide; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xpect,
org.eclipse.xtext.ide,
org.eclipse.xtext.xbase.ide,
org.eclipse.xtext.ide;bundle-version="2.34.0",
org.eclipse.xtext.xbase.ide;bundle-version="2.34.0",
org.antlr.runtime;bundle-version="[3.2.0,3.2.1)"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Export-Package: org.eclipse.xpect.ide.contentassist.antlr,
org.eclipse.xpect.ide.contentassist.antlr.lexer,
org.eclipse.xpect.lexer,
org.eclipse.xpect.ide.contentassist.antlr.internal
Export-Package: org.eclipse.xpect.ide.contentassist.antlr;version="0.3.0",
org.eclipse.xpect.ide.contentassist.antlr.lexer;version="0.3.0",
org.eclipse.xpect.lexer;version="0.3.0",
org.eclipse.xpect.ide.contentassist.antlr.internal;version="0.3.0"
6 changes: 3 additions & 3 deletions org.eclipse.xpect.mwe2/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Bundle-Version: 0.3.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Automatic-Module-Name: org.eclipse.xpect.xtext.lib
Require-Bundle: com.google.guava,
org.eclipse.xtext.xbase.lib,
org.eclipse.xtext.xbase.lib;bundle-version="2.34.0",
org.eclipse.xtend.lib,
org.eclipse.xtend.lib.macro,
org.eclipse.xtext,
org.eclipse.xtext.xtext.generator;bundle-version="2.31.0"
org.eclipse.xtext;bundle-version="2.34.0",
org.eclipse.xtext.xtext.generator;bundle-version="2.34.0"
17 changes: 17 additions & 0 deletions org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="main/resources/|test/resources/" kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
28 changes: 28 additions & 0 deletions org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.xpect.releng.utils</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Utils
Bundle-SymbolicName: org.eclipse.xpect.releng.utils
Bundle-Version: 0.3.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Automatic-Module-Name: org.eclipse.xpect.utils
Export-Package: org.eclipse.xpect.releng.utils;version="0.3.0"
Require-Bundle: org.eclipse.xtext.util;bundle-version="2.34.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source.. = src/
bin.includes = META-INF/,\
.
10 changes: 10 additions & 0 deletions org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.eclipse.xpect.utils</artifactId>
<parent>
<groupId>org.eclipse.xpect</groupId>
<artifactId>org.eclipse.xpect.parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<relativePath>../maven-plugin-parent</relativePath>
</parent>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
/*******************************************************************************
* Copyright (c) 2024 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.xpect.releng.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.eclipse.xpect.releng.utils.MergeableManifest2.BundleOrPackage;
import org.eclipse.xpect.releng.utils.MergeableManifest2.BundleOrPackageList;

/**
* @author Sebastian - Initial contribution and API
* @author Mehmet - Adjusted solution for the needs of xpect
*/
public class BumpVersions {

public static void main(String[] args) throws Exception {
try {
File gitRoot = new File(".").getAbsoluteFile().getParentFile().getParentFile().getParentFile();
Map<String, String> versionsFromDevBom = new HashMap<>();
addMissingVersions(versionsFromDevBom);
String xtextVersion = "2.34.0";
String xpectVersion = "0.3.0";
for (File bundleDir : gitRoot.listFiles()) {
if (bundleDir.isDirectory()) {
File manifest = new File(bundleDir, "META-INF/MANIFEST.MF");
if (manifest.exists()) {
MergeableManifest2 mergable;
try (FileInputStream is = new FileInputStream(manifest)) {
mergable = new MergeableManifest2(is);
}
String bundleSymName = mergable.getMainAttributes().get("Bundle-SymbolicName").replace(";singleton:=true", "");
if (!bundleSymName.equals("org.eclipse.xpect.doc") && !bundleSymName.equals("org.eclipse.xpect.doc") && !bundleSymName.equals("org.eclipse.xpect.examples")) {
mergable.getMainAttributes().put(MergeableManifest2.BUNDLE_VERSION,
xpectVersion + ".qualifier");
}
updateRequiredXtextBundles(mergable, xtextVersion);
updateImportedXtextPackages(mergable, xtextVersion);
updateExportedXtextPackages(mergable, xpectVersion);
updateRequiredBundle(mergable, versionsFromDevBom);

if (mergable.isModified()) {
try (FileOutputStream out = new FileOutputStream(manifest)) {
mergable.write(out);
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}

private static final String LSP4J_VERSION = "[0.23.1,0.24.0)";

private static void addMissingVersions(Map<String, String> bundleToVersion) {
bundleToVersion.put("org.hamcrest.core", "2.2.0");
bundleToVersion.put("org.hamcrest.library", "1.3.0");
bundleToVersion.put("org.eclipse.lsp4j", LSP4J_VERSION);
bundleToVersion.put("org.eclipse.lsp4j.jsonrpc", LSP4J_VERSION);

bundleToVersion.put("org.eclipse.jdt.core", "3.37.0");
bundleToVersion.put("org.eclipse.jdt.core.manipulation", "1.21.0");
bundleToVersion.put("org.eclipse.jdt.debug", "3.21.300");
bundleToVersion.put("org.eclipse.jdt.debug.ui", "3.13.300");
bundleToVersion.put("org.eclipse.jdt.junit", "3.16.300");
bundleToVersion.put("org.eclipse.jdt.launching", "3.21.100");
bundleToVersion.put("org.eclipse.jdt.ui", "3.32.0");

bundleToVersion.put("org.eclipse.ui", "3.205.100");
bundleToVersion.put("org.eclipse.ui.console", "3.14.0");
bundleToVersion.put("org.eclipse.ui.editors", "3.17.200");
bundleToVersion.put("org.eclipse.ui.forms", "3.13.200");
bundleToVersion.put("org.eclipse.ui.ide", "3.22.100");
bundleToVersion.put("org.eclipse.ui.navigator", "3.12.300");
bundleToVersion.put("org.eclipse.ui.views", "3.12.200");
bundleToVersion.put("org.eclipse.ui.workbench", "3.131.100");
bundleToVersion.put("org.eclipse.ui.workbench.texteditor", "3.17.300");

bundleToVersion.put("org.eclipse.swtbot.eclipse.core", "4.1.0");
bundleToVersion.put("org.eclipse.swtbot.eclipse.finder", "4.1.0");
bundleToVersion.put("org.eclipse.swtbot.junit4_x", "4.1.0");
bundleToVersion.put("org.eclipse.swtbot.swt.finder", "4.1.0");

bundleToVersion.put("org.apache.ant", "1.10.14");
bundleToVersion.put("org.eclipse.buildship.core", "3.1.9");

bundleToVersion.put("org.eclipse.compare", "3.10.0");
bundleToVersion.put("org.eclipse.e4.core.services", "2.4.300");
bundleToVersion.put("org.eclipse.e4.ui.css.swt.theme", "0.14.300");

bundleToVersion.put("jakarta.inject.jakarta.inject-api", "2.0.1");

bundleToVersion.put("org.eclipse.core.databinding", "1.13.200");
bundleToVersion.put("org.eclipse.core.databinding.beans", "1.10.200");
bundleToVersion.put("org.eclipse.core.databinding.property", "1.10.200");

bundleToVersion.put("org.eclipse.core.expressions", "3.9.300");
bundleToVersion.put("org.eclipse.core.filesystem", "1.10.300");
bundleToVersion.put("org.eclipse.core.resources", "3.20.100");
bundleToVersion.put("org.eclipse.core.runtime", "3.31.0");
bundleToVersion.put("org.eclipse.debug.core", "3.21.300");
bundleToVersion.put("org.eclipse.debug.ui", "3.18.300");
bundleToVersion.put("org.eclipse.draw2d", "3.15.0");
bundleToVersion.put("org.eclipse.emf.codegen", "2.23.0");
bundleToVersion.put("org.eclipse.emf.codegen.ecore", "2.37.0");
bundleToVersion.put("org.eclipse.emf.common", "2.30.0");
bundleToVersion.put("org.eclipse.emf.common.ui", "2.22.0");
bundleToVersion.put("org.eclipse.emf.ecore", "2.36.0");
bundleToVersion.put("org.eclipse.emf.ecore.change", "2.16.0");
bundleToVersion.put("org.eclipse.emf.ecore.editor", "2.18.0");
bundleToVersion.put("org.eclipse.emf.ecore.xmi", "2.37.0");
bundleToVersion.put("org.eclipse.emf.edit", "2.21.0");
bundleToVersion.put("org.eclipse.emf.edit.ui", "2.23.0");
bundleToVersion.put("org.eclipse.equinox.common", "3.19.0");
bundleToVersion.put("org.eclipse.help", "3.10.300");
bundleToVersion.put("org.eclipse.jface", "3.33.0");
bundleToVersion.put("org.eclipse.jface.databinding", "1.15.200");
bundleToVersion.put("org.eclipse.jface.text", "3.25.0");
bundleToVersion.put("org.eclipse.ltk.core.refactoring", "3.14.300");
bundleToVersion.put("org.eclipse.ltk.ui.refactoring", "3.13.300");
bundleToVersion.put("org.eclipse.m2e.core", "2.6.0");
bundleToVersion.put("org.eclipse.m2e.maven.runtime", "3.9.600");
bundleToVersion.put("org.eclipse.pde.core", "3.18.0");
bundleToVersion.put("org.eclipse.pde.ui", "3.15.100");
bundleToVersion.put("org.eclipse.search", "3.16.100");

bundleToVersion.put("org.eclipse.team.core", "3.10.300");
bundleToVersion.put("org.eclipse.team.ui", "3.10.300");
}

private static void updateRequiredBundle(MergeableManifest2 mergable, Map<String, String> bundleVersions) {
String oldBundles = mergable.getMainAttributes().get(MergeableManifest2.REQUIRE_BUNDLE);
if (oldBundles == null)
return;
BundleOrPackageList requiredBundles = BundleOrPackageList.fromInput(oldBundles, mergable.getLineDelimiter(),
"bundle-version");
List<String> updatedBundles = new ArrayList<>();
for (BundleOrPackage requiredBundle : requiredBundles.list()) {
String bundleName = requiredBundle.getName();
String newVersion = bundleVersions.get(bundleName);
if (newVersion != null) {
updatedBundles.add(bundleName + ";bundle-version=\"" + newVersion + "\"");
}
}
mergable.addRequiredBundles(updatedBundles.toArray(new String[0]), true);
}

private static void updateRequiredXtextBundles(MergeableManifest2 mergable, String newVersion) {
String oldBundles = mergable.getMainAttributes().get(MergeableManifest2.REQUIRE_BUNDLE);
if (oldBundles == null)
return;
BundleOrPackageList requiredBundles = BundleOrPackageList.fromInput(oldBundles, mergable.getLineDelimiter(),
"bundle-version");
List<String> updatedBundles = new ArrayList<>();
for (BundleOrPackage requiredBundle : requiredBundles.list()) {
String bundleName = requiredBundle.getName();
if (bundleName.startsWith("org.eclipse.xtext")) {
if (bundleName.endsWith(".example.domainmodel") || bundleName.endsWith("example.domainmodel.ui")) {
continue;
}
updatedBundles.add(bundleName + ";bundle-version=\"" + newVersion + "\"");
}
}
mergable.addRequiredBundles(updatedBundles.toArray(new String[0]), true);
}

private static void updateImportedXtextPackages(MergeableManifest2 mergable, String newVersion) {
String oldPackages = mergable.getMainAttributes().get(MergeableManifest2.IMPORT_PACKAGE);
if (oldPackages == null)
return;
BundleOrPackageList importedPackages = BundleOrPackageList.fromInput(oldPackages, mergable.getLineDelimiter(),
"version");
List<String> updatedPackages = new ArrayList<>();
for (BundleOrPackage importedPackage : importedPackages.list()) {
String packageName = importedPackage.getName();
if (packageName.startsWith("org.eclipse.x")) {
updatedPackages.add(packageName + ";version=\"" + newVersion + "\"");
}
}
mergable.addImportedPackages(updatedPackages.toArray(new String[0]), true);
}

private static void updateExportedXtextPackages(MergeableManifest2 mergable, String newVersion) {
String oldPackages = mergable.getMainAttributes().get(MergeableManifest2.EXPORT_PACKAGE);
if (oldPackages == null)
return;
BundleOrPackageList exportedPackages = BundleOrPackageList.fromInput(oldPackages, mergable.getLineDelimiter(),
"version");
List<String> updatedPackages = new ArrayList<>();
for (BundleOrPackage exportedPackage : exportedPackages.list()) {
String packageName = exportedPackage.getName();
updatedPackages.add(packageName + ";version=\"" + newVersion + "\"");
}
mergable.addExportedPackages(updatedPackages.toArray(new String[0]), true);
}

}
Loading

0 comments on commit 37c1c67

Please sign in to comment.