From e421ff0f9733a4977b27791e03a04cc01484dcdc Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Fri, 12 Feb 2016 14:06:16 +0100 Subject: [PATCH] Update to upstream version 3.0.1 --- .gitignore | 1 + ...ort-to-current-maven-dependency-tree.patch | 240 ++++++++++++++++++ 0002-Downgrade-aqute-bnd.patch | 51 ++++ maven-plugin-bundle.spec | 25 +- sources | 2 +- 5 files changed, 316 insertions(+), 3 deletions(-) create mode 100644 0001-Port-to-current-maven-dependency-tree.patch create mode 100644 0002-Downgrade-aqute-bnd.patch diff --git a/.gitignore b/.gitignore index 0527861..fe968b8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ maven-bundle-plugin-2.0.0-project.tar.gz /maven-bundle-plugin-2.3.6-source-release.tar.gz /maven-bundle-plugin-2.3.7-source-release.tar.gz /maven-bundle-plugin-2.5.4-source-release.tar.gz +/maven-bundle-plugin-3.0.1-source-release.tar.gz diff --git a/0001-Port-to-current-maven-dependency-tree.patch b/0001-Port-to-current-maven-dependency-tree.patch new file mode 100644 index 0000000..744c703 --- /dev/null +++ b/0001-Port-to-current-maven-dependency-tree.patch @@ -0,0 +1,240 @@ +From db734c96a85f9f323e5533a3a9d41260efa8f0e2 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Fri, 12 Feb 2016 09:45:20 +0100 +Subject: [PATCH 1/2] Port to current maven-dependency-tree + +--- + .../apache/felix/bundleplugin/BundleAllPlugin.java | 54 ++++++++++++---------- + .../apache/felix/bundleplugin/BundlePlugin.java | 29 ++++++------ + 2 files changed, 44 insertions(+), 39 deletions(-) + +diff --git a/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java b/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java +index 5d095d8..b32b90b 100644 +--- a/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java ++++ b/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java +@@ -21,8 +21,10 @@ package org.apache.felix.bundleplugin; + + import java.io.File; + import java.io.FilenameFilter; ++import java.util.ArrayDeque; + import java.util.Arrays; + import java.util.Collection; ++import java.util.Deque; + import java.util.HashSet; + import java.util.Iterator; + import java.util.LinkedHashMap; +@@ -38,7 +40,6 @@ import org.apache.maven.artifact.Artifact; + import org.apache.maven.artifact.factory.ArtifactFactory; + import org.apache.maven.artifact.metadata.ArtifactMetadataSource; + import org.apache.maven.artifact.repository.ArtifactRepository; +-import org.apache.maven.artifact.resolver.ArtifactCollector; + import org.apache.maven.artifact.resolver.ArtifactNotFoundException; + import org.apache.maven.artifact.resolver.ArtifactResolutionException; + import org.apache.maven.artifact.resolver.ArtifactResolver; +@@ -49,13 +50,14 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; + import org.apache.maven.plugins.annotations.Mojo; + import org.apache.maven.plugins.annotations.Parameter; + import org.apache.maven.plugins.annotations.ResolutionScope; ++import org.apache.maven.project.DefaultProjectBuildingRequest; + import org.apache.maven.project.MavenProject; + import org.apache.maven.project.MavenProjectBuilder; + import org.apache.maven.project.ProjectBuildingException; ++import org.apache.maven.project.ProjectBuildingRequest; + import org.apache.maven.project.artifact.InvalidDependencyVersionException; +-import org.apache.maven.shared.dependency.tree.DependencyNode; +-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder; +-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException; ++import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException; ++import org.apache.maven.shared.dependency.graph.DependencyNode; + import org.codehaus.plexus.util.FileUtils; + + import aQute.bnd.osgi.Analyzer; +@@ -92,24 +94,18 @@ public class BundleAllPlugin extends ManifestPlugin + */ + @Parameter( property = "wrapImportPackage", defaultValue = "*" ) + private String wrapImportPackage; +- + @Component + private ArtifactFactory m_factory; + + @Component + private ArtifactMetadataSource m_artifactMetadataSource; + +- @Component +- private ArtifactCollector m_collector; +- + /** + * Artifact resolver, needed to download jars. + */ + @Component + private ArtifactResolver m_artifactResolver; + +- @Component +- private DependencyTreeBuilder m_dependencyTreeBuilder; + + @Component + private MavenProjectBuilder m_mavenProjectBuilder; +@@ -180,17 +176,19 @@ public class BundleAllPlugin extends ManifestPlugin + + try + { +- dependencyTree = m_dependencyTreeBuilder.buildDependencyTree( project, localRepository, m_factory, +- m_artifactMetadataSource, null, m_collector ); ++ ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); ++ request.setProject(getProject()); ++ request.setRepositorySession(session.getRepositorySession()); ++ dependencyTree = m_dependencyGraphBuilder.buildDependencyGraph(request, null); + } +- catch ( DependencyTreeBuilderException e ) ++ catch ( DependencyGraphBuilderException e ) + { + throw new MojoExecutionException( "Unable to build dependency tree", e ); + } + + BundleInfo bundleInfo = new BundleInfo(); + +- if ( !dependencyTree.hasChildren() ) ++ if ( dependencyTree.getChildren().isEmpty()) + { + /* no need to traverse the tree */ + return bundleRoot( project, bundleInfo ); +@@ -198,20 +196,27 @@ public class BundleAllPlugin extends ManifestPlugin + + getLog().debug( "Will bundle the following dependency tree" + LS + dependencyTree ); + +- for ( Iterator it = dependencyTree.inverseIterator(); it.hasNext(); ) ++ Deque stack = new ArrayDeque(); ++ stack.push(dependencyTree); ++ Set visited = new HashSet(); ++ while (!stack.isEmpty()) + { +- DependencyNode node = ( DependencyNode ) it.next(); +- if ( !it.hasNext() ) ++ DependencyNode node = stack.pop(); ++ if (visited.contains(node)) + { +- /* this is the root, current project */ +- break; ++ continue; + } +- +- if ( node.getState() != DependencyNode.INCLUDED ) ++ visited.add(node); ++ if (node.getChildren() != null) + { +- continue; ++ stack.addAll(node.getChildren()); + } + ++ //if ( node.getState() != DependencyNode.INCLUDED ) ++ //{ ++ // continue; ++ //} ++ + if ( Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) ) + { + getLog().debug( "Ignoring system scoped artifact " + node.getArtifact() ); +@@ -235,12 +240,11 @@ public class BundleAllPlugin extends ManifestPlugin + + node.getArtifact().setFile( artifact.getFile() ); + +- int nodeDepth = node.getDepth(); +- if ( nodeDepth > maxDepth ) ++ if ( stack.size() > maxDepth ) + { + /* node is deeper than we want */ + getLog().debug( +- "Ignoring " + node.getArtifact() + ", depth is " + nodeDepth + ", bigger than " + maxDepth ); ++ "Ignoring " + node.getArtifact() + ", depth is " + stack.size() + ", bigger than " + maxDepth ); + continue; + } + +diff --git a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +index f15a34a..6ceb4c0 100644 +--- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java ++++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +@@ -72,15 +72,15 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; + import org.apache.maven.plugins.annotations.Mojo; + import org.apache.maven.plugins.annotations.Parameter; + import org.apache.maven.plugins.annotations.ResolutionScope; ++import org.apache.maven.project.DefaultProjectBuildingRequest; + import org.apache.maven.project.MavenProject; + import org.apache.maven.project.MavenProjectBuilder; + import org.apache.maven.project.MavenProjectHelper; + import org.apache.maven.project.ProjectBuildingException; ++import org.apache.maven.project.ProjectBuildingRequest; + import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder; + import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException; + import org.apache.maven.shared.dependency.graph.DependencyNode; +-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder; +-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException; + import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter; + import org.apache.maven.shared.osgi.Maven2OsgiConverter; + import org.codehaus.plexus.archiver.UnArchiver; +@@ -212,9 +212,6 @@ public class BundlePlugin extends AbstractMojo + @Component + protected MavenProjectBuilder mavenProjectBuilder; + +- @Component +- private DependencyTreeBuilder dependencyTreeBuilder; +- + /** + * The dependency graph builder to use. + */ +@@ -331,7 +328,9 @@ public class BundlePlugin extends AbstractMojo + DependencyNode dependencyGraph; + try + { +- dependencyGraph = m_dependencyGraphBuilder.buildDependencyGraph( mavenProject, null ); ++ ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); ++ request.setProject(mavenProject); ++ dependencyGraph = m_dependencyGraphBuilder.buildDependencyGraph( request, null ); + } + catch ( DependencyGraphBuilderException e ) + { +@@ -739,7 +738,7 @@ public class BundlePlugin extends AbstractMojo + // We need to find the direct dependencies that have been included in the uber JAR so that we can modify the + // POM accordingly. + private void createDependencyReducedPom( Set artifactsToRemove ) +- throws IOException, DependencyTreeBuilderException, ProjectBuildingException ++ throws IOException, DependencyGraphBuilderException, ProjectBuildingException + { + Model model = project.getOriginalModel(); + List dependencies = new ArrayList(); +@@ -882,24 +881,26 @@ public class BundlePlugin extends AbstractMojo + } + + public boolean updateExcludesInDeps( MavenProject project, List dependencies, List transitiveDeps ) +- throws DependencyTreeBuilderException ++ throws DependencyGraphBuilderException + { +- org.apache.maven.shared.dependency.tree.DependencyNode node = dependencyTreeBuilder.buildDependencyTree(project, localRepository, artifactFactory, +- artifactMetadataSource, null, +- artifactCollector); ++ ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); ++ request.setProject(project); ++ request.setRepositorySession(session.getRepositorySession()); ++ DependencyNode node = dependencyGraphBuilder.buildDependencyGraph(request, null); + boolean modified = false; + Iterator it = node.getChildren().listIterator(); + while ( it.hasNext() ) + { +- org.apache.maven.shared.dependency.tree.DependencyNode n2 = (org.apache.maven.shared.dependency.tree.DependencyNode) it.next(); ++ DependencyNode n2 = (DependencyNode) it.next(); + Iterator it2 = n2.getChildren().listIterator(); + while ( it2.hasNext() ) + { +- org.apache.maven.shared.dependency.tree.DependencyNode n3 = (org.apache.maven.shared.dependency.tree.DependencyNode) it2.next(); ++ DependencyNode n3 = (DependencyNode) it2.next(); + //anything two levels deep that is marked "included" + //is stuff that was excluded by the original poms, make sure it + //remains excluded IF promoting transitives. +- if ( n3.getState() == org.apache.maven.shared.dependency.tree.DependencyNode.INCLUDED ) ++ //if ( n3.getState() == org.apache.maven.shared.dependency.tree.DependencyNode.INCLUDED ) ++ if (true) + { + //check if it really isn't in the list of original dependencies. Maven + //prior to 2.0.8 may grab versions from transients instead of +-- +2.5.0 + diff --git a/0002-Downgrade-aqute-bnd.patch b/0002-Downgrade-aqute-bnd.patch new file mode 100644 index 0000000..4b79955 --- /dev/null +++ b/0002-Downgrade-aqute-bnd.patch @@ -0,0 +1,51 @@ +From ea37cbea181c548280c758aa6962d0d06f664c30 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Fri, 12 Feb 2016 11:17:02 +0100 +Subject: [PATCH 2/2] Downgrade aqute-bnd + +--- + .../java/org/apache/felix/bundleplugin/BundlePlugin.java | 1 + + .../java/org/apache/felix/bundleplugin/ManifestPlugin.java | 14 +++++++------- + 2 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +index 6ceb4c0..07a36fe 100644 +--- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java ++++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +@@ -330,6 +330,7 @@ public class BundlePlugin extends AbstractMojo + { + ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); + request.setProject(mavenProject); ++ request.setRepositorySession(session.getRepositorySession()); + dependencyGraph = m_dependencyGraphBuilder.buildDependencyGraph( request, null ); + } + catch ( DependencyGraphBuilderException e ) +diff --git a/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java b/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java +index 1e1d025..add2cd4 100644 +--- a/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java ++++ b/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java +@@ -120,14 +120,14 @@ public class ManifestPlugin extends BundlePlugin + } + finally + { +- try +- { ++// try ++// { + analyzer.close(); +- } +- catch ( IOException e ) +- { +- throw new MojoExecutionException( "Error trying to write Manifest to file " + outputFile, e ); +- } ++// } ++// catch ( IOException e ) ++// { ++// throw new MojoExecutionException( "Error trying to write Manifest to file " + outputFile, e ); ++// } + } + } + +-- +2.5.0 + diff --git a/maven-plugin-bundle.spec b/maven-plugin-bundle.spec index cfb4b20..e41f6e4 100644 --- a/maven-plugin-bundle.spec +++ b/maven-plugin-bundle.spec @@ -1,8 +1,8 @@ %global site_name maven-bundle-plugin Name: maven-plugin-bundle -Version: 2.5.4 -Release: 2%{?dist} +Version: 3.0.1 +Release: 1%{?dist} Summary: Maven Bundle Plugin License: ASL 2.0 URL: http://felix.apache.org @@ -10,6 +10,11 @@ BuildArch: noarch Source0: http://archive.apache.org/dist/felix/%{site_name}-%{version}-source-release.tar.gz +# Needs polishing to be sent upstream +Patch0: 0001-Port-to-current-maven-dependency-tree.patch +# It doesn't really need new aqute-bnd +Patch1: 0002-Downgrade-aqute-bnd.patch + BuildRequires: maven-local BuildRequires: mvn(biz.aQute.bnd:biz.aQute.bndlib) BuildRequires: mvn(net.sf.kxml:kxml2) @@ -17,17 +22,22 @@ BuildRequires: mvn(org.apache.felix:felix-parent:pom:) BuildRequires: mvn(org.apache.felix:org.apache.felix.bundlerepository) BuildRequires: mvn(org.apache.felix:org.apache.felix.framework) BuildRequires: mvn(org.apache.felix:org.apache.felix.utils) +BuildRequires: mvn(org.apache.maven.doxia:doxia-core) BuildRequires: mvn(org.apache.maven.doxia:doxia-sink-api) BuildRequires: mvn(org.apache.maven.doxia:doxia-site-renderer) BuildRequires: mvn(org.apache.maven:maven-archiver) +BuildRequires: mvn(org.apache.maven:maven-compat) BuildRequires: mvn(org.apache.maven:maven-core) +BuildRequires: mvn(org.apache.maven.plugins:maven-invoker-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin) BuildRequires: mvn(org.apache.maven.plugin-tools:maven-plugin-annotations) BuildRequires: mvn(org.apache.maven.reporting:maven-reporting-impl) BuildRequires: mvn(org.apache.maven.shared:maven-dependency-tree) BuildRequires: mvn(org.codehaus.plexus:plexus-utils) +BuildRequires: mvn(org.jdom:jdom) BuildRequires: mvn(org.osgi:org.osgi.core) BuildRequires: mvn(org.sonatype.plexus:plexus-build-api) +BuildRequires: mvn(xpp3:xpp3) %description Provides a maven plugin that supports creating an OSGi bundle @@ -43,11 +53,19 @@ API documentation for %{name}. %prep %setup -q -n %{site_name}-%{version} +%patch0 -p1 +%patch1 -p1 + find -name '*.jar' -delete +# Bundled class from old maven-dependency-tree +rm -r src/main/java/org/apache/maven/shared/dependency + # There is forked version of maven-osgi in # src/{main,test}/java/org/apache/maven +%pom_add_dep org.apache.maven:maven-compat +%pom_add_dep xpp3:xpp3 %pom_add_dep net.sf.kxml:kxml2 %pom_add_dep org.apache.felix:org.apache.felix.framework %pom_add_dep org.apache.maven.reporting:maven-reporting-impl @@ -66,6 +84,9 @@ find -name '*.jar' -delete %doc LICENSE NOTICE %changelog +* Fri Feb 12 2016 Michael Simacek - 3.0.1-1 +- Update to upstream version 3.0.1 + * Thu Feb 04 2016 Fedora Release Engineering - 2.5.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index 403231f..173724d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9dc0bf198f8a717b6369dc9fcca05e99 maven-bundle-plugin-2.5.4-source-release.tar.gz +816b8695dd6dbec3ba22f719baee60ba maven-bundle-plugin-3.0.1-source-release.tar.gz