2019-11-11 12:05:44 +00:00
committed by Git OBS Bridge
commit a82a350281
23 changed files with 2630 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

19
EmptyMojo.java Normal file
View File

@@ -0,0 +1,19 @@
package org.fedoraproject;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.AbstractMojo;
/**
* Empty goal to fix
* @goal empty
* @phase clean
*/
public class EmptyMojo
extends AbstractMojo
{
public void execute()
throws MojoExecutionException, MojoFailureException
{
}
}

10
_constraints Normal file
View File

@@ -0,0 +1,10 @@
<constraints>
<hardware>
<physicalmemory>
<size unit="M">2048</size>
</physicalmemory>
<disk>
<size unit="G">6</size>
</disk>
</hardware>
</constraints>

3
_multibuild Normal file
View File

@@ -0,0 +1,3 @@
<multibuild>
<package>bootstrap</package>
</multibuild>

View File

@@ -0,0 +1,176 @@
From d4d161e7ccfb21503e906229a37000eb9a821284 Mon Sep 17 00:00:00 2001
From: Jan Sievers <jan.sievers@sap.com>
Date: Tue, 4 Sep 2012 16:02:52 +0200
Subject: [PATCH] Resolve all necessary dependencies for Tycho Surefire.
When running an Eclipse bundle's tests, Tycho Surefire resolves its
runtime dependencies using a class loader, which is in fact just looking
through Bundle-ClassPath. As a result, it must copy over and include
system jars in its Bundle-ClassPath. We use Fedora system jars to
satisfy these dependencies but even these jars differ slightly in terms
of provided classes. This patch addresses this issue.
Basically, the jars added to the Bundle-ClassPath in this patch, provide
the additional classes that are in the original jars used upstream.
Change-Id: I9ef0239eed887fa47c380efcdce968934c788c9f
---
pom.xml | 2 +-
.../META-INF/MANIFEST.MF | 5 ++--
.../org.eclipse.tycho.surefire.junit/pom.xml | 5 ++++
.../META-INF/MANIFEST.MF | 5 +++-
.../org.eclipse.tycho.surefire.junit4/pom.xml | 10 ++++++++
.../META-INF/MANIFEST.MF | 8 ++++---
.../org.eclipse.tycho.surefire.junit47/pom.xml | 10 ++++++++
.../META-INF/MANIFEST.MF | 7 +++---
.../org.eclipse.tycho.surefire.osgibooter/pom.xml | 5 ++++
.../surefire/osgibooter/OsgiSurefireBooter.java | 20 ++++++++++------
tycho-surefire/pom.xml | 2 +-
.../java/org/eclipse/tycho/surefire/TestMojo.java | 27 +++++++++++++++++++---
12 files changed, 85 insertions(+), 21 deletions(-)
diff --git a/pom.xml b/pom.xml
index c43cc8d..6e5fde4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
<pluginToolsVersion>3.3</pluginToolsVersion>
<maven-version>3.0</maven-version>
<!-- NOTE: when updating surefire version, double-check Import-Package statements generated by bnd-maven-plugin and possibly adapt instructions in various bnd.bnd files -->
- <surefire-version>2.19.1</surefire-version>
+ <surefire-version>2.21.0</surefire-version>
<!-- dependencies to Eclipse artifacts deployed by tycho-releng/ -->
<equinoxVersion>3.13.0.v20180226-1711</equinoxVersion>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
index f99c319..0224cc6 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
@@ -36,6 +36,11 @@
<artifactId>surefire-junit3</artifactId>
<version>${surefire-version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit3</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
</artifactItems>
</configuration>
</plugin>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
index 9628b06..2a09e91 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
@@ -36,6 +36,16 @@
<artifactId>surefire-junit4</artifactId>
<version>${surefire-version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit3</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit4</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
</artifactItems>
</configuration>
</plugin>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml
index dc49a46..db453ac 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml
@@ -46,6 +46,16 @@
<artifactId>surefire-grouper</artifactId>
<version>${surefire-version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit4</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit3</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
</artifactItems>
</configuration>
</plugin>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
index 991edc1..83732d5 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
@@ -5,9 +5,11 @@ Require-Bundle: org.eclipse.osgi;bundle-version="3.2.2",
Eclipse-AutoStart: true
Bundle-Version: 1.2.0
Bundle-ClassPath: .,
- jars/surefire-booter-2.19.1.jar,
- jars/surefire-api-2.19.1.jar,
- jars/maven-surefire-common-2.19.1.jar
+ jars/surefire-booter-2.21.0.jar,
+ jars/surefire-api-2.21.0.jar,
+ jars/surefire-logger-api-2.21.0.jar,
+ jars/maven-surefire-common-2.21.0.jar,
+ jars/maven-shared-utils-3.2.1.jar
Bundle-Name: Tycho Surefire OSGi Booter Eclipse Application
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.tycho.surefire.osgibooter;singleton:=true
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
index 82700eb..3fbc3a3 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
@@ -59,6 +59,11 @@
</artifactItem>
<artifactItem>
<groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-logger-api</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-booter</artifactId>
<version>${surefire-version}</version>
</artifactItem>
@@ -67,6 +72,11 @@
<artifactId>maven-surefire-common</artifactId>
<version>${surefire-version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-shared-utils</artifactId>
+ <version>3.2.1</version>
+ </artifactItem>
</artifactItems>
</configuration>
</execution>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
index 033766c4..fe8105b9 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
@@ -28,6 +28,7 @@ import java.util.Properties;
import java.util.Set;
import org.apache.maven.plugin.surefire.StartupReportConfiguration;
+import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
import org.apache.maven.surefire.booter.BooterConstants;
import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
@@ -97,11 +98,11 @@ public class OsgiSurefireBooter {
ProviderConfiguration providerConfiguration = new ProviderConfiguration(dirScannerParams,
new RunOrderParameters(runOrder, null), failIfNoTests, reporterConfig, null, testRequest,
extractProviderProperties(testProps), null, false, Collections.<CommandLineOption> emptyList(),
- skipAfterFailureCount, Shutdown.DEFAULT);
+ skipAfterFailureCount, Shutdown.DEFAULT, 0);
StartupReportConfiguration startupReportConfig = new StartupReportConfiguration(useFile, printSummary,
StartupReportConfiguration.PLAIN_REPORT_FORMAT, redirectTestOutputToFile, disableXmlReport, reportsDir,
- trimStacktrace, null, "TESTHASH", false, rerunFailingTestsCount);
- ReporterFactory reporterFactory = new DefaultReporterFactory(startupReportConfig);
+ trimStacktrace, null, new File(reportsDir, "TESTHASH"), false, rerunFailingTestsCount, null);
+ ReporterFactory reporterFactory = new DefaultReporterFactory(startupReportConfig, new NullConsoleLogger());
// API indicates we should use testClassLoader below but surefire also tries
// to load surefire classes using this classloader
RunResult result = ProviderFactory.invokeProvider(null, createCombinedClassLoader(testPlugin), reporterFactory,

View File

@@ -0,0 +1,11 @@
--- tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java.orig 2018-07-25 15:02:39.484574315 +0100
+++ tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java 2018-07-25 15:04:38.494188050 +0100
@@ -101,7 +101,7 @@
skipAfterFailureCount, Shutdown.DEFAULT, 0);
StartupReportConfiguration startupReportConfig = new StartupReportConfiguration(useFile, printSummary,
StartupReportConfiguration.PLAIN_REPORT_FORMAT, redirectTestOutputToFile, disableXmlReport, reportsDir,
- trimStacktrace, null, new File(reportsDir, "TESTHASH"), false, rerunFailingTestsCount, null);
+ trimStacktrace, null, new File(reportsDir, "TESTHASH"), false, rerunFailingTestsCount, null, null);
ReporterFactory reporterFactory = new DefaultReporterFactory(startupReportConfig, new NullConsoleLogger());
// API indicates we should use testClassLoader below but surefire also tries
// to load surefire classes using this classloader

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4c6e8dd2e0e1626703800edba747581fde4df08b1f7f08cc2e80d947d9807b2d
size 14984084

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f5f7039adc1dfff5438805f609763021c11074b571cd768d947c03c02d986b99
size 49697

View File

@@ -0,0 +1,14 @@
--- fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/xmvn/EclipseArtifactInstaller.java 2018-05-01 18:28:51.000000000 +0200
+++ fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/xmvn/EclipseArtifactInstaller.java 2019-09-23 15:33:46.373407756 +0200
@@ -80,9 +80,9 @@
am.getVersion());
logger.info("Installing artifact {}", artifact);
- String commonId = basePackageName.replaceAll("^eclipse-", "");
+ String commonId = basePackageName.replaceAll("-bootstrap", "").replaceAll("^eclipse-", "");
request.setMainPackageId(commonId);
- String subpackageId = targetPackage.getId().replaceAll("^eclipse-", "");
+ String subpackageId = targetPackage.getId().replaceAll("-bootstrap", "").replaceAll("^eclipse-", "");
if (subpackageId.isEmpty())
subpackageId = commonId;
else if (!subpackageId.startsWith(commonId + "-"))

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b6d575d817775121e0dad08005ac3a13cad14efa0f1ad29ca720540f97efb92f
size 13288756

20
p2-install.sh Normal file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
_prefer_jre="true"
. /usr/share/java-utils/java-functions
set_jvm
set_classpath \
beust-jcommander \
eclipse/osgi \
slf4j/api \
slf4j/simple \
tycho/org.fedoraproject.p2 \
tycho/xmvn-p2-installer-plugin \
xmvn/xmvn-api \
xmvn/xmvn-core \
MAIN_CLASS=org.fedoraproject.p2.app.P2InstallerApp
run "$@"

View File

@@ -0,0 +1,26 @@
--- org.eclipse.tycho-tycho-1.2.0/tycho-surefire/org.eclipse.tycho.surefire.junit5/pom.xml 2019-04-11 23:10:24.453419824 +0200
+++ org.eclipse.tycho-tycho-1.2.0/tycho-surefire/org.eclipse.tycho.surefire.junit5/pom.xml 2019-04-11 23:53:11.679066646 +0200
@@ -38,9 +38,9 @@
<excludes>META-INF/**</excludes>
<artifactItems>
<artifactItem>
- <groupId>org.junit.platform</groupId>
- <artifactId>junit-platform-surefire-provider</artifactId>
- <version>${junit-platform-version}</version>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit-platform</artifactId>
+ <version>${surefire-version}</version>
</artifactItem>
<artifactItem>
<groupId>org.junit.platform</groupId>
--- org.eclipse.tycho-tycho-1.2.0/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/provider/impl/JUnit5Provider.java 2019-04-11 23:10:24.449419802 +0200
+++ org.eclipse.tycho-tycho-1.2.0/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/provider/impl/JUnit5Provider.java 2019-04-11 23:33:18.352699032 +0200
@@ -37,7 +37,7 @@
@Override
public String getSurefireProviderClassName() {
- return "org.junit.platform.surefire.provider.JUnitPlatformProvider";
+ return "org.apache.maven.surefire.junitplatform.JUnitPlatformProvider";
}
@Override

115
tycho-bootstrap.sh Normal file
View File

@@ -0,0 +1,115 @@
#! /bin/bash -e
. $(pwd)/tycho-scripts.sh
preV=$1
v="$preV-SNAPSHOT"
osgiV='3.13.0.v20180428-1222'
osgiCompatV='1.1.100.v20180428-1222'
fp2V='0.0.1-SNAPSHOT'
bundles=()
bundles[0]='tycho-bundles/org.eclipse.tycho.embedder.shared'
bundles[1]='tycho-bundles/org.eclipse.tycho.core.shared'
bundles[2]='tycho-bundles/org.eclipse.tycho.p2.resolver.shared'
bundles[3]='tycho-bundles/org.eclipse.tycho.p2.tools.shared'
bundles[4]='tycho-bundles/org.eclipse.tycho.p2.maven.repository'
bundles[5]='tycho-bundles/org.eclipse.tycho.p2.resolver.impl'
bundles[6]='tycho-bundles/org.eclipse.tycho.p2.tools.impl'
xtraBundles[0]='fedoraproject-p2/org.fedoraproject.p2'
deps[0]=""
deps[1]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar"
deps[2]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar"
deps[3]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.shared/target/org.eclipse.tycho.p2.resolver.shared-${v}.jar"
deps[4]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.shared/target/org.eclipse.tycho.p2.resolver.shared-${v}.jar"
deps[5]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.shared/target/org.eclipse.tycho.p2.resolver.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.maven.repository/target/org.eclipse.tycho.p2.maven.repository-${v}.jar:fedoraproject-p2/org.fedoraproject.p2/target/org.fedoraproject.p2-${fp2V}.jar"
deps[6]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.shared/target/org.eclipse.tycho.p2.resolver.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.tools.shared/target/org.eclipse.tycho.p2.tools.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.maven.repository/target/org.eclipse.tycho.p2.maven.repository-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.impl/target/org.eclipse.tycho.p2.resolver.impl-${v}.jar"
xtraDeps[0]=""
externalDeps[4]="org.eclipse.equinox.common,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.artifact.repository,org.eclipse.osgi"
externalDeps[5]="org.eclipse.core.runtime,org.eclipse.equinox.security,org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.frameworkadmin,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.publisher.eclipse,org.eclipse.equinox.p2.artifact.repository,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.director,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.updatesite,org.eclipse.core.net,org.eclipse.equinox.common,org.eclipse.osgi,org.eclipse.equinox.preferences"
externalDeps[6]="org.eclipse.equinox.p2.director.app,org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.frameworkadmin,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.updatesite,org.eclipse.core.runtime,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.repository.tools,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.artifact.repository,org.eclipse.equinox.p2.publisher.eclipse,org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.director,org.eclipse.osgi,org.eclipse.equinox.common,org.eclipse.equinox.app,org.eclipse.equinox.registry"
xtraExternalDeps[0]="org.eclipse.osgi,org.eclipse.core.runtime,org.eclipse.equinox.common,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.publisher.eclipse,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.equinox.p2.updatesite,org.eclipse.equinox.p2.repository.tools,org.eclipse.equinox.app,slf4j.api"
reactorprojs=( 'tycho-embedder-api' 'tycho-metadata-model' 'sisu-equinox/sisu-equinox-api' 'sisu-equinox/sisu-equinox-embedder' 'tycho-core' 'tycho-packaging-plugin' 'tycho-p2/tycho-p2-facade' 'tycho-maven-plugin' 'tycho-p2/tycho-p2-repository-plugin' 'tycho-p2/tycho-p2-publisher-plugin' 'target-platform-configuration' 'tycho-artifactcomparator' 'sisu-equinox/sisu-equinox-launching' 'tycho-p2/tycho-p2-plugin' 'tycho-lib-detector' 'tycho-compiler-jdt' 'tycho-compiler-plugin' )
for ((i=0; i < ${#xtraBundles[@]}; i++)) ;do
echo ''
echo 'Building ' ${xtraBundles[${i}]} '...'
echo ''
isolateProject ${xtraBundles[${i}]} ${fp2V}
minibuild ${xtraBundles[${i}]} "${xtraDeps[${i}]}" ${xtraExternalDeps[${i}]}
unifyProject ${xtraBundles[${i}]}
done
# TODO: stop minibuild function from hard-coding org/eclipse/tycho GID path
dir=$(pwd)/.m2/org/fedoraproject/p2/org.fedoraproject.p2/
mkdir -p ${dir}
ln -s $(pwd)/.m2/org/eclipse/tycho/org.fedoraproject.p2/${fp2V} ${dir}
for ((i=0; i < ${#bundles[@]}; i++)) ;do
echo ''
echo 'Building ' ${bundles[${i}]} '...'
echo ''
isolateProject ${bundles[${i}]}
minibuild ${bundles[${i}]} "${deps[${i}]}" ${externalDeps[${i}]}
unifyProject ${bundles[${i}]}
done
# Run the build on this maven reactor project
for proj in ${reactorprojs[@]} ; do
isolateProject ${proj}
xmvn -B -o -e -f "${proj}/pom.xml" -Dmaven.repo.local=$(pwd)/.m2 -Dmaven.test.skip=true \
-Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8 -Dproject.build.sourceEncoding=UTF-8 \
clean install
unifyProject ${proj}
done
# Add org.fedoraproject.p2 to target platform for tycho-bundles-external
extras='bootstrap/extras'
mkdir -p ${extras}
fp2Loc=`find .m2 -name "org.fedoraproject.p2-*.jar"`
cp ${fp2Loc} ${extras}
# Tycho Bundles External (needed for Tycho's OSGi Runtime)
tbeDir='tycho-bundles/tycho-bundles-external'
tbeTargetDir="${tbeDir}/target"
wantedBundles=`sed 's/ fragment=\"true\"//' "${tbeDir}/tycho-bundles-external.product" | sed -n 's/.*<plugin id=\"\(.*\)\"\/>.*/\1/ p'`
mkdir -p ${tbeTargetDir}'/eclipse/plugins'
copyBundles "${wantedBundles}" "${tbeTargetDir}/eclipse/plugins"
pushd ${tbeTargetDir}
echo "#Eclipse Product File
#Thu Dec 19 21:40:37 EST 2013
version=${v}
name=org.eclipse.tycho.p2
id=tycho-bundles-external" > 'eclipse/.eclipseproduct'
mkdir -p 'eclipse/configuration'
echo '#Product Runtime Configuration File
#Thu Dec 19 21:40:37 EST 2013
osgi.bundles=org.apache.commons.codec,org.apache.commons.logging,org.apache.httpcomponents.httpclient,org.apache.httpcomponents.httpcore,org.eclipse.core.contenttype,org.eclipse.core.jobs,org.eclipse.core.net,org.eclipse.core.runtime@4\:start,org.eclipse.core.runtime.compatibility.registry,org.eclipse.ecf,org.eclipse.ecf.filetransfer,org.eclipse.ecf.identity,org.eclipse.ecf.provider.filetransfer,org.eclipse.ecf.provider.filetransfer.httpclient4,org.eclipse.ecf.provider.filetransfer.httpclient4.ssl,org.eclipse.ecf.provider.filetransfer.ssl,org.eclipse.ecf.ssl,org.eclipse.equinox.app,org.eclipse.equinox.common@2\:start,org.eclipse.equinox.concurrent,org.eclipse.equinox.ds@2\:start,org.eclipse.equinox.frameworkadmin,org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.launcher,org.eclipse.equinox.p2.artifact.repository,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.director,org.eclipse.equinox.p2.director.app,org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.garbagecollector,org.eclipse.equinox.p2.jarprocessor,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.publisher.eclipse,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.repository.tools,org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.equinox.p2.touchpoint.natives,org.eclipse.equinox.p2.transport.ecf,org.eclipse.equinox.p2.updatesite,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.equinox.security,org.eclipse.equinox.simpleconfigurator,org.eclipse.equinox.simpleconfigurator.manipulator,org.eclipse.equinox.util,org.eclipse.osgi.services,org.eclipse.osgi.compatibility.state,org.eclipse.tycho.noopsecurity,org.sat4j.core,org.sat4j.pb,org.eclipse.osgi.util,org.apache.felix.scr,org.kxml2,org.xmlpull,org.fedoraproject.p2
osgi.bundles.defaultStartLevel=4
eclipse.product=org.eclipse.equinox.p2.director.app.product
osgi.splashPath=platform\:/base/plugins/org' > 'eclipse/configuration/config.ini'
zip -r "tycho-bundles-external-${v}.zip" 'eclipse'
popd
loc=".m2/org/eclipse/tycho/tycho-bundles-external/${v}"
mkdir -p ${loc}
cp "${tbeTargetDir}/tycho-bundles-external-${v}.zip" ${loc}
cp 'tycho-bundles/tycho-bundles-external/pom.xml' "${loc}/tycho-bundles-external-${v}.pom"
sed -i "s/<equinoxVersionMaven>.*<\/equinoxVersionMaven>/<equinoxVersionMaven>${osgiV}<\/equinoxVersionMaven>/" pom.xml
sed -i "s/<equinoxCompatVersionMaven>.*<\/equinoxCompatVersionMaven>/<equinoxCompatVersionMaven>${osgiCompatV}<\/equinoxCompatVersionMaven>/" pom.xml
# xmvn-p2-installer-plugin needs to find the org.eclipse.osgi bundle
sed -i "s/>\${equinox-version}</>${osgiV}</" fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml

25
tycho-debundle.sh Normal file
View File

@@ -0,0 +1,25 @@
#! /bin/bash
. $(pwd)/tycho-scripts.sh
projLoc=$1
zipLoc=$projLoc/target/*.zip
mfLoc=$2
zipDir=`dirname ${zipLoc}`
zipFile=`basename ${zipLoc}`
tmpDir=${zipDir}/tmp
[ -z "$mfLoc" ] && mfLoc=/dev/null
mkdir -p ${tmpDir}
unzip -d ${tmpDir} ${zipLoc}
wantedBundles=`sed 's/ fragment=\"true\"//' ${projLoc}/*.product | sed -n 's/.*<plugin id=\"\(.*\)\"\/>.*/\1/ p'`
pushd ${tmpDir}
pluginsDir=`find . -type d -name plugins`
pushd ${pluginsDir} && rm -rf *
symlinkBundles "${wantedBundles}"
for b in *; do readlink $b; done >$mfLoc
popd
zip -ry ${zipFile} *
popd
mv ${tmpDir}/${zipFile} ${zipLoc}

46
tycho-fix-build.patch Normal file
View File

@@ -0,0 +1,46 @@
From 33bb1bece17d1b6f6e81b149828fa1287aa61093 Mon Sep 17 00:00:00 2001
From: Roland Grunberg <rgrunber@redhat.com>
Date: Tue, 12 Jun 2012 09:56:38 -0400
Subject: [PATCH] Fix the Tycho build to work on Fedora.
Minor fixes of limited scope needed to have Tycho building on Fedora.
Change-Id: Ic8c0514c1fa10ee53580d2654ac6a363ccd66814
---
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
index b00c344..bc05c2d 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
@@ -102,7 +102,9 @@ public class TychoMavenLifecycleParticipant extends AbstractMavenLifecyclePartic
}
private void validate(List<MavenProject> projects) throws MavenExecutionException {
- validateConsistentTychoVersion(projects);
+ if (System.getProperty("tycho.enableVersionCheck") != null) {
+ validateConsistentTychoVersion(projects);
+ }
validateUniqueBaseDirs(projects);
}
diff --git a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java
index 097bdeb..f90b10c 100644
--- a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java
+++ b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java
@@ -115,12 +115,11 @@ public abstract class AbstractTychoIntegrationTest {
verifier.getCliOptions().add(customOptions);
}
- if (System.getProperty(SYSPROP_STATELOCATION) != null) {
- verifier.setForkJvm(false);
- String m2eresolver = System.getProperty("tychodev-maven.ext.class.path"); // XXX
- if (m2eresolver != null) {
- verifier.addCliOption("-Dmaven.ext.class.path=" + m2eresolver);
- }
+ String m2eState = System.getProperty("m2eclipse.workspace.state");
+ String m2eResolver = System.getProperty("m2eclipse.workspace.resolver");
+
+ if (m2eState != null && m2eResolver != null) {
+ verifier.getVerifierProperties().put("m2eclipse.workspace.state", m2eState);
}
return verifier;

View File

@@ -0,0 +1,11 @@
--- ./tycho-source-plugin/src/main/java/org/eclipse/tycho/source/AbstractSourceJarMojo.java.orig 2016-04-14 17:18:54.033371257 +0100
+++ ./tycho-source-plugin/src/main/java/org/eclipse/tycho/source/AbstractSourceJarMojo.java 2016-04-14 17:22:02.121228491 +0100
@@ -259,7 +259,7 @@
getLog().warn("ignoring unsupported archive forced = false parameter.");
archive.setForced(true);
}
- archiver.createArchive(project, archive);
+ archiver.createArchive(null, project, archive);
} catch (IOException e) {
throw new MojoExecutionException("Error creating source archive: " + e.getMessage(), e);
} catch (ArchiverException e) {

View File

@@ -0,0 +1,687 @@
From 824f4a6c2db4f229e43de0c217d00a0c2c5b723d Mon Sep 17 00:00:00 2001
From: Roland Grunberg <rgrunber@redhat.com>
Date: Wed, 18 Jun 2014 13:01:31 -0400
Subject: [PATCH] Tycho should always delegate artifact resolution to Maven.
Maven resolves dependencies from the following locations in the
following order:
* reactor,
* workspace (eg. XMvn),
* local repository,
* remote repositories.
Tycho assumes that all resolved artifacts are present within the reactor
cache but this is not true for artifacts resolved from workspace
locations.
Change-Id: Ia44969ed1064965a82c3507a63e54caeebb75b18
---
.../META-INF/MANIFEST.MF | 1 +
.../eclipse/tycho/core/shared/MavenContext.java | 2 +
.../tycho/core/shared/MavenContextImpl.java | 10 ++++-
.../tycho/core/shared/MavenRepositorySystem.java | 19 +++++++++
.../local/LocalArtifactRepositoryP2APITest.java | 4 +-
.../local/LocalMetadataRepositoryTest.java | 3 +-
.../repository/local/LocalArtifactRepository.java | 8 ++--
.../local/LocalArtifactRepositoryFactory.java | 3 +-
.../local/index/LocalRepositoryP2IndicesImpl.java | 7 ++++
.../p2/remote/RemoteAgentMavenMirrorsTest.java | 3 +-
.../RemoteAgentMetadataRepositoryCacheTest.java | 5 ++-
.../target/TargetPlatformBundlePublisherTest.java | 3 +-
.../tycho/p2/target/TestResolverFactory.java | 5 ++-
.../tycho/p2/resolver/P2ResolverFactoryImpl.java | 8 ++--
.../p2/target/PomDependencyCollectorImpl.java | 2 +-
.../p2/target/TargetPlatformBundlePublisher.java | 13 ++++--
.../p2/repository/LocalRepositoryP2Indices.java | 4 ++
.../tycho/p2/repository/LocalRepositoryReader.java | 49 +++++-----------------
.../testutil/TemporaryLocalMavenRepository.java | 4 +-
.../tycho/test/util/MavenRepositorySystemStub.java | 30 +++++++++++++
.../adapters/MavenRepositorySystemAdapter.java | 37 ++++++++++++++++
.../configuration/MavenContextConfigurator.java | 8 +++-
22 files changed, 166 insertions(+), 62 deletions(-)
create mode 100644 tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java
create mode 100644 tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java
create mode 100644 tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared.tests/META-INF/MANIFEST.MF b/tycho-bundles/org.eclipse.tycho.core.shared.tests/META-INF/MANIFEST.MF
index 9658fbc..efd0a2c 100644
--- a/tycho-bundles/org.eclipse.tycho.core.shared.tests/META-INF/MANIFEST.MF
+++ b/tycho-bundles/org.eclipse.tycho.core.shared.tests/META-INF/MANIFEST.MF
@@ -7,3 +7,4 @@ Fragment-Host: org.eclipse.tycho.core.shared
Require-Bundle: org.junit;bundle-version="4.8.2"
Bundle-Vendor: %providerName
Automatic-Module-Name: org.eclipse.tycho.core.shared.tests
+Import-Package: org.eclipse.tycho.p2.repository
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java
index d63c1f1..cd8594d 100644
--- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContext.java
@@ -38,4 +38,6 @@ public interface MavenContext {
*/
public Properties getSessionProperties();
+ public MavenRepositorySystem getRepositorySystem();
+
}
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java
index 7b39d58..a15354f 100644
--- a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenContextImpl.java
@@ -19,18 +19,20 @@ public class MavenContextImpl implements MavenContext {
private MavenLogger mavenLogger;
private boolean offline;
private Properties mergedProperties;
+ private MavenRepositorySystem repositorySystem;
public MavenContextImpl(File localRepositoryRoot, boolean offline, MavenLogger mavenLogger,
- Properties mergedProperties) {
+ Properties mergedProperties, MavenRepositorySystem repositorySystem) {
this.localRepositoryRoot = localRepositoryRoot;
this.offline = offline;
this.mavenLogger = mavenLogger;
this.mergedProperties = mergedProperties;
+ this.repositorySystem = repositorySystem;
}
// constructor for tests
public MavenContextImpl(File localRepositoryRoot, MavenLogger mavenLogger) {
- this(localRepositoryRoot, false, mavenLogger, new Properties());
+ this(localRepositoryRoot, false, mavenLogger, new Properties(), null);
}
@Override
@@ -53,4 +55,8 @@ public class MavenContextImpl implements MavenContext {
return mergedProperties;
}
+ public MavenRepositorySystem getRepositorySystem() {
+ return repositorySystem;
+ }
+
}
diff --git a/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java
new file mode 100644
index 0000000..965e5cd
--- /dev/null
+++ b/tycho-bundles/org.eclipse.tycho.core.shared/src/main/java/org/eclipse/tycho/core/shared/MavenRepositorySystem.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Red Hat Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.core.shared;
+
+import java.io.File;
+
+public interface MavenRepositorySystem {
+
+ public File resolve(String gid, String aid, String version, String type, String classifier);
+
+}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java
index bedc5cb..7df3d17 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryP2APITest.java
@@ -53,6 +53,7 @@ import org.eclipse.tycho.repository.p2base.artifact.repository.ArtifactRepositor
import org.eclipse.tycho.repository.streaming.testutil.ProbeArtifactSink;
import org.eclipse.tycho.repository.streaming.testutil.ProbeOutputStream;
import org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink;
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -114,7 +115,8 @@ public class LocalArtifactRepositoryP2APITest {
@Before
public void initSubject() throws Exception {
temporaryLocalMavenRepo.initContentFromResourceFolder(ResourceUtil.resourceFile("repositories/local"));
- subject = new LocalArtifactRepository(null, temporaryLocalMavenRepo.getLocalRepositoryIndex());
+ subject = new LocalArtifactRepository(null, temporaryLocalMavenRepo.getLocalRepositoryIndex(),
+ new MavenRepositorySystemStub(temporaryLocalMavenRepo.getLocalRepositoryRoot()));
testOutputStream = new ProbeOutputStream();
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java
index 9b6d270..8779841 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/local/LocalMetadataRepositoryTest.java
@@ -32,6 +32,7 @@ import org.eclipse.tycho.p2.repository.LocalRepositoryReader;
import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
import org.eclipse.tycho.repository.local.index.FileBasedTychoRepositoryIndex;
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
import org.junit.Test;
public class LocalMetadataRepositoryTest extends BaseMavenRepositoryTest {
@@ -48,7 +49,7 @@ public class LocalMetadataRepositoryTest extends BaseMavenRepositoryTest {
protected IMetadataRepository loadRepository(File location) throws ProvisionException {
return new LocalMetadataRepository(location.toURI(), createMetadataIndex(location), new LocalRepositoryReader(
- location));
+ location, new MavenRepositorySystemStub(location)));
}
private LocalMetadataRepository createRepository(File location) throws ProvisionException {
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java
index 36946bf..0e2d330 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepository.java
@@ -23,6 +23,7 @@ import java.util.Set;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
import org.eclipse.tycho.p2.maven.repository.Activator;
import org.eclipse.tycho.p2.maven.repository.xmlio.ArtifactsIO;
import org.eclipse.tycho.p2.repository.GAV;
@@ -42,15 +43,16 @@ public class LocalArtifactRepository extends ArtifactRepositoryBaseImpl<GAVArtif
// TODO what is the agent needed for? does using the default agent harm?
public LocalArtifactRepository(LocalRepositoryP2Indices localRepoIndices) {
- this(Activator.getProvisioningAgent(), localRepoIndices);
+ this(Activator.getProvisioningAgent(), localRepoIndices, (MavenRepositorySystem) null);
}
public LocalArtifactRepository(LocalRepositoryP2Indices localRepoIndices, RepositoryReader contentLocator) {
this(Activator.getProvisioningAgent(), localRepoIndices, contentLocator);
}
- public LocalArtifactRepository(IProvisioningAgent agent, LocalRepositoryP2Indices localRepoIndices) {
- this(agent, localRepoIndices, new LocalRepositoryReader(localRepoIndices.getBasedir()));
+ public LocalArtifactRepository(IProvisioningAgent agent, LocalRepositoryP2Indices localRepoIndices,
+ MavenRepositorySystem repositorySystem) {
+ this(agent, localRepoIndices, new LocalRepositoryReader(localRepoIndices.getBasedir(), repositorySystem));
}
public LocalArtifactRepository(IProvisioningAgent agent, LocalRepositoryP2Indices localRepoIndices,
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java
index fc99483..be2ce88 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/LocalArtifactRepositoryFactory.java
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactRepositoryFactory;
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
import org.eclipse.tycho.p2.maven.repository.Activator;
import org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices;
import org.eclipse.tycho.repository.util.internal.RepositoryFactoryTools;
@@ -41,7 +42,7 @@ public class LocalArtifactRepositoryFactory extends ArtifactRepositoryFactory {
if (localRepositoryDirectory.isDirectory()
&& new File(localRepositoryDirectory, ".meta/p2-artifacts.properties").exists()) {
// see FileBasedTychoRepositoryIndex#ARTIFACTS_INDEX_RELPATH
- return new LocalArtifactRepository(getAgent(), lookupLocalRepoIndices());
+ return new LocalArtifactRepository(getAgent(), lookupLocalRepoIndices(), lookupLocalRepoIndices().getRepositorySystem());
}
}
return null;
diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java
index 2a746f2..7b9983a 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/repository/local/index/LocalRepositoryP2IndicesImpl.java
@@ -15,6 +15,7 @@ package org.eclipse.tycho.repository.local.index;
import org.eclipse.tycho.core.shared.MavenContext;
import org.eclipse.tycho.core.shared.MavenLogger;
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
import org.eclipse.tycho.locking.facade.FileLockService;
import org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices;
import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
@@ -25,6 +26,7 @@ public class LocalRepositoryP2IndicesImpl implements LocalRepositoryP2Indices {
private FileLockService fileLockService;
private File localRepositoryRoot;
private MavenLogger logger;
+ private MavenRepositorySystem repoSystem;
// derived members
private boolean initialized = false;
@@ -39,6 +41,7 @@ public class LocalRepositoryP2IndicesImpl implements LocalRepositoryP2Indices {
public void setMavenContext(MavenContext mavenContext) {
this.localRepositoryRoot = mavenContext.getLocalRepositoryRoot();
this.logger = mavenContext.getLogger();
+ this.repoSystem = mavenContext.getRepositorySystem();
}
// injected by DS runtime
@@ -80,4 +83,8 @@ public class LocalRepositoryP2IndicesImpl implements LocalRepositoryP2Indices {
return localRepositoryRoot;
}
+ public MavenRepositorySystem getRepositorySystem() {
+ return repoSystem;
+ }
+
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java
index 432ec09..4e5566a 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMavenMirrorsTest.java
@@ -29,6 +29,7 @@ import org.eclipse.tycho.p2.impl.test.ResourceUtil;
import org.eclipse.tycho.p2.remote.testutil.MavenRepositorySettingsStub;
import org.eclipse.tycho.test.util.HttpServer;
import org.eclipse.tycho.test.util.LogVerifier;
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -52,7 +53,7 @@ public class RemoteAgentMavenMirrorsTest {
public void initSubject() throws Exception {
File localRepository = tempManager.newFolder("localRepo");
MavenContext mavenContext = new MavenContextImpl(localRepository, OFFLINE, logVerifier.getLogger(),
- new Properties());
+ new Properties(), new MavenRepositorySystemStub(localRepository));
mavenRepositorySettings = new MavenRepositorySettingsStub();
subject = new RemoteAgent(mavenContext, mavenRepositorySettings, OFFLINE);
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java
index ae31862..14b8f85 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/remote/RemoteAgentMetadataRepositoryCacheTest.java
@@ -26,6 +26,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.tycho.core.shared.MavenContextImpl;
import org.eclipse.tycho.test.util.HttpServer;
import org.eclipse.tycho.test.util.LogVerifier;
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -126,12 +127,12 @@ public class RemoteAgentMetadataRepositoryCacheTest {
private RemoteAgent newOnlineAgent() throws Exception {
return new RemoteAgent(new MavenContextImpl(localMavenRepository, false, logVerifier.getLogger(),
- new Properties()));
+ new Properties(), new MavenRepositorySystemStub(localMavenRepository)));
}
private RemoteAgent newOfflineAgent() throws Exception {
return new RemoteAgent(new MavenContextImpl(localMavenRepository, true, logVerifier.getLogger(),
- new Properties()));
+ new Properties(), new MavenRepositorySystemStub(localMavenRepository)));
}
private IMetadataRepository loadHttpRepository(RemoteAgent agent) throws ProvisionException {
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java
index 50fe92f..3044e97 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisherTest.java
@@ -32,6 +32,7 @@ import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
import org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactProvider;
import org.eclipse.tycho.repository.streaming.testutil.ProbeRawArtifactSink;
import org.eclipse.tycho.test.util.LogVerifier;
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -57,7 +58,7 @@ public class TargetPlatformBundlePublisherTest {
logVerifier.expectNoWarnings();
localRepositoryRoot = tempFolder.getRoot();
- subject = new TargetPlatformBundlePublisher(localRepositoryRoot, logVerifier.getLogger());
+ subject = new TargetPlatformBundlePublisher(localRepositoryRoot, logVerifier.getLogger(), new MavenRepositorySystemStub(localRepositoryRoot));
}
@Test
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java
index d982042..127ae11 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl.test/src/test/java/org/eclipse/tycho/p2/target/TestResolverFactory.java
@@ -28,6 +28,7 @@ import org.eclipse.tycho.p2.target.facade.TargetPlatformFactory;
import org.eclipse.tycho.repository.local.LocalArtifactRepository;
import org.eclipse.tycho.repository.local.LocalMetadataRepository;
import org.eclipse.tycho.repository.local.index.LocalRepositoryP2IndicesImpl;
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
import org.eclipse.tycho.test.util.NoopFileLockService;
public class TestResolverFactory implements P2ResolverFactory {
@@ -45,7 +46,7 @@ public class TestResolverFactory implements P2ResolverFactory {
File localMavenRepoRoot = mavenContext.getLocalRepositoryRoot();
LocalRepositoryP2Indices localRepoIndices = createLocalRepoIndices(mavenContext);
- LocalRepositoryReader localRepositoryReader = new LocalRepositoryReader(localMavenRepoRoot);
+ LocalRepositoryReader localRepositoryReader = new LocalRepositoryReader(localMavenRepoRoot, mavenContext.getRepositorySystem());
localMetadataRepo = new LocalMetadataRepository(localMavenRepoRoot.toURI(),
localRepoIndices.getMetadataIndex(), localRepositoryReader);
localArtifactRepo = new LocalArtifactRepository(localRepoIndices, localRepositoryReader);
@@ -56,7 +57,7 @@ public class TestResolverFactory implements P2ResolverFactory {
}
private MavenContext createMavenContext(boolean offline, MavenLogger logger) {
- return new MavenContextImpl(getLocalRepositoryLocation(), offline, logger, new Properties());
+ return new MavenContextImpl(getLocalRepositoryLocation(), offline, logger, new Properties(), new MavenRepositorySystemStub(getLocalRepositoryLocation()));
}
// TODO use TemporaryLocalMavenRepository
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java
index a74d4d5..2f903a1 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/resolver/P2ResolverFactoryImpl.java
@@ -33,7 +33,7 @@ public class P2ResolverFactoryImpl implements P2ResolverFactory {
private static LocalMetadataRepository localMetadataRepository;
private static LocalArtifactRepository localArtifactRepository;
- private MavenContext mavenContext;
+ private static MavenContext mavenContext;
private LocalRepositoryP2Indices localRepoIndices;
private RemoteAgentManager remoteAgentManager;
private TargetDefinitionResolverService targetDefinitionResolverService;
@@ -42,7 +42,8 @@ public class P2ResolverFactoryImpl implements P2ResolverFactory {
LocalRepositoryP2Indices localRepoIndices) {
if (localMetadataRepository == null) {
File localMavenRepoRoot = context.getLocalRepositoryRoot();
- RepositoryReader contentLocator = new LocalRepositoryReader(localMavenRepoRoot);
+ RepositoryReader contentLocator = new LocalRepositoryReader(localMavenRepoRoot,
+ mavenContext.getRepositorySystem());
localMetadataRepository = new LocalMetadataRepository(localMavenRepoRoot.toURI(),
localRepoIndices.getMetadataIndex(), contentLocator);
@@ -53,7 +54,8 @@ public class P2ResolverFactoryImpl implements P2ResolverFactory {
private static synchronized LocalArtifactRepository getLocalArtifactRepository(MavenContext mavenContext,
LocalRepositoryP2Indices localRepoIndices) {
if (localArtifactRepository == null) {
- RepositoryReader contentLocator = new LocalRepositoryReader(mavenContext.getLocalRepositoryRoot());
+ RepositoryReader contentLocator = new LocalRepositoryReader(mavenContext.getLocalRepositoryRoot(),
+ mavenContext.getRepositorySystem());
localArtifactRepository = new LocalArtifactRepository(localRepoIndices, contentLocator);
}
return localArtifactRepository;
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java
index 8bee7ba..f2b07a5 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/PomDependencyCollectorImpl.java
@@ -44,7 +44,7 @@ public class PomDependencyCollectorImpl implements PomDependencyCollector {
this.logger = mavenContext.getLogger();
File localRepositoryRoot = mavenContext.getLocalRepositoryRoot();
- this.bundlesPublisher = new TargetPlatformBundlePublisher(localRepositoryRoot, mavenContext.getLogger());
+ this.bundlesPublisher = new TargetPlatformBundlePublisher(localRepositoryRoot, mavenContext.getLogger(), mavenContext.getRepositorySystem());
}
@Override
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
index 0195871..44a0f30 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
@@ -25,6 +25,7 @@ import org.eclipse.equinox.p2.publisher.PublisherResult;
import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.tycho.core.shared.MavenLogger;
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
import org.eclipse.tycho.p2.impl.publisher.MavenPropertiesAdvice;
import org.eclipse.tycho.p2.impl.publisher.repo.TransientArtifactRepository;
import org.eclipse.tycho.p2.metadata.IArtifactFacade;
@@ -42,8 +43,9 @@ public class TargetPlatformBundlePublisher {
private final MavenLogger logger;
private final PublishedBundlesArtifactRepository publishedArtifacts;
- public TargetPlatformBundlePublisher(File localMavenRepositoryRoot, MavenLogger logger) {
- this.publishedArtifacts = new PublishedBundlesArtifactRepository(localMavenRepositoryRoot);
+ public TargetPlatformBundlePublisher(File localMavenRepositoryRoot, MavenLogger logger,
+ MavenRepositorySystem repositorySystem) {
+ this.publishedArtifacts = new PublishedBundlesArtifactRepository(localMavenRepositoryRoot, repositorySystem);
this.logger = logger;
}
@@ -204,8 +206,11 @@ public class TargetPlatformBundlePublisher {
*/
private static class PublishedBundlesArtifactRepository extends ArtifactRepositoryBaseImpl<GAVArtifactDescriptor> {
- PublishedBundlesArtifactRepository(File localMavenRepositoryRoot) {
+ private MavenRepositorySystem repositorySystem;
+
+ PublishedBundlesArtifactRepository(File localMavenRepositoryRoot, MavenRepositorySystem repositorySystem) {
super(null, localMavenRepositoryRoot.toURI(), ArtifactTransferPolicies.forLocalArtifacts());
+ this.repositorySystem = repositorySystem;
}
void addPublishedArtifact(IArtifactDescriptor baseDescriptor, IArtifactFacade mavenArtifact) {
@@ -250,7 +255,7 @@ public class TargetPlatformBundlePublisher {
@Override
protected File internalGetArtifactStorageLocation(IArtifactDescriptor descriptor) {
MavenRepositoryCoordinates coord = toInternalDescriptor(descriptor).getMavenCoordinates();
- LocalRepositoryReader reader = new LocalRepositoryReader(getBaseDir());
+ LocalRepositoryReader reader = new LocalRepositoryReader(getBaseDir(), repositorySystem);
return reader.getLocalArtifactLocation(coord.getGav(), coord.getClassifier(), coord.getExtensionOrDefault());
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java
index 2122578..5e4a01e 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryP2Indices.java
@@ -13,6 +13,8 @@ package org.eclipse.tycho.p2.repository;
import java.io.File;
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
+
/**
* This service provides access to the tycho p2 index files of the local maven repository.
*/
@@ -24,4 +26,6 @@ public interface LocalRepositoryP2Indices {
public File getBasedir();
+ public MavenRepositorySystem getRepositorySystem();
+
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
index b5c8c55..8842af3 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
@@ -14,55 +14,28 @@ import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
+
public class LocalRepositoryReader implements RepositoryReader {
private final File localMavenRepositoryRoot;
+ private final MavenRepositorySystem repositorySystem;
- public LocalRepositoryReader(File localMavenRepositoryRoot) {
+ public LocalRepositoryReader(File localMavenRepositoryRoot, MavenRepositorySystem repositorySystem) {
this.localMavenRepositoryRoot = localMavenRepositoryRoot;
+ this.repositorySystem = repositorySystem;
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public File getLocalArtifactLocation(GAV gav, String classifier, String extension) {
- File file = new File(localMavenRepositoryRoot, RepositoryLayoutHelper.getRelativePath(gav, classifier,
- extension));
- // In Fedora the artifact may be in an XMvn-defined repository location (not in reactor cache)
- if (!file.exists()) {
- try {
- // Create Plexus config
- Class pcclazz = Class.forName("org.codehaus.plexus.ContainerConfiguration");
- Object conf = Class.forName("org.codehaus.plexus.DefaultContainerConfiguration").newInstance();
- pcclazz.getMethod("setAutoWiring", boolean.class).invoke(conf, true);
- pcclazz.getMethod("setClassPathScanning", String.class).invoke(conf, "index");
-
- // Use plexus container to lookup the reader
- Class pclazz = Class.forName("org.codehaus.plexus.DefaultPlexusContainer");
- Object plexus = pclazz.getConstructor(pcclazz).newInstance(conf);
-
- // Retrieve the workspace reader from the plexus container
- Method mLookup = pclazz.getMethod("lookup", String.class, String.class);
- Object reader = mLookup.invoke(plexus, "org.eclipse.aether.repository.WorkspaceReader", "ide");
-
- // Create an Aether Artifact based on GAV, classifier, and extension
- Class iartclazz = Class.forName("org.eclipse.aether.artifact.Artifact");
- Class artclazz = Class.forName("org.eclipse.aether.artifact.DefaultArtifact");
- Constructor cNew = artclazz.getConstructor(String.class, String.class, String.class, String.class,
- String.class);
- Object artifact = cNew.newInstance(gav.getGroupId(), gav.getArtifactId(), classifier, extension,
- gav.getVersion());
-
- // Invoke "findArtifact" method of the workspace reader on the artifact
- Method mfindArtifact = reader.getClass().getMethod("findArtifact", iartclazz);
- File newFile = (File) mfindArtifact.invoke(reader, artifact);
- if (newFile != null) {
- file = newFile;
- }
- } catch (Exception e) {
- e.printStackTrace();
+ File ret = new File(localMavenRepositoryRoot, RepositoryLayoutHelper.getRelativePath(gav, classifier, extension));
+ if (repositorySystem != null) {
+ File tmp = repositorySystem.resolve(gav.getGroupId(), gav.getArtifactId(), gav.getVersion(), extension, classifier);
+ if (tmp != null) {
+ ret = tmp;
}
}
- return file;
-
+ return ret;
}
}
diff --git a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java
index f7cc92c..7bc8a95 100644
--- a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java
+++ b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/repository/local/testutil/TemporaryLocalMavenRepository.java
@@ -14,9 +14,11 @@ import java.io.File;
import java.io.IOException;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
import org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices;
import org.eclipse.tycho.repository.local.LocalArtifactRepository;
import org.eclipse.tycho.repository.local.index.LocalRepositoryP2IndicesImpl;
+import org.eclipse.tycho.test.util.MavenRepositorySystemStub;
import org.eclipse.tycho.test.util.NoopFileLockService;
import org.junit.Rule;
import org.junit.rules.ExternalResource;
@@ -72,7 +74,7 @@ public class TemporaryLocalMavenRepository extends ExternalResource {
public LocalArtifactRepository getLocalArtifactRepository() {
if (repo == null) {
- repo = new LocalArtifactRepository(null, getLocalRepositoryIndex());
+ repo = new LocalArtifactRepository(null, getLocalRepositoryIndex(), new MavenRepositorySystemStub(getLocalRepositoryRoot()));
}
return repo;
}
diff --git a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java
new file mode 100644
index 0000000..7e020da
--- /dev/null
+++ b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/MavenRepositorySystemStub.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Red Hat Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.test.util;
+
+import java.io.File;
+
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
+import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
+
+public class MavenRepositorySystemStub implements MavenRepositorySystem {
+
+ private File localMavenRepositoryRoot;
+
+ public MavenRepositorySystemStub(File localMavenRepositoryRoot) {
+ this.localMavenRepositoryRoot = localMavenRepositoryRoot;
+ }
+
+ public File resolve(String gid, String aid, String version, String type, String classifier) {
+ return new File(localMavenRepositoryRoot, RepositoryLayoutHelper.getRelativePath(gid, aid, version, classifier,
+ type));
+ }
+}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java
new file mode 100644
index 0000000..e1d46fa
--- /dev/null
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/adapters/MavenRepositorySystemAdapter.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Red Hat Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.osgi.adapters;
+
+import java.io.File;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.repository.RepositorySystem;
+import org.eclipse.tycho.core.shared.MavenRepositorySystem;
+
+public class MavenRepositorySystemAdapter implements MavenRepositorySystem {
+
+ private RepositorySystem repoSystem;
+
+ public MavenRepositorySystemAdapter(RepositorySystem repoSystem) {
+ this.repoSystem = repoSystem;
+ }
+
+ public File resolve(String gid, String aid, String version, String type, String classifier) {
+ ArtifactResolutionRequest req = new ArtifactResolutionRequest();
+ Artifact art = repoSystem.createArtifactWithClassifier(gid, aid, version, type, classifier);
+ req.setArtifact(art);
+ ArtifactResolutionResult res = repoSystem.resolve(req);
+ return res.getArtifacts().size() > 0 ? res.getArtifacts().toArray(new Artifact[0])[0].getFile() : null;
+ }
+
+}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java
index e5837e2..137dcb1 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/MavenContextConfigurator.java
@@ -16,6 +16,7 @@ import java.util.Properties;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.LegacySupport;
+import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.settings.Profile;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.component.annotations.Component;
@@ -26,6 +27,7 @@ import org.eclipse.sisu.equinox.embedder.EquinoxLifecycleListener;
import org.eclipse.tycho.core.shared.MavenContext;
import org.eclipse.tycho.core.shared.MavenContextImpl;
import org.eclipse.tycho.osgi.adapters.MavenLoggerAdapter;
+import org.eclipse.tycho.osgi.adapters.MavenRepositorySystemAdapter;
@Component(role = EquinoxLifecycleListener.class, hint = "MavenContextConfigurator")
public class MavenContextConfigurator extends EquinoxLifecycleListener {
@@ -36,13 +38,17 @@ public class MavenContextConfigurator extends EquinoxLifecycleListener {
@Requirement
private LegacySupport context;
+ @Requirement
+ private RepositorySystem repositorySystem;
+
@Override
public void afterFrameworkStarted(EmbeddedEquinox framework) {
MavenSession session = context.getSession();
File localRepoRoot = new File(session.getLocalRepository().getBasedir());
MavenLoggerAdapter mavenLogger = new MavenLoggerAdapter(logger, false);
Properties globalProps = getGlobalProperties(session);
- MavenContext mavenContext = new MavenContextImpl(localRepoRoot, session.isOffline(), mavenLogger, globalProps);
+ MavenContext mavenContext = new MavenContextImpl(localRepoRoot, session.isOffline(), mavenLogger, globalProps,
+ new MavenRepositorySystemAdapter(repositorySystem));
framework.registerService(MavenContext.class, mavenContext);
}
--
1.9.3

181
tycho-scripts.sh Normal file
View File

@@ -0,0 +1,181 @@
#! /bin/bash
function minibuild () {
basedir=$1
src=`cat "${basedir}/build.properties" | grep 'source..' | cut -d'=' -f2 | tr ' ' '\0'`
output=`cat "${basedir}/build.properties" | grep 'output..' | cut -d'=' -f2 | tr ' ' '\0'`
bName=`cat "${basedir}/META-INF/MANIFEST.MF" | grep 'Bundle-SymbolicName:' | sed 's/Bundle-SymbolicName: \([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`
artifactId=`cat "${basedir}/pom.xml" | sed '/<parent>/,/<\/parent>/ d' | grep "<artifactId>" | sed 's/.*<artifactId>\(.*\)<\/artifactId>.*/\1/'`
version=`cat "${basedir}/pom.xml" | grep "<version>" | sed 's/.*<version>\(.*\)<\/version>.*/\1/'`
# External (System) dependencies
if [ $# -eq 3 ]; then
mkdir -p "${basedir}/target/externalDeps"
copyBundles $3 "${basedir}/target/externalDeps"
else
mkdir -p "${basedir}/target"
fi
mkdir -p "${basedir}/${output}"
# Compile
cp=
if [ $# -gt 1 ]; then
cp='-classpath '$2':'"${basedir}"'/target/externalDeps/*'
fi
javac -d "${basedir}/${output}" \
$(for file in `find "${basedir}/${src}" -name "*.java"`; \
do echo -n "${file} "; \
done;) \
${cp}
# Package
pushd ${basedir}
pushd ${output}
classfiles=`for file in $(find . -name "*.class"); do echo -n ' -C '${output} ${file} ; done;`
popd
packagefiles="${classfiles}"
[ -e about.html ] && packagefiles="about.html $packagefiles"
[ -e plugin.properties ] && packagefiles="plugin.properties $packagefiles"
[ -e plugin.xml ] && packagefiles="plugin.xml $packagefiles"
[ -e OSGI-INF ] && packagefiles="OSGI-INF $packagefiles"
jar -cfmv "target/${bName}-${version}.jar" 'META-INF/MANIFEST.MF' ${packagefiles}
popd
# Install
loc=".m2/org/eclipse/tycho/${artifactId}/${version}"
mkdir -p ${loc}
cp "${basedir}/target/${bName}-${version}.jar" ${loc}
cp "${basedir}/pom.xml" "${loc}/${bName}-${version}.pom"
}
function copyBundles () {
# X_SCLS expands to list of currently enabled SCLs, in the order they were enabled, if any
scls="$X_SCLS"
baseLocations=( '/usr/share/java' '/usr/lib/java' '/usr/lib/eclipse' )
osgiLocations=(${baseLocations[@]} ${osgiLocations[@]} )
for scl in ${scls} ; do
osgiLocations=( ${baseLocations[@]/#//opt/rh/${scl}/root} ${osgiLocations[@]} )
done
prefix="$(pwd)/bootstrap"
osgiLocations=( ${osgiLocations[@]/#/${prefix}} )
osgiLocations+=( ${osgiLocations[@]/${prefix}/} )
osgiLocations=( ${prefix}/extras ${osgiLocations[@]} )
wantedBundles=`echo $1 | tr ',' ' '`
destDir=$2
for loc in ${osgiLocations[@]} ; do
for jar in `find ${loc} -name "*.jar" 2>/dev/null`; do
bsn=`readBSN ${jar}`
if [ -n "${bsn}" ]; then
versionline=`unzip -p ${jar} 'META-INF/MANIFEST.MF' | grep 'Bundle-Version:'`
vers=`echo "${versionline}" | sed 's/Bundle-Version: \([a-zA-Z0-9_.-]*\).*/\1/'`
if echo ${wantedBundles} | grep "${bsn}" ; then
cp ${jar} "${destDir}/${bsn}_${vers}.jar"
wantedBundles=`removeFromList "${wantedBundles}" "${bsn}"`
fi
fi
done
done
}
function symlinkBundles () {
# Bootstrap Built Tycho provides some Eclipse bundles
# Prevent non-bootstrap build's de-bundling from symlinking to them
# SCL priority is from right to left.
# X_SCLS expands to list of currently enabled SCLs, in the order they were enabled, if any
scls="$X_SCLS"
baseLocations=( '/usr/share/java/eclipse' '/usr/share/java' '/usr/lib/java' )
osgiLocations=(${baseLocations[@]} ${osgiLocations[@]} )
for scl in ${scls} ; do
osgiLocations=( ${baseLocations[@]/#//opt/rh/${scl}/root} ${osgiLocations[@]} )
done
wantedBundles=`echo $1 | tr ',' ' '`
for loc in ${osgiLocations[@]} ; do
for jar in `find ${loc} -name "*.jar" 2>/dev/null`; do
bsn=`readBSN ${jar}`
if [ -n "${bsn}" ]; then
echo ${wantedBundles} | grep -q "${bsn}"
if [ $? -eq 0 ]; then
ln -s ${jar} "${bsn}.jar"
wantedBundles=`removeFromList "${wantedBundles}" "${bsn}"`
fi
fi
done
done
}
function removeFromList () {
arr=( ${1} )
for (( i=0; i < ${#arr[@]}; i++ )); do
if [ "${arr[${i}]}" = "$2" ]; then
arr[${i}]=
fi
done
echo ${arr[@]}
}
function isolateProject () {
cp $1/pom.xml $1/pom.xml.boot
sed -i -e "/<artifactId>org.eclipse.osgi</ a <version>${osgiV}</version>" \
-e "/<artifactId>org.eclipse.osgi.compatibility.state</ a <version>${osgiCompatV}</version>" \
-e '/<parent>/,/<\/parent>/ d' "$1/pom.xml"
if ! grep -q generate-metadata "$1/pom.xml" ; then
sed -i -e "/<artifactId>plexus-component-metadata</ a <version>1.5.5</version><executions><execution><goals><goal>generate-metadata</goal></goals></execution></executions>" "$1/pom.xml"
fi
if [ $# -eq 2 ]; then
sed -i "/<modelVersion>/ a <groupId>org.eclipse.tycho<\/groupId><version>$2<\/version>" "$1/pom.xml"
else
sed -i "/<modelVersion>/ a <groupId>org.eclipse.tycho<\/groupId><version>${v}<\/version>" "$1/pom.xml"
fi
}
function unifyProject () {
cp $1/pom.xml.boot $1/pom.xml
}
function readBSN () {
bsn=
manEntryPat="^[a-zA-Z-]*:"
foundBSNLine=0
while read line; do
if [ ${foundBSNLine} -eq 1 ]; then
echo ${line} | grep -qE ${manEntryPat}
if [ $? -eq 0 ]; then
break
else
bsn=${bsn}"`echo ${line} | sed 's/\([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`"
fi
fi
echo ${line} | grep -q "Bundle-SymbolicName:"
if [ $? -eq 0 ]; then
bsn=`echo ${line} | grep 'Bundle-SymbolicName:' | sed 's/Bundle-SymbolicName: \([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`
echo ${line} | grep "Bundle-SymbolicName:" | grep -q ";"
if [ $? -eq 0 ]; then
break
fi
foundBSNLine=1
fi
done < <(unzip -p $1 'META-INF/MANIFEST.MF')
echo ${bsn}
}

View File

@@ -0,0 +1,648 @@
From 33e4d975ad449411522cf13e01c92992c8516dc6 Mon Sep 17 00:00:00 2001
From: Roland Grunberg <rgrunber@redhat.com>
Date: Tue, 12 Jun 2012 10:38:51 -0400
Subject: [PATCH] Implement a custom resolver for Tycho in local mode.
When running in local mode, dependencies should be resolved by looking
on the local system. Remote repositories should be ignored unless
offline mode is disabled.
Use fedoraproject-p2 to resolve bundles from their system location.
Relax constraints for bundles used in Tycho's Equinox runtime.
Since Fedora 17, we need an Execution Environment of at least JavaSE-1.6
for Eclipse bundles. Eclipse Juno platform bundles depend on
javax.annotation. In Fedora this is provided by geronimo-annotation, but
has a dependency on javax.lang.model (since 1.6).
Use the defined target environments in local mode when the property
tycho.local.keepTarget is set.
In situations where Tycho must resolve maven artifacts, upstream's
implementation only looks in the reactor cache. In Fedora, maven
artifacts may be located on the system using repository layouts
understood by XMvn. Therefore, when an artifact is not found in the
reactor cache, resolution should be attempted using the XMvn Resolver.
Upstream/Fedora Tycho differ in the kind of OSGi Runtime used
(org.eclipse.tycho:tycho-bundles-external:zip) so use separate location
for our runtime (fedora-eclipse) to avoid collisions.
Change-Id: Ia1ece07ece2412bc4a88901631f3f651ad2b634b
---
.../embedder/internal/DefaultEquinoxEmbedder.java | 11 +++++-
.../p2/remote/RemoteRepositoryCacheManager.java | 14 +++++++
.../tycho/p2/target/TargetDefinitionResolver.java | 17 ++++++--
.../p2/target/TargetPlatformBundlePublisher.java | 15 ++------
.../tycho/p2/target/TargetPlatformFactoryImpl.java | 45 ++++++++++++++++++++--
.../tycho/p2/repository/LocalRepositoryReader.java | 44 ++++++++++++++++++++-
.../facade/TargetPlatformConfigurationStub.java | 6 ++-
.../tycho-bundles-external.product | 1 +
.../eclipse/tycho/core/locking/FileLockerImpl.java | 26 ++++++++++---
.../core/maven/TychoMavenLifecycleParticipant.java | 13 +++++++
.../tycho/core/osgitools/AbstractTychoProject.java | 23 +++++++++++
.../tycho/core/osgitools/OsgiBundleProject.java | 5 ++-
.../DefaultTargetPlatformConfigurationReader.java | 6 ++-
.../osgi/runtime/TychoOsgiRuntimeLocator.java | 27 ++++++++++---
tycho-p2/tycho-p2-facade/pom.xml | 5 +++
.../tycho/p2/resolver/P2DependencyResolver.java | 8 ++++
16 files changed, 228 insertions(+), 38 deletions(-)
diff --git a/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/internal/DefaultEquinoxEmbedder.java b/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/internal/DefaultEquinoxEmbedder.java
index ed01c2d..759f005 100644
--- a/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/internal/DefaultEquinoxEmbedder.java
+++ b/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/internal/DefaultEquinoxEmbedder.java
@@ -239,7 +239,14 @@ public class DefaultEquinoxEmbedder extends AbstractLogEnabled implements Equino
if (verIdx > 0) {
bundles.append(name.substring(0, verIdx));
} else {
- throw new EquinoxEmbedderException("File name doesn't match expected pattern: " + file);
+ // In Fedora, NAME_VERSION.QUALIFIER.jar is too fragile.
+ // Let's also accept NAME.jar
+ verIdx = name.lastIndexOf(".jar");
+ if (verIdx > 0) {
+ bundles.append(name.substring(0, verIdx));
+ } else {
+ throw new EquinoxEmbedderException("File name doesn't match expected pattern: " + file);
+ }
}
}
}
@@ -247,7 +254,7 @@ public class DefaultEquinoxEmbedder extends AbstractLogEnabled implements Equino
}
protected boolean isFrameworkBundle(File file) {
- return file.getName().startsWith("org.eclipse.osgi_");
+ return file.getName().startsWith("org.eclipse.osgi_") || file.getName().equals("org.eclipse.osgi.jar");
}
String getReferenceUrl(File file) {
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/remote/RemoteRepositoryCacheManager.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/remote/RemoteRepositoryCacheManager.java
index 1d3a029..2ec5c59 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/remote/RemoteRepositoryCacheManager.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/remote/RemoteRepositoryCacheManager.java
@@ -12,14 +12,18 @@ package org.eclipse.tycho.p2.remote;
import java.io.File;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URL;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.repository.CacheManager;
+import org.eclipse.equinox.internal.p2.repository.Messages;
import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.tycho.core.shared.MavenContext;
import org.eclipse.tycho.core.shared.MavenLogger;
import org.eclipse.tycho.p2.impl.Activator;
@@ -51,6 +55,13 @@ class RemoteRepositoryCacheManager extends CacheManager {
@Override
public File createCache(URI repositoryLocation, String prefix, IProgressMonitor monitor)
throws IOException, ProvisionException {
+ try {
+ new URL(repositoryLocation.toASCIIString());
+ } catch (MalformedURLException e) {
+ throw new ProvisionException(new Status(IStatus.ERROR, org.eclipse.equinox.internal.p2.repository.Activator.ID,
+ ProvisionException.REPOSITORY_NOT_FOUND, NLS.bind(Messages.CacheManager_CannotLoadNonUrlLocation,
+ repositoryLocation), null));
+ }
File cacheFile = getCache(repositoryLocation, prefix);
if (offline) {
if (cacheFile != null) {
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java
index c614e15..d6ae1af 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java
@@ -20,6 +20,7 @@ import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -121,7 +122,12 @@ public final class TargetDefinitionResolver {
resolverRun.addLocation((InstallableUnitLocation) locationDefinition);
for (Repository repository : ((InstallableUnitLocation) locationDefinition).getRepositories()) {
- artifactRepositories.add(repository.getLocation());
+ // We cannot resolve a non-file URI in local mode
+ if ((System.getProperty("TYCHO_MVN_LOCAL") == null && System.getProperty("TYCHO_MVN_RPMBUILD") == null)
+ || URIUtil.isFileURI(repository.getLocation())
+ || "fedora".equals(repository.getLocation().getScheme())) {
+ artifactRepositories.add(repository.getLocation());
+ }
}
} else {
logger.warn("Target location type '" + locationDefinition.getTypeDescription() + "' is not supported");
@@ -278,8 +284,13 @@ public final class TargetDefinitionResolver {
loadedRepositories = new ArrayList<>();
for (Repository repository : locationDefinition.getRepositories()) {
- repositoryIdManager.addMapping(repository.getId(), repository.getLocation());
- loadedRepositories.add(loadRepository(repository));
+ // We cannot resolve a non-file URI in local mode
+ if ((System.getProperty("TYCHO_MVN_LOCAL") == null && System.getProperty("TYCHO_MVN_RPMBUILD") == null)
+ || URIUtil.isFileURI(repository.getLocation())
+ || "fedora".equals(repository.getLocation().getScheme())) {
+ repositoryIdManager.addMapping(repository.getId(), repository.getLocation());
+ loadedRepositories.add(loadRepository(repository));
+ }
}
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
index 66a252f..0195871 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBundlePublisher.java
@@ -28,6 +28,7 @@ import org.eclipse.tycho.core.shared.MavenLogger;
import org.eclipse.tycho.p2.impl.publisher.MavenPropertiesAdvice;
import org.eclipse.tycho.p2.impl.publisher.repo.TransientArtifactRepository;
import org.eclipse.tycho.p2.metadata.IArtifactFacade;
+import org.eclipse.tycho.p2.repository.LocalRepositoryReader;
import org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates;
import org.eclipse.tycho.repository.local.GAVArtifactDescriptor;
import org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider;
@@ -216,15 +217,6 @@ public class TargetPlatformBundlePublisher {
GAVArtifactDescriptor descriptorForRepository = new GAVArtifactDescriptor(baseDescriptor,
repositoryCoordinates);
- File requiredArtifactLocation = new File(getBaseDir(),
- descriptorForRepository.getMavenCoordinates().getLocalRepositoryPath());
- File actualArtifactLocation = mavenArtifact.getLocation();
- if (!equivalentPaths(requiredArtifactLocation, actualArtifactLocation)) {
- throw new AssertionFailedException(
- "The Maven artifact to be added to the target platform is not stored at the required location on disk: required \""
- + requiredArtifactLocation + "\" but was \"" + actualArtifactLocation + "\"");
- }
-
internalAddInternalDescriptor(descriptorForRepository);
}
@@ -257,8 +249,9 @@ public class TargetPlatformBundlePublisher {
@Override
protected File internalGetArtifactStorageLocation(IArtifactDescriptor descriptor) {
- String relativePath = toInternalDescriptor(descriptor).getMavenCoordinates().getLocalRepositoryPath();
- return new File(getBaseDir(), relativePath);
+ MavenRepositoryCoordinates coord = toInternalDescriptor(descriptor).getMavenCoordinates();
+ LocalRepositoryReader reader = new LocalRepositoryReader(getBaseDir());
+ return reader.getLocalArtifactLocation(coord.getGav(), coord.getClassifier(), coord.getExtensionOrDefault());
}
private File getBaseDir() {
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformFactoryImpl.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformFactoryImpl.java
index 41fb4c6..75b25ac 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformFactoryImpl.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformFactoryImpl.java
@@ -32,6 +32,9 @@ import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;
+import org.eclipse.equinox.p2.metadata.expression.IExpression;
+import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
@@ -273,9 +276,43 @@ public class TargetPlatformFactoryImpl implements TargetPlatformFactory {
metadataRepositories.add(localMetadataRepository);
}
- for (IMetadataRepository repository : metadataRepositories) {
- IQueryResult<IInstallableUnit> matches = repository.query(QueryUtil.ALL_UNITS, monitor);
- result.addAll(matches.toUnmodifiableSet());
+ if (System.getProperty("TYCHO_MVN_LOCAL") != null) {
+ final IExpression notmatchIU_ID = ExpressionUtil.parse("id != $0");
+ Set<IMetadataRepository> fedoraRepos = new HashSet<IMetadataRepository> ();
+
+ // Sanity check even though the repo we want should be at index 1
+ for (IMetadataRepository repository : metadataRepositories) {
+ if ("fedora".equals(repository.getLocation().getScheme())) {
+ fedoraRepos.add(repository);
+ }
+ }
+
+ IQuery<IInstallableUnit> noLocalIUs = QueryUtil.createIUAnyQuery();
+
+ // Create a conjunction query that negates all IUs on the local system
+ for (IMetadataRepository repo : fedoraRepos) {
+ for (IInstallableUnit unit : repo.query(QueryUtil.ALL_UNITS, null).toUnmodifiableSet()) {
+ noLocalIUs = QueryUtil.createCompoundQuery(noLocalIUs,
+ QueryUtil.createMatchQuery(notmatchIU_ID, unit.getId()), true);
+ }
+ }
+
+ for (IMetadataRepository repository : metadataRepositories) {
+ IQueryResult<IInstallableUnit> matches;
+ if ("fedora".equals(repository.getLocation().getScheme())) {
+ matches = repository.query(QueryUtil.ALL_UNITS, monitor);
+ } else {
+ // Don't collect any remote IUs that can be found on the system
+ // This will favour IUs in the system local p2 repository
+ matches = repository.query(noLocalIUs, monitor);
+ }
+ result.addAll(matches.toUnmodifiableSet());
+ }
+ } else {
+ for (IMetadataRepository repository : metadataRepositories) {
+ IQueryResult<IInstallableUnit> matches = repository.query(QueryUtil.ALL_UNITS, monitor);
+ result.addAll(matches.toUnmodifiableSet());
+ }
}
result.addAll(pomDependenciesContent.gatherMavenInstallableUnits());
@@ -329,7 +366,7 @@ public class TargetPlatformFactoryImpl implements TargetPlatformFactory {
List<URI> allRemoteArtifactRepositories = new ArrayList<>();
for (MavenRepositoryLocation location : completeRepositories) {
- if (!offline || URIUtil.isFileURI(location.getURL())) {
+ if (!offline || URIUtil.isFileURI(location.getURL()) || "fedora".equals(location.getURL().getScheme())) {
allRemoteArtifactRepositories.add(location.getURL());
}
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
index 8d36462..b5c8c55 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
@@ -11,6 +11,8 @@
package org.eclipse.tycho.p2.repository;
import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
public class LocalRepositoryReader implements RepositoryReader {
@@ -21,8 +23,46 @@
}
@Override
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public File getLocalArtifactLocation(GAV gav, String classifier, String extension) {
- return new File(localMavenRepositoryRoot, RepositoryLayoutHelper.getRelativePath(gav, classifier, extension));
- }
+ File file = new File(localMavenRepositoryRoot, RepositoryLayoutHelper.getRelativePath(gav, classifier,
+ extension));
+ // In Fedora the artifact may be in an XMvn-defined repository location (not in reactor cache)
+ if (!file.exists()) {
+ try {
+ // Create Plexus config
+ Class pcclazz = Class.forName("org.codehaus.plexus.ContainerConfiguration");
+ Object conf = Class.forName("org.codehaus.plexus.DefaultContainerConfiguration").newInstance();
+ pcclazz.getMethod("setAutoWiring", boolean.class).invoke(conf, true);
+ pcclazz.getMethod("setClassPathScanning", String.class).invoke(conf, "index");
+
+ // Use plexus container to lookup the reader
+ Class pclazz = Class.forName("org.codehaus.plexus.DefaultPlexusContainer");
+ Object plexus = pclazz.getConstructor(pcclazz).newInstance(conf);
+
+ // Retrieve the workspace reader from the plexus container
+ Method mLookup = pclazz.getMethod("lookup", String.class, String.class);
+ Object reader = mLookup.invoke(plexus, "org.eclipse.aether.repository.WorkspaceReader", "ide");
+
+ // Create an Aether Artifact based on GAV, classifier, and extension
+ Class iartclazz = Class.forName("org.eclipse.aether.artifact.Artifact");
+ Class artclazz = Class.forName("org.eclipse.aether.artifact.DefaultArtifact");
+ Constructor cNew = artclazz.getConstructor(String.class, String.class, String.class, String.class,
+ String.class);
+ Object artifact = cNew.newInstance(gav.getGroupId(), gav.getArtifactId(), classifier, extension,
+ gav.getVersion());
+
+ // Invoke "findArtifact" method of the workspace reader on the artifact
+ Method mfindArtifact = reader.getClass().getMethod("findArtifact", iartclazz);
+ File newFile = (File) mfindArtifact.invoke(reader, artifact);
+ if (newFile != null) {
+ file = newFile;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return file;
+ }
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetPlatformConfigurationStub.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetPlatformConfigurationStub.java
index 22cca24..670f013 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetPlatformConfigurationStub.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/target/facade/TargetPlatformConfigurationStub.java
@@ -56,7 +56,11 @@ public class TargetPlatformConfigurationStub {
}
public void addP2Repository(MavenRepositoryLocation location) {
- this.repositories.add(location);
+ // We cannot resolve a non-file URI in local mode while offline
+ if (System.getProperty("TYCHO_MVN_RPMBUILD") == null || "file".equalsIgnoreCase(location.getURL().getScheme())
+ || "fedora".equalsIgnoreCase(location.getURL().getScheme())) {
+ this.repositories.add(location);
+ }
}
// convenience method for tests
diff --git a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
index 7c99168..28ad59f 100644
--- a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
+++ b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
@@ -79,6 +79,9 @@
<plugin id="org.sat4j.core"/>
<plugin id="org.sat4j.pb"/>
<plugin id="org.tukaani.xz"/>
+ <plugin id="org.kxml2"/>
+ <plugin id="org.xmlpull"/>
+ <plugin id="org.fedoraproject.p2"/>
</plugins>
<configurations>
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/locking/FileLockerImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/core/locking/FileLockerImpl.java
index 86253bd..cef15d2 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/locking/FileLockerImpl.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/locking/FileLockerImpl.java
@@ -27,22 +27,36 @@ public class FileLockerImpl implements FileLocker {
final File lockMarkerFile;
public FileLockerImpl(File file, Location anyLocation) {
+ File lockFileCandidate = null;
try {
if (file.isDirectory()) {
- this.lockMarkerFile = new File(file, LOCKFILE_SUFFIX).getCanonicalFile();
+ lockFileCandidate = new File(file, LOCKFILE_SUFFIX).getCanonicalFile();
} else {
- this.lockMarkerFile = new File(file.getParentFile(), file.getName() + LOCKFILE_SUFFIX)
- .getCanonicalFile();
+ lockFileCandidate = new File(file.getParentFile(), file.getName() + LOCKFILE_SUFFIX).getCanonicalFile();
}
- if (lockMarkerFile.isDirectory()) {
- throw new RuntimeException("Lock marker file " + lockMarkerFile + " already exists and is a directory");
+
+ if (lockFileCandidate.isDirectory()) {
+ throw new RuntimeException("Lock marker file " + lockFileCandidate + " already exists and is a directory");
}
- File parentDir = lockMarkerFile.getParentFile();
+ File parentDir = lockFileCandidate.getParentFile();
if (!parentDir.isDirectory() && !parentDir.mkdirs()) {
throw new RuntimeException("Could not create parent directory " + parentDir + " of lock marker file");
}
+
+ String baseDir = System.getProperty("user.dir");
+ String reactorCache = baseDir + "/.m2/";
+ // In Fedora we can only assume reactor cache is safe for read/write.
+ if (!lockFileCandidate.getAbsolutePath().startsWith(reactorCache)) {
+ String lockFileDir = reactorCache + LOCKFILE_SUFFIX;
+ // If the file is located within baseDir, no need to repeat
+ String lockFileName = file.getAbsolutePath().replace(baseDir, "").replace("/", "-").replaceFirst("-", "/") + LOCKFILE_SUFFIX;
+ lockFileCandidate = new File(lockFileDir, lockFileName);
+ }
+
+ this.lockMarkerFile = lockFileCandidate;
this.lockFileLocation = anyLocation.createLocation(null, null, false);
this.lockFileLocation.set(lockMarkerFile.toURL(), false, lockMarkerFile.getAbsolutePath());
+
} catch (MalformedURLException e) {
throw new RuntimeException(e);
} catch (IOException e) {
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
index 1160f6c..acb2a1d 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
@@ -30,6 +30,7 @@ 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.tycho.ReactorProject;
import org.eclipse.tycho.core.osgitools.BundleReader;
@@ -86,6 +87,18 @@ public class TychoMavenLifecycleParticipant extends AbstractMavenLifecyclePartic
configureComponents(session);
+ try {
+ if (plexus.lookup("org.fedoraproject.xmvn.resolver.Resolver") != null) {
+ if (session.isOffline()) {
+ System.setProperty("TYCHO_MVN_RPMBUILD", "");
+ } else {
+ System.setProperty("TYCHO_MVN_LOCAL", "");
+ }
+ }
+ } catch (ComponentLookupException e) {
+ // No XMvn (Upstream Maven in use)
+ }
+
for (MavenProject project : projects) {
resolver.setupProject(session, project, DefaultReactorProject.adapt(project));
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractTychoProject.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractTychoProject.java
index dfd4b6f..c05fcd8 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractTychoProject.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/AbstractTychoProject.java
@@ -19,6 +19,9 @@ import org.eclipse.tycho.artifacts.DependencyArtifacts;
import org.eclipse.tycho.core.TargetPlatformConfiguration;
import org.eclipse.tycho.core.TychoConstants;
import org.eclipse.tycho.core.TychoProject;
+import org.eclipse.tycho.core.ee.ExecutionEnvironmentUtils;
+import org.eclipse.tycho.core.ee.UnknownEnvironmentException;
+import org.eclipse.tycho.core.ee.shared.ExecutionEnvironment;
import org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration;
import org.eclipse.tycho.core.osgitools.targetplatform.LocalDependencyResolver;
import org.eclipse.tycho.core.osgitools.targetplatform.MultiEnvironmentDependencyArtifacts;
@@ -94,15 +97,35 @@ public abstract class AbstractTychoProject extends AbstractLogEnabled implements
String configuredForcedProfile = tpConfiguration.getExecutionEnvironment();
if (configuredForcedProfile != null) {
+ configuredForcedProfile = overrideToAtLeastJavaSE16(configuredForcedProfile);
sink.overrideProfileConfiguration(configuredForcedProfile,
"target-platform-configuration <executionEnvironment>");
}
String configuredDefaultProfile = tpConfiguration.getExecutionEnvironmentDefault();
if (configuredDefaultProfile != null) {
+ configuredDefaultProfile = overrideToAtLeastJavaSE16(configuredDefaultProfile);
sink.setProfileConfiguration(configuredDefaultProfile,
"target-platform-configuration <executionEnvironmentDefault>");
}
}
+ public String overrideToAtLeastJavaSE16 (String profile) {
+ try {
+ ExecutionEnvironment ee = ExecutionEnvironmentUtils.getExecutionEnvironment(profile);
+
+ if (System.getProperty("TYCHO_MVN_LOCAL") != null || System.getProperty("TYCHO_MVN_RPMBUILD") != null) {
+ // EE must be at least JavaSE-1.6
+ final ExecutionEnvironment javaSE16 = ExecutionEnvironmentUtils.getExecutionEnvironment("JavaSE-1.6");
+ if (! ee.isCompatibleCompilerTargetLevel(javaSE16.getCompilerTargetLevelDefault())) {
+ ee = javaSE16;
+ }
+ }
+
+ return ee.getProfileName();
+ } catch (UnknownEnvironmentException e) {
+ // can't happen, ee is validated during configuration parsing
+ return null;
+ }
+ }
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java
index fae4eb7..3f5289c 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java
@@ -502,6 +502,7 @@ public class OsgiBundleProject extends AbstractTychoProject implements BundlePro
String pdeProfile = getEclipsePluginProject(DefaultReactorProject.adapt(project)).getBuildProperties()
.getJreCompilationProfile();
if (pdeProfile != null) {
+ pdeProfile = overrideToAtLeastJavaSE16(pdeProfile);
sink.setProfileConfiguration(pdeProfile.trim(), "build.properties");
} else {
@@ -512,13 +513,13 @@ public class OsgiBundleProject extends AbstractTychoProject implements BundlePro
switch (tpConfiguration.getBREEHeaderSelectionPolicy()) {
case first:
- sink.setProfileConfiguration(manifestBREEs[0].getProfileName(),
+ sink.setProfileConfiguration(overrideToAtLeastJavaSE16(manifestBREEs[0].getProfileName()),
"Bundle-RequiredExecutionEnvironment (first entry)");
break;
case minimal:
ExecutionEnvironment manifestMinimalEE = Collections.min(Arrays.asList(manifestBREEs));
- sink.setProfileConfiguration(manifestMinimalEE.getProfileName(),
+ sink.setProfileConfiguration(overrideToAtLeastJavaSE16(manifestMinimalEE.getProfileName()),
"Bundle-RequiredExecutionEnvironment (minimal entry)");
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java
index 6fa6b8e..e6d25be 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/resolver/DefaultTargetPlatformConfigurationReader.java
@@ -68,7 +68,11 @@ public class DefaultTargetPlatformConfigurationReader {
+ configuration.toString());
}
- addTargetEnvironments(result, project, configuration);
+ // Use the defined environments only in local mode with tycho.local.keepTarget
+ if ((System.getProperty("TYCHO_MVN_LOCAL") == null && System.getProperty("TYCHO_MVN_RPMBUILD") == null)
+ || System.getProperty("tycho.local.keepTarget") != null) {
+ addTargetEnvironments(result, project, configuration);
+ }
setTargetPlatformResolver(result, configuration);
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java
index c7d95df..ac5bae7 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java
@@ -12,6 +12,8 @@ package org.eclipse.tycho.osgi.runtime;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -163,36 +165,49 @@ public class TychoOsgiRuntimeLocator implements EquinoxRuntimeLocator {
File artifactFile = new File(session.getLocalRepository().getBasedir(), session.getLocalRepository()
.pathOf(artifact));
File eclipseDir = new File(artifactFile.getParentFile(), "eclipse");
+ File eclipseSaveDir = new File(artifactFile.getParentFile(), "eclipse-save");
+ File fedoraDir = new File(artifactFile.getParentFile(), "fedora-eclipse");
FileLocker locker = fileLockService.getFileLocker(artifactFile);
locker.lock();
try {
- if (!eclipseDir.exists() || artifact.isSnapshot()) {
+ if (!fedoraDir.exists() || artifact.isSnapshot()) {
logger.debug("Extracting Tycho's OSGi runtime");
- if (artifact.getFile().lastModified() > eclipseDir.lastModified()) {
+ if (artifact.getFile().lastModified() > fedoraDir.lastModified()) {
logger.debug("Unpacking Tycho's OSGi runtime to " + eclipseDir);
try {
- FileUtils.deleteDirectory(eclipseDir);
+ FileUtils.deleteDirectory(fedoraDir);
+ if (eclipseDir.exists()) {
+ FileUtils.rename(eclipseDir, eclipseSaveDir);
+ }
} catch (IOException e) {
- logger.warn("Failed to delete Tycho's OSGi runtime " + eclipseDir + ": " + e.getMessage());
+ logger.warn("Failed to delete Tycho's OSGi runtime " + fedoraDir + ": " + e.getMessage());
}
unArchiver.setSourceFile(artifact.getFile());
unArchiver.setDestDirectory(eclipseDir.getParentFile());
try {
unArchiver.extract();
+ logger.debug("Moving Tycho's OSGi runtime to " + fedoraDir);
+ FileUtils.rename(eclipseDir, fedoraDir);
+ if (eclipseSaveDir.exists()) {
+ FileUtils.rename(eclipseSaveDir, eclipseDir);
+ }
} catch (ArchiverException e) {
throw new MavenExecutionException("Failed to unpack Tycho's OSGi runtime: "
+ e.getMessage(), e);
+ } catch (IOException e) {
+ throw new MavenExecutionException("Failed to move Tycho's OSGi runtime: " + e.getMessage(),
+ e);
}
- eclipseDir.setLastModified(artifact.getFile().lastModified());
+ fedoraDir.setLastModified(artifact.getFile().lastModified());
}
}
} finally {
locker.release();
}
- description.addInstallation(eclipseDir);
+ description.addInstallation(fedoraDir);
} else {
description.addBundle(artifact.getFile());
}
diff --git a/tycho-p2/tycho-p2-facade/pom.xml b/tycho-p2/tycho-p2-facade/pom.xml
index b567d50..34baa1a 100644
--- a/tycho-p2/tycho-p2-facade/pom.xml
+++ b/tycho-p2/tycho-p2-facade/pom.xml
@@ -57,6 +57,11 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.fedoraproject.p2</groupId>
+ <artifactId>org.fedoraproject.p2</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
</dependencies>
<build>
diff --git a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2DependencyResolver.java b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2DependencyResolver.java
index ae2dc38..a0c9969 100644
--- a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2DependencyResolver.java
+++ b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/P2DependencyResolver.java
@@ -88,6 +88,7 @@ import org.eclipse.tycho.p2.resolver.facade.P2ResolverFactory;
import org.eclipse.tycho.p2.target.facade.PomDependencyCollector;
import org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub;
import org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManagerFacade;
+import org.fedoraproject.p2.EclipseSystemLayout;
@Component(role = DependencyResolver.class, hint = P2DependencyResolver.ROLE_HINT, instantiationStrategy = "per-lookup")
public class P2DependencyResolver extends AbstractLogEnabled implements DependencyResolver, Initializable {
@@ -208,6 +209,13 @@ public class P2DependencyResolver extends AbstractLogEnabled implements Dependen
pomDependencies.setProjectLocation(project.getBasedir());
}
+ // Add Fedora Local P2 Repository when running in local mode
+ if (System.getProperty("TYCHO_MVN_LOCAL") != null || System.getProperty("TYCHO_MVN_RPMBUILD") != null) {
+ for (URI uri : EclipseSystemLayout.getRepositories()) {
+ tpConfiguration.addP2Repository(new MavenRepositoryLocation(uri.getPath(), uri));
+ }
+ }
+
for (ArtifactRepository repository : project.getRemoteArtifactRepositories()) {
addEntireP2RepositoryToTargetPlatform(repository, tpConfiguration);
}
--
2.1.0

5
tycho.changes Normal file
View File

@@ -0,0 +1,5 @@
-------------------------------------------------------------------
Mon Nov 11 12:04:28 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- Initial packaging of tycho 1.2.0 as _multibuild package, in order
to allow bootstrapping

433
tycho.spec Normal file
View File

@@ -0,0 +1,433 @@
#
# spec file for package tycho
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "bootstrap"
%bcond_without bootstrap
%else
%bcond_with bootstrap
%endif
# Release tags or git SHAs
%global git_tag tycho-%{version}
%global fp_p2_git_tag 290f67a4c717599b2f5166ea89aa5365571314b1
%global fp_p2_version 0.0.1
%global fp_p2_snap -SNAPSHOT
%define __requires_exclude osgi*
# Allow conditionally building without Junit 5 support
%bcond_without junit5
%if %{with bootstrap}
Name: tycho-bootstrap
%else
Name: tycho
%endif
Version: 1.2.0
Release: 0
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
# license file is missing but all files having some licensing information are ASL 2.0
License: Apache-2.0 AND EPL-1.0
Group: Development/Libraries/Java
URL: https://eclipse.org/tycho
# Tycho project source
Source0: http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/snapshot/org.eclipse.tycho-%{git_tag}.tar.xz
# Eclipse Plugin Project supporting filesystem as p2 repository
Source1: https://github.com/rgrunber/fedoraproject-p2/archive/%{fp_p2_git_tag}/fedoraproject-p2-%{fp_p2_git_tag}.tar.gz
# this is a workaround for maven-plugin-plugin changes that happened after
# version 2.4.3 (impossible to have empty mojo created as aggregate). This
# should be fixed upstream properly
Source2: EmptyMojo.java
Source3: tycho-scripts.sh
Source4: tycho-bootstrap.sh
Source5: tycho-debundle.sh
# Script that can be used to install or simulate installation of P2
# artifacts. It is used in OSGi requires generation.
Source6: p2-install.sh
Patch0: tycho-fix-build.patch
# Submitted upstream: https://bugs.eclipse.org/bugs/show_bug.cgi?id=535564
Patch1: tycho-maven-archiver-3.0.1.patch
Patch2: tycho-use-custom-resolver.patch
Patch3: tycho-maven-delegation.patch
# Changes needed for building against latest surefire
# Submitted upstream: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537419
Patch4: build-against-surefire-2.21.patch
Patch5: build-against-surefire-2.22.patch
# Submitted upstream: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537963
Patch6: use-java8-for-default-ee.patch
# Build against org.apache.maven.surefire:surefire-junit-platform instead of
# against org.junit.platform:junit-platform-surefire-provider
Patch7: port-to-surefire-junit-platform.patch
Patch100: fedoraproject-p2-bootstrap-fix.patch
BuildRequires: bash
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: maven-local
BuildRequires: unzip
BuildRequires: zip
BuildRequires: mvn(biz.aQute.bnd:bnd-maven-plugin)
BuildRequires: mvn(com.beust:jcommander)
BuildRequires: mvn(de.pdark:decentxml)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.apache.commons:commons-compress)
BuildRequires: mvn(org.apache.commons:commons-exec)
BuildRequires: mvn(org.apache.commons:commons-lang3)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugin-testing:maven-plugin-testing-harness)
BuildRequires: mvn(org.apache.maven.plugin-tools:maven-plugin-annotations)
BuildRequires: mvn(org.apache.maven.plugins:maven-clean-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-install-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
BuildRequires: mvn(org.apache.maven.shared:maven-verifier)
BuildRequires: mvn(org.apache.maven.surefire:maven-surefire-common)
BuildRequires: mvn(org.apache.maven.surefire:surefire-api)
BuildRequires: mvn(org.apache.maven.surefire:surefire-booter)
BuildRequires: mvn(org.apache.maven.surefire:surefire-logger-api)
BuildRequires: mvn(org.apache.maven:maven-archiver)
BuildRequires: mvn(org.apache.maven:maven-compat)
BuildRequires: mvn(org.apache.maven:maven-core)
BuildRequires: mvn(org.apache.maven:maven-plugin-api)
BuildRequires: mvn(org.apiguardian:apiguardian-api)
BuildRequires: mvn(org.codehaus.plexus:plexus-archiver)
BuildRequires: mvn(org.codehaus.plexus:plexus-compiler-api)
BuildRequires: mvn(org.codehaus.plexus:plexus-compiler-manager)
BuildRequires: mvn(org.codehaus.plexus:plexus-component-annotations)
BuildRequires: mvn(org.codehaus.plexus:plexus-component-metadata)
BuildRequires: mvn(org.codehaus.plexus:plexus-container-default)
BuildRequires: mvn(org.codehaus.plexus:plexus-utils)
BuildRequires: mvn(org.easymock:easymock)
BuildRequires: mvn(org.eclipse.tycho:org.eclipse.jdt.compiler.apt)
BuildRequires: mvn(org.eclipse.tycho:org.eclipse.jdt.core)
BuildRequires: mvn(org.fedoraproject.xmvn:xmvn-api)
BuildRequires: mvn(org.fedoraproject.xmvn:xmvn-core)
BuildRequires: mvn(org.fedoraproject.xmvn:xmvn-install)
BuildRequires: mvn(org.fedoraproject.xmvn:xmvn-parent:pom:)
BuildRequires: mvn(org.hamcrest:hamcrest-core)
BuildRequires: mvn(org.mockito:mockito-core)
BuildRequires: mvn(org.opentest4j:opentest4j)
BuildRequires: mvn(org.ow2.asm:asm-debug-all)
BuildRequires: mvn(org.slf4j:slf4j-api)
BuildRequires: mvn(org.slf4j:slf4j-simple)
BuildConflicts: java-devel >= 9
Requires: ecj >= 4.7.3a-1
# maven-clean-plugin is bound to "initialize" Maven phase for
# "eclipse-repository" projects
Requires: maven-clean-plugin
Requires: maven-local
Requires: xmvn-minimal >= 3
BuildArch: noarch
# Prebuilt Eclipse bundles needed to build Tycho when Eclipse is not present
# or when the Eclipse that is present is not compatible
%if %{with bootstrap}
Source10: eclipse-bootstrap-photon.tar.xz
%endif
%if %{without bootstrap}
# Ordinarily Tycho additionally requires itself and Eclipse to build
BuildRequires: %{name}-bootstrap
BuildRequires: eclipse-platform-bootstrap >= 4.8.0
Requires: eclipse-platform >= 4.8.0
Obsoletes: %{name}-bootstrap
#!BuildRequires: eclipse-emf-core-bootstrap
#!BuildRequires: eclipse-ecf-core-bootstrap
%else
# For bootstrapping, we just need the dependencies of the Eclipse bundles we use
BuildRequires: osgi(com.ibm.icu)
BuildRequires: osgi(javax.servlet-api)
BuildRequires: osgi(javax.servlet.jsp)
BuildRequires: osgi(org.apache.batik.css)
BuildRequires: osgi(org.apache.commons.jxpath)
BuildRequires: osgi(org.apache.felix.scr)
BuildRequires: osgi(org.sat4j.core) >= 2.3.5
BuildRequires: osgi(org.sat4j.pb) >= 2.3.5
BuildRequires: osgi(org.w3c.css.sac)
%endif
%if %{with junit5}
BuildRequires: mvn(org.apache.maven.surefire:surefire-junit-platform)
BuildRequires: mvn(org.apiguardian:apiguardian-api)
BuildRequires: mvn(org.opentest4j:opentest4j)
%endif
%description
Tycho is a set of Maven plugins and extensions for building Eclipse
plugins and OSGI bundles with Maven. Eclipse plugins and OSGI bundles
have their own metadata for expressing dependencies, source folder
locations, etc. that are normally found in a Maven POM. Tycho uses
native metadata for Eclipse plugins and OSGi bundles and uses the POM
to configure and drive the build. Tycho supports bundles, fragments,
features, update site projects and RCP applications. Tycho also knows
how to run JUnit test plugins using OSGi runtime and there is also
support for sharing build results using Maven artifact repositories.
Tycho plugins introduce new packaging types and the corresponding
lifecycle bindings that allow Maven to use OSGi and Eclipse metadata
during a Maven build. OSGi rules are used to resolve project
dependencies and package visibility restrictions are honored by the
OSGi-aware JDT-based compiler plugin. Tycho will use OSGi metadata and
OSGi rules to calculate project dependencies dynamically and injects
them into the Maven project model at build time. Tycho supports all
attributes supported by the Eclipse OSGi resolver (Require-Bundle,
Import-Package, Eclipse-GenericRequire, etc). Tycho will use proper
classpath access rules during compilation. Tycho supports all project
types supported by PDE and will use PDE/JDT project metadata where
possible. One important design goal in Tycho is to make sure there is
no duplication of metadata between POM and OSGi metadata.
%package javadoc
Summary: Javadocs for %{name}
Group: Documentation/HTML
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n org.eclipse.tycho-%{git_tag} -a 1
mv fedoraproject-p2-%{fp_p2_git_tag} fedoraproject-p2
%patch0 -p1
%patch1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5
%patch6 -p1
%patch7 -p1
%patch100
# Unneeded for RPM builds
%pom_remove_plugin :maven-site-plugin
%if %{without junit5}
%pom_disable_module org.eclipse.tycho.surefire.junit5 tycho-surefire
%pom_remove_dep ":org.eclipse.tycho.surefire.junit5" tycho-surefire/tycho-surefire-plugin
%endif
# Switch for "tycho" platform deps
%pom_change_dep org.eclipse.jdt: org.eclipse.tycho: . tycho-compiler-jdt
# Move from org.sonatype.aether to org.eclipse.aether
find . -name "*.java" | xargs sed -i 's/org.sonatype.aether/org.eclipse.aether/g'
find . -name "*.java" | xargs sed -i 's/org.eclipse.aether.util.DefaultRepositorySystemSession/org.eclipse.aether.DefaultRepositorySystemSession/g'
sed -i 's/public int getPriority/public float getPriority/g' tycho-core/src/main/java/org/eclipse/tycho/core/p2/P2RepositoryConnectorFactory.java
# place empty mojo in place
mkdir -p tycho-maven-plugin/src/main/java/org/fedoraproject
pushd tycho-maven-plugin/src/main/java/org/fedoraproject
cp %{SOURCE2} .
popd
# These units cannot be found during a regular build
sed -i '/^<unit id=.*$/d' tycho-bundles/tycho-bundles-target/tycho-bundles-target.target
# we don't have org.apache.commons:commons-compress:jar:sources
%pom_xpath_remove "pom:dependency[pom:classifier='sources' and pom:artifactId='commons-compress']" tycho-p2/tycho-p2-director-plugin
# Previously, JUnit would re-export Hamcrest
# Now modules using org.hamcrest.core must state the requirement explicitly
for mod in tycho-bundles/org.eclipse.tycho.{p2.{maven.repository.tests,resolver.impl.test,tools.tests},test.utils,core.shared.tests}; do
sed -i 's/^Require-Bundle://
/org\.junit/ i Require-Bundle: org.hamcrest.core,' \
$mod/META-INF/MANIFEST.MF
done
# Fix bundle names
sed -i -e 's/org\.hamcrest/org.hamcrest.core/' tycho-bundles/pom.xml
sed -i -e 's/org\.mockito/org.mockito.mockito-core/' \
tycho-bundles/org.eclipse.tycho.p2.tools.tests/META-INF/MANIFEST.MF \
tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/META-INF/MANIFEST.MF \
tycho-bundles/org.eclipse.tycho.p2.resolver.shared.tests/META-INF/MANIFEST.MF
# Bootstrap Build
%if %{with bootstrap}
# Don't build tests when bootstrapping
for b in core.shared.tests p2.resolver.impl.test p2.resolver.shared.tests p2.maven.repository.tests p2.tools.tests test.utils ; do
%pom_disable_module org.eclipse.tycho.$b tycho-bundles
done
%pom_disable_module org.fedoraproject.p2.tests fedoraproject-p2
%pom_remove_dep -r :::test
# Unpack a compatible version of Eclipse we can use to build against
tar -xf %{SOURCE10}
# Install OSGi bundles into local repo to override any incompatible system version
# that may be already installed
pushd bootstrap
for f in usr/lib/eclipse/plugins/org.eclipse.osgi.compatibility.state_*.jar \
usr/lib/eclipse/plugins/org.eclipse.osgi_*.jar ; do
xmvn -o install:install-file -Dfile=$f -Dpackaging=jar -DgroupId=org.eclipse.tycho -Dmaven.repo.local=$(pwd)/../.m2 \
-DartifactId=$(echo $(basename $f) | cut -d_ -f1) -Dversion=$(echo "${f%.jar}" | cut -d_ -f2)
done
popd
# Perform the 'minimal' (bootstrap) build of Tycho
cp %{SOURCE3} %{SOURCE4} .
bash tycho-bootstrap.sh %{version}
# Non-Bootstrap Build
%else
# Set some temporary build version so that the bootstrapped build has
# a different version from the nonbootstrapped. Otherwise there will
# be cyclic dependencies.
sysVer=`grep -C 1 "<artifactId>tycho</artifactId>" %{_mavenpomdir}/tycho/tycho.pom | grep "version" | sed 's/.*>\(.*\)<.*/\1/'`
mkdir boot
sed -e 's/ns[0-9]://g' %{_datadir}/maven-metadata/tycho-bootstrap.xml > boot/tycho-metadata.xml
# Copy Tycho POMs from system repo and set their versions to %%{version}-SNAPSHOT.
for pom in $(grep 'pom</path>' boot/tycho-metadata.xml | sed 's|.*>\(.*\)<.*|\1|'); do
sed -e "s/>$sysVer/>%{version}-SNAPSHOT/g" -e "s/%{fp_p2_version}%{fp_p2_snap}/%{fp_p2_version}/" <$pom >boot/$(basename $pom)
done
# Update Maven lifecycle mappings for Tycho packaging types provided by tycho-maven-plugin.
cp -p $(build-classpath tycho/tycho-maven-plugin) boot/tycho-maven-plugin.jar
jar xf boot/tycho-maven-plugin.jar META-INF/plexus/components.xml
sed -i s/$sysVer/%{version}-SNAPSHOT/ META-INF/plexus/components.xml
jar uf boot/tycho-maven-plugin.jar META-INF/plexus/components.xml
# Create XMvn metadata for the new JARs and POMs by customizing system Tycho metadata.
sed -i '
s|>/[^<]*/\([^/]*\.pom\)</path>|>'$PWD'/boot/\1</path>|
s|>'$sysVer'</version>|>%{version}-SNAPSHOT</version><compatVersions><version>%{version}-SNAPSHOT</version></compatVersions>|
s|>'%{fp_p2_version}%{fp_p2_snap}'</version>|>%{fp_p2_version}</version><compatVersions><version>%{fp_p2_version}</version></compatVersions>|
s|%{_javadir}/tycho/tycho-maven-plugin.jar|'$PWD'/boot/tycho-maven-plugin.jar|
' boot/tycho-metadata.xml
%{mvn_config} resolverSettings/metadataRepositories/repository $PWD/boot/tycho-metadata.xml
%endif
# Avoid duplicate execution of clean when generating javadocs, see ebz#399756
%pom_add_plugin :maven-clean-plugin tycho-bundles/tycho-standalone-p2-director "
<executions>
<execution>
<id>default-clean-1</id>
<phase>initialize</phase>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>"
# Add fp-p2 to main build
%pom_xpath_inject "pom:modules" "<module>fedoraproject-p2</module>"
%mvn_file :{*} tycho/@1
%build
%if %{with bootstrap}
%global no_javadoc "-j"
%else
%global no_javadoc %{nil}
%endif
%{mvn_build} %{no_javadoc} -f -- \
-Dtycho-version=%{version}-SNAPSHOT -DtychoBootstrapVersion=%{version}-SNAPSHOT \
-Dmaven.repo.local=$(pwd)/.m2 -Dfedora.p2.repos=$(pwd)/bootstrap
%{mvn_artifact} fedoraproject-p2/org.fedoraproject.p2/pom.xml
# Relying on xmvn p2 plugin being present would be a circular dep
# So install as if all artifacts are normal jar files
sed -i -e 's|type>eclipse.*<|type>jar<|' .xmvn-reactor
# Don't package target platform definition files
%{mvn_package} "::target::" __noinstall
# Don't package fp-p2 tests
%{mvn_package} ":org.fedoraproject.p2.tests" __noinstall
%install
# Get debundling scripts
cp %{SOURCE3} %{SOURCE5} .
%if ! %{with bootstrap}
# Debundle p2 runtime
bash tycho-debundle.sh $(pwd)/tycho-bundles/tycho-bundles-external \
$(pwd)/tycho-bundles/tycho-bundles-external/target/tycho-bundles-external-manifest.txt
# Debundle standalone p2 director
bash tycho-debundle.sh $(pwd)/tycho-bundles/tycho-standalone-p2-director
%endif
%if %{with bootstrap}
# Install our own copy of OSGi runtime when bootstrapping to avoid external dep on Eclipse
for b in org.eclipse.osgi \
org.eclipse.osgi.compatibility.state ; do
osgiJarPath=$(find .m2/org/eclipse/tycho/$b/*/ -name "*.jar")
osgiPomPath=$(find .m2/org/eclipse/tycho/$b/*/ -name "*.pom")
%{mvn_artifact} $osgiPomPath $osgiJarPath
%{mvn_alias} "org.eclipse.tycho:$b" "org.eclipse.osgi:$b"
done
%endif
%mvn_install
%if ! %{with bootstrap}
install -pm 644 tycho-bundles/tycho-bundles-external/target/tycho-bundles-external-manifest.txt %{buildroot}%{_javadir}/tycho
%add_maven_depmap org.eclipse.tycho:tycho-bundles-external:txt:manifest:%{version} tycho/tycho-bundles-external-manifest.txt
%endif
%if %{with bootstrap}
# Misc other bundles needed for bootstrapping
for bnd in \
core.contenttype \
core.expressions \
core.filesystem \
core.jobs \
core.net \
core.resources \
core.runtime \
equinox.app \
equinox.common \
equinox.concurrent \
equinox.preferences \
equinox.registry \
equinox.security ; do
bndJarPath=$(find bootstrap -name "org.eclipse.${bnd}_*.jar")
install -m 644 -T $bndJarPath %{buildroot}%{_javadir}/tycho/$bnd.jar
done
%endif
# For some reason fp-p2 is treated as a compat version, this prevents that
# TODO: figure out why
sed -i '/<resolvedVersion>/d' %{buildroot}%{_datadir}/maven-metadata/%{name}.xml
# p2-install script
install -dm 755 %{buildroot}%{_javadir}-utils/
install -pm 755 %{SOURCE6} %{buildroot}%{_javadir}-utils/
# Symlink XMvn P2 plugin with all dependencies so that it can be loaded by XMvn
xmvn_libdir=$(realpath $(dirname $(readlink -f $(which xmvn)))/../lib)
install -dm 755 %{buildroot}${xmvn_libdir}/installer/
%if %{with bootstrap}
ln -s %{_javadir}/tycho/org.eclipse.osgi.jar %{buildroot}${xmvn_libdir}/installer/
%else
ln -s %{_javadir}/eclipse/osgi.jar %{buildroot}${xmvn_libdir}/installer/
%endif
ln -s %{_javadir}/tycho/xmvn-p2-installer-plugin.jar %{buildroot}${xmvn_libdir}/installer/
ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}${xmvn_libdir}/installer/
%files -f .mfiles
%if %{with bootstrap}
%{_javadir}/tycho/core.*.jar
%{_javadir}/tycho/equinox.*.jar
%endif
%{_datadir}/xmvn/lib/installer
%{_javadir}-utils/p2-install.sh
%doc README.md
%if %{without bootstrap}
%files javadoc -f .mfiles-javadoc
%endif
%changelog

View File

@@ -0,0 +1,167 @@
From d113fc877033b24305584d0157a79b7a54be4188 Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Wed, 15 Aug 2018 15:58:10 +0100
Subject: [PATCH] Bug 537963 - Make the default EE Java 1.8
This allows bundles that don't otherwise specify an EE (for example
if the bundle contains only a plugin.xml, or is a documentation only
bundle, or otherwise does not contain any bytecode) to continue
working in environments that are supported by the latest release
of Eclipse.
Change-Id: Ic6e41c3000c85e2e4222e8153e84b7701ab0e750
Signed-off-by: Mat Booth <mat.booth@redhat.com>
---
diff --git a/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java b/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java
index 7451d97..a0dae08 100644
--- a/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java
+++ b/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java
@@ -37,7 +37,7 @@
public class OsgiCompilerTest extends AbstractTychoMojoTestCase {
private static final int TARGET_1_4 = 48;
- private static final int TARGET_9 = 53;
+ private static final int TARGET_8 = 52;
protected File storage;
@@ -235,10 +235,10 @@
List<MavenProject> projects = getSortedProjects(basedir, null);
MavenProject project;
// project with neither POM nor MANIFEST configuration => must fallback to
- // source/target level == 9
+ // source/target level == 8
project = projects.get(1);
getMojo(projects, project).execute();
- assertBytecodeMajorLevel(TARGET_9, new File(project.getBasedir(), "target/classes/Generic.class"));
+ assertBytecodeMajorLevel(TARGET_8, new File(project.getBasedir(), "target/classes/Generic.class"));
// project with multiple execution envs.
// Minimum source and target level must be taken
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java
index 11f0ccf..ea67379 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 SAP SE and others.
+ * Copyright (c) 2012, 2018 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,8 +19,8 @@
import org.eclipse.tycho.core.shared.BuildFailureException;
public class ExecutionEnvironmentConfigurationImpl implements ExecutionEnvironmentConfiguration {
- // Most likely best to always be the latest known supported EE
- private static final String DEFAULT_EXECUTION_ENVIRONMENT = "JavaSE-9";
+ // Most likely best to always be the latest known supported long-term supported EE
+ private static final String DEFAULT_EXECUTION_ENVIRONMENT = "JavaSE-1.8";
private static final int PRIMARY = 0;
private static final int SECONDARY = 1;
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java
index 5391eb2..f04fa21 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java
@@ -45,9 +45,9 @@
@Test
public void testDefaults() {
- assertThat(subject.getProfileName(), is("JavaSE-9"));
+ assertThat(subject.getProfileName(), is("JavaSE-1.8"));
assertThat(subject.isCustomProfile(), is(false));
- assertThat(subject.getFullSpecification().getProfileName(), is("JavaSE-9"));
+ assertThat(subject.getFullSpecification().getProfileName(), is("JavaSE-1.8"));
}
@Test
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java
index 54f1134..fa2ce8d 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java
@@ -61,7 +61,7 @@
properties.put("tycho-version", TychoVersion.getTychoVersion());
List<MavenProject> projects = getSortedProjects(basedir, properties, null);
- assertEquals(6, projects.size());
+ assertEquals(7, projects.size());
assertEquals("executionenvironment.manifest-minimal", projects.get(2).getArtifactId());
ExecutionEnvironment ee = TychoProjectUtils.getExecutionEnvironmentConfiguration(projects.get(2))
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java
index e8eb7ad..a88e2e4 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java
@@ -360,7 +360,7 @@
properties.put("tycho-version", TychoVersion.getTychoVersion());
List<MavenProject> projects = getSortedProjects(basedir, properties, null);
- assertEquals(6, projects.size());
+ assertEquals(7, projects.size());
int i = 0;
assertEquals("executionenvironment.manifest", projects.get(++i).getArtifactId());
@@ -377,6 +377,9 @@
assertEquals("executionenvironment.pom-default", projects.get(++i).getArtifactId());
assertEquals("OSGi/Minimum-1.2", getActiveEEProfile(projects.get(i)));
+
+ assertEquals("executionenvironment.tycho-default", projects.get(++i).getArtifactId());
+ assertEquals("JavaSE-1.8", getActiveEEProfile(projects.get(i)));
}
public void testWithProjectReferencesItself() throws Exception {
diff --git a/tycho-core/src/test/resources/projects/bree/pom.xml b/tycho-core/src/test/resources/projects/bree/pom.xml
index 1ddff1d..18c5885 100644
--- a/tycho-core/src/test/resources/projects/bree/pom.xml
+++ b/tycho-core/src/test/resources/projects/bree/pom.xml
@@ -14,6 +14,7 @@
<module>pom-hard</module>
<module>buildproperties</module>
<module>pom-default</module>
+ <module>tycho-default</module>
</modules>
</project>
diff --git a/tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF b/tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e6d85c6
--- /dev/null
+++ b/tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: A bundle that specifies no EE at all and relies on Tycho to set one.
+Bundle-SymbolicName: executionenvironment.tycho-default
+Bundle-Version: 1.0.0
diff --git a/tycho-core/src/test/resources/projects/bree/tycho-default/build.properties b/tycho-core/src/test/resources/projects/bree/tycho-default/build.properties
new file mode 100644
index 0000000..7b02ed4
--- /dev/null
+++ b/tycho-core/src/test/resources/projects/bree/tycho-default/build.properties
@@ -0,0 +1,2 @@
+bin.includes = META-INF/
+
diff --git a/tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml b/tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml
new file mode 100644
index 0000000..f538f5e
--- /dev/null
+++ b/tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml
@@ -0,0 +1,15 @@
+<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 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>executionenvironment</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <artifactId>executionenvironment.tycho-default</artifactId>
+ <version>1.0.0</version>
+ <packaging>eclipse-plugin</packaging>
+
+</project>