diff --git a/.devtoolset-4-tycho.metadata b/.devtoolset-4-tycho.metadata new file mode 100644 index 0000000..bcd5208 --- /dev/null +++ b/.devtoolset-4-tycho.metadata @@ -0,0 +1,2 @@ +598d43664ce3658e768b6eff2bc207d7bc9e937c SOURCES/fedoraproject-p2-09403d.tar.xz +4e630e4230a8ccb1ab6fe7b2e62fb73bdac626d3 SOURCES/org.eclipse.tycho-tycho-0.23.0.tar.xz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..777d3e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/fedoraproject-p2-09403d.tar.xz +SOURCES/org.eclipse.tycho-tycho-0.23.0.tar.xz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/EmptyMojo.java b/SOURCES/EmptyMojo.java new file mode 100644 index 0000000..84d970f --- /dev/null +++ b/SOURCES/EmptyMojo.java @@ -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 + { + } +} diff --git a/SOURCES/p2-install.sh b/SOURCES/p2-install.sh new file mode 100755 index 0000000..30bfd35 --- /dev/null +++ b/SOURCES/p2-install.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -e + +_prefer_jre="true" +. /usr/share/java-utils/java-functions + +set_jvm + +set_classpath \ + aether/aether-api \ + atinject \ + beust-jcommander \ + cglib \ + eclipse/osgi \ + google-guice \ + guava \ + objectweb-asm/asm \ + org.eclipse.sisu.inject \ + plexus/utils \ + 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 "$@" diff --git a/SOURCES/tycho-bootstrap.sh b/SOURCES/tycho-bootstrap.sh new file mode 100755 index 0000000..ab3cb3e --- /dev/null +++ b/SOURCES/tycho-bootstrap.sh @@ -0,0 +1,138 @@ +#! /bin/bash -e + +. $(pwd)/tycho-scripts.sh + +eclipse_bootstrap=$1 +preV='0.23.0' +v='0.23.0-SNAPSHOT' +osgiV='3.10.100.v20150602-1500' +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-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 + +# Can't have empty mojo project +mkdir -p 'tycho-maven-plugin/src/main/java/org/fedoraproject' +pushd 'tycho-maven-plugin/src/main/java/org/fedoraproject' +echo ' +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 + { + } +} +' > EmptyMojo.java +popd + +# Run the build on this maven reactor project +for proj in ${reactorprojs[@]} ; do + isolateProject ${proj} + xmvn -o -f "${proj}/pom.xml" -Dmaven.repo.local=$(pwd)/.m2 -Dmaven.test.skip=true 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/.*.*/\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.fedoraproject.p2,slf4j.api +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/.*<\/equinox\(.*\)VersionMaven>/${osgiV}<\/equinox\1VersionMaven>/" pom.xml +# xmvn-p2-installer-plugin needs to find the org.eclipse.osgi bundle +sed -i "s/\${equinox-version}<\/version>/${osgiV}<\/version>/" fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml diff --git a/SOURCES/tycho-debundle.sh b/SOURCES/tycho-debundle.sh new file mode 100755 index 0000000..59c046b --- /dev/null +++ b/SOURCES/tycho-debundle.sh @@ -0,0 +1,25 @@ +#! /bin/bash + +. $(pwd)/tycho-scripts.sh + +projLoc=$1 +zipLoc=$2 +mfLoc=$3 + +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/.*.*/\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} diff --git a/SOURCES/tycho-fix-bootstrap-build.patch b/SOURCES/tycho-fix-bootstrap-build.patch new file mode 100644 index 0000000..b1d653f --- /dev/null +++ b/SOURCES/tycho-fix-bootstrap-build.patch @@ -0,0 +1,400 @@ +diff --git a/target-platform-configuration/pom.xml b/target-platform-configuration/pom.xml +index 497b671..9570b2e 100644 +--- a/target-platform-configuration/pom.xml ++++ b/target-platform-configuration/pom.xml +@@ -50,4 +50,30 @@ + ${project.version} + + ++ ++ ++ ++ ++ org.apache.maven.plugins ++ maven-plugin-plugin ++ 3.3 ++ ++ true ++ ++ java-annotations ++ ++ ++ ++ ++ default-descriptor ++ ++ descriptor ++ ++ process-classes ++ ++ ++ ++ ++ ++ + +diff --git a/tycho-artifactcomparator/pom.xml b/tycho-artifactcomparator/pom.xml +index 2b86d82..dfd2d5f 100644 +--- a/tycho-artifactcomparator/pom.xml ++++ b/tycho-artifactcomparator/pom.xml +@@ -51,6 +51,15 @@ + + org.codehaus.plexus + plexus-component-metadata ++ 1.5.5 ++ ++ ++ ++ generate-metadata ++ generate-test-metadata ++ ++ ++ + + + +diff --git a/tycho-compiler-jdt/pom.xml b/tycho-compiler-jdt/pom.xml +index f9a267a..fadb6df 100644 +--- a/tycho-compiler-jdt/pom.xml ++++ b/tycho-compiler-jdt/pom.xml +@@ -25,10 +25,19 @@ + + + +- +- org.codehaus.plexus +- plexus-component-metadata +- ++ ++ org.codehaus.plexus ++ plexus-component-metadata ++ 1.5.5 ++ ++ ++ ++ generate-metadata ++ generate-test-metadata ++ ++ ++ ++ + + + +diff --git a/tycho-compiler-plugin/pom.xml b/tycho-compiler-plugin/pom.xml +index 6050e97..c763fd0 100644 +--- a/tycho-compiler-plugin/pom.xml ++++ b/tycho-compiler-plugin/pom.xml +@@ -63,23 +63,35 @@ + + + +- org.eclipse.tycho +- tycho-testing-harness +- ${project.version} +- test +- +- +- org.eclipse.tycho +- tycho-core +- ${project.version} +- test +- tests +- +- + bcel + bcel + test + + + ++ ++ ++ ++ org.apache.maven.plugins ++ maven-plugin-plugin ++ 3.3 ++ ++ true ++ ++ java-annotations ++ ++ ++ ++ ++ default-descriptor ++ ++ descriptor ++ ++ process-classes ++ ++ ++ ++ ++ ++ + +diff --git a/tycho-core/pom.xml b/tycho-core/pom.xml +index f565826..abef39f 100644 +--- a/tycho-core/pom.xml ++++ b/tycho-core/pom.xml +@@ -59,11 +59,19 @@ + + + +- +- org.codehaus.plexus +- plexus-component-metadata +- +- ++ ++ org.codehaus.plexus ++ plexus-component-metadata ++ 1.5.5 ++ ++ ++ ++ generate-metadata ++ generate-test-metadata ++ ++ ++ ++ + + org.apache.felix + maven-bundle-plugin +@@ -148,12 +156,6 @@ + + + +- org.eclipse.tycho +- tycho-testing-harness +- ${project.version} +- test +- +- + org.apache.maven + maven-compat + test +diff --git a/tycho-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/tycho-maven-plugin/src/main/resources/META-INF/plexus/components.xml +index c3cb13c..a2e44d2 100644 +--- a/tycho-maven-plugin/src/main/resources/META-INF/plexus/components.xml ++++ b/tycho-maven-plugin/src/main/resources/META-INF/plexus/components.xml +@@ -94,9 +94,6 @@ + org.eclipse.tycho:tycho-packaging-plugin:${project.version}:package-plugin, + org.eclipse.tycho:tycho-p2-plugin:${project.version}:p2-metadata-default + +- +- org.eclipse.tycho:tycho-surefire-plugin:${project.version}:test +- + + org.apache.maven.plugins:maven-install-plugin:${install-plugin.version}:install, + org.eclipse.tycho:tycho-p2-plugin:${project.version}:update-local-index +diff --git a/tycho-p2/tycho-p2-plugin/pom.xml b/tycho-p2/tycho-p2-plugin/pom.xml +index a6a3bcd..d344076 100644 +--- a/tycho-p2/tycho-p2-plugin/pom.xml ++++ b/tycho-p2/tycho-p2-plugin/pom.xml +@@ -53,21 +53,43 @@ + tycho-artifactcomparator + ${project.version} + +- +- +- org.eclipse.tycho +- tycho-testing-harness +- ${project.version} +- test +- + + + + +- +- org.codehaus.plexus +- plexus-component-metadata +- ++ ++ org.codehaus.plexus ++ plexus-component-metadata ++ 1.5.5 ++ ++ ++ ++ generate-metadata ++ generate-test-metadata ++ ++ ++ ++ ++ ++ org.apache.maven.plugins ++ maven-plugin-plugin ++ 3.3 ++ ++ true ++ ++ java-annotations ++ ++ ++ ++ ++ default-descriptor ++ ++ descriptor ++ ++ process-classes ++ ++ ++ + + + +diff --git a/tycho-p2/tycho-p2-publisher-plugin/pom.xml b/tycho-p2/tycho-p2-publisher-plugin/pom.xml +index 454b8c2..9854dbb 100644 +--- a/tycho-p2/tycho-p2-publisher-plugin/pom.xml ++++ b/tycho-p2/tycho-p2-publisher-plugin/pom.xml +@@ -48,17 +48,31 @@ + tycho-packaging-plugin + ${project.version} + +- +- org.eclipse.tycho +- tycho-testing-harness +- ${project.version} +- test +- +- +- org.mockito +- mockito-core +- test +- + + ++ ++ ++ ++ org.apache.maven.plugins ++ maven-plugin-plugin ++ 3.3 ++ ++ true ++ ++ java-annotations ++ ++ ++ ++ ++ default-descriptor ++ ++ descriptor ++ ++ process-classes ++ ++ ++ ++ ++ ++ + +diff --git a/tycho-p2/tycho-p2-repository-plugin/pom.xml b/tycho-p2/tycho-p2-repository-plugin/pom.xml +index e8d5117..af7d657 100644 +--- a/tycho-p2/tycho-p2-repository-plugin/pom.xml ++++ b/tycho-p2/tycho-p2-repository-plugin/pom.xml +@@ -42,4 +42,29 @@ + + + ++ ++ ++ ++ org.apache.maven.plugins ++ maven-plugin-plugin ++ 3.3 ++ ++ true ++ ++ java-annotations ++ ++ ++ ++ ++ default-descriptor ++ ++ descriptor ++ ++ process-classes ++ ++ ++ ++ ++ ++ + +diff --git a/tycho-packaging-plugin/pom.xml b/tycho-packaging-plugin/pom.xml +index b842cbf..962494c 100644 +--- a/tycho-packaging-plugin/pom.xml ++++ b/tycho-packaging-plugin/pom.xml +@@ -33,19 +33,6 @@ + ${project.version} + + +- org.eclipse.tycho +- tycho-testing-harness +- ${project.version} +- test +- +- +- org.eclipse.tycho +- tycho-core +- ${project.version} +- test +- tests +- +- + org.mockito + mockito-core + test +@@ -83,10 +70,39 @@ + + + +- +- org.codehaus.plexus +- plexus-component-metadata +- ++ ++ org.codehaus.plexus ++ plexus-component-metadata ++ 1.5.5 ++ ++ ++ ++ generate-metadata ++ generate-test-metadata ++ ++ ++ ++ ++ ++ org.apache.maven.plugins ++ maven-plugin-plugin ++ 3.3 ++ ++ true ++ ++ java-annotations ++ ++ ++ ++ ++ default-descriptor ++ ++ descriptor ++ ++ process-classes ++ ++ ++ + + + diff --git a/SOURCES/tycho-fix-build.patch b/SOURCES/tycho-fix-build.patch new file mode 100644 index 0000000..3aae37d --- /dev/null +++ b/SOURCES/tycho-fix-build.patch @@ -0,0 +1,176 @@ +From 33bb1bece17d1b6f6e81b149828fa1287aa61093 Mon Sep 17 00:00:00 2001 +From: Roland Grunberg +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. + +Remove org.eclipse.equinox.concurrent until present in Fedora Eclipse. + +Tycho upstream currently depends upon 0.15.0 when building +0.16.0-SNAPSHOT, which doesn't have reactor plugin version checking. In +Fedora we depend on the previously built version which has that version +checking. We must keep previous build version strings different to avoid +a cyclic dependency, but doing so causes the version checking to fail, +so we must provide a way to disable it. Disable by default. + +Update to using Jetty 9 API. + +Update to using maven-surefire 2.18. + +Change-Id: Ic8c0514c1fa10ee53580d2654ac6a363ccd66814 +--- + .../META-INF/MANIFEST.MF | 2 +- + .../eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java | 2 +- + .../src/main/java/org/eclipse/tycho/test/util/HttpServer.java | 8 ++++++-- + .../tycho-bundles-external/tycho-bundles-external.product | 1 - + .../tycho-standalone-p2-director/p2 Director.product | 1 - + .../tycho/core/maven/TychoMavenLifecycleParticipant.java | 4 +++- + .../eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java | 2 +- + .../org/eclipse/tycho/test/AbstractTychoIntegrationTest.java | 11 +++++------ + 8 files changed, 17 insertions(+), 14 deletions(-) + +diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/META-INF/MANIFEST.MF b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/META-INF/MANIFEST.MF +index 4243cfd..eca4c01 100644 +--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/META-INF/MANIFEST.MF ++++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/META-INF/MANIFEST.MF +@@ -9,7 +9,7 @@ Fragment-Host: org.eclipse.tycho.p2.maven.repository + Require-Bundle: org.junit, + org.eclipse.equinox.p2.publisher, + org.eclipse.equinox.ds, +- org.mockito ++ org.mockito.mockito-core + Import-Package: org.eclipse.tycho.locking.facade, + org.eclipse.tycho.repository.local.testutil, + org.eclipse.tycho.repository.streaming.testutil, +diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java +index 7afa13e..82962f9 100644 +--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java ++++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java +@@ -59,7 +59,7 @@ class CustomEEResolutionHandler extends ExecutionEnvironmentResolutionHandler { + String name = capability.getName(); + String version = capability.getVersion().toString(); + +- if (JREAction.NAMESPACE_OSGI_EE.equals(namespace)) { ++ if ("osgi.ee".equals(namespace)) { + result.add(new SystemCapability(Type.OSGI_EE, name, version)); + } else if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(namespace)) { + result.add(new SystemCapability(Type.JAVA_PACKAGE, name, version)); +diff --git a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java +index 6e65627..eefc753 100644 +--- a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java ++++ b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java +@@ -17,6 +17,11 @@ import java.util.List; + import java.util.Map; + import java.util.Random; + ++import org.eclipse.jetty.security.ConstraintMapping; ++import org.eclipse.jetty.security.ConstraintSecurityHandler; ++import org.eclipse.jetty.security.HashLoginService; ++import org.eclipse.jetty.server.AbstractNetworkConnector; ++import org.eclipse.jetty.server.Connector; + import org.eclipse.jetty.server.Server; + import org.eclipse.jetty.server.ServerConnector; + import org.eclipse.jetty.servlet.ServletContextHandler; +@@ -76,8 +81,7 @@ public class HttpServer extends ExternalResource { + + private static RunningServer startServerOnPort(int port) throws Exception { + Server jetty = new Server(); +- ServerConnector connector = new ServerConnector(jetty); +- connector.setHost("localhost"); ++ AbstractNetworkConnector connector = new ServerConnector(jetty); + connector.setPort(port); + jetty.addConnector(connector); + +diff --git a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product +index 814afe1..0dc0980 100644 +--- a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product ++++ b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product +@@ -43,7 +43,6 @@ + + + +- + + + +diff --git a/tycho-bundles/tycho-standalone-p2-director/p2 Director.product b/tycho-bundles/tycho-standalone-p2-director/p2 Director.product +index 771d4f7..eabd0d9 100644 +--- a/tycho-bundles/tycho-standalone-p2-director/p2 Director.product ++++ b/tycho-bundles/tycho-standalone-p2-director/p2 Director.product +@@ -42,7 +42,6 @@ + + + +- + + + +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 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; +diff --git a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java +index e30aae3..0102465 100644 +--- a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java ++++ b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java +@@ -27,7 +27,6 @@ import org.apache.maven.project.MavenProjectHelper; + import org.codehaus.plexus.archiver.Archiver; + import org.codehaus.plexus.archiver.ArchiverException; + import org.codehaus.plexus.archiver.tar.TarArchiver; +-import org.codehaus.plexus.archiver.tar.TarArchiver.TarCompressionMethod; + import org.codehaus.plexus.archiver.tar.TarLongFileMode; + import org.eclipse.tycho.core.shared.TargetEnvironment; + import org.eclipse.tycho.plugins.tar.TarGzArchiver; +@@ -98,9 +99,13 @@ public final class ProductArchiverMojo extends AbstractProductMojo { + productArchivers.put(TAR_GZ_ARCHIVE_FORMAT, new ProductArchiver() { + @Override + Archiver getArchiver() throws ArchiverException { ++ TarArchiver.TarCompressionMethod tarCompressionMethod = new TarArchiver.TarCompressionMethod(); ++ tarCompressionMethod.setValue("gzip"); // surprisingly, compression names are private in plexus ++ tarArchiver.setCompression(tarCompressionMethod); +- tarArchiver.setCompression(TarCompressionMethod.gzip); + // avoid lots of long file path (> 100 chars) warnings ++ TarLongFileMode gnuMode = new TarLongFileMode(); ++ gnuMode.setValue(TarLongFileMode.GNU); ++ tarArchiver.setLongfile(gnuMode); +- tarArchiver.setLongfile(TarLongFileMode.gnu); + return tarArchiver; + } + }); +-- +2.1.0 + diff --git a/SOURCES/tycho-fix-surefire.patch b/SOURCES/tycho-fix-surefire.patch new file mode 100644 index 0000000..02edb28 --- /dev/null +++ b/SOURCES/tycho-fix-surefire.patch @@ -0,0 +1,162 @@ +From 3d497c3a1f153eeff65b5c336c3735afc2f5e02c Mon Sep 17 00:00:00 2001 +From: Jan Sievers +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 +--- + .../org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF | 5 +++-- + tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml | 5 +++++ + .../org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF | 4 +++- + tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml | 10 ++++++++++ + .../org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF | 4 +++- + tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml | 10 ++++++++++ + .../org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF | 3 ++- + tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml | 5 +++++ + 8 files changed, 41 insertions(+), 5 deletions(-) + +diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF +index 985c901..d0ae690 100644 +--- a/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF ++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF +@@ -6,6 +6,7 @@ Bundle-Version: 0.22.0 + Fragment-Host: org.eclipse.tycho.surefire.osgibooter;bundle-version="0.14.0" + Bundle-RequiredExecutionEnvironment: J2SE-1.5, + JavaSE-1.6 +-Require-Bundle: org.junit;bundle-version="[3.8.0,4.0.0)" +-Bundle-ClassPath: jars/surefire-junit3-2.17.jar ++Require-Bundle: org.junit;bundle-version="[3.8.0,5.0.0)" ++Bundle-ClassPath: jars/surefire-junit3-2.17.jar, ++ jars/common-junit3-2.17.jar + Bundle-Vendor: %providerName +diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml +index 108286e..4093a2f 100644 +--- a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml ++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml +@@ -44,6 +44,11 @@ + surefire-junit3 + ${surefire-version} + ++ ++ org.apache.maven.surefire ++ common-junit3 ++ ${surefire-version} ++ + + + +diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF +index 41cf2a4..1f554ba 100644 +--- a/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF ++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF +@@ -6,7 +6,9 @@ Bundle-Version: 0.22.0 + Fragment-Host: org.eclipse.tycho.surefire.osgibooter;bundle-version="0.14.0" + Bundle-RequiredExecutionEnvironment: J2SE-1.5, + JavaSE-1.6 +-Bundle-ClassPath: jars/surefire-junit4-2.17.jar ++Bundle-ClassPath: jars/surefire-junit4-2.17.jar, ++ jars/common-junit3-2.17.jar, ++ jars/common-junit4-2.17.jar + Import-Package: junit.framework;version="3.0.0", + org.junit;version="4.0.0", + org.junit.runner;version="4.0.0", +diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml +index 8b5cf64..ae3b3b1 100644 +--- a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml ++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml +@@ -44,6 +44,16 @@ + surefire-junit4 + ${surefire-version} + ++ ++ org.apache.maven.surefire ++ common-junit3 ++ ${surefire-version} ++ ++ ++ org.apache.maven.surefire ++ common-junit4 ++ ${surefire-version} ++ + + + +diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF +index 6bb3710..ebac243 100644 +--- a/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF ++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF +@@ -8,7 +8,9 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5 + Bundle-ClassPath: ., + jars/surefire-junit47-2.17.jar, + jars/common-junit48-2.17.jar, +- jars/surefire-grouper-2.17.jar ++ jars/surefire-grouper-2.17.jar, ++ jars/common-junit3-2.17.jar, ++ jars/common-junit4-2.17.jar + Import-Package: junit.framework;version="3.0.0", + org.junit;version="[4.7,5)", + org.junit.runner;version="[4.7,5)", +diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml +index ba08dc0..afadf96 100644 +--- a/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml ++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml +@@ -54,6 +54,16 @@ + surefire-grouper + ${surefire-version} + ++ ++ org.apache.maven.surefire ++ common-junit4 ++ ${surefire-version} ++ ++ ++ org.apache.maven.surefire ++ common-junit3 ++ ${surefire-version} ++ + + + +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 6c9a366..dfe22ae 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 +@@ -7,7 +7,8 @@ Bundle-Version: 0.22.0 + Bundle-ClassPath: ., + jars/surefire-booter-2.17.jar, + jars/surefire-api-2.17.jar, +- jars/maven-surefire-common-2.17.jar ++ jars/maven-surefire-common-2.17.jar, ++ jars/plexus-utils-3.0.jar + Bundle-Name: Tycho Surefire OSGi Booter Eclipse Application (Incubation) + 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 e457dce..6fd329f 100644 +--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml ++++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml +@@ -57,6 +57,11 @@ + maven-surefire-common + ${surefire-version} + ++ ++ org.codehaus.plexus ++ plexus-utils ++ 3.0 ++ + + + +-- +1.9.3 + diff --git a/SOURCES/tycho-java-7-compatibility.patch b/SOURCES/tycho-java-7-compatibility.patch new file mode 100644 index 0000000..0ed9217 --- /dev/null +++ b/SOURCES/tycho-java-7-compatibility.patch @@ -0,0 +1,137 @@ +From 08a04cbff4fc6393ec56c61fff7f859d1d707cd6 Mon Sep 17 00:00:00 2001 +From: Roland Grunberg +Date: Fri, 26 Jun 2015 15:34:12 -0400 +Subject: [PATCH] Respect compatibility with Java 7. + +--- + org.fedoraproject.p2/META-INF/MANIFEST.MF | 2 +- + .../p2/installer/impl/DefaultEclipseInstaller.java | 58 ++++++++++++++++------ + xmvn-p2-installer-plugin/pom.xml | 4 +- + 3 files changed, 45 insertions(+), 19 deletions(-) + +diff --git a/fedoraproject-p2/org.fedoraproject.p2/META-INF/MANIFEST.MF b/fedoraproject-p2/org.fedoraproject.p2/META-INF/MANIFEST.MF +index 4319079..2967c22 100644 +--- a/fedoraproject-p2/org.fedoraproject.p2/META-INF/MANIFEST.MF ++++ b/fedoraproject-p2/org.fedoraproject.p2/META-INF/MANIFEST.MF +@@ -4,7 +4,7 @@ Bundle-Name: Fedora Project P2 Repository + Bundle-SymbolicName: org.fedoraproject.p2;singleton:=true + Bundle-Version: 0.0.1.qualifier + Bundle-Vendor: Fedora +-Bundle-RequiredExecutionEnvironment: JavaSE-1.8 ++Bundle-RequiredExecutionEnvironment: JavaSE-1.7 + Require-Bundle: org.eclipse.core.runtime, + org.eclipse.equinox.p2.metadata, + org.eclipse.equinox.p2.repository, +diff --git a/fedoraproject-p2/org.fedoraproject.p2/src/org/fedoraproject/p2/installer/impl/DefaultEclipseInstaller.java b/fedoraproject-p2/org.fedoraproject.p2/src/org/fedoraproject/p2/installer/impl/DefaultEclipseInstaller.java +index 35c6657..77da1f5 100644 +--- a/fedoraproject-p2/org.fedoraproject.p2/src/org/fedoraproject/p2/installer/impl/DefaultEclipseInstaller.java ++++ b/fedoraproject-p2/org.fedoraproject.p2/src/org/fedoraproject/p2/installer/impl/DefaultEclipseInstaller.java +@@ -26,11 +26,11 @@ import java.util.List; + import java.util.Map; + import java.util.Map.Entry; + import java.util.Set; +-import java.util.stream.Collectors; + + import org.eclipse.equinox.p2.metadata.IArtifactKey; + import org.eclipse.equinox.p2.metadata.IInstallableUnit; + import org.eclipse.equinox.p2.metadata.IInstallableUnitFragment; ++import org.eclipse.equinox.p2.metadata.IProvidedCapability; + import org.eclipse.equinox.p2.metadata.IRequirement; + import org.eclipse.equinox.p2.query.IQuery; + import org.eclipse.equinox.p2.query.QueryUtil; +@@ -89,13 +89,27 @@ public class DefaultEclipseInstaller implements EclipseInstaller { + Director.publish(reactorRepo, plugins, features); + reactor = reactorRepo.getAllUnits(); + // Remove all host localization fragments +- reactor.removeAll(reactor.stream() +- .filter(u -> u.getId().endsWith("translated_host_properties")) +- .collect(Collectors.toSet())); +- Set reactorPaths = reactor.stream().map(u -> P2Utils.getPath(u)).collect(Collectors.toSet()); +- request.getArtifacts().stream().filter(a -> !reactorPaths.contains(a.getPath())) +- .forEach(a -> logger.error("Not a valid {}: {}", a.isFeature() ? "feature" : "plugin", a.getPath())); +- if (reactor.stream().collect(Collectors.summingInt(u -> u.getArtifacts().size())) ++ Set hostLocalizationFragments = new LinkedHashSet<>(); ++ for (IInstallableUnit u : reactor) { ++ if (u.getId().endsWith("translated_host_properties")) { ++ hostLocalizationFragments.add(u); ++ } ++ } ++ reactor.removeAll(hostLocalizationFragments); ++ Set reactorPaths = new LinkedHashSet<>(); ++ for (IInstallableUnit u : reactor) { ++ reactorPaths.add(P2Utils.getPath(u)); ++ } ++ for (EclipseArtifact a : request.getArtifacts()) { ++ if (!reactorPaths.contains(a.getPath())) { ++ logger.error("Not a valid {}: {}", a.isFeature() ? "feature" : "plugin", a.getPath()); ++ } ++ } ++ int numOfArtifacts = 0; ++ for (IInstallableUnit u : reactor) { ++ numOfArtifacts += u.getArtifacts().size(); ++ } ++ if (numOfArtifacts + != plugins.size() + features.size()) { + throw new RuntimeException("Reactor contains invalid plugin or feature"); + } +@@ -106,7 +120,10 @@ public class DefaultEclipseInstaller implements EclipseInstaller { + List sclConfs = request.getConfigFiles(); + if (sclConfs.isEmpty()) + sclConfs = EclipseSystemLayout.getSclConfFiles(); +- List scls = sclConfs.stream().map(c -> new SCL(c)).collect(Collectors.toList()); ++ List scls = new LinkedList<>(); ++ for (Path c : sclConfs) { ++ scls.add(new SCL(c)); ++ } + index = new CompoundBundleRepository(scls); + + SCL currentScl = scls.iterator().next(); +@@ -223,14 +240,23 @@ public class DefaultEclipseInstaller implements EclipseInstaller { + .get(unit); + requires.removeAll(content); + // Remove all fragments from requires generation +- requires.removeAll(requires.stream().filter( +- r -> r.getProvidedCapabilities().stream().anyMatch( +- p -> p.getNamespace().equals("osgi.fragment"))) +- .collect(Collectors.toSet())); ++ Set fragments = new LinkedHashSet<>(); ++ for (IInstallableUnit u : requires) { ++ for (IProvidedCapability p : u.getProvidedCapabilities()) { ++ if (p.getNamespace().equals("osgi.fragment")) { ++ fragments.add(u); ++ break; ++ } ++ } ++ } ++ requires.removeAll(fragments); + if (!requires.isEmpty()) { +- provide.setProperty("osgi.requires", requires +- .stream().map(u -> P2Utils.toString(u)) +- .collect(Collectors.joining(","))); ++ StringBuffer osgiRequiresString = new StringBuffer(); ++ for (IInstallableUnit u : requires) { ++ osgiRequiresString.append(","); ++ osgiRequiresString.append(P2Utils.toString(u)); ++ } ++ provide.setProperty("osgi.requires", osgiRequiresString.substring(1)); + } + } + } +diff --git a/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml b/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml +index 2974dda..3ca2d3c 100644 +--- a/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml ++++ b/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml +@@ -85,8 +85,8 @@ + + maven-compiler-plugin + +- 1.8 +- 1.8 ++ 1.7 ++ 1.7 + + + +-- +2.1.0 + diff --git a/SOURCES/tycho-maven-delegation.patch b/SOURCES/tycho-maven-delegation.patch new file mode 100644 index 0000000..e706456 --- /dev/null +++ b/SOURCES/tycho-maven-delegation.patch @@ -0,0 +1,687 @@ +From 824f4a6c2db4f229e43de0c217d00a0c2c5b723d Mon Sep 17 00:00:00 2001 +From: Roland Grunberg +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 + Bundle-RequiredExecutionEnvironment: JavaSE-1.7 + Require-Bundle: org.junit;bundle-version="4.8.2" + Bundle-Vendor: %providerName ++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 { + +- 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) { +@@ -252,7 +257,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 + diff --git a/SOURCES/tycho-port-to-jetty-9.3.0.patch b/SOURCES/tycho-port-to-jetty-9.3.0.patch new file mode 100644 index 0000000..328d51b --- /dev/null +++ b/SOURCES/tycho-port-to-jetty-9.3.0.patch @@ -0,0 +1,29 @@ +--- tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/AbstractMonitorServlet.java~ 2015-03-29 16:42:21.976690003 +0200 ++++ tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/AbstractMonitorServlet.java 2015-03-29 16:48:04.996306637 +0200 +@@ -21,8 +21,6 @@ + import javax.servlet.http.HttpServletRequest; + import javax.servlet.http.HttpServletResponse; + +-import org.eclipse.jetty.server.Request; +- + public abstract class AbstractMonitorServlet extends GenericServlet { + + private static final long serialVersionUID = -7271350776954812609L; +@@ -42,7 +40,7 @@ + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse res = (HttpServletResponse) response; + +- String uri = ((Request) req).getUri().toString(); ++ String uri = req.getRequestURI(); + if (!uri.endsWith(".sha1") && !uri.endsWith(".md5")) { + accessedUrls.add(uri); + } +@@ -51,7 +49,7 @@ + } + + protected void addUri(HttpServletRequest req) { +- String uri = ((Request) req).getUri().toString(); ++ String uri = req.getRequestURI(); + if (!accessedUrls.contains(uri)) { + accessedUrls.add(uri); + } diff --git a/SOURCES/tycho-port-to-maven-3.0.5.patch b/SOURCES/tycho-port-to-maven-3.0.5.patch new file mode 100644 index 0000000..6bc57e0 --- /dev/null +++ b/SOURCES/tycho-port-to-maven-3.0.5.patch @@ -0,0 +1,284 @@ +From 6288e6893d924202cd6e777da2c6e607d4f76c93 Mon Sep 17 00:00:00 2001 +From: Roland Grunberg +Date: Fri, 19 Dec 2014 14:58:53 -0500 +Subject: [PATCH] Port to Maven 3.0.5 + +Porting to Maven 3.0.5 also means migrating to some other libraries +and technologies which are used by Maven: + + Eclipse Sisu Inject -> Sonatype Sisu Plexus + JSR-330 -> Plexus Component Annotations +--- + xmvn-p2-installer-plugin/pom.xml | 27 +++++++++++++++---- + .../org/fedoraproject/p2/app/P2InstallerApp.java | 30 ++++++---------------- + .../p2/osgi/impl/DefaultOSGiConfigurator.java | 16 ++++-------- + .../p2/osgi/impl/DefaultOSGiFramework.java | 16 ++++-------- + .../p2/osgi/impl/DefaultOSGiServiceLocator.java | 16 ++++-------- + .../p2/xmvn/EclipseArtifactInstaller.java | 11 +++----- + 6 files changed, 49 insertions(+), 67 deletions(-) + +diff --git a/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml b/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml +index c6aa3b7..2974dda 100644 +--- a/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml ++++ b/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml +@@ -45,13 +45,12 @@ + ${project.version} + + +- javax.inject +- javax.inject +- provided ++ org.codehaus.plexus ++ plexus-component-annotations + + +- org.eclipse.sisu +- org.eclipse.sisu.inject ++ org.sonatype.sisu ++ sisu-inject-plexus + + + org.sonatype.sisu +@@ -69,6 +68,10 @@ + + + org.slf4j ++ slf4j-api ++ ++ ++ org.slf4j + slf4j-simple + + +@@ -88,5 +91,19 @@ + + + ++ ++ ++ org.codehaus.plexus ++ plexus-component-metadata ++ ++ ++ ++ generate-metadata ++ generate-test-metadata ++ ++ ++ ++ ++ + + +diff --git a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/app/P2InstallerApp.java b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/app/P2InstallerApp.java +index 3d543c6..7901a1a 100644 +--- a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/app/P2InstallerApp.java ++++ b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/app/P2InstallerApp.java +@@ -13,16 +13,10 @@ package org.fedoraproject.p2.app; + import java.nio.file.Paths; + import java.util.Set; + +-import javax.inject.Inject; +-import com.google.inject.Injector; +-import org.eclipse.sisu.space.ClassSpace; +-import com.google.inject.Module; +-import javax.inject.Singleton; +-import javax.inject.Named; +-import com.google.inject.Guice; +-import org.eclipse.sisu.space.SpaceModule; +-import org.eclipse.sisu.space.URLClassSpace; +-import org.eclipse.sisu.wire.WireModule; ++import org.codehaus.plexus.DefaultPlexusContainer; ++import org.codehaus.plexus.PlexusContainer; ++import org.codehaus.plexus.component.annotations.Component; ++import org.codehaus.plexus.component.annotations.Requirement; + + import org.fedoraproject.p2.installer.Dropin; + import org.fedoraproject.p2.installer.EclipseArtifact; +@@ -34,17 +28,12 @@ import org.fedoraproject.p2.osgi.OSGiServiceLocator; + /** + * @author Mikolaj Izdebski + */ +-@Named +-@Singleton ++@Component( role = P2InstallerApp.class ) + public class P2InstallerApp { + ++ @Requirement + private OSGiServiceLocator serviceLocator; + +- @Inject +- public P2InstallerApp(OSGiServiceLocator serviceLocator) { +- this.serviceLocator = serviceLocator; +- } +- + public int run(CliRequest cliRequest) throws Exception { + if (cliRequest.getParameters().isEmpty()) { + System.err.println("No artifacts specified for installation." +@@ -93,11 +82,8 @@ public class P2InstallerApp { + try { + CliRequest cliRequest = new CliRequest(args); + +- ClassLoader realm = Thread.currentThread().getContextClassLoader(); +- ClassSpace classSpace = new URLClassSpace(realm); +- Module module = new WireModule(new SpaceModule(classSpace)); +- Injector injector = Guice.createInjector(module); +- P2InstallerApp app = injector.getInstance(P2InstallerApp.class); ++ PlexusContainer container = new DefaultPlexusContainer(); ++ P2InstallerApp app = container.lookup( P2InstallerApp.class ); + + System.exit(app.run(cliRequest)); + } catch (Throwable e) { +diff --git a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiConfigurator.java b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiConfigurator.java +index 8acb598..a642a65 100644 +--- a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiConfigurator.java ++++ b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiConfigurator.java +@@ -21,9 +21,8 @@ import java.util.Collections; + import java.util.zip.ZipEntry; + import java.util.zip.ZipInputStream; + +-import javax.inject.Inject; +-import javax.inject.Named; +-import javax.inject.Singleton; ++import org.codehaus.plexus.component.annotations.Component; ++import org.codehaus.plexus.component.annotations.Requirement; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; + +@@ -37,8 +36,7 @@ import org.fedoraproject.p2.osgi.OSGiConfigurator; + * instead loads bundles contained withing the "tycho-bundles-external" + * bootstrap zip-ball. + */ +-@Named +-@Singleton ++@Component( role = OSGiConfigurator.class ) + public class DefaultOSGiConfigurator implements OSGiConfigurator { + private final Logger logger = LoggerFactory + .getLogger(DefaultOSGiConfigurator.class); +@@ -47,12 +45,8 @@ public class DefaultOSGiConfigurator implements OSGiConfigurator { + private static final Artifact BUNDLES_EXTERNAL_ZIP = new DefaultArtifact( + "org.eclipse.tycho", "tycho-bundles-external", "zip", "SYSTEM"); + +- private final Resolver resolver; +- +- @Inject +- public DefaultOSGiConfigurator(Resolver resolver) { +- this.resolver = resolver; +- } ++ @Requirement ++ private Resolver resolver; + + @Override + public Collection getBundles() { +diff --git a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiFramework.java b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiFramework.java +index 56b1875..ccc995a 100644 +--- a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiFramework.java ++++ b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiFramework.java +@@ -14,9 +14,8 @@ import java.util.LinkedHashMap; + import java.util.Map; + + import com.google.common.base.Joiner; +-import javax.inject.Inject; +-import javax.inject.Named; +-import javax.inject.Singleton; ++import org.codehaus.plexus.component.annotations.Component; ++import org.codehaus.plexus.component.annotations.Requirement; + import org.eclipse.core.runtime.adaptor.EclipseStarter; + import org.osgi.framework.Bundle; + import org.osgi.framework.BundleContext; +@@ -30,21 +29,16 @@ import org.fedoraproject.p2.osgi.OSGiFramework; + /** + * @author Mikolaj Izdebski + */ +-@Named +-@Singleton ++@Component( role = OSGiFramework.class ) + public class DefaultOSGiFramework implements OSGiFramework { + private final Logger logger = LoggerFactory + .getLogger(DefaultOSGiFramework.class); + +- private final OSGiConfigurator equinoxLocator; ++ @Requirement ++ private OSGiConfigurator equinoxLocator; + + private BundleContext bundleContext; + +- @Inject +- public DefaultOSGiFramework(OSGiConfigurator equinoxLocator) { +- this.equinoxLocator = equinoxLocator; +- } +- + private BundleContext launchEquinox() throws Exception { + Map properties = new LinkedHashMap<>(); + +diff --git a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiServiceLocator.java b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiServiceLocator.java +index 3274381..9fcbf49 100644 +--- a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiServiceLocator.java ++++ b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/osgi/impl/DefaultOSGiServiceLocator.java +@@ -10,9 +10,8 @@ + *******************************************************************************/ + package org.fedoraproject.p2.osgi.impl; + +-import javax.inject.Inject; +-import javax.inject.Named; +-import javax.inject.Singleton; ++import org.codehaus.plexus.component.annotations.Component; ++import org.codehaus.plexus.component.annotations.Requirement; + import org.osgi.framework.BundleContext; + import org.osgi.framework.ServiceReference; + +@@ -22,15 +21,10 @@ import org.fedoraproject.p2.osgi.OSGiServiceLocator; + /** + * @author Mikolaj Izdebski + */ +-@Named +-@Singleton ++@Component( role = OSGiServiceLocator.class ) + public class DefaultOSGiServiceLocator implements OSGiServiceLocator { +- private final OSGiFramework framework; +- +- @Inject +- public DefaultOSGiServiceLocator(OSGiFramework framework) { +- this.framework = framework; +- } ++ @Requirement ++ private OSGiFramework framework; + + @Override + public T getService(Class clazz) { +diff --git a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/xmvn/EclipseArtifactInstaller.java b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/xmvn/EclipseArtifactInstaller.java +index 7ee8f66..3a6dd99 100644 +--- a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/xmvn/EclipseArtifactInstaller.java ++++ b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/p2/xmvn/EclipseArtifactInstaller.java +@@ -17,10 +17,8 @@ import java.nio.file.Paths; + import java.util.LinkedHashMap; + import java.util.Map; + +-import javax.inject.Inject; +-import javax.inject.Named; +-import javax.inject.Singleton; +- ++import org.codehaus.plexus.component.annotations.Component; ++import org.codehaus.plexus.component.annotations.Requirement; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; + import org.fedoraproject.xmvn.artifact.Artifact; +@@ -42,13 +40,12 @@ import org.fedoraproject.p2.installer.EclipseInstallationResult; + import org.fedoraproject.p2.installer.EclipseInstaller; + import org.fedoraproject.p2.osgi.OSGiServiceLocator; + +-@Named("eclipse") +-@Singleton ++@Component( role = ArtifactInstaller.class, hint = "eclipse" ) + public class EclipseArtifactInstaller implements ArtifactInstaller { + private final Logger logger = LoggerFactory + .getLogger(EclipseArtifactInstaller.class); + +- @Inject ++ @Requirement + private OSGiServiceLocator equinox; + + private final EclipseInstallationRequest request = new EclipseInstallationRequest(); +-- +2.1.0 + diff --git a/SOURCES/tycho-port-to-xmvn-2.1.0.patch b/SOURCES/tycho-port-to-xmvn-2.1.0.patch new file mode 100644 index 0000000..f6abf39 --- /dev/null +++ b/SOURCES/tycho-port-to-xmvn-2.1.0.patch @@ -0,0 +1,145 @@ +From f35b198f727a7b4d8e57ed52b6aa77b24a3af274 Mon Sep 17 00:00:00 2001 +From: Mat Booth +Date: Thu, 23 Apr 2015 10:27:12 +0100 +Subject: [PATCH] Keep compatibility with xmvn 2.1.0 + +Add copies of functions from xmvn 2.4.0 that we need to maintain +compatibility with xmvn 2.1.0 + +This branch should be used only when xmvn >= 2.4.0 is not available. + +Signed-off-by: Mat Booth +--- + pom.xml | 2 +- + .../fedoraproject/xmvn/tools/install/JarUtils.java | 143 +++++++++++++++++++++ + 2 files changed, 144 insertions(+), 1 deletion(-) + create mode 100644 xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java + +diff --git a/fedoraproject-p2/pom.xml b/fedoraproject-p2/pom.xml +index 9febe26..91910e4 100644 +--- a/fedoraproject-p2/pom.xml ++++ b/fedoraproject-p2/pom.xml +@@ -24,7 +24,7 @@ + + + 0.23.0 +- 2.4.0 ++ 2.1.0 + 3.10.100.v20150521-1310 + + +diff --git a/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java +new file mode 100644 +index 0000000..ccba2b0 +--- /dev/null ++++ b/fedoraproject-p2/xmvn-p2-installer-plugin/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java +@@ -0,0 +1,106 @@ ++/*- ++ * Copyright (c) 2012-2015 Red Hat, Inc. ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++package org.fedoraproject.xmvn.tools.install; ++ ++import java.io.IOException; ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.util.zip.ZipEntry; ++import java.util.zip.ZipInputStream; ++ ++import org.slf4j.Logger; ++import org.slf4j.LoggerFactory; ++ ++/** ++ * @author Mikolaj Izdebski ++ */ ++public class JarUtils ++{ ++ private static final Logger logger = LoggerFactory.getLogger( JarUtils.class ); ++ ++ /** ++ * Heuristically try to determine whether given JAR (or WAR, EAR, ...) file contains native (architecture-dependent) ++ * code. ++ *

