From 526fd4f2ac95944baba545b5dc2e35d0396ae4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Wed, 19 Jun 2024 17:51:40 +0300 Subject: [PATCH] Switch to JSR330 The following plugins and components are switched tycho-apitools-plugin, tycho-baseline-plugin, tycho-bnd-plugin, tycho-build are migrated. --- tycho-apitools-plugin/pom.xml | 6 +++--- .../ApiAnnotationsClasspathContributor.java | 9 +++++---- .../apitools/ApiApplicationResolver.java | 17 +++++++--------- tycho-artifactcomparator/pom.xml | 6 +++--- .../internal/NestedZipComparator.java | 17 ++++++++++------ .../internal/PropertiesComparator.java | 9 ++++++--- .../internal/TextComparator.java | 7 +++++-- .../zipcomparator/internal/XmlComparator.java | 9 ++++++--- .../internal/ZipComparatorImpl.java | 15 ++++++++------ .../jarcomparator/testdata/JavaClass.java | 8 +++++--- tycho-baseline-plugin/pom.xml | 6 +++--- .../BundleArtifactBaselineComparator.java | 15 ++++++++------ .../baseline/FeatureBaselineComparator.java | 20 +++++++++++-------- tycho-bnd-plugin/pom.xml | 6 +++--- .../maven/BndMavenLifecycleParticipant.java | 13 +++++++----- .../maven/BndProjectExecutionListener.java | 7 +++++-- tycho-build/pom.xml | 7 +++---- .../build/DefaultBuildTimestampProvider.java | 7 +++++-- .../tycho/build/TychoCiFriendlyVersions.java | 6 ++++-- .../tycho/build/TychoGraphBuilder.java | 15 ++++++++------ .../tycho/build/bnd/BndProjectMapping.java | 13 +++++------- .../tycho/build/bnd/BndWorkspaceMapping.java | 8 +++++--- .../jgit/JGitBuildTimestampProvider.java | 14 ++++++++----- 23 files changed, 140 insertions(+), 100 deletions(-) diff --git a/tycho-apitools-plugin/pom.xml b/tycho-apitools-plugin/pom.xml index d6b4e2613c..3b1e35fab1 100644 --- a/tycho-apitools-plugin/pom.xml +++ b/tycho-apitools-plugin/pom.xml @@ -94,9 +94,9 @@ - org.codehaus.plexus - plexus-component-metadata - + org.eclipse.sisu + sisu-maven-plugin + org.apache.maven.plugins maven-plugin-plugin diff --git a/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiAnnotationsClasspathContributor.java b/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiAnnotationsClasspathContributor.java index e1560017db..bf6ba32a4c 100644 --- a/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiAnnotationsClasspathContributor.java +++ b/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiAnnotationsClasspathContributor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023 Christoph Läubrich and others. + * Copyright (c) 2023, 2024 Christoph Läubrich and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -15,19 +15,20 @@ import java.util.Optional; import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; import org.apache.maven.SessionScoped; import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin; -import org.eclipse.tycho.classpath.ClasspathContributor; import org.eclipse.tycho.core.TychoProjectManager; import org.eclipse.tycho.core.osgitools.AbstractSpecificationClasspathContributor; import org.eclipse.tycho.model.project.EclipseProject; import org.osgi.framework.VersionRange; -@Component(role = ClasspathContributor.class, hint = "apitools-annotations") +@Named("apitools-annotations") +@Singleton @SessionScoped public class ApiAnnotationsClasspathContributor extends AbstractSpecificationClasspathContributor { diff --git a/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiApplicationResolver.java b/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiApplicationResolver.java index ddc2b1c6b7..e1385822fa 100644 --- a/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiApplicationResolver.java +++ b/tycho-apitools-plugin/src/main/java/org/eclipse/tycho/apitools/ApiApplicationResolver.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023 Christoph Läubrich and others. + * Copyright (c) 2023, 2024 Christoph Läubrich and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -18,9 +18,9 @@ import java.util.List; import java.util.Set; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; +import javax.inject.Inject; +import javax.inject.Singleton; + import org.eclipse.tycho.ArtifactKey; import org.eclipse.tycho.ArtifactType; import org.eclipse.tycho.IllegalArtifactReferenceException; @@ -41,16 +41,13 @@ * Component that resolves the bundles that make up the ApiApplication from a * given URI */ -@Component(role = ApiApplicationResolver.class) +@Singleton public class ApiApplicationResolver { - @Requirement - private Logger logger; - - @Requirement + @Inject private EclipseApplicationFactory applicationFactory; - @Requirement + @Inject private EclipseApplicationManager applicationManager; public Collection getApiBaselineBundles(Collection baselineRepoLocations, diff --git a/tycho-artifactcomparator/pom.xml b/tycho-artifactcomparator/pom.xml index ab222e246c..e9da3c5d9f 100644 --- a/tycho-artifactcomparator/pom.xml +++ b/tycho-artifactcomparator/pom.xml @@ -86,9 +86,9 @@ - org.codehaus.plexus - plexus-component-metadata - + org.eclipse.sisu + sisu-maven-plugin + diff --git a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/NestedZipComparator.java b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/NestedZipComparator.java index a8168a7a0a..e9c34b91d8 100644 --- a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/NestedZipComparator.java +++ b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/NestedZipComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2022 Sonatype Inc. and others. + * Copyright (c) 2012, 2024 Sonatype Inc. and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -17,18 +17,22 @@ import java.nio.file.Path; import java.nio.file.StandardCopyOption; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + import org.eclipse.tycho.artifactcomparator.ArtifactComparator; import org.eclipse.tycho.artifactcomparator.ArtifactComparator.ComparisonData; import org.eclipse.tycho.artifactcomparator.ArtifactDelta; import org.eclipse.tycho.artifactcomparator.ComparatorInputStream; -@Component(role = ContentsComparator.class, hint = NestedZipComparator.TYPE) +@Named(NestedZipComparator.TYPE) +@Singleton public class NestedZipComparator implements ContentsComparator { public static final String TYPE = "zip"; - @Requirement(hint = ZipComparatorImpl.TYPE) + @Inject + @Named(ZipComparatorImpl.TYPE) private ArtifactComparator zipComparator; @Override @@ -48,7 +52,8 @@ public ArtifactDelta getDelta(ComparatorInputStream baseline, ComparatorInputStr @Override public boolean matches(String extension) { - return TYPE.equalsIgnoreCase(extension) || "jar".equalsIgnoreCase(extension) || "war".equalsIgnoreCase(extension); + return TYPE.equalsIgnoreCase(extension) || "jar".equalsIgnoreCase(extension) + || "war".equalsIgnoreCase(extension); } } diff --git a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/PropertiesComparator.java b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/PropertiesComparator.java index b5f34abc19..1cca955615 100644 --- a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/PropertiesComparator.java +++ b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/PropertiesComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2022 Sonatype Inc. and others. + * Copyright (c) 2012, 2024 Sonatype Inc. and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -19,12 +19,15 @@ import java.util.Set; import java.util.TreeMap; -import org.codehaus.plexus.component.annotations.Component; +import javax.inject.Named; +import javax.inject.Singleton; + import org.eclipse.tycho.artifactcomparator.ArtifactComparator.ComparisonData; import org.eclipse.tycho.artifactcomparator.ArtifactDelta; import org.eclipse.tycho.artifactcomparator.ComparatorInputStream; -@Component(role = ContentsComparator.class, hint = PropertiesComparator.TYPE) +@Named(PropertiesComparator.TYPE) +@Singleton public class PropertiesComparator implements ContentsComparator { public static final String TYPE = "properties"; diff --git a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/TextComparator.java b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/TextComparator.java index 34b6589f3d..1d3d6058e9 100644 --- a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/TextComparator.java +++ b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/TextComparator.java @@ -18,8 +18,10 @@ import java.util.List; import java.util.stream.Collectors; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.commons.io.IOUtils; -import org.codehaus.plexus.component.annotations.Component; import org.eclipse.tycho.artifactcomparator.ArtifactComparator.ComparisonData; import org.eclipse.tycho.artifactcomparator.ArtifactDelta; import org.eclipse.tycho.artifactcomparator.ComparatorInputStream; @@ -31,7 +33,8 @@ /** * Compares text-like files by ignoring there line ending styles */ -@Component(role = ContentsComparator.class, hint = TextComparator.HINT) +@Named(TextComparator.HINT) +@Singleton public class TextComparator implements ContentsComparator { static final String HINT = "txt"; diff --git a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/XmlComparator.java b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/XmlComparator.java index 7ef0b3e7a0..306bafa415 100644 --- a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/XmlComparator.java +++ b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/XmlComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 Christoph Läubrich and others. + * Copyright (c) 2022, 2024 Christoph Läubrich and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -16,7 +16,9 @@ import java.io.InputStream; import java.util.Set; -import org.codehaus.plexus.component.annotations.Component; +import javax.inject.Named; +import javax.inject.Singleton; + import org.eclipse.tycho.artifactcomparator.ArtifactComparator.ComparisonData; import org.eclipse.tycho.artifactcomparator.ArtifactDelta; import org.eclipse.tycho.artifactcomparator.ComparatorInputStream; @@ -24,7 +26,8 @@ import org.xmlunit.builder.Input; import org.xmlunit.diff.Diff; -@Component(role = ContentsComparator.class, hint = XmlComparator.HINT) +@Named(XmlComparator.HINT) +@Singleton public class XmlComparator implements ContentsComparator { static final String HINT = "xml"; diff --git a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ZipComparatorImpl.java b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ZipComparatorImpl.java index a1de7efc13..bf8742c17b 100644 --- a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ZipComparatorImpl.java +++ b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ZipComparatorImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2022 Sonatype Inc. and others. + * Copyright (c) 2012, 2024 Sonatype Inc. and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -31,27 +31,30 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.MatchPatterns; import org.eclipse.tycho.artifactcomparator.ArtifactComparator; import org.eclipse.tycho.artifactcomparator.ArtifactDelta; import org.eclipse.tycho.artifactcomparator.ComparatorInputStream; -@Component(role = ArtifactComparator.class, hint = ZipComparatorImpl.TYPE) +@Named(ZipComparatorImpl.TYPE) +@Singleton public class ZipComparatorImpl implements ArtifactComparator { public static final String TYPE = "zip"; private static final List IGNORED_PATTERNS = List.of("META-INF/maven/**"); - @Requirement + @Inject private Logger log; - @Requirement + @Inject private Map comparators; @Override diff --git a/tycho-artifactcomparator/src/test/java/org/eclipse/tycho/jarcomparator/testdata/JavaClass.java b/tycho-artifactcomparator/src/test/java/org/eclipse/tycho/jarcomparator/testdata/JavaClass.java index 82fd3fd1fa..aa45ba2302 100644 --- a/tycho-artifactcomparator/src/test/java/org/eclipse/tycho/jarcomparator/testdata/JavaClass.java +++ b/tycho-artifactcomparator/src/test/java/org/eclipse/tycho/jarcomparator/testdata/JavaClass.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Sonatype Inc. and others. + * Copyright (c) 2012, 2024 Sonatype Inc. and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -16,9 +16,11 @@ import java.util.LinkedHashSet; import java.util.Set; -import org.codehaus.plexus.component.annotations.Component; +import javax.inject.Named; +import javax.inject.Singleton; -@Component(role = JavaClass.class) +@Named +@Singleton public class JavaClass { public Set getStrings() throws IOException { return new LinkedHashSet() { diff --git a/tycho-baseline-plugin/pom.xml b/tycho-baseline-plugin/pom.xml index 5acee8e8ba..4826a1d810 100644 --- a/tycho-baseline-plugin/pom.xml +++ b/tycho-baseline-plugin/pom.xml @@ -57,9 +57,9 @@ - org.codehaus.plexus - plexus-component-metadata - + org.eclipse.sisu + sisu-maven-plugin + org.apache.maven.plugins maven-plugin-plugin diff --git a/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/BundleArtifactBaselineComparator.java b/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/BundleArtifactBaselineComparator.java index b91eec903b..f674d4d0e2 100644 --- a/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/BundleArtifactBaselineComparator.java +++ b/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/BundleArtifactBaselineComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 Christoph Läubrich and others. + * Copyright (c) 2022, 2024 Christoph Läubrich and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -32,11 +32,13 @@ import java.util.jar.Manifest; import java.util.stream.Collectors; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.commons.io.FilenameUtils; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.VersionRange; @@ -75,7 +77,8 @@ import de.vandermeer.asciitable.AsciiTable; import de.vandermeer.skb.interfaces.transformers.textformat.TextAlignment; -@Component(role = ArtifactBaselineComparator.class, hint = ArtifactType.TYPE_ECLIPSE_PLUGIN) +@Named(ArtifactType.TYPE_ECLIPSE_PLUGIN) +@Singleton public class BundleArtifactBaselineComparator implements ArtifactBaselineComparator { private static final String X_INTERNAL_ATTRIBUTE = "x-internal"; @@ -86,10 +89,10 @@ public class BundleArtifactBaselineComparator implements ArtifactBaselineCompara private static final int WIDTH = 160; - @Requirement + @Inject private P2RepositoryManager repositoryManager; - @Requirement(role = ContentsComparator.class) + @Inject Map contentComparators; @Override diff --git a/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/FeatureBaselineComparator.java b/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/FeatureBaselineComparator.java index 230561832b..1c1d0b4c05 100644 --- a/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/FeatureBaselineComparator.java +++ b/tycho-baseline-plugin/src/main/java/org/eclipse/tycho/baseline/FeatureBaselineComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 Christoph Läubrich and others. + * Copyright (c) 2022, 2024 Christoph Läubrich and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -29,11 +29,13 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -78,7 +80,8 @@ * will be considered a micro change *
    */ -@Component(role = ArtifactBaselineComparator.class, hint = ArtifactType.TYPE_ECLIPSE_FEATURE) +@Named(ArtifactType.TYPE_ECLIPSE_FEATURE) +@Singleton public class FeatureBaselineComparator implements ArtifactBaselineComparator { private static final int WIDTH = 160; @@ -86,16 +89,17 @@ public class FeatureBaselineComparator implements ArtifactBaselineComparator { private static final String GROUP_SUFFIX = ".feature.group"; private static final String JAR_SUFFIX = ".feature.jar"; - @Requirement(hint = "zip") + @Named("zip") + @Inject ContentsComparator zipComparator; - @Requirement + @Inject MetadataIO metadataIO; - @Requirement + @Inject P2Generator p2generator; - @Requirement + @Inject P2RepositoryManager repositoryManager; @Override diff --git a/tycho-bnd-plugin/pom.xml b/tycho-bnd-plugin/pom.xml index 7df3bcade2..84ad7788d7 100644 --- a/tycho-bnd-plugin/pom.xml +++ b/tycho-bnd-plugin/pom.xml @@ -52,9 +52,9 @@ - org.codehaus.plexus - plexus-component-metadata - + org.eclipse.sisu + sisu-maven-plugin + org.apache.maven.plugins maven-plugin-plugin diff --git a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/maven/BndMavenLifecycleParticipant.java b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/maven/BndMavenLifecycleParticipant.java index 3e197b0b95..7b22f6967c 100644 --- a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/maven/BndMavenLifecycleParticipant.java +++ b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/maven/BndMavenLifecycleParticipant.java @@ -24,14 +24,16 @@ import java.util.jar.Manifest; import java.util.stream.Collectors; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.maven.AbstractMavenLifecycleParticipant; import org.apache.maven.MavenExecutionException; import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Dependency; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; import org.eclipse.tycho.core.bnd.BndPluginManager; @@ -51,7 +53,8 @@ * test maven dependency *
*/ -@Component(role = AbstractMavenLifecycleParticipant.class) +@Named +@Singleton public class BndMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant { private static final Set> BND_TO_MAVEN_MAPPING = Map.of(// @@ -60,10 +63,10 @@ public class BndMavenLifecycleParticipant extends AbstractMavenLifecycleParticip Constants.TESTPATH, Artifact.SCOPE_TEST // ).entrySet(); - @Requirement + @Inject private Logger logger; - @Requirement + @Inject private BndPluginManager bndPluginManager; @Override diff --git a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/maven/BndProjectExecutionListener.java b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/maven/BndProjectExecutionListener.java index 4cbc20c79e..8b282a4d5f 100644 --- a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/maven/BndProjectExecutionListener.java +++ b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/maven/BndProjectExecutionListener.java @@ -15,13 +15,16 @@ import java.util.Iterator; import java.util.List; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.maven.execution.ProjectExecutionEvent; import org.apache.maven.execution.ProjectExecutionListener; import org.apache.maven.lifecycle.LifecycleExecutionException; import org.apache.maven.plugin.MojoExecution; -import org.codehaus.plexus.component.annotations.Component; -@Component(role = ProjectExecutionListener.class) +@Named +@Singleton public class BndProjectExecutionListener implements ProjectExecutionListener { @Override diff --git a/tycho-build/pom.xml b/tycho-build/pom.xml index 9f2a138dae..4cb881282e 100644 --- a/tycho-build/pom.xml +++ b/tycho-build/pom.xml @@ -11,10 +11,9 @@ - org.codehaus.plexus - plexus-component-metadata - - + org.eclipse.sisu + sisu-maven-plugin +
diff --git a/tycho-build/src/main/java/org/eclipse/tycho/build/DefaultBuildTimestampProvider.java b/tycho-build/src/main/java/org/eclipse/tycho/build/DefaultBuildTimestampProvider.java index 731fefebbb..eb14a54463 100644 --- a/tycho-build/src/main/java/org/eclipse/tycho/build/DefaultBuildTimestampProvider.java +++ b/tycho-build/src/main/java/org/eclipse/tycho/build/DefaultBuildTimestampProvider.java @@ -14,16 +14,19 @@ import java.util.Date; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecution; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; /** * Build timestamp provider that returns the same timestamp for all projects, the * ${maven.build.timestamp}. */ -@Component(role = BuildTimestampProvider.class, hint = DefaultBuildTimestampProvider.ROLE_HINT) +@Named(DefaultBuildTimestampProvider.ROLE_HINT) +@Singleton public class DefaultBuildTimestampProvider implements BuildTimestampProvider { static final String ROLE_HINT = "default"; diff --git a/tycho-build/src/main/java/org/eclipse/tycho/build/TychoCiFriendlyVersions.java b/tycho-build/src/main/java/org/eclipse/tycho/build/TychoCiFriendlyVersions.java index dbb5b2581e..a9c7a44868 100644 --- a/tycho-build/src/main/java/org/eclipse/tycho/build/TychoCiFriendlyVersions.java +++ b/tycho-build/src/main/java/org/eclipse/tycho/build/TychoCiFriendlyVersions.java @@ -26,6 +26,8 @@ import javax.annotation.Priority; import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.DefaultMavenExecutionResult; @@ -42,7 +44,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.xml.Xpp3DomBuilder; @@ -50,7 +51,8 @@ import org.eclipse.tycho.TychoConstants; @Priority(100) -@Component(role = ModelVersionProcessor.class) +@Named +@Singleton public class TychoCiFriendlyVersions extends DefaultModelVersionProcessor implements ModelVersionProcessor { static final String PROPERTY_FORCE_QUALIFIER = "forceContextQualifier"; diff --git a/tycho-build/src/main/java/org/eclipse/tycho/build/TychoGraphBuilder.java b/tycho-build/src/main/java/org/eclipse/tycho/build/TychoGraphBuilder.java index 1100f3ff40..4150c78e9e 100644 --- a/tycho-build/src/main/java/org/eclipse/tycho/build/TychoGraphBuilder.java +++ b/tycho-build/src/main/java/org/eclipse/tycho/build/TychoGraphBuilder.java @@ -33,6 +33,10 @@ import java.util.function.Function; import java.util.stream.Collectors; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.ProjectDependencyGraph; @@ -46,8 +50,6 @@ import org.apache.maven.model.building.Result; import org.apache.maven.project.DuplicateProjectException; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.dag.CycleDetectedException; import org.eclipse.core.runtime.CoreException; @@ -61,17 +63,18 @@ import org.eclipse.tycho.pomless.AbstractTychoMapping; import org.sonatype.maven.polyglot.mapping.Mapping; -@Component(role = GraphBuilder.class, hint = GraphBuilder.HINT) +@Named(GraphBuilder.HINT) +@Singleton public class TychoGraphBuilder extends DefaultGraphBuilder { private static final boolean DEBUG = Boolean.getBoolean("tycho.graphbuilder.debug"); - @Requirement + @Inject private Logger log; - @Requirement(role = Mapping.class) + @Inject private Map polyglotMappings; - @Requirement + @Inject private MavenProjectDependencyProcessor dependencyProcessor; @Override diff --git a/tycho-build/src/main/java/org/eclipse/tycho/build/bnd/BndProjectMapping.java b/tycho-build/src/main/java/org/eclipse/tycho/build/bnd/BndProjectMapping.java index 399e14f8f0..25f48ea51b 100644 --- a/tycho-build/src/main/java/org/eclipse/tycho/build/bnd/BndProjectMapping.java +++ b/tycho-build/src/main/java/org/eclipse/tycho/build/bnd/BndProjectMapping.java @@ -16,28 +16,25 @@ import java.io.IOException; import java.io.Reader; import java.nio.file.Path; -import java.util.Map; -import org.apache.maven.lifecycle.Lifecycle; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.maven.model.Model; import org.apache.maven.model.Plugin; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.pomless.AbstractTychoMapping; import org.eclipse.tycho.version.TychoVersion; -import org.sonatype.maven.polyglot.mapping.Mapping; import aQute.bnd.build.Project; import aQute.bnd.build.Workspace; -@Component(role = Mapping.class, hint = "bnd") +@Named("bnd") +@Singleton public class BndProjectMapping extends AbstractTychoMapping { private static final String TYCHO_BND_PLUGIN = "tycho-bnd-plugin"; - @Requirement(role = Lifecycle.class) - private Map lifecycles; @Override public float getPriority() { diff --git a/tycho-build/src/main/java/org/eclipse/tycho/build/bnd/BndWorkspaceMapping.java b/tycho-build/src/main/java/org/eclipse/tycho/build/bnd/BndWorkspaceMapping.java index e42f70cf3a..f2ab25158f 100644 --- a/tycho-build/src/main/java/org/eclipse/tycho/build/bnd/BndWorkspaceMapping.java +++ b/tycho-build/src/main/java/org/eclipse/tycho/build/bnd/BndWorkspaceMapping.java @@ -22,18 +22,20 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.maven.model.Model; -import org.codehaus.plexus.component.annotations.Component; import org.eclipse.tycho.TychoConstants; import org.eclipse.tycho.pomless.AbstractTychoMapping; import org.eclipse.tycho.pomless.NoParentPomFound; import org.eclipse.tycho.pomless.ParentModel; -import org.sonatype.maven.polyglot.mapping.Mapping; import aQute.bnd.build.Project; import aQute.bnd.build.Workspace; -@Component(role = Mapping.class, hint = "bnd-workspace") +@Named("bnd-workspace") +@Singleton public class BndWorkspaceMapping extends AbstractTychoMapping { private Map> modulesCache = new ConcurrentHashMap>(); diff --git a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java index 3b0310fe8c..835d04c0fd 100644 --- a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java +++ b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java @@ -22,12 +22,14 @@ import java.util.List; import java.util.Set; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3DomBuilder; @@ -91,16 +93,18 @@ * ... * */ -@Component(role = BuildTimestampProvider.class, hint = "jgit") +@Named("jgit") +@Singleton public class JGitBuildTimestampProvider implements BuildTimestampProvider { private static final String PARAMETER_JGIT_IGNORE = "jgit.ignore"; private static final String PARAMETER_JGIT_DIRTY_WORKING_TREE = "jgit.dirtyWorkingTree"; - @Requirement(hint = "default") + @Named("default") + @Inject private BuildTimestampProvider defaultTimestampProvider; - @Requirement + @Inject private Logger logger; private boolean quiet;