diff --git a/fix-xmvn-pomless-builddep.patch b/fix-xmvn-pomless-builddep.patch new file mode 100644 index 0000000..9ddbd13 --- /dev/null +++ b/fix-xmvn-pomless-builddep.patch @@ -0,0 +1,107 @@ +From d33893c3e3ea8f4be7636439a8f9011bb179a8e9 Mon Sep 17 00:00:00 2001 +Date: Mon, 13 Jun 2016 13:14:03 +0200 +Subject: [PATCH] Set location for pomless models + +Core Maven model reader sets location and some tools depend on these +values. These tools won't work with tycho-pomless unless it also sets +the location. + +Change-Id: I4da47c995c1333db0bb0ddb31f7309b08bf5ff39 +--- + +diff --git a/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoModelReader.java b/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoModelReader.java +index 349c776..e8a4f92 100644 +--- a/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoModelReader.java ++++ b/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoModelReader.java +@@ -26,6 +26,8 @@ + import javax.xml.parsers.DocumentBuilderFactory; + import javax.xml.parsers.ParserConfigurationException; + ++import org.apache.maven.model.InputLocation; ++import org.apache.maven.model.InputSource; + import org.apache.maven.model.Build; + import org.apache.maven.model.Model; + import org.apache.maven.model.Parent; +@@ -90,6 +92,7 @@ + String bundleVersion = getRequiredHeaderValue("Bundle-Version", headers, manifestFile); + model.setVersion(getPomVersion(bundleVersion)); + model.setPackaging(getPackagingType(bundleSymbolicName)); ++ setLocation(model, manifestFile); + return model; + } + +@@ -150,6 +153,7 @@ + } + model.setVersion(getPomVersion(versionNode.getValue())); + // groupId is inherited from parent pom ++ setLocation(model, xmlFile); + return model; + } + +@@ -247,4 +251,11 @@ + parentReference.setVersion(version); + return parentReference; + } ++ ++ private void setLocation(Model model, File modelSource) { ++ InputSource inputSource = new InputSource(); ++ inputSource.setLocation(modelSource.toString()); ++ inputSource.setModelId(model.getParent().getGroupId() + ":" + model.getArtifactId() + ":" + model.getVersion()); ++ model.setLocation("", new InputLocation(0, 0, inputSource)); ++ } + } +diff --git a/tycho-pomless/src/test/java/org/eclipse/tycho/pomless/TychoModelReaderTest.java b/tycho-pomless/src/test/java/org/eclipse/tycho/pomless/TychoModelReaderTest.java +index 05cf0c2..a40e738 100644 +--- a/tycho-pomless/src/test/java/org/eclipse/tycho/pomless/TychoModelReaderTest.java ++++ b/tycho-pomless/src/test/java/org/eclipse/tycho/pomless/TychoModelReaderTest.java +@@ -19,6 +19,8 @@ + import java.util.HashMap; + import java.util.Map; + ++import org.apache.maven.model.InputLocation; ++import org.apache.maven.model.InputSource; + import org.apache.maven.model.Model; + import org.apache.maven.model.Parent; + import org.apache.maven.model.building.ModelProcessor; +@@ -45,6 +47,7 @@ + assertEquals("0.1.0-SNAPSHOT", model.getVersion()); + assertEquals("eclipse-plugin", model.getPackaging()); + assertParent(model.getParent()); ++ assertLocation("bundle1/META-INF/MANIFEST.MF", model.getLocation("")); + } + + @Test +@@ -55,6 +58,7 @@ + assertEquals("1.0.1", model.getVersion()); + assertEquals("eclipse-test-plugin", model.getPackaging()); + assertParent(model.getParent()); ++ assertLocation("bundle1.tests/META-INF/MANIFEST.MF", model.getLocation("")); + } + + @Test +@@ -65,6 +69,7 @@ + assertEquals("1.0.0-SNAPSHOT", model.getVersion()); + assertEquals("eclipse-feature", model.getPackaging()); + assertParent(model.getParent()); ++ assertLocation("feature/feature.xml", model.getLocation("")); + } + + @Test +@@ -204,6 +209,17 @@ + assertEquals("0.0.1-SNAPSHOT", parent.getVersion()); + } + ++ private void assertLocation(String expectedLocation, InputLocation location) { ++ assertNotNull(location); ++ assertEquals(0, location.getLineNumber()); ++ assertEquals(0, location.getColumnNumber()); ++ InputSource source = location.getSource(); ++ assertNotNull(source); ++ assertEquals(new File(getPolyglotTestDir(), expectedLocation).toString(), source.getLocation()); ++ assertNotNull(source.getModelId()); ++ assertTrue(source.getModelId().matches("^testParent.groupId:.*:.*")); ++ } ++ + private Map createReaderOptions(File buildProperties) { + Map options = new HashMap<>(); + options.put(ModelProcessor.SOURCE, buildProperties.getAbsolutePath()); diff --git a/org.eclipse.tycho.extras-tycho-extras-1.3.0.tar.xz b/org.eclipse.tycho.extras-tycho-extras-1.3.0.tar.xz new file mode 100644 index 0000000..ebc1343 Binary files /dev/null and b/org.eclipse.tycho.extras-tycho-extras-1.3.0.tar.xz differ diff --git a/tycho-extras-fix-build.patch b/tycho-extras-fix-build.patch new file mode 100644 index 0000000..6ccfef3 --- /dev/null +++ b/tycho-extras-fix-build.patch @@ -0,0 +1,31 @@ +diff --git a/tycho-source-feature-plugin/src/main/java/org/eclipse/tycho/extras/sourcefeature/SourceFeatureMojo.java b/tycho-source-feature-plugin/src/main/java/org/eclipse/tycho/extras/sourcefeature/SourceFeatureMojo.java +index 05baf87..2c62fb0 100644 +--- a/tycho-source-feature-plugin/src/main/java/org/eclipse/tycho/extras/sourcefeature/SourceFeatureMojo.java ++++ b/tycho-source-feature-plugin/src/main/java/org/eclipse/tycho/extras/sourcefeature/SourceFeatureMojo.java +@@ -549,15 +549,19 @@ public class SourceFeatureMojo extends AbstractMojo { + } + + private String getAttribute(PlexusConfiguration dom, String attrName) { +- String attr = dom.getAttribute(attrName); +- if (attr == null) { +- return null; +- } +- attr = attr.trim(); +- if (attr.length() == 0) { ++ try { ++ String attr = dom.getAttribute(attrName); ++ if (attr == null) { ++ return null; ++ } ++ attr = attr.trim(); ++ if (attr.length() == 0) { ++ return null; ++ } ++ return attr; ++ } catch (Exception e) { + return null; + } +- return attr; + } + + } diff --git a/tycho-extras.spec b/tycho-extras.spec new file mode 100644 index 0000000..3f97aaf --- /dev/null +++ b/tycho-extras.spec @@ -0,0 +1,64 @@ +%global xmvn_libdir %(realpath $(dirname $(readlink -f $(which xmvn)))/../lib) +Name: tycho-extras +Version: 1.3.0 +Release: 1 +Summary: Additional plugins for Tycho +License: EPL-1.0 +URL: http://eclipse.org/tycho/ +Source0: http://git.eclipse.org/c/tycho/org.eclipse.tycho.extras.git/snapshot/org.eclipse.tycho.extras-tycho-extras-%{version}.tar.xz +Patch0: %{name}-fix-build.patch +Patch1: fix-xmvn-pomless-builddep.patch +BuildArch: noarch +ExcludeArch: s390 %{arm} %{ix86} +BuildRequires: maven-local mvn(io.takari.polyglot:polyglot-common) +BuildRequires: mvn(org.apache.commons:commons-lang3) mvn(org.apache.maven:maven-archiver) +BuildRequires: mvn(org.apache.maven:maven-core) mvn(org.apache.maven:maven-model) +BuildRequires: mvn(org.apache.maven:maven-model-builder) +BuildRequires: mvn(org.apache.maven:maven-plugin-api) +BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin) +BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin) +BuildRequires: mvn(org.apache.maven.plugin-tools:maven-plugin-annotations) +BuildRequires: mvn(org.codehaus.plexus:plexus-component-metadata) +BuildRequires: mvn(org.eclipse.jgit:org.eclipse.jgit) +BuildRequires: mvn(org.eclipse.sisu:org.eclipse.sisu.plexus) +BuildRequires: mvn(org.eclipse.tycho:org.eclipse.tycho.core.shared) +BuildRequires: mvn(org.eclipse.tycho:org.eclipse.tycho.p2.resolver.shared) +BuildRequires: mvn(org.eclipse.tycho:sisu-equinox-launching) mvn(org.eclipse.tycho:tycho-core) +BuildRequires: mvn(org.eclipse.tycho:tycho-p2-facade) +BuildRequires: mvn(org.eclipse.tycho:tycho-packaging-plugin) +%description +A small set of plugins that work with Tycho to provide additional functionality +when building projects of an OSGi nature. + +%package javadoc +Summary: Java docs for %{name} +%description javadoc +This package contains the API documentation for %{name}. + +%prep +%setup -q -n org.eclipse.tycho.extras-tycho-extras-%{version} +%patch0 -p1 +%patch1 -p1 +%pom_remove_plugin :maven-site-plugin +%pom_remove_plugin org.eclipse.m2e:lifecycle-mapping +%pom_remove_plugin org.sonatype.plugins:maven-properties-plugin tycho-p2-extras-plugin +%pom_remove_dep org.apache.maven:apache-maven tycho-p2-extras-plugin +%mvn_alias :{*} org.eclipse.tycho:@1 + +%build +%mvn_build -f + +%install +%mvn_install +install -d -m 755 %{buildroot}%{xmvn_libdir}/ext/ +ln -s %{_javadir}/%{name}/tycho-pomless.jar %{buildroot}%{xmvn_libdir}/ext/ +ln -s %{_javadir}/tesla-polyglot/polyglot-common.jar %{buildroot}%{xmvn_libdir}/ext/ + +%files -f .mfiles +%{xmvn_libdir}/ext/* + +%files javadoc -f .mfiles-javadoc + +%changelog +* Wed Aug 19 2020 maminjie - 1.3.0-1 +- package init diff --git a/tycho-extras.yaml b/tycho-extras.yaml new file mode 100644 index 0000000..f3f9d27 --- /dev/null +++ b/tycho-extras.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: eclipse/tycho.extras +tag_prefix: "tycho-extras-" +seperator: "."