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-artifactcomparator, tycho-baseline-plugin, tycho-bnd-plugin,
tycho-build are migrated.
  • Loading branch information
akurtakov committed Jun 19, 2024
1 parent 4b110ce commit 9fb8b76
Show file tree
Hide file tree
Showing 27 changed files with 165 additions and 111 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, 2020 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 @@ -20,7 +20,9 @@
import java.util.Collections;
import java.util.List;

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;
Expand All @@ -30,7 +32,8 @@
import org.objectweb.asm.tree.InnerClassNode;
import org.objectweb.asm.util.TraceClassVisitor;

@Component(role = ContentsComparator.class, hint = ClassfileComparator.TYPE)
@Named(ClassfileComparator.TYPE)
@Singleton
public class ClassfileComparator implements ContentsComparator {
public static final String TYPE = "class";

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 All @@ -15,12 +15,15 @@
import java.io.IOException;
import java.io.InputStream;

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 = DefaultContentsComparator.TYPE)
@Named(DefaultContentsComparator.TYPE)
@Singleton
public class DefaultContentsComparator implements ContentsComparator {

public static final String TYPE = "default";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import java.nio.charset.StandardCharsets;
import java.util.List;

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;
Expand All @@ -30,7 +32,8 @@
/**
* Compares html files for some special cases and fall back to simple textcompare otherwise
*/
@Component(role = ContentsComparator.class, hint = HtmlComparator.HINT)
@Named(HtmlComparator.HINT)
@Singleton
public class HtmlComparator implements ContentsComparator {

private static final String META_ELEMENT = "meta";
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 All @@ -24,7 +24,9 @@
import java.util.jar.Attributes.Name;
import java.util.jar.Manifest;

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;
Expand All @@ -35,7 +37,8 @@
import aQute.bnd.header.Parameters;
import aQute.bnd.osgi.resource.CapReqBuilder;

@Component(role = ContentsComparator.class, hint = ManifestComparator.TYPE)
@Named(ManifestComparator.TYPE)
@Singleton
public class ManifestComparator implements ContentsComparator {

public static final String TYPE = "manifest";
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 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,17 @@
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.sisu.Typed;
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
@Typed(ContentsComparator.class)
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
Loading

0 comments on commit 9fb8b76

Please sign in to comment.