Skip to content

Commit

Permalink
Provide generator support for keeping older dependencies when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
merks committed Dec 5, 2023
1 parent a5b1e66 commit f9995f3
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 21 deletions.
3 changes: 3 additions & 0 deletions maven-osgi/dependency-analyzer-arg.txt
Expand Up @@ -55,3 +55,6 @@ commons-collections:commons-collections:200[234].*
io.takari.m2e.workspace:org.eclipse.m2e.workspace.cli:0.4.0
ch.qos.logback:logback-classic:1.4.7 // Has non-optional missing required service capability.
org.apache.commons:commons-digester3:3.2 // requires 'java.package; net.sf.cglib.proxy 0.0.0' but it could not be found

-keep
commons-logging:commons-logging:1.2
Expand Up @@ -149,8 +149,16 @@ public static void main(String[] args) throws Exception {
return exclusionPatterns.stream().anyMatch(pattern -> it.matches(pattern));
});

var keep = getArguments(arguments, "-keep");
var keepPatterns = keep.stream().map(Pattern::compile).collect(Collectors.toList());

// Remove any dependency for which there is a minor update version.
// Except the ones specified to keep.
dependencies.removeIf(it -> {
if (keepPatterns.stream().anyMatch(it::matches)) {
return false;
}

return dependencies.stream().anyMatch(it2 -> {
return it != it2 && it2.isSameArtfiact(it)
&& it2.version.compareTo(it.nextMajorVersion(majorInclusionPatterns)) < 0
Expand Down
4 changes: 2 additions & 2 deletions maven-osgi/tp/Maven.target
Expand Up @@ -3,7 +3,7 @@
<target name="Maven" sequenceNumber="1">
<locations>
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="error" type="Maven">
<feature id="org.eclipse.orbit.maven.osgi.all" label="Orbit Maven OSGi All" provider-name="Eclipse Orbit" version="4.31.0.v20231205-0807">
<feature id="org.eclipse.orbit.maven.osgi.all" label="Orbit Maven OSGi All" provider-name="Eclipse Orbit" version="4.31.0.v20231205-1136">
<description>This feature's dependencies are pulled directly from Maven central.</description>
<copyright>
Copyright (c) 2023 Eclipse contributors and others.
Expand All @@ -16,7 +16,7 @@ https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
</copyright>
<license url="https://www.eclipse.org/legal/epl-2.0/"/>
<!-- SHA1 1b550dba8140f2fb706337f22b6b75fe0164f969 -->
<!-- SHA1 e05a7f45563284d1015a3048e36412d547a5c241 -->
</feature>
<dependencies>
<dependency>
Expand Down
6 changes: 0 additions & 6 deletions maven-osgi/tp/other/MavenSupplement.target
Expand Up @@ -291,12 +291,6 @@
<version>3.6.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
Expand Down
1 change: 1 addition & 0 deletions report/maven-osgi/merged-target/REPORT.md
Expand Up @@ -127,6 +127,7 @@
- [commons-lang](https://repo1.maven.org/maven2/commons-lang/)
- [commons-lang](https://repo1.maven.org/maven2/commons-lang/commons-lang/) **[2.6](https://repo1.maven.org/maven2/commons-lang/commons-lang/2.6)**
- [commons-logging](https://repo1.maven.org/maven2/commons-logging/)
- [commons-logging](https://repo1.maven.org/maven2/commons-logging/commons-logging/) **[1.2](https://repo1.maven.org/maven2/commons-logging/commons-logging/1.2)**
- [commons-logging](https://repo1.maven.org/maven2/commons-logging/commons-logging/) **[1.3.0](https://repo1.maven.org/maven2/commons-logging/commons-logging/1.3.0)**
- [io.github.classgraph](https://repo1.maven.org/maven2/io/github/classgraph/)
- [classgraph](https://repo1.maven.org/maven2/io/github/classgraph/classgraph/) **[4.8.165](https://repo1.maven.org/maven2/io/github/classgraph/classgraph/4.8.165)**
Expand Down
1 change: 0 additions & 1 deletion report/maven-osgi/supplement/REPORT.md
Expand Up @@ -48,7 +48,6 @@
- [commons-discovery](https://repo1.maven.org/maven2/commons-discovery/)
- [commons-discovery](https://repo1.maven.org/maven2/commons-discovery/commons-discovery/) **[0.5](https://repo1.maven.org/maven2/commons-discovery/commons-discovery/0.5)**
- [commons-logging](https://repo1.maven.org/maven2/commons-logging/)
- [commons-logging](https://repo1.maven.org/maven2/commons-logging/commons-logging/) **[1.2](https://repo1.maven.org/maven2/commons-logging/commons-logging/1.2)**
- [commons-logging](https://repo1.maven.org/maven2/commons-logging/commons-logging/) **[1.3.0](https://repo1.maven.org/maven2/commons-logging/commons-logging/1.3.0)**
- [io.github.classgraph](https://repo1.maven.org/maven2/io/github/classgraph/)
- [classgraph](https://repo1.maven.org/maven2/io/github/classgraph/classgraph/) **[4.8.165](https://repo1.maven.org/maven2/io/github/classgraph/classgraph/4.8.165)**
Expand Down
6 changes: 0 additions & 6 deletions report/maven-osgi/supplement/original.target
Expand Up @@ -291,12 +291,6 @@
<version>3.6.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions report/maven-osgi/supplement/updated.target
Expand Up @@ -291,12 +291,6 @@
<version>3.6.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
Expand Down

0 comments on commit f9995f3

Please sign in to comment.