aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Alexander Kuppe2012-01-13 11:24:07 (EST)
committerJan Sievers2012-01-30 07:07:33 (EST)
commit066a12dc3686f14c637f901fc413d6959830f682 (patch)
tree8e68d509d5266b31db215808e930fd8335a6fd92
parent7659706cbae99e1a4781098b67d8d38a4dfc8f5e (diff)
downloadorg.eclipse.tycho-066a12dc3686f14c637f901fc413d6959830f682.zip
org.eclipse.tycho-066a12dc3686f14c637f901fc413d6959830f682.tar.gz
org.eclipse.tycho-066a12dc3686f14c637f901fc413d6959830f682.tar.bz2
357503 Support customizing product archive file names
Product archive file name prefixes (without <os>.<ws>.<arch>.<archiveExtension> suffix) can now be specified using <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-p2-director-plugin</artifactId> <configuration> <products> <product> <id>PRODUCT_UID</id> <archiveFileName>CUSTOM_ARCHIVE_NAME</archiveFileName> </product> </products> </configuration> </plugin> The default archive name is still the product id (unchanged).
-rw-r--r--tycho-its/projects/368079_productArchiveFormat/pom.xml7
-rw-r--r--tycho-its/src/test/java/org/eclipse/tycho/test/bug368079_productArchiveFormat/ProductArchiveFormatTest.java6
-rw-r--r--tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/Product.java21
-rw-r--r--tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java10
4 files changed, 39 insertions, 5 deletions
diff --git a/tycho-its/projects/368079_productArchiveFormat/pom.xml b/tycho-its/projects/368079_productArchiveFormat/pom.xml
index 9ffccda..3005ba0 100644
--- a/tycho-its/projects/368079_productArchiveFormat/pom.xml
+++ b/tycho-its/projects/368079_productArchiveFormat/pom.xml
@@ -86,6 +86,13 @@
<!-- non-zip for macosx -->
<macosx>tar.gz</macosx>
</formats>
+ <!-- custom archive file name -->
+ <products>
+ <product>
+ <id>368079_productArchiveFormat</id>
+ <archiveFileName>customArchiveName</archiveFileName>
+ </product>
+ </products>
</configuration>
</plugin>
</plugins>
diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/bug368079_productArchiveFormat/ProductArchiveFormatTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/bug368079_productArchiveFormat/ProductArchiveFormatTest.java
index 6258b49..53c70db 100644
--- a/tycho-its/src/test/java/org/eclipse/tycho/test/bug368079_productArchiveFormat/ProductArchiveFormatTest.java
+++ b/tycho-its/src/test/java/org/eclipse/tycho/test/bug368079_productArchiveFormat/ProductArchiveFormatTest.java
@@ -28,9 +28,9 @@ public class ProductArchiveFormatTest extends AbstractTychoIntegrationTest {
File basedir = new File(verifier.getBasedir());
- assertFileExists(basedir, "target/products/368079_productArchiveFormat-win32.win32.x86.zip");
- assertFileExists(basedir, "target/products/368079_productArchiveFormat-linux.gtk.x86.zip");
- assertFileExists(basedir, "target/products/368079_productArchiveFormat-macosx.cocoa.x86_64.tar.gz");
+ assertFileExists(basedir, "target/products/customArchiveName-win32.win32.x86.zip");
+ assertFileExists(basedir, "target/products/customArchiveName-linux.gtk.x86.zip");
+ assertFileExists(basedir, "target/products/customArchiveName-macosx.cocoa.x86_64.tar.gz");
}
}
diff --git a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/Product.java b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/Product.java
index 839f7c4..1613077 100644
--- a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/Product.java
+++ b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/Product.java
@@ -34,6 +34,12 @@ public final class Product {
*/
private String rootFolder;
+ /**
+ * The name of the output archive file (without extension). If omitted, the id will be used
+ * instead.
+ */
+ private String archiveFileName;
+
public Product() {
}
@@ -58,6 +64,13 @@ public final class Product {
return rootFolder;
}
+ /**
+ * @return An archive file name without extension
+ */
+ public String getArchiveFileName() {
+ return archiveFileName;
+ }
+
@Override
public String toString() {
return "Product [id=" + id + ", attachId=" + attachId + "]";
@@ -69,6 +82,7 @@ public final class Product {
int result = 1;
result = prime * result + ((attachId == null) ? 0 : attachId.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((archiveFileName == null) ? 0 : archiveFileName.hashCode());
return result;
}
@@ -78,7 +92,8 @@ public final class Product {
return true;
if (obj instanceof Product) {
Product other = (Product) obj;
- return equals(this.id, other.id) && equals(this.attachId, other.attachId);
+ return equals(this.id, other.id) && equals(this.attachId, other.attachId)
+ && equals(this.archiveFileName, other.archiveFileName);
}
return false;
}
@@ -91,4 +106,8 @@ public final class Product {
else
return left.equals(right);
}
+
+ public void setArchiveFileName(String anArchiveFileName) {
+ this.archiveFileName = anArchiveFileName;
+ }
}
diff --git a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java
index b93d9a7..b74b100 100644
--- a/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java
+++ b/tycho-p2/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductArchiverMojo.java
@@ -126,7 +126,7 @@ public final class ProductArchiverMojo extends AbstractProductMojo {
+ " format=" + format);
}
- File productArchive = new File(getProductsBuildDirectory(), product.getId() + "-"
+ File productArchive = new File(getProductsBuildDirectory(), getArchiveFileName(product) + "-"
+ getOsWsArch(env, '.') + "." + format);
try {
@@ -146,6 +146,14 @@ public final class ProductArchiverMojo extends AbstractProductMojo {
}
}
+ static String getArchiveFileName(Product product) {
+ if (product.getArchiveFileName() != null) {
+ return product.getArchiveFileName();
+ } else {
+ return product.getId();
+ }
+ }
+
static String getArtifactClassifier(Product product, TargetEnvironment environment, String format) {
// classifier (and hence artifact file name) ends with os.ws.arch (similar to Eclipse
// download packages)