summaryrefslogtreecommitdiffstats
path: root/maven-plugins/trunk
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-09-29 14:56:52 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-09-29 14:56:52 +0000
commitdac68c265156f6d8608d55d8e00df987dae9e635 (patch)
tree4f4e106be6488757d1058e1873af14d6f3c637cb /maven-plugins/trunk
parent38369674260614352b2fd1d8b3e36c4b7a53a7ea (diff)
Updates to get the ant build paths working and to generate a what-jars file
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1002663 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'maven-plugins/trunk')
-rw-r--r--maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java45
1 files changed, 37 insertions, 8 deletions
diff --git a/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java b/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java
index 4e316a4863..4a793fc8c1 100644
--- a/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java
+++ b/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java
@@ -305,6 +305,11 @@ public class BundlesMetaDataBuildMojo extends AbstractMojo {
* @parameter default-value="true"
*/
private boolean generateAntScript = true;
+
+ /**
+ * @parameter default-value="true"
+ */
+ private boolean generateWhichJars = true;
/**
* @parameter
@@ -655,7 +660,7 @@ public class BundlesMetaDataBuildMojo extends AbstractMojo {
copyFile(artifactFile, root);
}
bundleSymbolicNames.add(artifact, bundleName);
- bundleLocations.add(artifact, artifactFile.getName());
+ bundleLocations.add(artifact, artifactFile.getName());
jarNames.add(artifact, artifactFile.getName());
if (isServiceProvider(mf)) {
serviceProviders.add(artifact, bundleName);
@@ -680,7 +685,7 @@ public class BundlesMetaDataBuildMojo extends AbstractMojo {
}
bundleSymbolicNames.add(artifact, bundleName);
bundleLocations.add(artifact, dir.getName());
- jarNames.add(artifact, dirName + "/" + artifactFile.getName());
+ jarNames.add(artifact, dirName + "/" + artifactFile.getName());
if (isServiceProvider(mf)) {
serviceProviders.add(artifact, bundleName);
}
@@ -890,6 +895,10 @@ public class BundlesMetaDataBuildMojo extends AbstractMojo {
generateANTPath(jarNames, root, log);
}
+ if (generateWhichJars) {
+ generateWhichJars(jarNames, root, log);
+ }
+
if (generateAggregatedBundle) {
generateAggregatedBundles(bundleLocations, root, log);
}
@@ -1035,12 +1044,10 @@ public class BundlesMetaDataBuildMojo extends AbstractMojo {
ps.println(ASL_HEADER);
String name = trim(e.getKey());
ps.println("<project name=\"" + name + "\">");
- //ps.println(" <property name=\"tuscany.distro\" value=\"" + name + "\"/>");
- //ps.println(" <property name=\"tuscany.manifest\" value=\"" + new File(feature, manifestJarName)
- // .getCanonicalPath()
- // + "\"/>");
+ ps.println(" <property name=\"tuscany.manifest\" value=\"" + new File(feature, manifestJarName).getCanonicalPath() + "\"/>");
+ ps.println(" <dirname property=\"" + name + ".basedir\" file=\"${ant.file." + name + "}\"/>");
ps.println(" <path id=\"" + name + ".path" + "\">");
- ps.println(" <fileset dir=\"..\\..\\modules\">");
+ ps.println(" <fileset dir=\"${" + name + ".basedir}../../../modules\">");
for (String jar : jars) {
ps.println(" <include name=\"" + jar + "\"/>");
}
@@ -1049,14 +1056,36 @@ public class BundlesMetaDataBuildMojo extends AbstractMojo {
ps.println("</project>");
}
}
+
+ private void generateWhichJars(ProjectSet jarNames, File root, Log log) throws FileNotFoundException, IOException {
+ for (Map.Entry<String, Set<String>> e : jarNames.nameMap.entrySet()) {
+ Set<String> jars = e.getValue();
+ File feature = new File(root, "../" + featuresName + "/" + (useDistributionName ? trim(e.getKey()) : ""));
+ feature.mkdirs();
+ File whichJarsPath = new File(feature, "which-jars");
+ log.info("Generating Which Jars: " + whichJarsPath.getCanonicalPath());
+ FileOutputStream fos = new FileOutputStream(whichJarsPath);
+ PrintStream ps = new PrintStream(fos);
+
+ ps.println(ASL_HEADER);
+ String name = trim(e.getKey());
+ ps.println("Jars required to enable extension: " + name);
+ ps.println("");
+ for (String jar : jars) {
+ ps.println(jar);
+ }
+ }
+ }
private void generateManifestJar(ProjectSet jarNames, File root, Log log) throws FileNotFoundException, IOException {
for (Map.Entry<String, Set<String>> e : jarNames.nameMap.entrySet()) {
MavenProject pom = jarNames.getProject(e.getKey());
Set<String> jars = e.getValue();
+ String name = trim(e.getKey());
File feature = new File(root, "../" + featuresName + "/" + (useDistributionName ? trim(e.getKey()) : ""));
feature.mkdirs();
- File mfJar = new File(feature, manifestJarName);
+ String manifestName = name + "-manifest.jar";
+ File mfJar = new File(feature, manifestName);
log.info("Generating manifest jar: " + mfJar.getCanonicalPath());
FileOutputStream fos = new FileOutputStream(mfJar);
Manifest mf = new Manifest();