-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump versions + copied BumpVersions (& adjusted) and MergableManifest2
from xtext utils.
- Loading branch information
1 parent
7f15726
commit 37c1c67
Showing
25 changed files
with
1,311 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
28
org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
2 changes: 2 additions & 0 deletions
2
...se.xpect.releng/org.eclipse.xpect.releng.utils/.settings/org.eclipse.core.resources.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
16 changes: 16 additions & 0 deletions
16
org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
4 changes: 4 additions & 0 deletions
4
org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/.settings/org.eclipse.m2e.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
9 changes: 9 additions & 0 deletions
9
org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
3 changes: 3 additions & 0 deletions
3
org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
org.eclipse.xpect.releng/org.eclipse.xpect.releng.utils/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
211 changes: 211 additions & 0 deletions
211
...eleng/org.eclipse.xpect.releng.utils/src/org/eclipse/xpect/releng/utils/BumpVersions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
Oops, something went wrong.