From dac68c265156f6d8608d55d8e00df987dae9e635 Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 29 Sep 2010 14:56:52 +0000 Subject: 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 --- .../bundle/plugin/BundlesMetaDataBuildMojo.java | 45 ++++++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'maven-plugins/trunk') 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(""); - //ps.println(" "); - //ps.println(" "); + ps.println(" "); + ps.println(" "); ps.println(" "); - ps.println(" "); + ps.println(" "); for (String jar : jars) { ps.println(" "); } @@ -1049,14 +1056,36 @@ public class BundlesMetaDataBuildMojo extends AbstractMojo { ps.println(""); } } + + private void generateWhichJars(ProjectSet jarNames, File root, Log log) throws FileNotFoundException, IOException { + for (Map.Entry> e : jarNames.nameMap.entrySet()) { + Set 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> e : jarNames.nameMap.entrySet()) { MavenProject pom = jarNames.getProject(e.getKey()); Set 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(); -- cgit v1.2.3