You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2010/09/29 16:56:53 UTC
svn commit: r1002663 -
/tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java
Author: slaws
Date: Wed Sep 29 14:56:52 2010
New Revision: 1002663
URL: http://svn.apache.org/viewvc?rev=1002663&view=rev
Log:
Updates to get the ant build paths working and to generate a what-jars file
Modified:
tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java
Modified: tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java
URL: http://svn.apache.org/viewvc/tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java?rev=1002663&r1=1002662&r2=1002663&view=diff
==============================================================================
--- tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java (original)
+++ tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundlesMetaDataBuildMojo.java Wed Sep 29 14:56:52 2010
@@ -305,6 +305,11 @@ public class BundlesMetaDataBuildMojo ex
* @parameter default-value="true"
*/
private boolean generateAntScript = true;
+
+ /**
+ * @parameter default-value="true"
+ */
+ private boolean generateWhichJars = true;
/**
* @parameter
@@ -655,7 +660,7 @@ public class BundlesMetaDataBuildMojo ex
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 ex
}
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 ex
generateANTPath(jarNames, root, log);
}
+ if (generateWhichJars) {
+ generateWhichJars(jarNames, root, log);
+ }
+
if (generateAggregatedBundle) {
generateAggregatedBundles(bundleLocations, root, log);
}
@@ -1035,12 +1044,10 @@ public class BundlesMetaDataBuildMojo ex
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 ex
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();