Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make "include" the default for referencedRepositoryMode #3252

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ to your project and make sure it has the `org.eclipse.pde.api.tools.apiAnalysisN

Tycho now contains a new `tycho-repository-plugin` that can be used to package OSGi repositories.

### new option to include referenced repositories when resolving the target platform
### referenced repositories are considered by default when resolving the target platform

Repositories can contain references to other repositories (e.g. to find additional dependencies), from now on there is a new option to also consider these references:
The option `referencedRepositoryMode`, introduced in Tycho 4.0.2, now defaults to `include`: referenced repositories are considered by default when resolving the target platform, as PDE already does.
To restore the old behavior of Tycho 4.0.2, you need to explicitly set the option to `ignore`:

```xml
<plugin>
Expand All @@ -94,7 +95,7 @@ Repositories can contain references to other repositories (e.g. to find addition
<version>${tycho-version}</version>
<configuration>
... other configuration options ...
<referencedRepositoryMode>include</referencedRepositoryMode>
<referencedRepositoryMode>ignore</referencedRepositoryMode>
</configuration>
</plugin>

Expand Down Expand Up @@ -155,7 +156,21 @@ If `addOnlyProviding` is `true` repositories that don't provide any filtered uni
```

## 4.0.2
- new option to include referenced repositories when resolving the target platform
- new option to include referenced repositories when resolving the target platform:
Repositories can contain references to other repositories (e.g. to find additional dependencies), from now on there is a new option, `referencedRepositoryMode`, to also consider these references. By default, it is set to `ignore`; to enable referenced repositories in target platform resolution, set it to `include`:

```xml
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
... other configuration options ...
<referencedRepositoryMode>include</referencedRepositoryMode>
</configuration>
</plugin>
```

- Add dummy parameter to prevent warnings with jgit as timestamp provider

## 4.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public enum InjectP2MavenMetadataHandling {

private InjectP2MavenMetadataHandling p2MavenMetadataHandling;

private ReferencedRepositoryMode referencedRepositoryMode = ReferencedRepositoryMode.ignore;
private ReferencedRepositoryMode referencedRepositoryMode = ReferencedRepositoryMode.include;

/**
* Returns the list of configured target environments, or the running environment if no
Expand Down
12 changes: 12 additions & 0 deletions tycho-its/projects/compiler.exclude/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- The default is now include, and this would lead to
failures of the shape
Failed to load p2 repository from location http://download.eclipse.org/dsdp/dd/updates:
No repository found at http://download.eclipse.org/dsdp/dd/updates -->
<referencedRepositoryMode>ignore</referencedRepositoryMode>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bundle-ManifestVersion: 2
Bundle-SymbolicName: p2Repository.repositoryRef.target;singleton:=true
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.epsilon.picto
Bundle-Name: p2Repository.repositoryRef.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin.includes = META-INF/,\
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>tycho-its-project.p2Repository.repositoryRef.targetresolution</groupId>
<artifactId>p2Repository.repositoryRef.target</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<target>
<file>
${project.basedir}/test-target.target
</file>
</target>
<referencedRepositoryMode>ignore</referencedRepositoryMode>
<!--
The project requires a bundle from Epsilon and Eclipse.
The target platform only uses the Epsilon update site.
Epsilon update site uses referenced repositories so using its update site alone
should be enough to resolve the transitive dependencies.
However, we explicitly ignore referenced sites, so this should lead to
a resolution failure -->
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="test-target.target" sequenceNumber="1">
<locations>
<!-- Epsilon update site uses referenced repositories so using its update site alone
should be enough to resolve the transitive dependencies -->
<location includeAllPlatforms="false" includeConfigurePhase="true"
includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.epsilon.picto"
version="0.0.0" />
<repository
location="https://download.eclipse.org/epsilon/updates/2.4/" />
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bundle-ManifestVersion: 2
Bundle-SymbolicName: p2Repository.repositoryRef.target;singleton:=true
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.epsilon.picto
Bundle-Name: p2Repository.repositoryRef.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin.includes = META-INF/,\
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>tycho-its-project.p2Repository.repositoryRef.targetresolution</groupId>
<artifactId>p2Repository.repositoryRef.target</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<target>
<file>
${project.basedir}/test-target.target
</file>
</target>
<!-- The default is
<referencedRepositoryMode>include</referencedRepositoryMode>
The project requires a bundle from Epsilon and Eclipse.
The target platform only uses the Epsilon update site.
Epsilon update site uses referenced repositories so using its update site alone
should be enough to resolve the transitive dependencies-->
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="test-target.target" sequenceNumber="1">
<locations>
<!-- Epsilon update site uses referenced repositories so using its update site alone
should be enough to resolve the transitive dependencies -->
<location includeAllPlatforms="false" includeConfigurePhase="true"
includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.epsilon.picto"
version="0.0.0" />
<repository
location="https://download.eclipse.org/epsilon/updates/2.4/" />
</location>
</locations>
</target>
13 changes: 13 additions & 0 deletions tycho-its/projects/sourcePlugin/basic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@
<forceContextQualifier>123abc</forceContextQualifier>
</configuration>
</plugin>

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- The default is now include, and this would lead to
failures of the shape
Failed to load p2 repository from location http://download.eclipse.org/dsdp/dd/updates:
No repository found at http://download.eclipse.org/dsdp/dd/updates -->
<referencedRepositoryMode>ignore</referencedRepositoryMode>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
13 changes: 13 additions & 0 deletions tycho-its/projects/sourcePlugin/extra-source-bundles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@
<forceContextQualifier>123abc</forceContextQualifier>
</configuration>
</plugin>

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- The default is now include, and this would lead to
failures of the shape
Failed to load p2 repository from location http://download.eclipse.org/dsdp/dd/updates:
No repository found at http://download.eclipse.org/dsdp/dd/updates -->
<referencedRepositoryMode>ignore</referencedRepositoryMode>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
13 changes: 13 additions & 0 deletions tycho-its/projects/sourcePlugin/remote-source-bundles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@
<forceContextQualifier>123abc</forceContextQualifier>
</configuration>
</plugin>

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- The default is now include, and this would lead to
failures of the shape
Failed to load p2 repository from location http://download.eclipse.org/dsdp/dd/updates:
No repository found at http://download.eclipse.org/dsdp/dd/updates -->
<referencedRepositoryMode>ignore</referencedRepositoryMode>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import java.io.File;
import java.util.List;
Expand Down Expand Up @@ -84,6 +85,25 @@ public void testAdditionOfOnlyProvidingRepos() throws Exception {
new RepositoryReference("https://download.eclipse.org/cbi/updates/license", TYPE_METADATA, ENABLED)));
}

@Test
public void testTargetResolutionWithReferencedRepositoryInclude() throws Exception {
// <referencedRepositoryMode>include</referencedRepositoryMode> is the default
Verifier verifier = getVerifier("/p2Repository.repositoryRef.targetresolution.include", false);
verifier.executeGoal("package");
verifier.verifyErrorFreeLog();
}

@Test
public void testTargetResolutionWithReferencedRepositoryIgnore() throws Exception {
Verifier verifier = getVerifier("/p2Repository.repositoryRef.targetresolution.ignore", false);
try {
verifier.executeGoal("package");
fail("Build should fail due to missing transitive dependency dependency");
} catch (VerificationException e) {
verifier.verifyTextInLog("requires 'osgi.bundle; org.eclipse.emf.ecore 0.0.0' but it could not be found");
}
}

private List<RepositoryReference> buildAndGetRepositoryReferences(String buildRoot, Consumer<Verifier> setup)
throws Exception, VerificationException {
Verifier verifier = getVerifier(buildRoot, false);
Expand Down
Loading