Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaeubi2019-08-27 11:43:17 +0000
committerlaeubi2019-08-27 11:43:17 +0000
commit3fde10ef254cb7ddaa19345f2e5011bd77c9427b (patch)
treea0b2ce808b7d6ed89ca91173f8d0e071f699ebed
parent8aff8a777de91fe2b98b3579af2613cf51117e45 (diff)
downloadorg.eclipse.tycho.extras-3fde10ef254cb7ddaa19345f2e5011bd77c9427b.tar.gz
org.eclipse.tycho.extras-3fde10ef254cb7ddaa19345f2e5011bd77c9427b.tar.xz
org.eclipse.tycho.extras-3fde10ef254cb7ddaa19345f2e5011bd77c9427b.zip
Bug 478704 - path must be canonical + merge tests + add logging
Change-Id: I6ea595cf4ddebcfceae50f1d0ee879072bc7ea42 Signed-off-by: laeubi <laeubi@laeubi-soft.de>
-rw-r--r--tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessITest.java18
-rw-r--r--tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessStructuredITest.java48
-rw-r--r--tycho-pomless/src/main/java/org/eclipse/tycho/pomless/AbstractTychoMapping.java11
3 files changed, 25 insertions, 52 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 0bb7f67..7f2f5d8 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
@@ -57,6 +57,24 @@ public class TychoPomlessITest extends AbstractTychoExtrasIntegrationTest {
}
+ @Test
+ public void testPomlessStructuredBuildExtension() throws Exception {
+ Verifier verifier = getVerifier("testpomless-structured", false);
+ verifier.addCliOption("-Dp2.repo=" + new File("repositories/kepler").getAbsoluteFile().toURI().toString());
+ 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());
+ assertThat(new File(baseDir, "bundles/bundle1/target/pomless.bundle-0.1.0-SNAPSHOT.jar"), isFile());
+ assertThat(new File(baseDir, "tests/bundle1.tests/target/pomless.bundle.tests-1.0.1.jar"), isFile());
+ assertThat(new File(baseDir, "features/feature/target/pomless.feature-1.0.0-SNAPSHOT.jar"), isFile());
+ assertThat(new File(baseDir, "releng/product/target/my.test.product.pomless-1.0.0.zip"), isFile());
+ isRepository(baseDir, "releng/product");
+ assertThat(new File(baseDir, "releng/site1/target/site1.eclipse-repository-0.0.1-SNAPSHOT.zip"), isFile());
+ isRepository(baseDir, "releng/site1");
+
+ }
+
private void isRepository(File baseDir, String subdir) {
assertThat(new File(baseDir, subdir + "/target/repository/artifacts.jar"), isFile());
assertThat(new File(baseDir, subdir + "/target/repository/content.jar"), isFile());
diff --git a/tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessStructuredITest.java b/tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessStructuredITest.java
deleted file mode 100644
index 2723194..0000000
--- a/tycho-extras-its/src/test/java/org/eclipse/tycho/extras/pomless/TychoPomlessStructuredITest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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
- *******************************************************************************/
-package org.eclipse.tycho.extras.pomless;
-
-import static java.util.Arrays.asList;
-import static org.eclipse.tycho.extras.its.TychoMatchers.isFile;
-import static org.junit.Assert.assertThat;
-
-import java.io.File;
-
-import org.apache.maven.it.Verifier;
-import org.eclipse.tycho.extras.its.AbstractTychoExtrasIntegrationTest;
-import org.junit.Test;
-
-public class TychoPomlessStructuredITest extends AbstractTychoExtrasIntegrationTest {
-
- @Test
- public void testPomlessBuildExtension() throws Exception {
- Verifier verifier = getVerifier("testpomless-structured", false);
- verifier.addCliOption("-Dp2.repo=" + new File("repositories/kepler").getAbsoluteFile().toURI().toString());
- 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());
- assertThat(new File(baseDir, "bundles/bundle1/target/pomless.bundle-0.1.0-SNAPSHOT.jar"), isFile());
- assertThat(new File(baseDir, "tests/bundle1.tests/target/pomless.bundle.tests-1.0.1.jar"), isFile());
- assertThat(new File(baseDir, "features/feature/target/pomless.feature-1.0.0-SNAPSHOT.jar"), isFile());
- assertThat(new File(baseDir, "releng/product/target/my.test.product.pomless-1.0.0.zip"), isFile());
- isRepository(baseDir, "releng/product");
- assertThat(new File(baseDir, "releng/site1/target/site1.eclipse-repository-0.0.1-SNAPSHOT.zip"), isFile());
- isRepository(baseDir, "releng/site1");
-
- }
-
- private void isRepository(File baseDir, String subdir) {
- assertThat(new File(baseDir, subdir + "/target/repository/artifacts.jar"), isFile());
- assertThat(new File(baseDir, subdir + "/target/repository/content.jar"), isFile());
- }
-
-}
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 ff29900..8a87894 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
@@ -188,15 +188,14 @@ public abstract class AbstractTychoMapping implements Mapping, ModelReader {
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 fileOrFolder = new File(projectRoot, parentRef).getCanonicalFile();
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");
+ throw new FileNotFoundException("parent pom file/folder " + fileOrFolder + " is not accessible");
}
if (parentPom == null) {
throw new FileNotFoundException("No parent pom file found in " + fileOrFolder.getCanonicalPath());
@@ -219,7 +218,11 @@ public abstract class AbstractTychoMapping implements Mapping, ModelReader {
version = parentModel.getParent().getVersion();
}
parentReference.setVersion(version);
- parentReference.setRelativePath(projectRoot.toPath().relativize(parentPom.toPath()).toString());
+ parentReference
+ .setRelativePath(projectRoot.getCanonicalFile().toPath().relativize(parentPom.toPath()).toString());
+ logger.debug("Derived parent for path " + projectRoot + " is goupId: " + parentReference.getGroupId()
+ + ", artifactId: " + parentReference.getArtifactId() + ", relativePath: "
+ + parentReference.getRelativePath());
return parentReference;
}

Back to the top