Skip to content

Commit

Permalink
Merge branch 'master' into update_verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
akurtakov committed Jan 6, 2023
2 parents 7e38006 + c663386 commit ec556bc
Show file tree
Hide file tree
Showing 136 changed files with 1,307 additions and 1,156 deletions.
20 changes: 18 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,27 @@ Some improvements have been made for the test execution with `eclipse-plugin` pa
1. The property `skipITs` has been renamed to `tycho.plugin-test.skip`
2. the mojo `integration-test` has been renamed to `plugin-test`
3. the default pattern of the former `integration-test` has been changed from `**/PluginTest*.class", "**/*IT.class` to the maven default `**/Test*.class", "**/*Test.class", "**/*Tests.class", "**/*TestCase.class`
4. the former `integration-test` mojo is no longer part of the default life-cycle, that means to use it it has to be explicitly be enabled to be more flexible and this is how standard maven behaves
4. the former `integration-test` mojo is no longer part of the default life-cycle, that means it has to be explicitly be enabled to be more flexible and this is how standard maven behaves
5. the `test` mojo of the `maven-surefire-plugin` is no longer part of the default life-cycle, that means it has to be explicitly be enabled to be more flexible and to not pollute the test-phase.

To restore old behaviour you can add the follwoing snippet to your (master) pom:

