Skip to content

Commit

Permalink
Improve the update mechanism for new Jetty versions
Browse files Browse the repository at this point in the history
Enhance the dependency analyzer to update bom dependencies for
MavenJettySupplement.target.
Enhance the updater to update the feature version from a selected
dependency's version for MavenJetty.target.
Provide launchers for these and use them in the AnalyzerAndUpdateAll
launcher.
Update json-schema-validator to 1.3.1.
  • Loading branch information
merks committed Feb 1, 2024
1 parent ab9d605 commit e3d5cf2
Show file tree
Hide file tree
Showing 22 changed files with 445 additions and 365 deletions.
12 changes: 11 additions & 1 deletion AnalyzeAndUpdateAll.launch
Expand Up @@ -39,7 +39,17 @@
<booleanAttribute key="org.eclipse.debug.core.launchGroup.7.adoptIfRunning" value="false"/>
<booleanAttribute key="org.eclipse.debug.core.launchGroup.7.enabled" value="true"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.7.mode" value="inherit"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.7.name" value="MavenJettyDependencyAnalyzer"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.7.name" value="MavenJettySupplementDependencyAnalyzer"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.8.action" value="WAIT_FOR_TERMINATION"/>
<booleanAttribute key="org.eclipse.debug.core.launchGroup.8.adoptIfRunning" value="false"/>
<booleanAttribute key="org.eclipse.debug.core.launchGroup.8.enabled" value="true"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.8.mode" value="inherit"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.8.name" value="MavenJettyDependencyAnalyzer"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.9.action" value="WAIT_FOR_TERMINATION"/>
<booleanAttribute key="org.eclipse.debug.core.launchGroup.9.adoptIfRunning" value="false"/>
<booleanAttribute key="org.eclipse.debug.core.launchGroup.9.enabled" value="true"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.9.mode" value="inherit"/>
<stringAttribute key="org.eclipse.debug.core.launchGroup.9.name" value="MavenJettyUpdater"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
Expand Down
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/org.eclipse.orbit.maven.bnd.generator/src/org/eclipse/orbit/maven/bnd/generator/Analyzer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.orbit.maven.bnd.generator.Analyzer"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="org.eclipse.orbit.maven.bnd.generator"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-version &quot;&lt;version&gt;(.*?)&lt;/version&gt;&quot;&#13;&#10;-target ${resource_loc:/org.eclipse.orbit.simrel/maven-jetty/tp/MavenJetty.target}&#13;&#10;-verbose"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.orbit.maven.bnd.generator"/>
</launchConfiguration>
Expand Up @@ -176,8 +176,13 @@ private String visitLocation(String location) {
throw new IllegalStateException("Each feature must have unique id: " + featureID);
}

featureMatcher.appendReplacement(result, Matcher.quoteReplacement(visitFeature(feature, featureID)));
featureMatcher.appendReplacement(result, Matcher.quoteReplacement(visitFeature(location, feature, featureID)));
featureMatcher.appendTail(result);

if (!version.contains("(")) { // )
return result.toString();
}

return visitDependencies(result.toString(), featureID);
}

Expand All @@ -189,7 +194,7 @@ private String getFeatureID(String feature) {
return null;
}

private String visitFeature(String feature, String featureID) {
private String visitFeature(String location, String feature, String featureID) {
var featureVersionMatcher = FEATURE_VERSION_PATTERN.matcher(feature);
if (!featureVersionMatcher.find()) {
throw new IllegalStateException("Each feature must have a version.");
Expand All @@ -200,8 +205,17 @@ private String visitFeature(String feature, String featureID) {
System.out.println("--- " + featureID + ":" + featureVersion + "---");
}

if (!featureVersion.startsWith(version)) {
feature = replace(feature, featureVersionMatcher, "version", version);
var effectiveVersion = version;
if (version.contains("(")) { // )
Matcher matcher = Pattern.compile(version).matcher(location);
if (!matcher.find()) {
throw new IllegalStateException("The version pattern is not found: " + version);
}
effectiveVersion = matcher.group(1);
}

if (!featureVersion.startsWith(effectiveVersion)) {
feature = replace(feature, featureVersionMatcher, "version", effectiveVersion);
}

return feature.replaceAll("Copyright \\(c\\) [0-9]+", "Copyright (c) " + year);
Expand Down
2 changes: 1 addition & 1 deletion maven-bnd/tp/MavenBND.target
Expand Up @@ -2548,7 +2548,7 @@ SPDX-License-Identifier: EPL-2.0
<dependency>
<groupId>com.networknt</groupId>
<artifactId>json-schema-validator</artifactId>
<version>1.3.0</version>
<version>1.3.1</version>
<type>jar</type>
</dependency>

Expand Down

0 comments on commit e3d5cf2

Please sign in to comment.