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 526fd4f
Show file tree
Hide file tree
Showing 23 changed files with 140 additions and 100 deletions.
6 changes: 3 additions & 3 deletions tycho-apitools-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,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) 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,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 {

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,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;
Expand All @@ -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<Path> getApiBaselineBundles(Collection<MavenRepositoryLocation> baselineRepoLocations,
Expand Down
6 changes: 3 additions & 3 deletions tycho-artifactcomparator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,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>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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);
}

}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
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 All @@ -16,15 +16,18 @@
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;
import org.xmlunit.builder.DiffBuilder;
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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<String> IGNORED_PATTERNS = List.of("META-INF/maven/**");

@Requirement
@Inject
private Logger log;

@Requirement
@Inject
private Map<String, ContentsComparator> comparators;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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<String> getStrings() throws IOException {
return new LinkedHashSet<String>() {
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
Loading

0 comments on commit 526fd4f

Please sign in to comment.