diff --git a/0001-Bug-537963-Make-the-default-EE-Java-1.8.patch b/0001-Bug-537963-Make-the-default-EE-Java-1.8.patch new file mode 100644 index 0000000..6d03c71 --- /dev/null +++ b/0001-Bug-537963-Make-the-default-EE-Java-1.8.patch @@ -0,0 +1,181 @@ +From b7dae094376ab642339d5bcbe52e16cba0fa11f1 Mon Sep 17 00:00:00 2001 +Date: Wed, 15 Aug 2018 15:58:10 +0100 +Subject: [PATCH 4/6] Bug 537963 - Make the default EE Java 1.8 + +This allows bundles that don't otherwise specify an EE (for example +if the bundle contains only a plugin.xml, or is a documentation only +bundle, or otherwise does not contain any bytecode) to continue +working in environments that are supported by the latest release +of Eclipse. + +Change-Id: Ic6e41c3000c85e2e4222e8153e84b7701ab0e750 +--- + .../tycho/osgicompiler/test/OsgiCompilerTest.java | 6 +++--- + .../ee/ExecutionEnvironmentConfigurationImpl.java | 6 +++--- + .../ee/ExecutionEnvironmentConfigurationTest.java | 4 ++-- + .../tycho/core/osgitools/EquinoxResolverTest.java | 2 +- + .../org/eclipse/tycho/core/test/TychoTest.java | 5 ++++- + .../src/test/resources/projects/bree/pom.xml | 1 + + .../bree/tycho-default/META-INF/MANIFEST.MF | 5 +++++ + .../projects/bree/tycho-default/build.properties | 2 ++ + .../resources/projects/bree/tycho-default/pom.xml | 15 +++++++++++++++ + 9 files changed, 36 insertions(+), 10 deletions(-) + create mode 100644 tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF + create mode 100644 tycho-core/src/test/resources/projects/bree/tycho-default/build.properties + create mode 100644 tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml + +diff --git a/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java b/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java +index 7451d97..a0dae08 100644 +--- a/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java ++++ b/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java +@@ -37,7 +37,7 @@ import copied.org.apache.maven.plugin.CompilationFailureException; + public class OsgiCompilerTest extends AbstractTychoMojoTestCase { + + private static final int TARGET_1_4 = 48; +- private static final int TARGET_9 = 53; ++ private static final int TARGET_8 = 52; + + protected File storage; + +@@ -235,10 +235,10 @@ public class OsgiCompilerTest extends AbstractTychoMojoTestCase { + List projects = getSortedProjects(basedir, null); + MavenProject project; + // project with neither POM nor MANIFEST configuration => must fallback to +- // source/target level == 9 ++ // source/target level == 8 + project = projects.get(1); + getMojo(projects, project).execute(); +- assertBytecodeMajorLevel(TARGET_9, new File(project.getBasedir(), "target/classes/Generic.class")); ++ assertBytecodeMajorLevel(TARGET_8, new File(project.getBasedir(), "target/classes/Generic.class")); + + // project with multiple execution envs. + // Minimum source and target level must be taken +diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java +index 11f0ccf..ea67379 100644 +--- a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java ++++ b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java +@@ -1,5 +1,5 @@ + /******************************************************************************* +- * Copyright (c) 2012, 2014 SAP SE and others. ++ * Copyright (c) 2012, 2018 SAP SE and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at +@@ -19,8 +19,8 @@ import org.eclipse.tycho.core.ee.shared.SystemCapability; + import org.eclipse.tycho.core.shared.BuildFailureException; + + public class ExecutionEnvironmentConfigurationImpl implements ExecutionEnvironmentConfiguration { +- // Most likely best to always be the latest known supported EE +- private static final String DEFAULT_EXECUTION_ENVIRONMENT = "JavaSE-9"; ++ // Most likely best to always be the latest known supported long-term supported EE ++ private static final String DEFAULT_EXECUTION_ENVIRONMENT = "JavaSE-1.8"; + + private static final int PRIMARY = 0; + private static final int SECONDARY = 1; +diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java +index 5391eb2..f04fa21 100644 +--- a/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java ++++ b/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java +@@ -45,9 +45,9 @@ public class ExecutionEnvironmentConfigurationTest { + + @Test + public void testDefaults() { +- assertThat(subject.getProfileName(), is("JavaSE-9")); ++ assertThat(subject.getProfileName(), is("JavaSE-1.8")); + assertThat(subject.isCustomProfile(), is(false)); +- assertThat(subject.getFullSpecification().getProfileName(), is("JavaSE-9")); ++ assertThat(subject.getFullSpecification().getProfileName(), is("JavaSE-1.8")); + } + + @Test +diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java +index 54f1134..fa2ce8d 100644 +--- a/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java ++++ b/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java +@@ -61,7 +61,7 @@ public class EquinoxResolverTest extends AbstractTychoMojoTestCase { + properties.put("tycho-version", TychoVersion.getTychoVersion()); + + List projects = getSortedProjects(basedir, properties, null); +- assertEquals(6, projects.size()); ++ assertEquals(7, projects.size()); + + assertEquals("executionenvironment.manifest-minimal", projects.get(2).getArtifactId()); + ExecutionEnvironment ee = TychoProjectUtils.getExecutionEnvironmentConfiguration(projects.get(2)) +diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java +index e8eb7ad..a88e2e4 100644 +--- a/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java ++++ b/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java +@@ -360,7 +360,7 @@ public class TychoTest extends AbstractTychoMojoTestCase { + properties.put("tycho-version", TychoVersion.getTychoVersion()); + + List projects = getSortedProjects(basedir, properties, null); +- assertEquals(6, projects.size()); ++ assertEquals(7, projects.size()); + int i = 0; + + assertEquals("executionenvironment.manifest", projects.get(++i).getArtifactId()); +@@ -377,6 +377,9 @@ public class TychoTest extends AbstractTychoMojoTestCase { + + assertEquals("executionenvironment.pom-default", projects.get(++i).getArtifactId()); + assertEquals("OSGi/Minimum-1.2", getActiveEEProfile(projects.get(i))); ++ ++ assertEquals("executionenvironment.tycho-default", projects.get(++i).getArtifactId()); ++ assertEquals("JavaSE-1.8", getActiveEEProfile(projects.get(i))); + } + + public void testWithProjectReferencesItself() throws Exception { +diff --git a/tycho-core/src/test/resources/projects/bree/pom.xml b/tycho-core/src/test/resources/projects/bree/pom.xml +index 1ddff1d..18c5885 100644 +--- a/tycho-core/src/test/resources/projects/bree/pom.xml ++++ b/tycho-core/src/test/resources/projects/bree/pom.xml +@@ -14,6 +14,7 @@ + pom-hard + buildproperties + pom-default ++ tycho-default + + + +diff --git a/tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF b/tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF +new file mode 100644 +index 0000000..e6d85c6 +--- /dev/null ++++ b/tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF +@@ -0,0 +1,5 @@ ++Manifest-Version: 1.0 ++Bundle-ManifestVersion: 2 ++Bundle-Name: A bundle that specifies no EE at all and relies on Tycho to set one. ++Bundle-SymbolicName: executionenvironment.tycho-default ++Bundle-Version: 1.0.0 +diff --git a/tycho-core/src/test/resources/projects/bree/tycho-default/build.properties b/tycho-core/src/test/resources/projects/bree/tycho-default/build.properties +new file mode 100644 +index 0000000..7b02ed4 +--- /dev/null ++++ b/tycho-core/src/test/resources/projects/bree/tycho-default/build.properties +@@ -0,0 +1,2 @@ ++bin.includes = META-INF/ ++ +diff --git a/tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml b/tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml +new file mode 100644 +index 0000000..f538f5e +--- /dev/null ++++ b/tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml +@@ -0,0 +1,15 @@ ++ ++ 4.0.0 ++ ++ ++ executionenvironment ++ parent ++ 1.0.0 ++ ++ ++ executionenvironment.tycho-default ++ 1.0.0 ++ eclipse-plugin ++ ++ +-- +2.20.1 + diff --git a/0002-Bug-543850-Update-artifactcomparator-asm-dep-to-7.0.patch b/0002-Bug-543850-Update-artifactcomparator-asm-dep-to-7.0.patch new file mode 100644 index 0000000..5c3d37e --- /dev/null +++ b/0002-Bug-543850-Update-artifactcomparator-asm-dep-to-7.0.patch @@ -0,0 +1,83 @@ +From fa0bff4ef49b117959beb96186d639954a3c0181 Mon Sep 17 00:00:00 2001 +Date: Fri, 25 Jan 2019 21:32:55 +0200 +Subject: [PATCH 5/6] Bug 543850 - Update artifactcomparator asm dep to 7.0 + +Update the asm version to 7.0 and switch to using Opcodes.ASM7 API in +ClassReader. + +Change-Id: I957f79413e49424a9f82de99d541d75b3f2f99be +--- + tycho-artifactcomparator/pom.xml | 12 ++++++++++-- + .../zipcomparator/internal/ClassfileComparator.java | 12 +++--------- + 2 files changed, 13 insertions(+), 11 deletions(-) + +diff --git a/tycho-artifactcomparator/pom.xml b/tycho-artifactcomparator/pom.xml +index f2c3c43..4831be1 100644 +--- a/tycho-artifactcomparator/pom.xml ++++ b/tycho-artifactcomparator/pom.xml +@@ -19,13 +19,21 @@ + 1.3.0 + + tycho-artifactcomparator ++ ++ 7.0 ++ + + + + + org.ow2.asm +- asm-debug-all +- 5.0.3 ++ asm-tree ++ ${asm-version} ++ ++ ++ org.ow2.asm ++ asm-util ++ ${asm-version} + + + org.codehaus.plexus +diff --git a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java +index c69bd2c..52ba2dc 100644 +--- a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java ++++ b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java +@@ -1,5 +1,5 @@ + /******************************************************************************* +- * Copyright (c) 2012 Sonatype Inc. and others. ++ * Copyright (c) 2012, 2019 Sonatype Inc. and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at +@@ -17,7 +17,6 @@ import java.io.StringWriter; + import java.util.ArrayList; + import java.util.Arrays; + import java.util.Collections; +-import java.util.Comparator; + import java.util.List; + + import org.apache.maven.plugin.MojoExecution; +@@ -63,17 +62,12 @@ public class ClassfileComparator implements ContentsComparator { + private String disassemble(byte[] bytes) { + ClassReader reader = new ClassReader(bytes); + ClassNode clazz = new ClassNode(); +- reader.accept(clazz, Opcodes.ASM5 | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); ++ reader.accept(clazz, Opcodes.ASM6 | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); + + // inner class list gets reordered during pack200 normalization + if (clazz.innerClasses != null) { + List sorted = new ArrayList<>(clazz.innerClasses); +- Collections.sort(sorted, new Comparator() { +- @Override +- public int compare(InnerClassNode o1, InnerClassNode o2) { +- return o1.name.compareTo(o2.name); +- } +- }); ++ Collections.sort(sorted, (o1, o2) -> o1.name.compareTo(o2.name)); + clazz.innerClasses = sorted; + } + +-- +2.20.1 + diff --git a/0003-Port-to-latest-versio-of-Mockito.patch b/0003-Port-to-latest-versio-of-Mockito.patch new file mode 100644 index 0000000..7133c85 --- /dev/null +++ b/0003-Port-to-latest-versio-of-Mockito.patch @@ -0,0 +1,98 @@ +From c130487d9900e198564b0559da28937616c06208 Mon Sep 17 00:00:00 2001 +Date: Tue, 19 Feb 2019 11:11:10 +0000 +Subject: [PATCH 6/6] Port to latest versio of Mockito + +Change-Id: Ie0f6189cc66a8f13d952fa6e9d5c7bf1d39535b5 +--- + pom.xml | 2 +- + .../RepositoryArtifactProviderTest.java | 4 ++-- + tycho-bundles/pom.xml | 6 ------ + .../tycho-bundles-target.target | 21 +++++++------------ + 4 files changed, 11 insertions(+), 22 deletions(-) + +diff --git a/pom.xml b/pom.xml +index 2b34d93..5ddc9eb 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -244,7 +244,7 @@ + + org.mockito + mockito-core +- 1.8.4 ++ 2.23.0 + test + + +diff --git a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/p2base/artifact/repository/RepositoryArtifactProviderTest.java b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/p2base/artifact/repository/RepositoryArtifactProviderTest.java +index bd897e2..fc5231b 100644 +--- a/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/p2base/artifact/repository/RepositoryArtifactProviderTest.java ++++ b/tycho-bundles/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/repository/p2base/artifact/repository/RepositoryArtifactProviderTest.java +@@ -26,8 +26,8 @@ import static org.hamcrest.CoreMatchers.containsString; + import static org.hamcrest.CoreMatchers.hasItem; + import static org.hamcrest.CoreMatchers.is; + import static org.junit.Assert.assertThat; +-import static org.mockito.Matchers.any; +-import static org.mockito.Matchers.argThat; ++import static org.mockito.ArgumentMatchers.any; ++import static org.mockito.hamcrest.MockitoHamcrest.argThat; + import static org.mockito.Mockito.mock; + import static org.mockito.Mockito.when; + +diff --git a/tycho-bundles/pom.xml b/tycho-bundles/pom.xml +index abc0795..5c45e60 100644 +--- a/tycho-bundles/pom.xml ++++ b/tycho-bundles/pom.xml +@@ -81,12 +81,6 @@ + org.eclipse.osgi.compatibility.state + 0.0.0 + +- +- +- eclipse-plugin +- org.hamcrest +- 0.0.0 +- + + + +diff --git a/tycho-bundles/tycho-bundles-target/tycho-bundles-target.target b/tycho-bundles/tycho-bundles-target/tycho-bundles-target.target +index b3e58ea..33956d8 100644 +--- a/tycho-bundles/tycho-bundles-target/tycho-bundles-target.target ++++ b/tycho-bundles/tycho-bundles-target/tycho-bundles-target.target +@@ -1,5 +1,5 @@ + +- ++ + + + +@@ -19,19 +19,14 @@ + + + +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + +- +- +- +- +- ++ + + + +-- +2.20.1 + diff --git a/fedoraproject-p2-290f67a4c717599b2f5166ea89aa5365571314b1.tar.gz b/fedoraproject-p2-290f67a4c717599b2f5166ea89aa5365571314b1.tar.gz new file mode 100644 index 0000000..96cac5b Binary files /dev/null and b/fedoraproject-p2-290f67a4c717599b2f5166ea89aa5365571314b1.tar.gz differ diff --git a/org.eclipse.tycho-tycho-1.3.0.tar.xz b/org.eclipse.tycho-tycho-1.3.0.tar.xz new file mode 100644 index 0000000..9fb07bb Binary files /dev/null and b/org.eclipse.tycho-tycho-1.3.0.tar.xz differ diff --git a/p2-install.sh b/p2-install.sh new file mode 100644 index 0000000..e04cb9d --- /dev/null +++ b/p2-install.sh @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +_prefer_jre="true" +. /usr/share/java-utils/java-functions + +set_jvm + +set_classpath \ + beust-jcommander \ + eclipse/osgi \ + slf4j/api \ + slf4j/simple \ + tycho/org.fedoraproject.p2 \ + tycho/xmvn-p2-installer-plugin \ + xmvn/xmvn-api \ + xmvn/xmvn-core \ + +MAIN_CLASS=org.fedoraproject.p2.app.P2InstallerApp +run "$@" diff --git a/tycho-bootstrap.sh b/tycho-bootstrap.sh new file mode 100644 index 0000000..0340fdd --- /dev/null +++ b/tycho-bootstrap.sh @@ -0,0 +1,115 @@ +#! /bin/bash -e + +. $(pwd)/tycho-scripts.sh + +preV=$1 +v="$preV-SNAPSHOT" +osgiV='3.13.0.v20180428-1222' +osgiCompatV='1.1.100.v20180428-1222' +fp2V='0.0.1-SNAPSHOT' +bundles=() +bundles[0]='tycho-bundles/org.eclipse.tycho.embedder.shared' +bundles[1]='tycho-bundles/org.eclipse.tycho.core.shared' +bundles[2]='tycho-bundles/org.eclipse.tycho.p2.resolver.shared' +bundles[3]='tycho-bundles/org.eclipse.tycho.p2.tools.shared' +bundles[4]='tycho-bundles/org.eclipse.tycho.p2.maven.repository' +bundles[5]='tycho-bundles/org.eclipse.tycho.p2.resolver.impl' +bundles[6]='tycho-bundles/org.eclipse.tycho.p2.tools.impl' + +xtraBundles[0]='fedoraproject-p2/org.fedoraproject.p2' + +deps[0]="" +deps[1]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar" +deps[2]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar" +deps[3]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.shared/target/org.eclipse.tycho.p2.resolver.shared-${v}.jar" +deps[4]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.shared/target/org.eclipse.tycho.p2.resolver.shared-${v}.jar" +deps[5]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.shared/target/org.eclipse.tycho.p2.resolver.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.maven.repository/target/org.eclipse.tycho.p2.maven.repository-${v}.jar:fedoraproject-p2/org.fedoraproject.p2/target/org.fedoraproject.p2-${fp2V}.jar" +deps[6]="tycho-bundles/org.eclipse.tycho.embedder.shared/target/org.eclipse.tycho.embedder.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.core.shared/target/org.eclipse.tycho.core.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.shared/target/org.eclipse.tycho.p2.resolver.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.tools.shared/target/org.eclipse.tycho.p2.tools.shared-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.maven.repository/target/org.eclipse.tycho.p2.maven.repository-${v}.jar:tycho-bundles/org.eclipse.tycho.p2.resolver.impl/target/org.eclipse.tycho.p2.resolver.impl-${v}.jar" + +xtraDeps[0]="" + +externalDeps[4]="org.eclipse.equinox.common,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.artifact.repository,org.eclipse.osgi" +externalDeps[5]="org.eclipse.core.runtime,org.eclipse.equinox.security,org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.frameworkadmin,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.publisher.eclipse,org.eclipse.equinox.p2.artifact.repository,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.director,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.updatesite,org.eclipse.core.net,org.eclipse.equinox.common,org.eclipse.osgi,org.eclipse.equinox.preferences" +externalDeps[6]="org.eclipse.equinox.p2.director.app,org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.frameworkadmin,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.updatesite,org.eclipse.core.runtime,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.repository.tools,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.artifact.repository,org.eclipse.equinox.p2.publisher.eclipse,org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.director,org.eclipse.osgi,org.eclipse.equinox.common,org.eclipse.equinox.app,org.eclipse.equinox.registry" + +xtraExternalDeps[0]="org.eclipse.osgi,org.eclipse.core.runtime,org.eclipse.equinox.common,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.publisher.eclipse,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.equinox.p2.updatesite,org.eclipse.equinox.p2.repository.tools,org.eclipse.equinox.app,slf4j.api" + +reactorprojs=( 'tycho-embedder-api' 'tycho-metadata-model' 'sisu-equinox/sisu-equinox-api' 'sisu-equinox/sisu-equinox-embedder' 'tycho-core' 'tycho-packaging-plugin' 'tycho-p2/tycho-p2-facade' 'tycho-maven-plugin' 'tycho-p2/tycho-p2-repository-plugin' 'tycho-p2/tycho-p2-publisher-plugin' 'target-platform-configuration' 'tycho-artifactcomparator' 'sisu-equinox/sisu-equinox-launching' 'tycho-p2/tycho-p2-plugin' 'tycho-lib-detector' 'tycho-compiler-jdt' 'tycho-compiler-plugin' ) + +for ((i=0; i < ${#xtraBundles[@]}; i++)) ;do + echo '' + echo 'Building ' ${xtraBundles[${i}]} '...' + echo '' + isolateProject ${xtraBundles[${i}]} ${fp2V} + minibuild ${xtraBundles[${i}]} "${xtraDeps[${i}]}" ${xtraExternalDeps[${i}]} + unifyProject ${xtraBundles[${i}]} +done + +# TODO: stop minibuild function from hard-coding org/eclipse/tycho GID path +dir=$(pwd)/.m2/org/fedoraproject/p2/org.fedoraproject.p2/ +mkdir -p ${dir} +ln -s $(pwd)/.m2/org/eclipse/tycho/org.fedoraproject.p2/${fp2V} ${dir} + +for ((i=0; i < ${#bundles[@]}; i++)) ;do + echo '' + echo 'Building ' ${bundles[${i}]} '...' + echo '' + isolateProject ${bundles[${i}]} + minibuild ${bundles[${i}]} "${deps[${i}]}" ${externalDeps[${i}]} + unifyProject ${bundles[${i}]} +done + +# Run the build on this maven reactor project +for proj in ${reactorprojs[@]} ; do + isolateProject ${proj} + xmvn -B -o -e -f "${proj}/pom.xml" -Dmaven.repo.local=$(pwd)/.m2 -Dmaven.test.skip=true \ + -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8 -Dproject.build.sourceEncoding=UTF-8 \ + clean install + unifyProject ${proj} +done + +# Add org.fedoraproject.p2 to target platform for tycho-bundles-external +extras='bootstrap/extras' +mkdir -p ${extras} +fp2Loc=`find .m2 -name "org.fedoraproject.p2-*.jar"` +cp ${fp2Loc} ${extras} + +# Tycho Bundles External (needed for Tycho's OSGi Runtime) +tbeDir='tycho-bundles/tycho-bundles-external' +tbeTargetDir="${tbeDir}/target" +wantedBundles=`sed 's/ fragment=\"true\"//' "${tbeDir}/tycho-bundles-external.product" | sed -n 's/.*.*/\1/ p'` + +mkdir -p ${tbeTargetDir}'/eclipse/plugins' +copyBundles "${wantedBundles}" "${tbeTargetDir}/eclipse/plugins" + +pushd ${tbeTargetDir} + +echo "#Eclipse Product File +#Thu Dec 19 21:40:37 EST 2013 +version=${v} +name=org.eclipse.tycho.p2 +id=tycho-bundles-external" > 'eclipse/.eclipseproduct' + +mkdir -p 'eclipse/configuration' + +echo '#Product Runtime Configuration File +#Thu Dec 19 21:40:37 EST 2013 +osgi.bundles=org.apache.commons.codec,org.apache.commons.logging,org.apache.httpcomponents.httpclient,org.apache.httpcomponents.httpcore,org.eclipse.core.contenttype,org.eclipse.core.jobs,org.eclipse.core.net,org.eclipse.core.runtime@4\:start,org.eclipse.core.runtime.compatibility.registry,org.eclipse.ecf,org.eclipse.ecf.filetransfer,org.eclipse.ecf.identity,org.eclipse.ecf.provider.filetransfer,org.eclipse.ecf.provider.filetransfer.httpclient4,org.eclipse.ecf.provider.filetransfer.httpclient4.ssl,org.eclipse.ecf.provider.filetransfer.ssl,org.eclipse.ecf.ssl,org.eclipse.equinox.app,org.eclipse.equinox.common@2\:start,org.eclipse.equinox.concurrent,org.eclipse.equinox.ds@2\:start,org.eclipse.equinox.frameworkadmin,org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.launcher,org.eclipse.equinox.p2.artifact.repository,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.director,org.eclipse.equinox.p2.director.app,org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.garbagecollector,org.eclipse.equinox.p2.jarprocessor,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.publisher,org.eclipse.equinox.p2.publisher.eclipse,org.eclipse.equinox.p2.repository,org.eclipse.equinox.p2.repository.tools,org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.equinox.p2.touchpoint.natives,org.eclipse.equinox.p2.transport.ecf,org.eclipse.equinox.p2.updatesite,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.equinox.security,org.eclipse.equinox.simpleconfigurator,org.eclipse.equinox.simpleconfigurator.manipulator,org.eclipse.equinox.util,org.eclipse.osgi.services,org.eclipse.osgi.compatibility.state,org.eclipse.tycho.noopsecurity,org.sat4j.core,org.sat4j.pb,org.eclipse.osgi.util,org.apache.felix.scr,org.kxml2,org.xmlpull,org.fedoraproject.p2 +osgi.bundles.defaultStartLevel=4 +eclipse.product=org.eclipse.equinox.p2.director.app.product +osgi.splashPath=platform\:/base/plugins/org' > 'eclipse/configuration/config.ini' + +zip -r "tycho-bundles-external-${v}.zip" 'eclipse' + +popd + +loc=".m2/org/eclipse/tycho/tycho-bundles-external/${v}" + +mkdir -p ${loc} +cp "${tbeTargetDir}/tycho-bundles-external-${v}.zip" ${loc} +cp 'tycho-bundles/tycho-bundles-external/pom.xml' "${loc}/tycho-bundles-external-${v}.pom" + +sed -i "s/.*<\/equinoxVersionMaven>/${osgiV}<\/equinoxVersionMaven>/" pom.xml +sed -i "s/.*<\/equinoxCompatVersionMaven>/${osgiCompatV}<\/equinoxCompatVersionMaven>/" pom.xml +# xmvn-p2-installer-plugin needs to find the org.eclipse.osgi bundle +sed -i "s/>\${equinox-version}${osgiV}.*/\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/tycho-scripts.sh b/tycho-scripts.sh new file mode 100644 index 0000000..25ed6af --- /dev/null +++ b/tycho-scripts.sh @@ -0,0 +1,181 @@ +#! /bin/bash + +function minibuild () { + +basedir=$1 + +src=$(cat "${basedir}/build.properties" | grep 'source..' | cut -d'=' -f2 | sed -e 's/ //g') +output=$(cat "${basedir}/build.properties" | grep 'output..' | cut -d'=' -f2 | sed -e 's/ //g') +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}" -encoding utf8 \ + $(for file in `find "${basedir}/${src}" -name "*.java"`; \ + do echo -n "${file} "; \ + done;) \ + ${cp} + +# Package +pushd ${basedir} +pushd ${output} +classfiles=`for file in $(find . -name "*.class"); do echo -n ' -C '${output} ${file} ; done;` +popd +packagefiles="${classfiles}" +[ -e about.html ] && packagefiles="about.html $packagefiles" +[ -e plugin.properties ] && packagefiles="plugin.properties $packagefiles" +[ -e plugin.xml ] && packagefiles="plugin.xml $packagefiles" +[ -e OSGI-INF ] && packagefiles="OSGI-INF $packagefiles" +jar -cfmv "target/${bName}-${version}.jar" 'META-INF/MANIFEST.MF' ${packagefiles} +popd + +# Install +loc=".m2/org/eclipse/tycho/${artifactId}/${version}" +mkdir -p ${loc} +cp "${basedir}/target/${bName}-${version}.jar" ${loc} +cp "${basedir}/pom.xml" "${loc}/${bName}-${version}.pom" + +} + + +function copyBundles () { + +# X_SCLS expands to list of currently enabled SCLs, in the order they were enabled, if any +scls="$X_SCLS" +baseLocations=( '/usr/share/java' '/usr/lib/java' '/usr/lib/eclipse' ) +osgiLocations=(${baseLocations[@]} ${osgiLocations[@]} ) +for scl in ${scls} ; do + osgiLocations=( ${baseLocations[@]/#//opt/rh/${scl}/root} ${osgiLocations[@]} ) +done + +prefix="$(pwd)/bootstrap" +osgiLocations=( ${osgiLocations[@]/#/${prefix}} ) +osgiLocations+=( ${osgiLocations[@]/${prefix}/} ) +osgiLocations=( ${prefix}/extras ${osgiLocations[@]} ) + +wantedBundles=`echo $1 | tr ',' ' '` +destDir=$2 + +for loc in ${osgiLocations[@]} ; do + for jar in `find ${loc} -name "*.jar" 2>/dev/null`; do + bsn=`readBSN ${jar}` + if [ -n "${bsn}" ]; then + versionline=`unzip -p ${jar} 'META-INF/MANIFEST.MF' | grep 'Bundle-Version:'` + vers=`echo "${versionline}" | sed 's/Bundle-Version: \([a-zA-Z0-9_.-]*\).*/\1/'` + if echo ${wantedBundles} | grep "${bsn}" ; then + cp ${jar} "${destDir}/${bsn}_${vers}.jar" + wantedBundles=`removeFromList "${wantedBundles}" "${bsn}"` + fi + fi + done +done + +} + +function symlinkBundles () { + +# Bootstrap Built Tycho provides some Eclipse bundles +# Prevent non-bootstrap build's de-bundling from symlinking to them +# SCL priority is from right to left. +# X_SCLS expands to list of currently enabled SCLs, in the order they were enabled, if any +scls="$X_SCLS" +baseLocations=( '/usr/share/java/eclipse' '/usr/share/java' '/usr/lib/java' ) +osgiLocations=(${baseLocations[@]} ${osgiLocations[@]} ) +for scl in ${scls} ; do + osgiLocations=( ${baseLocations[@]/#//opt/rh/${scl}/root} ${osgiLocations[@]} ) +done + + +wantedBundles=`echo $1 | tr ',' ' '` + +for loc in ${osgiLocations[@]} ; do + for jar in `find ${loc} -name "*.jar" 2>/dev/null`; do + bsn=`readBSN ${jar}` + if [ -n "${bsn}" ]; then + echo ${wantedBundles} | grep -q "${bsn}" + if [ $? -eq 0 ]; then + ln -s ${jar} "${bsn}.jar" + wantedBundles=`removeFromList "${wantedBundles}" "${bsn}"` + fi + fi + done +done +} + +function removeFromList () { +arr=( ${1} ) +for (( i=0; i < ${#arr[@]}; i++ )); do + if [ "${arr[${i}]}" = "$2" ]; then + arr[${i}]= + fi +done +echo ${arr[@]} +} + +function isolateProject () { + cp $1/pom.xml $1/pom.xml.boot + + sed -i -e "/org.eclipse.osgi${osgiV}" \ + -e "/org.eclipse.osgi.compatibility.state${osgiCompatV}" \ + -e '//,/<\/parent>/ d' "$1/pom.xml" + if ! grep -q generate-metadata "$1/pom.xml" ; then + sed -i -e "/plexus-component-metadata1.5.5generate-metadata" "$1/pom.xml" + fi + + 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.boot $1/pom.xml +} + +function readBSN () { + +bsn= +manEntryPat="^[a-zA-Z-]*:" +foundBSNLine=0 + +while read line; do +if [ ${foundBSNLine} -eq 1 ]; then + echo ${line} | grep -qE ${manEntryPat} + if [ $? -eq 0 ]; then + break + else + bsn=${bsn}"`echo ${line} | sed 's/\([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`" + fi +fi + +echo ${line} | grep -q "Bundle-SymbolicName:" +if [ $? -eq 0 ]; then + bsn=`echo ${line} | grep 'Bundle-SymbolicName:' | sed 's/Bundle-SymbolicName: \([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'` + echo ${line} | grep "Bundle-SymbolicName:" | grep -q ";" + if [ $? -eq 0 ]; then + break + fi + foundBSNLine=1 +fi +done < <(unzip -p $1 'META-INF/MANIFEST.MF') + +echo ${bsn} + +} diff --git a/tycho.spec b/tycho.spec new file mode 100644 index 0000000..38e61de --- /dev/null +++ b/tycho.spec @@ -0,0 +1,253 @@ +%bcond_with bootstrap +%bcond_without junit5 +%global git_tag tycho-%{version} +%global fp_p2_git_tag 290f67a4c717599b2f5166ea89aa5365571314b1 +%global fp_p2_version 0.0.1 +%global fp_p2_snap -SNAPSHOT +%global xmvn_libdir %(realpath $(dirname $(readlink -f $(which xmvn)))/../lib) +%define __requires_exclude osgi* +Name: tycho +Version: 1.3.0 +Release: 1 +Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven +License: ASL 2.0 and EPL-1.0 +URL: http://eclipse.org/tycho +Source0: http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/snapshot/org.eclipse.tycho-%{git_tag}.tar.xz +Source1: https://github.com/rgrunber/fedoraproject-p2/archive/%{fp_p2_git_tag}/fedoraproject-p2-%{fp_p2_git_tag}.tar.gz +Source3: tycho-scripts.sh +Source4: tycho-bootstrap.sh +Source5: tycho-debundle.sh +Source6: p2-install.sh +%if %{with bootstrap} +Source10: eclipse-bootstrap-photon.tar.xz +%endif +# Submitted upstream: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537963 +Patch0: 0001-Bug-537963-Make-the-default-EE-Java-1.8.patch +# Merged upstream: https://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=a437fb8870761d733199392f25a8c0e4f34caae9 +Patch1: 0002-Bug-543850-Update-artifactcomparator-asm-dep-to-7.0.patch +# Port to latest version of Mockito 2.x +Patch2: 0003-Port-to-latest-versio-of-Mockito.patch +# Upstream Eclipse no longer supports non-64bit arches +ExcludeArch: s390 %{arm} %{ix86} +BuildArch: noarch +BuildRequires: maven-local mvn(biz.aQute.bnd:bnd-maven-plugin) mvn(com.beust:jcommander) +BuildRequires: mvn(de.pdark:decentxml) mvn(junit:junit) +BuildRequires: mvn(org.apache.commons:commons-compress) mvn(org.apache.commons:commons-exec) +BuildRequires: mvn(org.apache.commons:commons-lang3) mvn(org.apache.felix:maven-bundle-plugin) +BuildRequires: mvn(org.apache.maven:maven-archiver) mvn(org.apache.maven:maven-compat) +BuildRequires: mvn(org.apache.maven:maven-core) mvn(org.apache.maven:maven-plugin-api) +BuildRequires: mvn(org.apache.maven.plugins:maven-clean-plugin) +BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin) +BuildRequires: mvn(org.apache.maven.plugins:maven-install-plugin) +BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin) +BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin) +BuildRequires: mvn(org.apache.maven.plugin-testing:maven-plugin-testing-harness) +BuildRequires: mvn(org.apache.maven.plugin-tools:maven-plugin-annotations) +BuildRequires: mvn(org.apache.maven.shared:maven-verifier) +BuildRequires: mvn(org.apache.maven.surefire:maven-surefire-common) +BuildRequires: mvn(org.apache.maven.surefire:surefire-api) +BuildRequires: mvn(org.codehaus.plexus:plexus-archiver) +BuildRequires: mvn(org.codehaus.plexus:plexus-compiler-api) +BuildRequires: mvn(org.codehaus.plexus:plexus-compiler-manager) +BuildRequires: mvn(org.codehaus.plexus:plexus-component-annotations) +BuildRequires: mvn(org.codehaus.plexus:plexus-component-metadata) +BuildRequires: mvn(org.codehaus.plexus:plexus-container-default) +BuildRequires: mvn(org.codehaus.plexus:plexus-utils) mvn(org.eclipse.jdt:ecj) +BuildRequires: mvn(org.fedoraproject.xmvn:xmvn-api) mvn(org.fedoraproject.xmvn:xmvn-core) +BuildRequires: mvn(org.fedoraproject.xmvn:xmvn-install) +BuildRequires: mvn(org.fedoraproject.xmvn:xmvn-parent:pom:) mvn(org.hamcrest:hamcrest-core) +BuildRequires: mvn(org.mockito:mockito-core) mvn(org.ow2.asm:asm-tree) +BuildRequires: mvn(org.ow2.asm:asm-util) mvn(org.slf4j:slf4j-api) mvn(org.slf4j:slf4j-simple) +%if %{with junit5} +BuildRequires: mvn(org.apache.maven.surefire:surefire-junit-platform) +BuildRequires: mvn(org.apiguardian:apiguardian-api) mvn(org.opentest4j:opentest4j) +%endif +%if ! %{with bootstrap} +BuildRequires: %{name} eclipse-platform >= 1:4.11 +%else +BuildRequires: osgi(com.ibm.icu) osgi(org.apache.commons.jxpath) osgi(org.apache.batik.css) +BuildRequires: osgi(org.kxml2) osgi(org.sat4j.core) osgi(org.sat4j.pb) osgi(org.w3c.css.sac) +BuildRequires: osgi(javax.servlet-api) osgi(javax.servlet.jsp) +%endif +Requires: maven-local xmvn-minimal >= 3 ecj >= 1:4.7.3a-1 +%if ! %{with bootstrap} +Requires: eclipse-platform >= 1:4.11 +%endif +Requires: maven-clean-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 %{name} +%description javadoc +This package contains the API documentation for %{name}. + +%prep +%setup -q -n org.eclipse.tycho-%{git_tag} -a 1 +mv fedoraproject-p2-%{fp_p2_git_tag} fedoraproject-p2 +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%pom_remove_plugin :maven-site-plugin +%if %{without junit5} +%pom_disable_module org.eclipse.tycho.surefire.junit5 tycho-surefire +%pom_remove_dep ":org.eclipse.tycho.surefire.junit5" tycho-surefire/tycho-surefire-plugin +%endif +find . -name "*.java" | xargs sed -i 's/org.sonatype.aether/org.eclipse.aether/g' +find . -name "*.java" | xargs sed -i 's/org.eclipse.aether.util.DefaultRepositorySystemSession/org.eclipse.aether.DefaultRepositorySystemSession/g' +sed -i 's/public int getPriority/public float getPriority/g' tycho-core/src/main/java/org/eclipse/tycho/core/p2/P2RepositoryConnectorFactory.java +mkdir -p tycho-maven-plugin/src/main/java/org/fedoraproject +sed -i '/^${project.version}' tycho-surefire/tycho-surefire-plugin/pom.xml +%if %{with bootstrap} +%pom_xpath_remove "pom:compilerId" tycho-lib-detector +%pom_remove_dep "org.eclipse.tycho:tycho-compiler-jdt" tycho-lib-detector +for b in core.shared.tests p2.resolver.impl.test p2.resolver.shared.tests p2.maven.repository.tests p2.tools.tests test.utils ; do + %pom_disable_module org.eclipse.tycho.$b tycho-bundles +done +%pom_disable_module org.fedoraproject.p2.tests fedoraproject-p2 +%pom_remove_dep -r :::test +tar -xf %{SOURCE10} +pushd bootstrap +for f in usr/lib/eclipse/plugins/org.eclipse.osgi.compatibility.state_*.jar \ + usr/lib/eclipse/plugins/org.eclipse.osgi_*.jar ; do + xmvn -o install:install-file -Dfile=$f -Dpackaging=jar -DgroupId=org.eclipse.tycho -Dmaven.repo.local=$(pwd)/../.m2 \ + -DartifactId=$(echo $(basename $f) | cut -d_ -f1) -Dversion=$(echo "${f%.jar}" | cut -d_ -f2) +done +popd +cp %{SOURCE3} %{SOURCE4} . +./tycho-bootstrap.sh %{version} +%else +sysVer=`grep -C 1 "tycho" %{_mavenpomdir}/tycho/tycho.pom | grep "version" | sed 's/.*>\(.*\)<.*/\1/'` +mkdir boot +sed -e 's/ns[0-9]://g' %{_datadir}/maven-metadata/tycho.xml > boot/tycho-metadata.xml +for pom in $(grep 'pom' boot/tycho-metadata.xml | sed 's|.*>\(.*\)<.*|\1|'); do + sed -e "s/>$sysVer/>%{version}-SNAPSHOT/g" -e "s/%{fp_p2_version}%{fp_p2_snap}/%{fp_p2_version}/" <$pom >boot/$(basename $pom) +done +cp -p $(build-classpath tycho/tycho-maven-plugin) boot/tycho-maven-plugin.jar +jar xf boot/tycho-maven-plugin.jar META-INF/plexus/components.xml +sed -i s/$sysVer/%{version}-SNAPSHOT/ META-INF/plexus/components.xml +jar uf boot/tycho-maven-plugin.jar META-INF/plexus/components.xml +sed -i ' + s|>/[^<]*/\([^/]*\.pom\)|>'$PWD'/boot/\1| + s|>'$sysVer'|>%{version}-SNAPSHOT%{version}-SNAPSHOT| + s|>'%{fp_p2_version}%{fp_p2_snap}'|>%{fp_p2_version}%{fp_p2_version}| + s|%{_javadir}/tycho/tycho-maven-plugin.jar|'$PWD'/boot/tycho-maven-plugin.jar| +' boot/tycho-metadata.xml +%mvn_config resolverSettings/metadataRepositories/repository $PWD/boot/tycho-metadata.xml +%endif +%pom_add_plugin :maven-clean-plugin tycho-bundles/tycho-standalone-p2-director " + + + default-clean-1 + initialize + + true + + +" +%pom_xpath_inject "pom:modules" "fedoraproject-p2" + +%build +%mvn_build -f -- \ + -Dtycho-version=%{version}-SNAPSHOT -DtychoBootstrapVersion=%{version}-SNAPSHOT \ + -Dmaven.repo.local=$(pwd)/.m2 -Dfedora.p2.repos=$(pwd)/bootstrap +%mvn_artifact fedoraproject-p2/org.fedoraproject.p2/pom.xml +sed -i -e 's|type>eclipse.*<|type>jar<|' .xmvn-reactor +%mvn_package "::target::" __noinstall +%mvn_package ":org.fedoraproject.p2.tests" __noinstall + +%install +cp %{SOURCE3} %{SOURCE5} . +%if ! %{with bootstrap} +chmod 777 tycho-debundle.sh +./tycho-debundle.sh $(pwd)/tycho-bundles/tycho-bundles-external \ + $(pwd)/tycho-bundles/tycho-bundles-external/target/tycho-bundles-external-manifest.txt +./tycho-debundle.sh $(pwd)/tycho-bundles/tycho-standalone-p2-director +%endif +%if %{with bootstrap} +for b in org.eclipse.osgi \ + org.eclipse.osgi.compatibility.state ; do + osgiJarPath=$(find .m2/org/eclipse/tycho/$b/*/ -name "*.jar") + osgiPomPath=$(find .m2/org/eclipse/tycho/$b/*/ -name "*.pom") + %mvn_artifact $osgiPomPath $osgiJarPath + %mvn_alias "org.eclipse.tycho:$b" "org.eclipse.osgi:$b" +done +%endif +%mvn_install +%if ! %{with bootstrap} +install -pm 644 tycho-bundles/tycho-bundles-external/target/tycho-bundles-external-manifest.txt %{buildroot}%{_javadir}/tycho +%add_maven_depmap org.eclipse.tycho:tycho-bundles-external:txt:manifest:%{version} tycho/tycho-bundles-external-manifest.txt +%endif +%if %{with bootstrap} +for bnd in \ + core.contenttype \ + core.expressions \ + core.filesystem \ + core.jobs \ + core.net \ + core.resources \ + core.runtime \ + equinox.app \ + equinox.common \ + equinox.concurrent \ + equinox.preferences \ + equinox.registry \ + equinox.security ; do +bndJarPath=$(find bootstrap -name "org.eclipse.${bnd}_*.jar") +install -m 644 -T $bndJarPath $RPM_BUILD_ROOT%{_javadir}/tycho/$bnd.jar +done +%endif +sed -i '//d' %{buildroot}%{_datadir}/maven-metadata/tycho.xml +install -dm 755 %{buildroot}%{_javadir}-utils/ +install -pm 755 %{SOURCE6} %{buildroot}%{_javadir}-utils/ +install -dm 755 %{buildroot}%{xmvn_libdir}/installer/ +%if %{with bootstrap} +ln -s %{_javadir}/tycho/org.eclipse.osgi.jar %{buildroot}%{xmvn_libdir}/installer/ +%else +ln -s %{_javadir}/eclipse/osgi.jar %{buildroot}%{xmvn_libdir}/installer/ +%endif +ln -s %{_javadir}/tycho/xmvn-p2-installer-plugin.jar %{buildroot}%{xmvn_libdir}/installer/ +ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}%{xmvn_libdir}/installer/ + +%files -f .mfiles +%{xmvn_libdir}/installer/* +%{_javadir}-utils/p2-install.sh +%if %{with bootstrap} +%{_javadir}/tycho/core.*.jar +%{_javadir}/tycho/equinox.*.jar +%endif +%doc README.md + +%files javadoc -f .mfiles-javadoc + +%changelog +* Fri Aug 21 2020 maminjie - 1.3.0-1 +- package init diff --git a/tycho.yaml b/tycho.yaml new file mode 100644 index 0000000..5ab9132 --- /dev/null +++ b/tycho.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: eclipse/tycho +tag_prefix: "tycho-" +seperator: "."