```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin-version}</version>
<executions>
<execution>
<id>execute-tests</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
Expand Down Expand Up @@ -409,7 +425,7 @@ While for an IDE that might be sufficient as target resolution is only performed
- If there is a temporary server outage one might want to fall back to the previous state for this build instead of failing completely.
- Build times are often a rare resource one doesn't want to waste waiting for servers, bandwidth might even be limited or you have to pay for it.

Because of this, Tycho now includes a brand new caching P2 transport that allows advanced caching, offline handling and fallback to cache in case of server failures. The transport is enabled by default so nothing has to be done, just in case you want the old behavior you can set `-D=tycho.p2.transport=ecf` beside that the following properties might be interesting:
Because of this, Tycho now includes a brand new caching P2 transport that allows advanced caching, offline handling and fallback to cache in case of server failures. The transport is enabled by default so nothing has to be done, just in case you want the old behavior you can set `-Dtycho.p2.transport=ecf` beside that the following properties might be interesting:

#### Force cache-revalidation

Expand Down
2 changes: 1 addition & 1 deletion p2-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<!-- used API packages from Tycho -->
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-embedder-api</artifactId>
<artifactId>tycho-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.logging.Logger;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
Expand All @@ -54,13 +52,14 @@
import org.eclipse.equinox.p2.publisher.eclipse.Feature;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.tycho.PackagingType;
import org.eclipse.tycho.helper.PluginRealmHelper;
import org.eclipse.tycho.p2maven.actions.AuthoredIUAction;
import org.eclipse.tycho.p2maven.actions.CategoryDependenciesAction;
import org.eclipse.tycho.p2maven.actions.FeatureDependenciesAction;
import org.eclipse.tycho.p2maven.actions.ProductDependenciesAction;
import org.eclipse.tycho.p2maven.actions.ProductFile2;
import org.eclipse.tycho.p2maven.helper.PluginRealmHelper;
import org.eclipse.tycho.p2maven.io.MetadataIO;
import org.eclipse.tycho.resolver.InstallableUnitProvider;
import org.osgi.framework.Constants;
import org.xml.sax.SAXException;

Expand Down Expand Up @@ -263,15 +262,8 @@ private Collection<InstallableUnitProvider> getProvider(MavenProject project, Ma
throws CoreException {
Set<InstallableUnitProvider> unitProviders = new HashSet<>(additionalUnitProviders.values());
try {
pluginRealmHelper.execute(mavenSession, project, () -> {
try {
for (InstallableUnitProvider provider : plexus.lookupList(InstallableUnitProvider.class)) {
unitProviders.add(provider);
}
} catch (ComponentLookupException e) {
// ignore, nothing was found...
}
}, InstallableUnitGenerator::hasPluginDependency);
pluginRealmHelper.visitPluginExtensions(project, mavenSession, InstallableUnitProvider.class,
unitProviders::add);
} catch (Exception e) {
throw new CoreException(Status.error("Can't lookup InstallableUnitProviders", e));
}
Expand All @@ -292,14 +284,6 @@ private static boolean isCompatible(Collection<?> collection) {
return true;
}

private static boolean hasPluginDependency(PluginDescriptor pluginDescriptor) {
if (pluginDescriptor.getArtifactMap().containsKey(P2Plugin.KEY)) {
return true;
}
return pluginDescriptor.getDependencies().stream().filter(dep -> P2Plugin.GROUP_ID.equals(dep.getGroupId()))
.filter(dep -> P2Plugin.ARTIFACT_ID.equals(dep.getArtifactId())).findAny().isPresent();
}

private final class ArtifactUnits {

private Collection<IInstallableUnit> units;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public IArtifactRepository getCompositeArtifactRepository(Collection<Repository>
if (repositories.size() == 1) {
return getArtifactRepository(repositories.iterator().next());
}
ArrayList<IArtifactRepository> childs = new ArrayList<IArtifactRepository>();
ArrayList<IArtifactRepository> childs = new ArrayList<>();
for (Repository repository : repositories) {
childs.add(getArtifactRepository(repository));
}
Expand Down
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<cipherVersion>2.0</cipherVersion>
<pluginToolsVersion>3.7.0</pluginToolsVersion>
<jgit-version>6.4.0.202211300538-r</jgit-version>
<maven-version>3.8.6</maven-version>
<maven-version>3.8.7</maven-version>
<!-- When updating surefire version, double-check Import-Package statements generated by bnd-maven-plugin and possibly adapt instructions in various bnd.bnd files -->
<!-- Stick to 3.0.0-M5 because of https://github.com/eclipse-tycho/tycho/issues/879 / https://issues.apache.org/jira/projects/SUREFIRE/issues/SUREFIRE-2072 -->
<surefire-version>3.0.0-M5</surefire-version>
Expand Down Expand Up @@ -148,7 +148,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>4.6.0</version>
<version>4.6.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down Expand Up @@ -192,6 +192,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -207,7 +212,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.10.0</version>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -502,7 +507,7 @@
<module>sisu-osgi</module>
<module>p2-maven-plugin</module>
<module>tycho-metadata-model</module>
<module>tycho-embedder-api</module>
<module>tycho-spi</module>
<module>tycho-core</module>
<module>tycho-testing-harness</module>
<module>tycho-compiler-jdt</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.eclipse.tycho.core.TychoProject;
import org.eclipse.tycho.core.TychoProjectManager;
import org.eclipse.tycho.core.resolver.DefaultTargetPlatformConfigurationReader;
import org.eclipse.tycho.p2maven.InstallableUnitProvider;
import org.eclipse.tycho.resolver.InstallableUnitProvider;

/**
* Provides additional requirements defined in the target platform configuration
Expand Down
4 changes: 4 additions & 0 deletions tycho-artifactcomparator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@
public class ComparatorInputStream extends ByteArrayInputStream {

private final byte[] content;
private final String name;

public ComparatorInputStream(InputStream stream, String name) throws IOException {
this(IOUtils.toByteArray(stream), name);
public ComparatorInputStream(InputStream stream) throws IOException {
this(IOUtils.toByteArray(stream));
}

public ComparatorInputStream(byte[] content, String name) {
public ComparatorInputStream(byte[] content) {
super(content);
this.content = content;
this.name = name;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class ClassfileComparator implements ContentsComparator {
@Override
public ArtifactDelta getDelta(ComparatorInputStream baseline, ComparatorInputStream reactor, ComparisonData data)
throws IOException {
boolean equal;
try {
String baselineDisassemble = disassemble(baseline.asBytes());
String reactorDisassemble = disassemble(reactor.asBytes());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ private ArtifactDelta getDelta(String name, Map<String, ZipEntry> baselineMap, M
ContentsComparator comparator = comparators.get(getContentType(name));
if (comparator != null) {
try {
return comparator.getDelta(new ComparatorInputStream(baselineBytes, name),
new ComparatorInputStream(reactorBytes, name), data);
return comparator.getDelta(new ComparatorInputStream(baselineBytes),
new ComparatorInputStream(reactorBytes), data);
} catch (IOException e) {
log.debug("comparing entry " + name + " (baseline = " + baselineJar.getName() + ", reactor="
+ reactorJar.getName() + ") using " + comparator.getClass().getName() + " failed with: " + e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ private boolean isContentEqual(String type, String baseline, String reactor) thr
ContentsComparator comparator = lookup(ContentsComparator.class, type);
try (InputStream is = new FileInputStream(baseline)) {
try (InputStream is2 = new FileInputStream(reactor)) {
return comparator.getDelta(new ComparatorInputStream(is, "base"),
new ComparatorInputStream(is2, "reactor"), null) == null;
return comparator.getDelta(new ComparatorInputStream(is), new ComparatorInputStream(is2), null) == null;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ private ArtifactDelta getDelta(Diff diff, Jar baselineJar, Jar projectJar, Basel
if (baseResource != null && currenttResource != null) {
try (InputStream baseStream = baseResource.openInputStream();
InputStream currentStream = currenttResource.openInputStream()) {
return comparator.getDelta(new ComparatorInputStream(baseStream, name),
new ComparatorInputStream(currentStream, name),
return comparator.getDelta(new ComparatorInputStream(baseStream),
new ComparatorInputStream(currentStream),
new ComparisonData(baselineContext.getIgnores(), false));
} catch (Exception e) {
}
Expand Down
Loading

0 comments on commit ec556bc

Please sign in to comment.