Skip to content

Commit

Permalink
Switch to JSR330
Browse files Browse the repository at this point in the history
The following plugins and components are switched tycho-apitools-plugin,
tycho-baseline-plugin, tycho-bnd-plugin,
tycho-build are migrated.
  • Loading branch information
akurtakov committed Jun 19, 2024
1 parent 4b110ce commit ad1e6d0
Show file tree
Hide file tree
Showing 16 changed files with 101 additions and 74 deletions.
12 changes: 9 additions & 3 deletions tycho-apitools-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,19 @@
<artifactId>asm-util</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
</plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,19 +15,18 @@
import java.util.Optional;

import javax.inject.Inject;
import javax.inject.Named;

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")
@SessionScoped
public class ApiAnnotationsClasspathContributor extends AbstractSpecificationClasspathContributor {

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,9 +18,10 @@
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.Named;
import javax.inject.Singleton;

import org.eclipse.tycho.ArtifactKey;
import org.eclipse.tycho.ArtifactType;
import org.eclipse.tycho.IllegalArtifactReferenceException;
Expand All @@ -41,16 +42,14 @@
* Component that resolves the bundles that make up the ApiApplication from a
* given URI
*/
@Component(role = ApiApplicationResolver.class)
@Named
@Singleton
public class ApiApplicationResolver {

@Requirement
private Logger logger;

@Requirement
@Inject
private EclipseApplicationFactory applicationFactory;

@Requirement
@Inject
private EclipseApplicationManager applicationManager;

public Collection<Path> getApiBaselineBundles(Collection<MavenRepositoryLocation> baselineRepoLocations,
Expand Down
6 changes: 3 additions & 3 deletions tycho-baseline-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
</plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand All @@ -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<String, ContentsComparator> contentComparators;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -78,24 +80,26 @@
* will be considered a micro change</li>
* <ul>
*/
@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;

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
Expand Down
6 changes: 3 additions & 3 deletions tycho-bnd-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
</plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -51,7 +53,8 @@
* <code>test<code> maven dependency</li>
* </ul>
*/
@Component(role = AbstractMavenLifecycleParticipant.class)
@Named
@Singleton
public class BndMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {

private static final Set<Entry<String, String>> BND_TO_MAVEN_MAPPING = Map.of(//
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions tycho-build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@

<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
</plugin>

<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,15 +44,15 @@
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;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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<String, Mapping> polyglotMappings;

@Requirement
@Inject
private MavenProjectDependencyProcessor dependencyProcessor;

@Override
Expand Down
Loading

0 comments on commit ad1e6d0

Please sign in to comment.