From 34e73e72be75113ede3e74a1723fab9a14c26dbe Mon Sep 17 00:00:00 2001 From: rfeng Date: Thu, 29 Jan 2009 01:26:58 +0000 Subject: Group the config under the "features" folder git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@738696 13f79535-47bb-0310-9956-ffa450edef68 --- .../bundle/plugin/ModuleBundlesBuildMojo.java | 68 +++++++++++++++------- 1 file changed, 48 insertions(+), 20 deletions(-) (limited to 'java') diff --git a/java/sca/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java b/java/sca/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java index a54fd25736..e9523f45bf 100644 --- a/java/sca/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java +++ b/java/sca/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java @@ -202,6 +202,27 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { * @parameter */ private ArtifactAggregation[] artifactAggregations; + + private static final String XML_PI = ""; + private static final String ASL_HEADER = + ""; /** * Group the artifacts by distribution poms @@ -472,15 +493,16 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { if (generateTargetPlatform) { for (Map.Entry> e : bundleSymbolicNames.nameMap.entrySet()) { Set bundles = e.getValue(); - File feature = new File(root, "../" + (useDistributionName ? trim(e.getKey()) : "")); - feature.mkdir(); + String name = trim(e.getKey()); + File feature = new File(root, "../features/" + (useDistributionName ? name : "")); + feature.mkdirs(); File target = new File(feature, "tuscany.target"); log.info("Generating target definition: " + target); FileOutputStream targetFile = new FileOutputStream(target); if (!bundles.contains("org.eclipse.osgi")) { bundles.add("org.eclipse.osgi"); } - writeTarget(new PrintStream(targetFile), trim(e.getKey()), bundles, eclipseFeatures); + writeTarget(new PrintStream(targetFile), name, bundles, eclipseFeatures); targetFile.close(); } } @@ -496,7 +518,7 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { if (generateConfig) { for (Map.Entry> e : bundleLocations.nameMap.entrySet()) { Set locations = e.getValue(); - File feature = new File(root, "../" + (useDistributionName ? trim(e.getKey()) : "")); + File feature = new File(root, "../features/" + (useDistributionName ? trim(e.getKey()) : "")); File config = new File(feature, "configuration"); config.mkdirs(); File ini = new File(config, "config.ini"); @@ -518,14 +540,14 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { for (Map.Entry> e : jarNames.nameMap.entrySet()) { MavenProject pom = jarNames.getProject(e.getKey()); Set jars = e.getValue(); - File feature = new File(root, "../" + (useDistributionName ? trim(e.getKey()) : "")); - feature.mkdir(); + File feature = new File(root, "../features/" + (useDistributionName ? trim(e.getKey()) : "")); + feature.mkdirs(); File mfJar = new File(feature, "manifest.jar"); log.info("Generating manifest jar: " + mfJar); FileOutputStream fos = new FileOutputStream(mfJar); Manifest mf = new Manifest(); StringBuffer cp = new StringBuffer(); - String path = "../" + root.getName(); + String path = (useDistributionName ? "../../" : "../") + root.getName(); for (String jar : jars) { cp.append(path).append('/').append(jar).append(' '); } @@ -548,23 +570,27 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { if (generateAntScript) { for (Map.Entry> e : jarNames.nameMap.entrySet()) { Set jars = e.getValue(); - File feature = new File(root, "../" + (useDistributionName ? trim(e.getKey()) : "")); - feature.mkdir(); + File feature = new File(root, "../features/" + (useDistributionName ? trim(e.getKey()) : "")); + feature.mkdirs(); File antPath = new File(feature, "build-path.xml"); log.info("Generating ANT build path: " + antPath); FileOutputStream fos = new FileOutputStream(antPath); PrintStream ps = new PrintStream(fos); - ps.println(""); - ps.println(""); + ps.println(" "); + ps.println(" "); - ps.println(""); - ps.println(" "); + ps.println(" "); + ps.println(" "); for (String jar : jars) { - ps.println(" "); + ps.println(" "); } - ps.println(" "); - ps.println(""); - ps.println(""); + ps.println(" "); + ps.println(" "); + ps.println(""); } } @@ -581,7 +607,7 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { */ private String trim(String artifactId) { if (artifactId.startsWith("tuscany-distribution-")) { - return "feature-" + artifactId.substring("tuscany-distribution-".length()); + return artifactId.substring("tuscany-distribution-".length()); } else { return artifactId; } @@ -605,8 +631,9 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { } private void writeTarget(PrintStream ps, String pom, Set ids, String[] features) { - ps.println(""); + ps.println(XML_PI); ps.println(""); + ps.println(ASL_HEADER); ps.println(""); @@ -649,8 +676,9 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { } private static void writePluginXML(PrintStream ps) { - ps.println(""); + ps.println(XML_PI); ps.println(""); + ps.println(ASL_HEADER); ps.println(""); ps.println(""); ps.println("