aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Pellaton2012-04-13 12:30:56 (EDT)
committerJan Sievers2012-04-19 13:05:56 (EDT)
commit320e624dfc14baad5e313e9194cfb5f274f42a30 (patch)
tree9df715f2d70b1748f409f5b716e9ac7d17c246cf
parentc20832d8b3c1528e2e91e935aad7ff0398a821ed (diff)
downloadorg.eclipse.tycho-320e624dfc14baad5e313e9194cfb5f274f42a30.zip
org.eclipse.tycho-320e624dfc14baad5e313e9194cfb5f274f42a30.tar.gz
org.eclipse.tycho-320e624dfc14baad5e313e9194cfb5f274f42a30.tar.bz2
347416 New parameter 'finalName' for the repo archive file namerefs/changes/93/5593/2
- Add the parameter finalName to the Mojo (defaults to ${project.build.finalName} ) - Use finalName as file name for the repository archive - adapt Tycho491PublishFeaturesAndCategoriesTest - Added test case RepositoryFinalNameTest with a custom finalName and asserts that check for the zip file being created having that name Change-Id: Ia50c4bf1bbeeee51cc863b74f549acd0791bd9e4
-rw-r--r--tycho-its/projects/p2Repository.finalName/category.xml3
-rw-r--r--tycho-its/projects/p2Repository.finalName/pom.xml39
-rw-r--r--tycho-its/src/test/java/org/eclipse/tycho/test/TYCHO491PublishFeaturesAndCategories/Tycho491PublishFeaturesAndCategoriesTest.java5
-rw-r--r--tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/finalName/RepositoryFinalNameTest.java37
-rw-r--r--tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/ArchiveRepositoryMojo.java11
5 files changed, 93 insertions, 2 deletions
diff --git a/tycho-its/projects/p2Repository.finalName/category.xml b/tycho-its/projects/p2Repository.finalName/category.xml
new file mode 100644
index 0000000..ffda4a4
--- /dev/null
+++ b/tycho-its/projects/p2Repository.finalName/category.xml
@@ -0,0 +1,3 @@
+<site>
+ <feature url="features/org.eclipse.equinox.executable_0.0.0.jar" id="org.eclipse.equinox.executable" version="0.0.0"/>
+</site> \ No newline at end of file
diff --git a/tycho-its/projects/p2Repository.finalName/pom.xml b/tycho-its/projects/p2Repository.finalName/pom.xml
new file mode 100644
index 0000000..548db4e
--- /dev/null
+++ b/tycho-its/projects/p2Repository.finalName/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>tycho-its-project.p2Repository.finalName</groupId>
+ <artifactId>testrepo</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <packaging>eclipse-repository</packaging>
+
+ <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>tycho-p2-repository-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <finalName>${project.artifactId}-myqualifier</finalName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>eclipse-3.4.2</id>
+ <layout>p2</layout>
+ <url>${p2.repo}</url>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/TYCHO491PublishFeaturesAndCategories/Tycho491PublishFeaturesAndCategoriesTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/TYCHO491PublishFeaturesAndCategories/Tycho491PublishFeaturesAndCategoriesTest.java
index 4a0a265..cd0f503 100644
--- a/tycho-its/src/test/java/org/eclipse/tycho/test/TYCHO491PublishFeaturesAndCategories/Tycho491PublishFeaturesAndCategoriesTest.java
+++ b/tycho-its/src/test/java/org/eclipse/tycho/test/TYCHO491PublishFeaturesAndCategories/Tycho491PublishFeaturesAndCategoriesTest.java
@@ -36,6 +36,8 @@ public class Tycho491PublishFeaturesAndCategoriesTest extends AbstractTychoInteg
private static final String ARTIFACT_ID = "example-eclipse-repository";
+ private static final String PROJECT_VERSION = "1.0.0-SNAPSHOT";
+
private static final String QUALIFIER = "20101116-forcedQualifier";
@Test
@@ -110,7 +112,8 @@ public class Tycho491PublishFeaturesAndCategoriesTest extends AbstractTychoInteg
static private void assertRepositoryContainsArtifact(Verifier verifier, String artifactPath) throws IOException,
ZipException {
- File repositoryArtifact = new File(verifier.getBasedir(), MODULE + "/target/" + ARTIFACT_ID + ".zip");
+ File repositoryArtifact = new File(verifier.getBasedir(), MODULE + "/target/" + ARTIFACT_ID + "-"
+ + PROJECT_VERSION + ".zip");
assertZipContainsEntry(repositoryArtifact, artifactPath);
}
diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/finalName/RepositoryFinalNameTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/finalName/RepositoryFinalNameTest.java
new file mode 100644
index 0000000..0f3dfd7
--- /dev/null
+++ b/tycho-its/src/test/java/org/eclipse/tycho/test/p2Repository/finalName/RepositoryFinalNameTest.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Netcetera 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:
+ * Michael Pellaton (Netcetera) - initial API and implementation
+ * Jan Sievers (SAP AG) - strip down integration test
+ *******************************************************************************/
+package org.eclipse.tycho.test.p2Repository.finalName;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.apache.maven.it.Verifier;
+import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
+import org.eclipse.tycho.test.util.ResourceUtil;
+import org.junit.Test;
+
+public class RepositoryFinalNameTest extends AbstractTychoIntegrationTest {
+
+ private static final String FINAL_NAME = "testrepo-myqualifier";
+
+ @Test
+ public void testCustomFinalName() throws Exception {
+ Verifier verifier = getVerifier("/p2Repository.finalName", false);
+ verifier.getCliOptions().add("-Dp2.repo=" + ResourceUtil.P2Repositories.ECLIPSE_342.toString());
+ verifier.executeGoal("package");
+ verifier.verifyErrorFreeLog();
+ File repositoryArchive = new File(verifier.getBasedir(), "target/" + FINAL_NAME + ".zip");
+ String name = repositoryArchive.getAbsolutePath();
+ assertTrue("Repository archive with name '" + name + "' does not exist.", repositoryArchive.isFile());
+ }
+}
diff --git a/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/ArchiveRepositoryMojo.java b/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/ArchiveRepositoryMojo.java
index d0b80e6..58e22e4 100644
--- a/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/ArchiveRepositoryMojo.java
+++ b/tycho-p2/tycho-p2-repository-plugin/src/main/java/org/eclipse/tycho/plugins/p2/repository/ArchiveRepositoryMojo.java
@@ -7,6 +7,7 @@
*
* Contributors:
* SAP AG - initial API and implementation
+ * Michael Pellaton (Netcetera) - add finalName mojo parameter
*******************************************************************************/
package org.eclipse.tycho.plugins.p2.repository;
@@ -30,8 +31,16 @@ public final class ArchiveRepositoryMojo extends AbstractRepositoryMojo {
*/
private Archiver inflater;
+ /**
+ * Name of the generated zip file (without extension).
+ *
+ * @parameter expression="${project.build.finalName}"
+ */
+ private String finalName;
+
public void execute() throws MojoExecutionException, MojoFailureException {
- File destFile = getBuildDirectory().getChild(getProject().getArtifactId() + ".zip");
+
+ File destFile = getBuildDirectory().getChild(finalName + ".zip");
try {
inflater.addDirectory(getAssemblyRepositoryLocation());