Skip to content

Commit

Permalink
Support specifying a pattern for which units should generate a version
Browse files Browse the repository at this point in the history
  • Loading branch information
merks committed Nov 1, 2023
1 parent a04f0c3 commit 751267f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion features/org.eclipse.oomph.targlets-feature/feature.xml
Expand Up @@ -12,7 +12,7 @@
<feature
id="org.eclipse.oomph.targlets"
label="%featureName"
version="1.24.0.qualifier"
version="1.25.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.oomph.license"
license-feature-version="0.0.0">
Expand Down
2 changes: 1 addition & 1 deletion features/org.eclipse.oomph.targlets-feature/pom.xml
Expand Up @@ -20,6 +20,6 @@
</parent>
<groupId>org.eclipse.oomph.features</groupId>
<artifactId>org.eclipse.oomph.targlets</artifactId>
<version>1.24.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
14 changes: 7 additions & 7 deletions plugins/org.eclipse.oomph.targlets.core/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.oomph.targlets.core;singleton:=true
Bundle-Version: 1.19.0.qualifier
Bundle-Version: 1.20.0.qualifier
Bundle-ClassPath: .
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Expand All @@ -27,15 +27,15 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.24.0,4.0.0)",
org.eclipse.equinox.p2.updatesite;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jdt.core;bundle-version="[3.5.0,4.0.0)",
org.eclipse.pde.core;bundle-version="[3.5.0,4.0.0)",
org.eclipse.oomph.targlets;bundle-version="[1.17.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.p2.core;bundle-version="[1.25.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.targlets;bundle-version="[1.18.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.p2.core;bundle-version="[1.27.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.util.pde;bundle-version="[1.12.0,2.0.0)",
org.eclipse.equinox.frameworkadmin;bundle-version="[2.0.0,3.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.oomph.targlets.core;version="1.19.0";x-internal:=true,
org.eclipse.oomph.targlets.internal.core;version="1.19.0";x-internal:=true,
org.eclipse.oomph.targlets.internal.core.listeners;version="1.19.0";x-internal:=true,
org.eclipse.oomph.targlets.internal.core.variables;version="1.19.0";x-internal:=true
Export-Package: org.eclipse.oomph.targlets.core;version="1.20.0";x-internal:=true,
org.eclipse.oomph.targlets.internal.core;version="1.20.0";x-internal:=true,
org.eclipse.oomph.targlets.internal.core.listeners;version="1.20.0";x-internal:=true,
org.eclipse.oomph.targlets.internal.core.variables;version="1.20.0";x-internal:=true
Bundle-Activator: org.eclipse.oomph.targlets.internal.core.TargletsCorePlugin$Implementation
Automatic-Module-Name: org.eclipse.oomph.targlets.core
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.targlets.core/pom.xml
Expand Up @@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.oomph</groupId>
<artifactId>org.eclipse.oomph.targlets.core</artifactId>
<version>1.19.0-SNAPSHOT</version>
<version>1.20.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Expand Up @@ -134,6 +134,8 @@ public class TargetDefinitionGenerator extends WorkspaceUpdateListener

private static final String TRUE = Boolean.TRUE.toString();

private static final String FALSE = Boolean.FALSE.toString();

private static final String SETTINGS_NAMESPACE = "http://maven.apache.org/SETTINGS/1.0.0"; //$NON-NLS-1$

public TargetDefinitionGenerator()
Expand Down Expand Up @@ -195,7 +197,21 @@ else if (location.startsWith("platform:/resource/")) //$NON-NLS-1$
final boolean generateImplicitUnits = isAnnotationDetail(annotation, ANNOTATION_GENERATE_IMPLICIT_UNITS, false);
final boolean minimizeImplicitUnits = isAnnotationDetail(annotation, ANNOTATION_MINIMIZE_IMPLICIT_UNITS, false);
final boolean ignoreJavaRequirements = isAnnotationDetail(annotation, ANNOTATION_IGNORE_JAVA_REQUIREMENTS, true);
final boolean versions = isAnnotationDetail(annotation, ANNOTATION_GENERATE_VERSIONS, false);
String detail = getAnnotationDetail(annotation, ANNOTATION_GENERATE_VERSIONS, Boolean.toString(false));
final Pattern versionsPattern;
if (TRUE.equalsIgnoreCase(detail))
{
versionsPattern = Pattern.compile(".*"); //$NON-NLS-1$
}
else if (FALSE.equalsIgnoreCase(detail) || StringUtil.isEmpty(detail))
{
versionsPattern = Pattern.compile(""); //$NON-NLS-1$
}
else
{
versionsPattern = Pattern.compile(detail);
}

final boolean includeAllPlatforms = isAnnotationDetail(annotation, ANNOTATION_INCLUDE_ALL_PLATFORMS, targlet.isIncludeAllPlatforms());
final boolean includeConfigurePhase = isAnnotationDetail(annotation, ANNOTATION_INCLUDE_CONFIGURE_PHASE, true);
final String includeMode = getAnnotationDetail(annotation, ANNOTATION_INCLUDE_MODE,
Expand Down Expand Up @@ -292,7 +308,7 @@ protected String createNewContents(String oldContents, String encoding, String n

for (IInstallableUnit iu : list)
{
elements.add(formatElement(iu, versions, escaper));
elements.add(formatElement(iu, versionsPattern.matcher(iu.getId()).matches(), escaper));
}

for (String element : elements)
Expand Down Expand Up @@ -344,7 +360,7 @@ protected String createNewContents(String oldContents, String encoding, String n

for (IInstallableUnit iu : list)
{
elements.add(formatElement(iu, versions, escaper));
elements.add(formatElement(iu, versionsPattern.matcher(iu.getId()).matches(), escaper));
}

for (String element : elements)
Expand Down

0 comments on commit 751267f

Please sign in to comment.