++ * Currently this code only checks only for ELF binaries, but that behavior can change in future. ++ * ++ * @return {@code true} if native code was found inside given JAR ++ */ ++ public static boolean containsNativeCode( Path jar ) ++ { ++ // From /usr/include/linux/elf.h ++ final int ELFMAG0 = 0x7F; ++ final int ELFMAG1 = 'E'; ++ final int ELFMAG2 = 'L'; ++ final int ELFMAG3 = 'F'; ++ ++ try (ZipInputStream jis = new ZipInputStream( Files.newInputStream( jar ) )) ++ { ++ ZipEntry ent; ++ while ( ( ent = jis.getNextEntry() ) != null ) ++ { ++ if ( ent.isDirectory() ) ++ continue; ++ if ( jis.read() == ELFMAG0 && jis.read() == ELFMAG1 && jis.read() == ELFMAG2 && jis.read() == ELFMAG3 ) ++ { ++ logger.debug( "Native code found inside {}: {}", jar, ent.getName() ); ++ return true; ++ } ++ } ++ ++ logger.trace( "Native code not found inside {}", jar ); ++ return false; ++ } ++ catch ( IOException e ) ++ { ++ logger.debug( "I/O exception caught when trying to determine whether JAR contains native code: {}", jar, e ); ++ return false; ++ } ++ } ++ ++ static class NativeMethodFound ++ extends RuntimeException ++ { ++ private static final long serialVersionUID = 1; ++ ++ final String className; ++ ++ final String methodName; ++ ++ final String methodSignature; ++ ++ NativeMethodFound( String className, String methodName, String methodSignature ) ++ { ++ this.className = className; ++ this.methodName = methodName; ++ this.methodSignature = methodSignature; ++ } ++ } ++ ++ /** ++ * Heuristically try to determine whether given JAR (or WAR, EAR, ...) file is using native (architecture-dependent) ++ * code. ++ *

++ * Currently this code only checks if any class file declares Java native methods, but that behavior can change in ++ * future. ++ * ++ * @return {@code true} given JAR as found inside to use native code ++ */ ++ public static boolean usesNativeCode( Path jar ) ++ { ++ return false; ++ } ++} +-- +2.1.0 + diff --git a/SOURCES/tycho-scripts.sh b/SOURCES/tycho-scripts.sh new file mode 100755 index 0000000..a3ca52c --- /dev/null +++ b/SOURCES/tycho-scripts.sh @@ -0,0 +1,184 @@ +#! /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>/ d' | grep "" | sed 's/.*\(.*\)<\/artifactId>.*/\1/'` +version=`cat "${basedir}/pom.xml" | grep "" | sed 's/.*\(.*\)<\/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 () { + +# scls='scl1 scl2 scl3' +scls='maven30 rh-java-common devtoolset-4' +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 + +if [ ${eclipse_bootstrap} -eq 1 ]; then +prefix="$(pwd)/bootstrap" +osgiLocations=( ${osgiLocations[@]/#/${prefix}} ) +osgiLocations+=( ${osgiLocations[@]/${prefix}/} ) +osgiLocations=( ${prefix}/extras ${osgiLocations[@]} ) +fi + +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. +# scls='scl1 scl2 scl3' +scls='devtoolset-4 rh-java-common' +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 () { +sed -i "/org.eclipse.osgi<\/artifactId>/ a ${osgiV}" "$1/pom.xml" +sed -i "/org.eclipse.osgi.compatibility.state<\/artifactId>/ a ${osgiV}" "$1/pom.xml" + +cp $1/pom.xml $1/pom.xml.bak + +sed -i '//,/<\/parent>/ d' "$1/pom.xml" +if [ $# -eq 2 ]; then + sed -i "// a org.eclipse.tycho<\/groupId>$2<\/version>" "$1/pom.xml" +else + sed -i "// a org.eclipse.tycho<\/groupId>${v}<\/version>" "$1/pom.xml" +fi + +} + +function unifyProject () { + +cp $1/pom.xml.bak $1/pom.xml +sed -i "/${osgiV}<\/version>/ d" "$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} + +} diff --git a/SOURCES/tycho-use-custom-resolver.patch b/SOURCES/tycho-use-custom-resolver.patch new file mode 100644 index 0000000..c6b1d03 --- /dev/null +++ b/SOURCES/tycho-use-custom-resolver.patch @@ -0,0 +1,676 @@ +From 33e4d975ad449411522cf13e01c92992c8516dc6 Mon Sep 17 00:00:00 2001 +From: Roland Grunberg +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. + +Support extraction of symlinks with plexus-archiver < 2.4.4-4. + +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 +@@ -230,7 +230,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); ++ } + } + } + } +@@ -238,7 +245,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,12 +12,19 @@ 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.Activator; + 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; + +@@ -48,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, 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; +@@ -218,15 +219,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); + } + +@@ -259,8 +251,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; +@@ -272,9 +275,43 @@ public class TargetPlatformFactoryImpl implements TargetPlatformFactory { + metadataRepositories.add(localMetadataRepository); + } + +- for (IMetadataRepository repository : metadataRepositories) { +- IQueryResult 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 fedoraRepos = new HashSet (); ++ ++ // 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 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 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 matches = repository.query(QueryUtil.ALL_UNITS, monitor); ++ result.addAll(matches.toUnmodifiableSet()); ++ } + } + + result.addAll(pomDependenciesContent.gatherMavenInstallableUnits()); +@@ -322,7 +359,7 @@ public class TargetPlatformFactoryImpl implements TargetPlatformFactory { + List 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 +@@ -77,6 +77,8 @@ + + + ++ ++ + + + +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; +@@ -91,15 +94,35 @@ public abstract class AbstractTychoProject extends AbstractLogEnabled implements + + String configuredForcedProfile = tpConfiguration.getExecutionEnvironment(); + if (configuredForcedProfile != null) { ++ configuredForcedProfile = overrideToAtLeastJavaSE16(configuredForcedProfile); + sink.overrideProfileConfiguration(configuredForcedProfile, + "target-platform-configuration "); + } + + String configuredDefaultProfile = tpConfiguration.getExecutionEnvironmentDefault(); + if (configuredDefaultProfile != null) { ++ configuredDefaultProfile = overrideToAtLeastJavaSE16(configuredDefaultProfile); + sink.setProfileConfiguration(configuredDefaultProfile, + "target-platform-configuration "); + } + } + ++ 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 +@@ -492,6 +492,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 { +@@ -502,13 +503,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 4a750f7..a608f1b 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,9 +12,12 @@ package org.eclipse.tycho.osgi.runtime; + + import java.io.File; + import java.io.IOException; ++import java.nio.file.Files; ++import java.nio.file.Paths; + import java.util.ArrayList; + import java.util.List; + import java.util.Map; ++import java.util.jar.JarFile; + + import org.apache.maven.MavenExecutionException; + import org.apache.maven.artifact.Artifact; +@@ -163,36 +166,71 @@ 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); ++ } ++ // Check extracted files are symlinks ++ File pluginDir = new File(fedoraDir, "plugins"); ++ try { ++ List plugins = FileUtils.getFiles(pluginDir, "*.jar", ""); ++ for (File plugin : plugins) { ++ boolean symlink = Files.isSymbolicLink(plugin.toPath()); ++ boolean isJar; ++ try { ++ isJar = (new JarFile(plugin).getJarEntry("META-INF/MANIFEST.MF") != null); ++ } catch (IOException e) { ++ isJar = false; ++ } ++ if (!symlink && !isJar) { ++ String target = FileUtils.fileRead(plugin); ++ logger.warn("Replacing " + plugin.getName() + " with symlink to: " + target); ++ Files.delete(plugin.toPath()); ++ Files.createSymbolicLink(plugin.toPath(), Paths.get(target)); ++ } ++ } ++ } catch (IOException e) { ++ logger.warn("Failed to do symlink detection of Tycho's OSGi runtime: " + e.getMessage()); + } + +- 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 @@ + junit + test + ++ ++ org.fedoraproject.p2 ++ org.fedoraproject.p2 ++ 0.0.1-SNAPSHOT ++ + + + +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 +@@ -86,6 +86,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 { +@@ -206,6 +207,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 diff --git a/SPECS/tycho.spec b/SPECS/tycho.spec new file mode 100644 index 0000000..4dce62b --- /dev/null +++ b/SPECS/tycho.spec @@ -0,0 +1,457 @@ +%global pkg_name tycho +%{?scl:%scl_package %{pkg_name}} +# Bootstrap build +# Tycho depends on itself, and Eclipse to build but in certain cases +# these requirements may not be satisfiable. + +# Set 'tycho_bootstrap' if Tycho from buildroot is broken or non-existent +# This basically uses javac + xmvn to build only the Tycho components +# required to perform a full Tycho build +# Most common usage : A library (in Fedora) used by Tycho's runtime broke API +%global tycho_bootstrap 0 +# Set 'eclipse_bootstrap' if Eclipse from buildroot cannot help build Tycho +# This basically provides a location for usage of pre-bundled Eclipse +# Possible uses : Need to build Tycho before Eclipse in fresh buildroot +%global eclipse_bootstrap 0 +# When building version under development (non-release) +# %%global snap -SNAPSHOT +%global snap %{nil} + +%global git_tag tycho-0.23.0 + +%global fp_p2_sha 09403d +%global fp_p2_version 0.0.1 +%global fp_p2_snap -SNAPSHOT + +%define __requires_exclude osgi* +%{?java_common_find_provides_and_requires} + +Name: %{?scl_prefix}tycho +Version: 0.23.0 +Release: 8.2%{?dist} +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: ASL 2.0 and EPL +URL: http://eclipse.org/tycho +Source0: http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/snapshot/org.eclipse.tycho-%{git_tag}.tar.xz + +# 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 +Source1: EmptyMojo.java +Source2: %{pkg_name}-scripts.sh +Source3: %{pkg_name}-bootstrap.sh +Source4: %{pkg_name}-debundle.sh +# Fedora Eclipse bundles (needed when Eclipse not present) to build Tycho +%if %{eclipse_bootstrap} +Source5: eclipse-bootstrap.tar.xz +%endif +# Eclipse Plugin Project supporting filesystem as p2 repository +# https://github.com/rgrunber/fedoraproject-p2 +# Generated using 'git archive --prefix=fedoraproject-p2/ -o fedoraproject-p2-%%{fp_p2_sha}.tar %%{fp_p2_sha} && xz fedoraproject-p2-%%{fp_p2_sha}.tar' +Source6: fedoraproject-p2-%{fp_p2_sha}.tar.xz +# Script that can be used to install or simulate installation of P2 +# artifacts. It is used in OSGi requires generation. +Source7: p2-install.sh + +Patch0: %{pkg_name}-fix-build.patch +Patch1: %{pkg_name}-port-to-maven-3.0.5.patch +Patch2: %{pkg_name}-fix-surefire.patch +Patch3: %{pkg_name}-use-custom-resolver.patch +Patch4: %{pkg_name}-maven-delegation.patch +# Additional changes needed just for bootstrap build +Patch5: %{pkg_name}-fix-bootstrap-build.patch +Patch6: %{pkg_name}-port-to-jetty-9.3.0.patch +Patch7: %{pkg_name}-java-7-compatibility.patch +Patch8: %{pkg_name}-port-to-xmvn-2.1.0.patch + +BuildArch: noarch + +#BuildRequires: java-devel >= 1:1.8 +BuildRequires: %{?scl_prefix_java_common}maven-local >= 4.2.0 +BuildRequires: %{?scl_prefix_maven}maven-clean-plugin +BuildRequires: %{?scl_prefix_maven}maven-dependency-plugin +BuildRequires: %{?scl_prefix_maven}maven-install-plugin +BuildRequires: %{?scl_prefix_maven}maven-release-plugin +BuildRequires: %{?scl_prefix_maven}maven-verifier +BuildRequires: %{?scl_prefix_java_common}objectweb-asm5 +BuildRequires: %{?scl_prefix_maven}plexus-containers-component-metadata +BuildRequires: %{?scl_prefix_maven}apache-commons-exec +BuildRequires: %{?scl_prefix_java_common}bcel +BuildRequires: %{?scl_prefix}decentxml +BuildRequires: %{?scl_prefix_java_common}easymock3 +BuildRequires: %{?scl_prefix_java_common}ecj >= 4.4.2 +BuildRequires: %{?scl_prefix_maven}maven-plugin-testing-harness +BuildRequires: %{?scl_prefix_maven}xmvn-parent-pom +%if %{tycho_bootstrap} +BuildRequires: %{?scl_prefix_maven}maven-deploy-plugin +BuildRequires: %{?scl_prefix_maven}maven-site-plugin +%else +BuildRequires: %{name} +%endif +%if %{eclipse_bootstrap} +# Dependencies for Eclipse bundles we use +BuildRequires: %{?scl_prefix}eclipse-filesystem +BuildRequires: %{?scl_prefix_java_common}apache-commons-jxpath +BuildRequires: %{?scl_prefix_java_common}geronimo-annotation +BuildRequires: %{?scl_prefix_java_common}glassfish-jsp-api +BuildRequires: %{?scl_prefix}icu4j +BuildRequires: %{?scl_prefix_maven}sac +BuildRequires: %{?scl_prefix}sat4j +BuildRequires: %{?scl_prefix_java_common}xz-java +%else +BuildRequires: %{?scl_prefix}eclipse-platform +%endif +BuildRequires: %{?scl_prefix_java_common}jetty-http +BuildRequires: %{?scl_prefix_java_common}jetty-util +BuildRequires: %{?scl_prefix_java_common}jetty-security +BuildRequires: %{?scl_prefix_java_common}jetty-server +BuildRequires: %{?scl_prefix_java_common}jetty-servlet +BuildRequires: %{?scl_prefix_maven}maven-shared-utils +BuildRequires: %{?scl_prefix}mockito +BuildRequires: zip + +Requires: %{?scl_prefix_maven}apache-commons-exec +Requires: %{?scl_prefix}decentxml +Requires: %{?scl_prefix_java_common}maven-local >= 4.2.0 +Requires: %{?scl_prefix_maven}maven-dependency-plugin +Requires: %{?scl_prefix_maven}maven-verifier +Requires: %{?scl_prefix_java_common}objectweb-asm5 +Requires: %{?scl_prefix_java_common}ecj >= 4.4.2 +%if ! %{eclipse_bootstrap} +Requires: %{?scl_prefix}eclipse-platform +%endif + +# Tycho always tries to resolve all build plugins, even if they are +# not needed during Maven lifecycle. This means that Tycho will try +# to resolve plugins like clean, deploy or site, which aren't normally +# used during package build. See rhbz#971301 +Requires: %{?scl_prefix_maven}maven-clean-plugin +Requires: %{?scl_prefix_maven}maven-deploy-plugin +Requires: %{?scl_prefix_maven}maven-install-plugin +Requires: %{?scl_prefix_maven}maven-site-plugin + +%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 %{pkg_name} + +%description javadoc +This package contains the API documentation for %{pkg_name}. + +%prep +%setup -q -n org.eclipse.tycho-%{git_tag} + +# Prepare fedoraproject-p2 +tar -xf %{SOURCE6} + +%{?scl:scl enable %{scl_maven} %{scl} - << "EOF"} +%pom_disable_module org.fedoraproject.p2.tests fedoraproject-p2 + +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch6 -p0 +%patch7 -p1 +%patch8 -p1 + +find tycho-core -iname '*html' -delete + +sed -i -e 's/org.apache.maven.it.util.DirectoryScanner/org.apache.maven.shared.utils.io.DirectoryScanner/g' tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.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 %{SOURCE1} . +popd + +# These units cannot be found during a regular build +sed -i '/^ org.ow2.asm:asm-all +%pom_xpath_set "pom:dependency[pom:artifactId='asm-debug-all']/pom:artifactId" "asm-all" tycho-artifactcomparator + +# 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 + +# Bootstrap Build +%if %{eclipse_bootstrap} +tar -xf %{SOURCE5} +%endif + +%if %{tycho_bootstrap} + +%patch5 -p1 + +# Perform the 'minimal' (bootstrap) build of Tycho +cp %{SOURCE2} %{SOURCE3} . +./%{pkg_name}-bootstrap.sh %{eclipse_bootstrap} + +%patch5 -p1 -R + +# 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. + +medadataFile=%{_datadir}/maven-metadata/tycho.xml +sysVer=`grep -C 1 "tycho" %{_mavenpomdir}/JPP.tycho-main.pom | grep "version" | sed 's/.*>\(.*\)<.*/\1/'` +mkdir boot + +# Copy Tycho POMs from system repo and set their versions to %%{version}-SNAPSHOT. +for pom in $(grep 'pom' $medadataFile | sed 's|.*>\(.*\)<.*|\1|'); do + sed ' + s/$sysVer/%{version}-SNAPSHOT/g + 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 %{_javadir}/tycho/tycho-maven-plugin.jar 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 ' + s|>/[^<]*/\([^/]*\.pom\)|>'$PWD'/boot/\1| + s|>'$sysVer'|>%{version}-SNAPSHOT<\1:compatVersions><\1:version>%{version}-SNAPSHOT| + s|>'%{fp_p2_version}%{fp_p2_snap}'|>%{fp_p2_version}<\1:compatVersions><\1:version>%{fp_p2_version}| + s|%{_javadir}/tycho/tycho-maven-plugin.jar|'$PWD'/boot/tycho-maven-plugin.jar| +' $medadataFile >boot/tycho-metadata.xml +%mvn_config resolverSettings/metadataRepositories/repository $PWD/boot/tycho-metadata.xml + +%endif + +# Tests are skipped anyways, so remove some test dependencies +%pom_xpath_remove "pom:dependency[pom:classifier='tests']" tycho-compiler-plugin +%pom_xpath_remove "pom:dependency[pom:classifier='tests']" tycho-packaging-plugin + +%{?scl:EOF} + +%build +%{?scl:scl enable %{scl_maven} %{scl} - << "EOF"} +xmvn -o -Dtycho-version=%{version}-SNAPSHOT -Dmaven.test.skip=true \ +-Dmaven.repo.local=$(pwd)/.m2 -Dfedora.p2.repos=$(pwd)/bootstrap \ +-f fedoraproject-p2/pom.xml \ +clean install org.apache.maven.plugins:maven-javadoc-plugin:aggregate + +xmvn -o -DtychoBootstrapVersion=%{version}-SNAPSHOT -Dmaven.test.skip=true \ +-Dmaven.repo.local=$(pwd)/.m2 -Dfedora.p2.repos=$(pwd)/bootstrap \ +clean install org.apache.maven.plugins:maven-javadoc-plugin:aggregate +%{?scl:EOF} + +%install +%{?scl:scl enable %{scl_maven} %{scl} - << "EOF"} + +cp %{SOURCE2} %{SOURCE4} . + +install -dm 755 $RPM_BUILD_ROOT%{_javadir}/tycho +install -dm 755 $RPM_BUILD_ROOT%{_mavenpomdir} + +# fedoraproject-p2 parent +mod=fedoraproject-p2 +install -pm 644 $mod/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-$mod.pom +%add_maven_depmap JPP.%{pkg_name}-$mod.pom + +# fedoraproject-p2 +for mod in fedoraproject-p2/{org.fedoraproject.p2,xmvn-p2-installer-plugin}; do + echo $mod + aid=`basename $mod` + install -pm 644 $mod/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-$aid.pom + install -m 644 $mod/target/$aid-%{fp_p2_version}%{fp_p2_snap}.jar $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/$aid.jar + %add_maven_depmap JPP.%{pkg_name}-$aid.pom %{pkg_name}/$aid.jar -a "org.eclipse.tycho:$aid" +done + +# pom and jar installation +for mod in target-platform-configuration tycho-compiler-{jdt,plugin} \ + tycho-{artifactcomparator,core,embedder-api,metadata-model,testing-harness} \ + sisu-equinox/sisu-equinox{-api,-launching,-embedder} \ + tycho-p2/tycho-p2-{facade,plugin,{director,publisher,repository}-plugin} \ + tycho-{maven,packaging,pomgenerator,release/tycho-versions,source}-plugin \ + tycho-bundles/org* \ + tycho-surefire/{tycho-surefire-plugin,org.eclipse.tycho.surefire.{osgibooter,junit,junit4{,7}}}; do + echo $mod + aid=`basename $mod` + install -pm 644 $mod/pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-$aid.pom + install -m 644 $mod/target/$aid-%{version}%{snap}.jar $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/$aid.jar + %add_maven_depmap JPP.%{pkg_name}-$aid.pom %{pkg_name}/$aid.jar -a "org.eclipse.tycho:$aid" +done + +# pom installation +for pommod in tycho-p2 tycho-bundles tycho-surefire \ + tycho-release sisu-equinox; do + aid=`basename $pommod` + install -pm 644 $pommod/pom.xml \ + $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-$aid.pom + %add_maven_depmap JPP.%{pkg_name}-$aid.pom -a "org.eclipse.tycho:$aid" +done + +# p2 runtime +dir=.m2/org/eclipse/tycho/tycho-bundles-external/%{version}%{snap} +%if ! %{eclipse_bootstrap} +./%{pkg_name}-debundle.sh tycho-bundles/tycho-bundles-external/ $dir/tycho-bundles-external-%{version}*.zip $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/tycho-bundles-external-manifest.txt +%endif +install -pm 644 $dir/tycho-bundles-external-%{version}*.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-tycho-bundles-external.pom +install -m 644 $dir/tycho-bundles-external-%{version}*.zip $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/tycho-bundles-external.zip +%add_maven_depmap JPP.%{pkg_name}-tycho-bundles-external.pom %{pkg_name}/tycho-bundles-external.zip -a "org.eclipse.tycho:tycho-bundles-external" +%if ! %{eclipse_bootstrap} +%add_maven_depmap org.eclipse.tycho:tycho-bundles-external:txt:manifest:%{version}%{snap} %{pkg_name}/tycho-bundles-external-manifest.txt +%endif + +# main +install -pm 644 pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-main.pom +%add_maven_depmap JPP.%{pkg_name}-main.pom + +# standalone p2 director +%if ! %{eclipse_bootstrap} +./%{pkg_name}-debundle.sh tycho-bundles/tycho-standalone-p2-director/ .m2/org/eclipse/tycho/tycho-standalone-p2-director/%{version}%{snap}/tycho-standalone-p2-director-%{version}*.zip +%endif +pushd .m2/org/eclipse/tycho/tycho-standalone-p2-director/%{version}%{snap}/ +install -m 644 tycho-standalone-p2-director-%{version}*.zip $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}/tycho-standalone-p2-director.zip +install -pm 644 tycho-standalone-p2-director-%{version}*.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{pkg_name}-tycho-standalone-p2-director.pom +popd +%add_maven_depmap JPP.%{pkg_name}-tycho-standalone-p2-director.pom tycho/tycho-standalone-p2-director.zip -a "org.eclipse.tycho:tycho-standalone-p2-director" + +# javadoc +install -dm 755 $RPM_BUILD_ROOT%{_javadocdir}/tycho +cp -pr target/site/api*/* $RPM_BUILD_ROOT%{_javadocdir}/tycho + +# p2-install script +install -dm 755 $RPM_BUILD_ROOT%{_javadir}-utils/ +install -pm 755 %{SOURCE7} $RPM_BUILD_ROOT%{_javadir}-utils/ + +%if %{eclipse_bootstrap} +# org.eclipse.osgi +osgiJarPath=`find ".m2/org" -name "org.eclipse.osgi_*.jar"` + +# http://git.eclipse.org/c/linuxtools/org.eclipse.linuxtools.eclipse-build.git/tree/externalpoms/org.eclipse.osgi.pom +echo ' + + 4.0.0 + org.eclipse.osgi + org.eclipse.osgi + 3.10.100.v20150602-1500 +' > JPP.tycho-osgi.pom + +install -pm 644 JPP.tycho-osgi.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.tycho-osgi.pom +install -m 644 $osgiJarPath $RPM_BUILD_ROOT%{_javadir}/tycho/osgi.jar +%add_maven_depmap JPP.tycho-osgi.pom tycho/osgi.jar -a "org.eclipse.tycho:org.eclipse.osgi" + +# org.eclipse.osgi.compatibility.state +osgiStateJarPath=`find ".m2/org" -name "org.eclipse.osgi.compatibility.state_*.jar"` + +# http://git.eclipse.org/c/linuxtools/org.eclipse.linuxtools.eclipse-build.git/tree/externalpoms/org.eclipse.osgi.compatibility.state.pom +echo ' + + 4.0.0 + org.eclipse.osgi + org.eclipse.osgi.compatibility.state + 1.0.100.v20150602-1500 +' > JPP.tycho-osgi.compatibility.state.pom + +install -pm 644 JPP.tycho-osgi.compatibility.state.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.tycho-osgi.compatibility.state.pom +install -m 644 $osgiStateJarPath $RPM_BUILD_ROOT%{_javadir}/tycho/osgi.compatibility.state.jar +%add_maven_depmap JPP.tycho-osgi.compatibility.state.pom tycho/osgi.compatibility.state.jar -a "org.eclipse.tycho:org.eclipse.osgi.compatibility.state" +%endif + +# Symlink XMvn P2 plugin with all dependencies so that it can be loaded by XMvn +install -dm 755 %{buildroot}%{?_scl_prefix}%{?scl_maven:/%{scl_maven}/root}%{_root_datadir}/xmvn/lib/installer/ +%if %{eclipse_bootstrap} +ln -s %{_javadir}/tycho/osgi.jar %{buildroot}%{?_scl_prefix}%{?scl_maven:/%{scl_maven}/root}%{_root_datadir}/xmvn/lib/installer/ +%else +ln -s %{_javadir}/eclipse/osgi.jar %{buildroot}%{?_scl_prefix}%{?scl_maven:/%{scl_maven}/root}%{_root_datadir}/xmvn/lib/installer/ +%endif +ln -s %{_javadir}/tycho/xmvn-p2-installer-plugin.jar %{buildroot}%{?_scl_prefix}%{?scl_maven:/%{scl_maven}/root}%{_root_datadir}/xmvn/lib/installer/ +ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}%{?_scl_prefix}%{?scl_maven:/%{scl_maven}/root}%{_root_datadir}/xmvn/lib/installer/ +%{?scl:EOF} + +%files -f .mfiles +%dir %{_javadir}/tycho +%{?_scl_prefix}%{?scl_maven:/%{scl_maven}/root}%{_root_datadir}/xmvn/lib/installer/* +%{_javadir}-utils/p2-install.sh +%doc README.md + +%files javadoc +%{_javadocdir}/tycho + +%changelog +* Tue Aug 04 2015 Mat Booth - 0.23.0-8.2 +- Tighten up the dependency on ecj, rhbz#1249293 + +* Tue Jul 28 2015 Roland Grunberg - 0.23.0-8.1 +- fedoraproject-p2: Single IU resolving requirements with multiple matches. + +* Mon Jul 06 2015 Mat Booth - 0.23.0-5.4 +- Non-bootstrap build + +* Tue Jun 30 2015 Mat Booth - 0.23.0-5.3 +- fedoraproject-p2: Allow xmvn-p2-installer to work in bootstrap mode + +* Mon Jun 29 2015 Roland Grunberg - 0.23.0-5.2 +- Support extraction of symlinks with plexus-archiver < 2.4.4-4. +- Re-enable o.e.tycho.p2.{maven.repository,tools}.tests. +- Add BuildRequires on zip. + +* Sun Jun 28 2015 Roland Grunberg - 0.23.0-5.1 +- Additional fixes for SCL-iziation. +- Port to maven-surefire 2.15 +- Port to plexus-archiver 2.4 +- Disable usesNativeCode due to issue with objectweb-asm. +- Disable o.e.tycho.p2.{maven.repository,tools}.tests due to mockito. + +* Fri Jun 26 2015 Roland Grunberg - 0.23.0-5.1 +- SCL-ize. +- Make bootstrap build work with maven-plugin-plugin < 3.2 +- Port to work with Maven 3.0.5 +- Port to work with Java 7 +- Port to work with XMvn 2.1.0 + +* Fri Jun 26 2015 Roland Grunberg - 0.23.0-5.1 +- Initial import of tycho-0.23.0-5.fc23.