Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaeubi2019-08-19 08:05:00 +0000
committerlaeubi2019-08-19 13:00:49 +0000
commit6faee907ed75917815e3c6731668e9a26bbfb915 (patch)
tree115635aa36cce4d3f7eaa0d744ff57a8eccd1463
parenta97b2d24766a8928ca4b395bc4efd30127eaef61 (diff)
downloadorg.eclipse.tycho.extras-6faee907ed75917815e3c6731668e9a26bbfb915.tar.gz
org.eclipse.tycho.extras-6faee907ed75917815e3c6731668e9a26bbfb915.tar.xz
org.eclipse.tycho.extras-6faee907ed75917815e3c6731668e9a26bbfb915.zip
Bug 482487 - detect projects without build.properties
Change-Id: Icaed711af24c3d91785607cd0cb7aa4355dde9b9 Signed-off-by: laeubi <laeubi@laeubi-soft.de>
-rw-r--r--tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessITest.java3
-rw-r--r--tycho-extras-its/src/test/resources/testpomless/pom.xml1
-rw-r--r--tycho-extras-its/src/test/resources/testpomless/product/test.product22
-rw-r--r--tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoMapping.java16
-rw-r--r--tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoModelReader.java16
5 files changed, 54 insertions, 4 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 f22312d..86f439c 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
@@ -33,6 +33,9 @@ public class TychoPomlessITest extends AbstractTychoExtrasIntegrationTest {
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());
+ assertThat(new File(baseDir, "product/target/my.test.product.pomless-1.0.0.zip"), isFile());
+ assertThat(new File(baseDir, "product/target/repository/artifacts.jar"), isFile());
+ assertThat(new File(baseDir, "product/target/repository/content.jar"), isFile());
}
}
diff --git a/tycho-extras-its/src/test/resources/testpomless/pom.xml b/tycho-extras-its/src/test/resources/testpomless/pom.xml
index 6af11cb..4a2c160 100644
--- a/tycho-extras-its/src/test/resources/testpomless/pom.xml
+++ b/tycho-extras-its/src/test/resources/testpomless/pom.xml
@@ -46,6 +46,7 @@
<module>bundle1</module>
<module>bundle1.tests</module>
<module>feature</module>
+ <module>product</module>
</modules>
<build>
diff --git a/tycho-extras-its/src/test/resources/testpomless/product/test.product b/tycho-extras-its/src/test/resources/testpomless/product/test.product
new file mode 100644
index 0000000..b979739
--- /dev/null
+++ b/tycho-extras-its/src/test/resources/testpomless/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-pomless/src/main/java/org/eclipse/tycho/pomless/TychoMapping.java b/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoMapping.java
index 1e742e1..679ef26 100644
--- a/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoMapping.java
+++ b/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoMapping.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.tycho.pomless;
+import java.io.File;
+
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.maven.polyglot.mapping.Mapping;
import org.sonatype.maven.polyglot.mapping.MappingSupport;
@@ -22,9 +24,21 @@ public class TychoMapping extends MappingSupport {
// can't check for META-INF/MANIFEST.MF as this is in a subfolder and maven (and tycho) assumes
// in many places that the pom file is located in the project base dir, so we just use build.properties as a marker file
setPomNames("build.properties");
- setAcceptLocationExtensions("build.properties");
+ setAcceptLocationExtensions("build.properties", ".product");
// make sure priority is lower than pom.xml (XmlMapping) so we can still override and use pom.xml if needed
setPriority(-2);
}
+
+ @Override
+ public File locatePom(File dir) {
+ File pom = super.locatePom(dir);
+ if (pom == null) {
+ File productFile = TychoModelReader.getProductFile(dir);
+ if (productFile != null) {
+ return productFile;
+ }
+ }
+ return pom;
+ }
}
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 e62cd57..9ef3b6e 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
@@ -37,6 +37,7 @@ import org.apache.maven.model.io.ModelParseException;
import org.apache.maven.model.io.ModelReader;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.sonatype.maven.polyglot.PolyglotModelManager;
import org.sonatype.maven.polyglot.PolyglotModelUtil;
import org.sonatype.maven.polyglot.io.ModelReaderSupport;
@@ -115,10 +116,19 @@ public class TychoModelReader extends ModelReaderSupport {
materialize.setId("materialize-prodcuts");
materialize.setGoals(Arrays.asList("materialize-products"));
plugin.addExecution(materialize);
-
+ Xpp3Dom config = new Xpp3Dom("configuration");
+ Xpp3Dom products = new Xpp3Dom("products");
+ Xpp3Dom product = new Xpp3Dom("product");
+ Xpp3Dom id = new Xpp3Dom("id");
+ id.setValue(model.getArtifactId());
+ config.addChild(products);
+ products.addChild(product);
+ product.addChild(id);
+ materialize.setConfiguration(config);
PluginExecution archive = new PluginExecution();
archive.setId("archive-prodcuts");
archive.setGoals(Arrays.asList("archive-products"));
+ archive.setConfiguration(config);
plugin.addExecution(archive);
model.setBuild(build);
@@ -206,8 +216,8 @@ public class TychoModelReader extends ModelReaderSupport {
}
}
- private File getProductFile(File projectRoot) {
- File[] productFiles = projectRoot.listFiles((File dir, String name) -> name.endsWith(".product"));
+ public static File getProductFile(File projectRoot) {
+ File[] productFiles = projectRoot.listFiles((File dir, String name) -> name.endsWith(".product") && !name.startsWith(".polyglot"));
if (productFiles.length > 0 && productFiles[0].isFile()) {
return productFiles[0];
}

Back to the top