Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaeubi2019-08-27 07:31:04 +0000
committerMickael Istria2019-08-27 10:26:42 +0000
commit8aff8a777de91fe2b98b3579af2613cf51117e45 (patch)
treed02ffded61f5d765b98fcaffacb820ff349f3b14
parent39b1cd87f6bdd1c4b8361a1b4d7ab39184bc579d (diff)
downloadorg.eclipse.tycho.extras-8aff8a777de91fe2b98b3579af2613cf51117e45.tar.gz
org.eclipse.tycho.extras-8aff8a777de91fe2b98b3579af2613cf51117e45.tar.xz
org.eclipse.tycho.extras-8aff8a777de91fe2b98b3579af2613cf51117e45.zip
Bug 478704 - pomless builds should work with flat project structure
Change-Id: I64280ed30334f4cc7ba69f012053a2ffa7839464 Signed-off-by: laeubi <laeubi@laeubi-soft.de>
-rw-r--r--tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessITest.java21
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/.mvn/extensions.xml8
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/aggregate/pom.xml68
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/META-INF/MANIFEST.MF6
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/build.properties3
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/src/DummyTest.java21
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/bundle1/META-INF/MANIFEST.MF6
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/bundle1/build.properties3
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/feature/build.properties2
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/feature/feature.xml20
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/product/build.properties1
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/product/test.product22
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/site1/build.properties1
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/site1/category.xml7
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/targetplatform/build.properties1
-rw-r--r--tycho-extras-its/src/test/resources/testpomless-flat/targetplatform/targetplatform.target10
-rw-r--r--tycho-pomless/src/main/java/org/eclipse/tycho/pomless/AbstractTychoMapping.java23
17 files changed, 215 insertions, 8 deletions
diff --git a/tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessITest.java b/tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessITest.java
index 44d4a49..0bb7f67 100644
--- a/tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessITest.java
+++ b/tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessITest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 SAP SE and others.
+ * Copyright (c) 2015, 2019 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
@@ -7,6 +7,7 @@
*
* Contributors:
* SAP SE - initial API and implementation
+ * Christoph Läubrich - add testPomlessFlatBuildExtension
*******************************************************************************/
package org.eclipse.tycho.extras.pomless;
@@ -29,7 +30,11 @@ public class TychoPomlessITest extends AbstractTychoExtrasIntegrationTest {
verifier.executeGoals(asList("clean", "verify"));
verifier.verifyErrorFreeLog();
// sanity check pom-less if bundle, test bundle and feature have been built
- File baseDir = new File(verifier.getBasedir());
+ check(new File(verifier.getBasedir()));
+
+ }
+
+ private void check(File baseDir) {
assertThat(new File(baseDir, "bundle1/target/pomless.bundle-0.1.0-SNAPSHOT.jar"), isFile());
assertThat(new File(baseDir, "bundle1.tests/target/pomless.bundle.tests-1.0.1.jar"), isFile());
assertThat(new File(baseDir, "feature/target/pomless.feature-1.0.0-SNAPSHOT.jar"), isFile());
@@ -37,6 +42,18 @@ public class TychoPomlessITest extends AbstractTychoExtrasIntegrationTest {
isRepository(baseDir, "product");
assertThat(new File(baseDir, "site1/target/site1.eclipse-repository-0.0.1-SNAPSHOT.zip"), isFile());
isRepository(baseDir, "site1");
+ }
+
+ @Test
+ public void testPomlessFlatBuildExtension() throws Exception {
+ Verifier verifier = getVerifier("testpomless-flat", false);
+ verifier.addCliOption("-Dp2.repo=" + new File("repositories/kepler").getAbsoluteFile().toURI().toString());
+ verifier.addCliOption("-f");
+ verifier.addCliOption("aggregate/pom.xml");
+ verifier.executeGoals(asList("clean", "verify"));
+ verifier.verifyErrorFreeLog();
+ // sanity check pom-less if bundle, test bundle and feature have been built
+ check(new File(verifier.getBasedir()));
}
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/.mvn/extensions.xml b/tycho-extras-its/src/test/resources/testpomless-flat/.mvn/extensions.xml
new file mode 100644
index 0000000..b890ce9
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/.mvn/extensions.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<extensions>
+ <extension>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-pomless</artifactId>
+ <version>${tycho-version}</version>
+ </extension>
+</extensions>
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/aggregate/pom.xml b/tycho-extras-its/src/test/resources/testpomless-flat/aggregate/pom.xml
new file mode 100644
index 0000000..8398b8a
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/aggregate/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- - Copyright (c) 2015 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 - http://www.eclipse.org/legal/epl-v10.html - - Contributors:
+ - SAP SE - initial API and implementation -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>testParent.groupId</groupId>
+ <artifactId>testparent</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>tycho-snapshots</id>
+ <url>${tycho-snapshots-url}</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <modules>
+ <!-- look ma, no poms ! -->
+ <module>../targetplatform</module>
+ <module>../bundle1</module>
+ <module>../bundle1.tests</module>
+ <module>../feature</module>
+ <module>../site1</module>
+ <module>../product</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-maven-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <target>
+ <artifact>
+ <groupId>testParent.groupId</groupId>
+ <artifactId>targetplatform</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </artifact>
+ </target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+
+</project>
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/META-INF/MANIFEST.MF b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..6ffc116
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: pomless.bundle.tests
+Bundle-Version: 1.0.1
+Require-Bundle: org.junit;bundle-version="4.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/build.properties b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/build.properties
new file mode 100644
index 0000000..1435c45
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/build.properties
@@ -0,0 +1,3 @@
+bin.includes = META-INF/,.
+source.. = src/
+tycho.pomless.parent=../aggregate
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/src/DummyTest.java b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/src/DummyTest.java
new file mode 100644
index 0000000..56495fe
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1.tests/src/DummyTest.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SAP SE - initial API and implementation
+ *******************************************************************************/
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DummyTest {
+
+ @Test
+ public void test() {
+ Assert.assertTrue(true);
+ }
+
+}
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/bundle1/META-INF/MANIFEST.MF b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..4ba703e
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: pomless.bundle;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/bundle1/build.properties b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1/build.properties
new file mode 100644
index 0000000..1435c45
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/bundle1/build.properties
@@ -0,0 +1,3 @@
+bin.includes = META-INF/,.
+source.. = src/
+tycho.pomless.parent=../aggregate
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/feature/build.properties b/tycho-extras-its/src/test/resources/testpomless-flat/feature/build.properties
new file mode 100644
index 0000000..29233ef
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/feature/build.properties
@@ -0,0 +1,2 @@
+bin.includes = feature.xml
+tycho.pomless.parent=../aggregate
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/feature/feature.xml b/tycho-extras-its/src/test/resources/testpomless-flat/feature/feature.xml
new file mode 100644
index 0000000..da903db
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/feature/feature.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="pomless.feature"
+ version="1.0.0.qualifier">
+
+ <plugin
+ id="pomless.bundle"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="pomless.bundle.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/product/build.properties b/tycho-extras-its/src/test/resources/testpomless-flat/product/build.properties
new file mode 100644
index 0000000..746e0ce
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/product/build.properties
@@ -0,0 +1 @@
+tycho.pomless.parent=../aggregate
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/product/test.product b/tycho-extras-its/src/test/resources/testpomless-flat/product/test.product
new file mode 100644
index 0000000..b979739
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/product/test.product
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?pde version="3.5"?>
+
+<product name="Test Pomles Product" uid="my.test.product.pomless" version="1.0.0" useFeatures="true" includeLaunchers="false">
+
+ <configIni use="default">
+ </configIni>
+
+ <launcherArgs>
+ <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
+ </vmArgsMac>
+ </launcherArgs>
+
+ <plugins>
+ </plugins>
+
+ <features>
+ <feature id="pomless.feature" version="1.0.0.qualifier"/>
+ </features>
+
+
+</product>
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/site1/build.properties b/tycho-extras-its/src/test/resources/testpomless-flat/site1/build.properties
new file mode 100644
index 0000000..746e0ce
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/site1/build.properties
@@ -0,0 +1 @@
+tycho.pomless.parent=../aggregate
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/site1/category.xml b/tycho-extras-its/src/test/resources/testpomless-flat/site1/category.xml
new file mode 100644
index 0000000..76e0d3a
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/site1/category.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <feature id="pomless.feature" version="1.0.0.qualifier">
+ <category name="myCategory"/>
+ </feature>
+ <category-def name="myCategory" label="A Category"/>
+</site>
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/targetplatform/build.properties b/tycho-extras-its/src/test/resources/testpomless-flat/targetplatform/build.properties
new file mode 100644
index 0000000..746e0ce
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/targetplatform/build.properties
@@ -0,0 +1 @@
+tycho.pomless.parent=../aggregate
diff --git a/tycho-extras-its/src/test/resources/testpomless-flat/targetplatform/targetplatform.target b/tycho-extras-its/src/test/resources/testpomless-flat/targetplatform/targetplatform.target
new file mode 100644
index 0000000..e1218aa
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless-flat/targetplatform/targetplatform.target
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?><target name="Thats my pomless Target" sequenceNumber="1">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.equinox.sdk.feature.group" version="3.9.0.v20140221-1852"/>
+<unit id="org.eclipse.jdt.feature.group" version="3.9.2.v20140221-1700"/>
+<repository location="http://download.eclipse.org/releases/kepler/201402280900"/>
+</location>
+</locations>
+</target>
diff --git a/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/AbstractTychoMapping.java b/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/AbstractTychoMapping.java
index 9997e2b..ff29900 100644
--- a/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/AbstractTychoMapping.java
+++ b/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/AbstractTychoMapping.java
@@ -49,6 +49,8 @@ import org.sonatype.maven.polyglot.mapping.Mapping;
*/
public abstract class AbstractTychoMapping implements Mapping, ModelReader {
+ private static final String TYCHO_POMLESS_PARENT = "tycho.pomless.parent";
+ private static final String PARENT_POM_DEFAULT_VALUE = System.getProperty(TYCHO_POMLESS_PARENT, "..");
private static final String QUALIFIER_SUFFIX = ".qualifier";
private static final String ISSUE_192 = ".takari_issue_192";
private static final String MODEL_PARENT = "TychoMapping.model.parent";
@@ -183,12 +185,21 @@ public abstract class AbstractTychoMapping implements Mapping, ModelReader {
//if the parent is given by the options we don't neet to search it!
return parent;
}
-
- // assumption/limitation: parent pom must be physically located in
- // parent directory
- File parentPom = polyglotModelManager.locatePom(projectRoot.getParentFile());
+ Properties buildProperties = getBuildProperties(projectRoot);
+ // assumption parent pom must be physically located in parent directory if not given by build.properties
+ String parentRef = buildProperties.getProperty(TYCHO_POMLESS_PARENT, PARENT_POM_DEFAULT_VALUE);
+ File fileOrFolder = new File(projectRoot, parentRef);
+ File parentPom;
+ if (fileOrFolder.isFile()) {
+ parentPom = fileOrFolder;
+ } else if (fileOrFolder.isDirectory()) {
+ parentPom = polyglotModelManager.locatePom(fileOrFolder);
+ } else {
+ throw new FileNotFoundException(
+ "parent pom file/folder " + fileOrFolder.getCanonicalPath() + " is not accessible");
+ }
if (parentPom == null) {
- throw new FileNotFoundException("No parent pom file found in " + projectRoot.getParentFile());
+ throw new FileNotFoundException("No parent pom file found in " + fileOrFolder.getCanonicalPath());
}
Map<String, File> options = new HashMap<>(4);
options.put(ModelProcessor.SOURCE, parentPom);
@@ -208,7 +219,7 @@ public abstract class AbstractTychoMapping implements Mapping, ModelReader {
version = parentModel.getParent().getVersion();
}
parentReference.setVersion(version);
- parentReference.setRelativePath("../" + parentPom.getName());
+ parentReference.setRelativePath(projectRoot.toPath().relativize(parentPom.toPath()).toString());
return parentReference;
}

Back to the top