Revision: 21 http://mvn-infix.svn.sourceforge.net/mvn-infix/?rev=21&view=rev Author: bindul Date: 2010-11-22 14:32:21 +0000 (Mon, 22 Nov 2010)
Log Message: ----------- Updates after the weekend! Modified Paths: -------------- infix-parent/trunk/pom.xml infix-site/trunk/src/site/site.xml plugins/maven-jsmooth-plugin/trunk/pom.xml skins/infix-site-skin/trunk/src/site/site.xml Added Paths: ----------- plugins/maven-jsmooth-plugin/trunk/src/changes/changes.xml plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/ plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/ClasspathInputStreamFacade.java plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/JSmoothCompileMojo.java plugins/maven-jsmooth-plugin/trunk/src/site/apt/index.apt plugins/maven-jsmooth-plugin/trunk/src/site/apt/insight-jsmooth-conf.apt plugins/maven-jsmooth-plugin/trunk/src/site/apt/usage.apt plugins/maven-jsmooth-plugin/trunk/src/site/site.xml Removed Paths: ------------- infix-site/trunk/src/target/ Property Changed: ---------------- infix-parent/trunk/ infix-site/trunk/ Property changes on: infix-parent/trunk ___________________________________________________________________ Added: svn:ignore + .project Modified: infix-parent/trunk/pom.xml =================================================================== --- infix-parent/trunk/pom.xml 2010-11-22 12:15:10 UTC (rev 20) +++ infix-parent/trunk/pom.xml 2010-11-22 14:32:21 UTC (rev 21) @@ -176,9 +176,22 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> + <version>2.3</version> + <configuration> + <addActionDate>true</addActionDate> + <issueLinkTemplatePerSystem> + <mantisbt>%URL%/view.php?id=%ISSUE%</mantisbt> + <insightbugs>https://sourceforge.net/tracker2/index.php?func=detail&group_id=212019&atid=1020092&aid=%ISSUE%</insightbugs> + <insightfrq>https://sourceforge.net/tracker2/index.php?func=detail&group_id=212019&atid=1020095&aid=%ISSUE%</insightfrq> + </issueLinkTemplatePerSystem> + </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> </plugin> <plugin> @@ -298,6 +311,14 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> <version>2.3</version> + <configuration> + <addActionDate>true</addActionDate> + <issueLinkTemplatePerSystem> + <mantisbt>%URL%/view.php?id=%ISSUE%</mantisbt> + <insightbugs>https://sourceforge.net/tracker2/index.php?func=detail&group_id=212019&atid=1020092&aid=%ISSUE%</insightbugs> + <insightfrq>https://sourceforge.net/tracker2/index.php?func=detail&group_id=212019&atid=1020095&aid=%ISSUE%</insightfrq> + </issueLinkTemplatePerSystem> + </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -477,6 +498,7 @@ </profile> </profiles> <!-- Repositories and distribution on SF.net --> + <!-- <repositories> <repository> <id>mvn-infix-repo</id> @@ -507,6 +529,7 @@ <layout>default</layout> </pluginRepository> </pluginRepositories> + --> <distributionManagement> <repository> <id>mvn-infix-frs.sf.net</id> Property changes on: infix-site/trunk ___________________________________________________________________ Added: svn:ignore + target .project Modified: infix-site/trunk/src/site/site.xml =================================================================== --- infix-site/trunk/src/site/site.xml 2010-11-22 12:15:10 UTC (rev 20) +++ infix-site/trunk/src/site/site.xml 2010-11-22 14:32:21 UTC (rev 21) @@ -34,6 +34,10 @@ <logo name="GPL version 3" alt="GPL v3" href="http://www.gnu.org/licenses/gpl-3.0.html" img="http://www.gnu.org/graphics/gplv3-88x31.png"/> </poweredBy> <publishDate format="dd MMM yyyy" position="left"/> + <bannerLeft> + <name>MindTree Infix</name> + <href>${project.url}</href> + </bannerLeft> <bannerRight> <name>from MindTree</name> <href>http://www.mindtree.com/</href> Modified: plugins/maven-jsmooth-plugin/trunk/pom.xml =================================================================== --- plugins/maven-jsmooth-plugin/trunk/pom.xml 2010-11-22 12:15:10 UTC (rev 20) +++ plugins/maven-jsmooth-plugin/trunk/pom.xml 2010-11-22 14:32:21 UTC (rev 21) @@ -38,4 +38,10 @@ <artifactId>plexus-utils</artifactId> </dependency> </dependencies> + <contributors> + <contributor> + <name>Christoph Brill</name> + <email>http://www.google.com/recaptcha/mailhide/d?k=01aMH2eWAEuCVTzQyiL63PTw==&c=gMxj7aM5RgiK9tw2KwzzJmbsCgFDlPd1Y8x9eAt-6rw=</email> + </contributor> + </contributors> </project> Added: plugins/maven-jsmooth-plugin/trunk/src/changes/changes.xml =================================================================== --- plugins/maven-jsmooth-plugin/trunk/src/changes/changes.xml (rev 0) +++ plugins/maven-jsmooth-plugin/trunk/src/changes/changes.xml 2010-11-22 14:32:21 UTC (rev 21) @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + | + | Copyright (c) 2007-2009 MindTree Ltd. + | + | This file is part of Insight Release Engineering Tools. + | + | Insight Release Engineering Tools is free software: you can redistribute + | it and/or modify it under the terms of the GNU General Public License as + | published by the Free Software Foundation, either version 3 of the License, + | or (at your option) any later version. + | + | Insight Release Engineering Tools is distributed in the hope that it will + | be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + | Public License for more details. + | + | You should have received a copy of the GNU General Public License along with + | Insight Release Engineering Tools. If not, see + | <http://www.gnu.org/licenses/>. + | +--> +<!-- For reference, see http://maven.apache.org/plugins/maven-changes-plugin/changes.html --> +<!-- Defined BugTrack systems: bugs, featureRequests, default --> +<document xmlns="http://maven.apache.org/changes/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd"> + <properties> + <title>Maven JSmooth Plug-in</title> + </properties> + <body> + <release version="0.3.0" date="SNAPSHOT" description="Feature Release"> + <action type="update" date="2009-03-09" dev="bindul" issue="3" system="mantisbt"> + Made code compatible with JDK 1.4. We will stay here for a little while longer. + </action> + <action type="fix" date="2009-03-30" dev="bindul" issue="8" system="mantisbt"> + Changed strategy for copying skeleton directory to a more robust + one - we don't depend on code source any more, and load from + classpath- file list in a property file + </action> + <action type="fix" date="2009-04-03" due-to="Christoph Brill" due-to-email="http://www.google.com/recaptcha/mailhide/d?k=01aMH2eWAEuCVTzQyiL63PTw==&c=gMxj7aM5RgiK9tw2KwzzJmbsCgFDlPd1Y8x9eAt-6rw=" issue="9" system="mantisbt"> + Fixes skipJsmooth not working + </action> + </release> + <release version="0.2.0" date="2008-04-17" description="Bug fixes"> + <action type="update" date="2008-04-17" dev="bindul" issue="1936496" system="insightbugs"> + Partial fix for issue reported + </action> + </release> + <release version="0.1.0" date="2008-01-13" description="Initial release to support Insight"> + </release> + </body> +</document> \ No newline at end of file Property changes on: plugins/maven-jsmooth-plugin/trunk/src/changes/changes.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/ClasspathInputStreamFacade.java =================================================================== --- plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/ClasspathInputStreamFacade.java (rev 0) +++ plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/ClasspathInputStreamFacade.java 2010-11-22 14:32:21 UTC (rev 21) @@ -0,0 +1,83 @@ +/* + * $HeadURL$ + * + * Copyright (c) 2010 MindTree Ltd. + * + * This file is part of Infix Maven Plugins + * + * Infix Maven Plugins is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * Infix Maven Plugins is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * Infix Maven Plugins. If not, see <http://www.gnu.org/licenses/>. + */ +package com.mindtree.techworks.infix.jsmooth; + +import java.io.IOException; +import java.io.InputStream; + +import org.codehaus.plexus.util.io.InputStreamFacade; + + +/** + * An <code>InputStreamFacade</code> implementation to load data from classpath. + * This implementation can be passed a classpath, and it will use that to + * resolve the <code>resource</code>, else it will use the classpath of this + * instance. + * + * @since 0.3.0 + * @author Bindul Bhowmik + * @version $Revision$ $Date$ + */ +public class ClasspathInputStreamFacade implements InputStreamFacade { + + /** + * The resource location in the classpath + */ + private String resourceLocation; + + /** + * Classloader to use to load the resource, or uses the classpath of this + * instance. + */ + private ClassLoader classLoader; + + /** + * Creates a new <code>ClasspathInputStreamFacade</code> implementation + * + * @param resourceLocation The resource to load + * @param classLoader The classloader to use to load the resource + */ + public ClasspathInputStreamFacade(String resourceLocation, + ClassLoader classLoader) { + this.resourceLocation = resourceLocation; + this.classLoader = classLoader; + } + + /** + * Creates a new <code>ClasspathInputStreamFacade</code> implementation + * + * @param resourceLocation The resource to load + */ + public ClasspathInputStreamFacade(String resourceLocation) { + this.resourceLocation = resourceLocation; + } + + /* (non-Javadoc) + * @see org.codehaus.plexus.util.io.InputStreamFacade#getInputStream() + */ + public InputStream getInputStream() throws IOException { + ClassLoader cl = this.classLoader; + if (cl == null) { + cl = getClass().getClassLoader(); + } + return cl.getResourceAsStream(resourceLocation); + } +} Property changes on: plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/ClasspathInputStreamFacade.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/JSmoothCompileMojo.java =================================================================== --- plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/JSmoothCompileMojo.java (rev 0) +++ plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/JSmoothCompileMojo.java 2010-11-22 14:32:21 UTC (rev 21) @@ -0,0 +1,680 @@ +/* + * $HeadURL$ + * + * Copyright (c) 2010 MindTree Ltd. + * + * This file is part of Infix Maven Plugins + * + * Infix Maven Plugins is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * Infix Maven Plugins is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * Infix Maven Plugins. If not, see <http://www.gnu.org/licenses/>. + */ +package com.mindtree.techworks.infix.jsmooth; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; + +import net.charabia.jsmoothgen.application.ExeCompiler; +import net.charabia.jsmoothgen.application.JSmoothModelBean; +import net.charabia.jsmoothgen.application.JSmoothModelPersistency; +import net.charabia.jsmoothgen.skeleton.SkeletonBean; +import net.charabia.jsmoothgen.skeleton.SkeletonList; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectHelper; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.io.InputStreamFacade; + + +/** + * This is the entry class for the maven plugin to compile a Jsmooth file. + * + * <br/> The following tasks are accomplished in order: + * <ol> + * <li>Create a temporary folder under 'target'</li> + * <li>Copy the jsmooth file to the target folder</li> + * <li>Apply any filters required to the .jsmooth file</li> + * <li>Call Jsmooth's {...@link ExeCompiler}</li> + * </ol> + * + * @see AbstractMojo + * + * @author Bindul Bhowmik + * @version $Revision$ $Date$ + * + * @goal jsmoothcompile + * @requiresDependencyResolution test + * @requiresDependencyResolution compile + * @requiresDependencyResolution runtime + * @description Compiles the Jsmooth executable for the project + */ +public class JSmoothCompileMojo extends AbstractMojo { + + + /** + * The plugin configuratino file + */ + private static final String CONFIG_FILE = "pluginconfig.properties"; + + /** + * List of skeleton files that will be extracted from the classpath and set + */ + private List<String> skeletonFiles = null; + + /** + * The parent of the directory to which the skeletons are copied + */ + private String parentSkeletonDirectory = null; + + /** + * Flag to allow one or more executions of the build to skip the compile + * + * @parameter default-value="false" + */ + private boolean skipJSmooth; + + /** + * The relative location of the jsmooth file + * + * @parameter + * @required + */ + private String jsmoothFile; + + /** + * The location of the icon file + * + * @parameter + */ + private String iconLocation; + + /** + * Flag to indicate if the exe name generated in the build process is to be + * replaced in the jsmooth file + * + * @parameter default-value="false" + */ + private boolean setExeName; + + /** + * Flag to indicate if the jar name generated in the build process is to be + * replaced in the jsmooth file + * + * @parameter default-value="true" + */ + private boolean setJarName; + + /** + * If dependencies are to be set from a base directory, the name of the base + * directory + * + * @parameter + */ + private String dependencyBaseDir; + + /** + * Flag to indicate if dependencies are to be included + * + * @parameter default-value="true" + */ + private boolean includeDependencies; + + /** + * The optional parameter to indicate the scope of dependencies to include. + * The allowed values are runtime, compile and test. + * + * @parameter default-value="runtime" + */ + private String dependencyScope; + + /** + * The maven project we are working in + * + * @parameter default-value="${project}" + * @required + * @readonly + */ + private MavenProject project; + + /** + * Maven ProjectHelper. + * + * @component + */ + private MavenProjectHelper projectHelper; + + /* + * (non-Javadoc) + * + * @see org.apache.maven.plugin.Mojo#execute() + */ + public void execute() throws MojoExecutionException, MojoFailureException { + if (skipJSmooth) { + getLog().info("Skipping JSmooth Compile, as skipJSmooth flag " + + "is set to false"); + return; + } + + // Load the properties + loadConfig(); + + // Resolve the Jsmooth file path + File jSmthFile = resolveFile(jsmoothFile); + getLog().info("Using jsmooth file... " + jSmthFile.getAbsolutePath()); + + // Load the jsmooth file + JSmoothModelBean jsmoothModel = null; + try { + jsmoothModel = JSmoothModelPersistency.load(jSmthFile); + } catch (IOException e) { + getLog().error("IOException while reading jsmooth file", e); + throw new MojoFailureException(this, + "IOException reading jsmooth file", e.getMessage()); + } + + // Modify stuff + manipulateModelFile(jsmoothModel); + + // Create the temporary directory + File jsmoothTmpDir = createTemporaryDirectory(); + + // Write the modified jsmooth file for debugging + writeJsmoothFile(jsmoothTmpDir, jsmoothModel); + + // Write out the skeletons + File skeletonDir = writeSkeletons(jsmoothTmpDir); + + // Compile stuff + File compiledFile = compileJSmooth(skeletonDir, jsmoothModel); + + projectHelper.attachArtifact(project, "exe", compiledFile); + } + + /** + * Loads the configuration for this plug-in from the property file. + * + * @throws MojoExecutionException If there is an error loading the properties + */ + private void loadConfig() throws MojoExecutionException { + + // Load the property file + InputStream propertyFile = getClass().getResourceAsStream(CONFIG_FILE); + Properties config = new Properties(); + try { + config.load(propertyFile); + } catch (IOException e) { + getLog().error( + "Error loading configuration file " + CONFIG_FILE + + " from classpath", e); + throw new MojoExecutionException("Error loading configuration file " + + CONFIG_FILE + " from classpath", e); + } finally { + try { + propertyFile.close(); + } catch (IOException e) { + // Ignore + } + } + + // Load the parent skelton directory property + parentSkeletonDirectory = config.getProperty("jsmooth.skel.parent", + "skeletons"); + + // Load the list of property files + String skeletonFilesProp = config.getProperty("jsmooth.skel.files"); + StringTokenizer tokenizer = new StringTokenizer(skeletonFilesProp, ","); + List<String> skelFiles = new ArrayList<String>(); + while (tokenizer.hasMoreTokens()) { + skelFiles.add(tokenizer.nextToken().trim()); + } + + if (getLog().isDebugEnabled()) { + getLog().debug("Skeleton files: "); + for (int i = 0; i < skelFiles.size(); i++) { + getLog().debug("\t" + skelFiles.get(i)); + } + } + skeletonFiles = skelFiles; + } + + /** + * Calls <code>JSmoothGen</code> to compile the jar into an executable. + * + * @param skeletonRoot The root directory where skeletons are present + * @param model The model bean + * @return The location of the compile file + * @throws MojoExecutionException If there is an exception compiling + */ + private File compileJSmooth(File skeletonRoot, JSmoothModelBean model) throws MojoExecutionException { + try { + SkeletonList skelList = new SkeletonList(skeletonRoot); + + File out = new File(project.getBuild().getDirectory(), model + .getExecutableName()); + getLog().debug("Determined output file: " + out.getAbsolutePath()); + + SkeletonBean skel = skelList.getSkeleton(model.getSkeletonName()); + File skelroot = skelList.getDirectory(skel); + getLog().debug( + "Using skeleton [" + skel.getShortName() + "] from root [" + + skelroot.getAbsolutePath() + "] "); + + final ExeCompiler compiler = new ExeCompiler(); + compiler.addListener(new ExeCompiler.StepListener() { + + public void complete() { + getLog().info("JSmooth generation complete"); + } + + public void failed() { + getLog().error("JSmooth generation failed"); + } + + public void setNewState(int percentComplete, String state) { + + getLog().debug( + "jsmooth: " + state + " ( " + percentComplete + + "%)"); + } + }); + + if (compiler.compile(skelroot, skel, new File(project.getBuild() + .getDirectory()), model, out)) { + getLog().info( + "Java application wrapped in " + + model.getExecutableName()); + } else { + getLog().error("jsmoothgen failed: " + compiler.getErrors()); + throw new MojoExecutionException(this, "jsmoothgen failed: ", compiler.getErrors().toString()); + } + + return out; + } catch (MojoExecutionException exc) { + getLog().error("Error building the jsmooth wrapper", exc); + throw exc; + } catch (Exception exc) { + getLog().error("Error building the jsmooth wrapper", exc); + throw new MojoExecutionException(this, "Error building the jsmooth wrapper", exc.getMessage()); + } + + } + + /** + * Writes the jsmooth skeletons to the specified directory + * + * @param jsmoothTmpDir + * The temporary directory under which to create the skeletons + * directory + * @return The file reference to the skeleton directory + * @throws MojoFailureException + * If there is a failure is extracting the skeletons + * @throws MojoExecutionException + * Error copying skeleton directory + */ + private File writeSkeletons(File jsmoothTmpDir) + throws MojoFailureException, MojoExecutionException { + + ClassLoader cl = getClass().getClassLoader(); + int skeletonFilesCount = (null == skeletonFiles) ? 0 : skeletonFiles.size(); + for (int i = 0; i < skeletonFilesCount; i ++) { + String filePath = (String) skeletonFiles.get(i); + InputStreamFacade isFacade = new ClasspathInputStreamFacade(filePath, cl); + File destinationFile = new File(jsmoothTmpDir, filePath); + if (getLog().isDebugEnabled()) { + getLog().debug( + "Coping skeleton file [" + filePath + + "] to destination file [" + + destinationFile.getAbsolutePath() + "]"); + } + try { + FileUtils.copyStreamToFile(isFacade, destinationFile); + } catch (IOException e) { + throw new MojoFailureException("Unable to copy source skeleton file " + filePath + " to destination.", e); + } + } + + return new File(jsmoothTmpDir, parentSkeletonDirectory); + } + + /** + * Writes the jsmooth file to the specified directory + * + * @param jsmoothTmpDir + * The directory to which to write to + * @param jsmoothModel + * The model to write + */ + private void writeJsmoothFile(File jsmoothTmpDir, + JSmoothModelBean jsmoothModel) { + File tmpFileNm = new File(jsmoothFile); + String tempJSmoothFileName = jsmoothTmpDir.getAbsolutePath() + + File.separator + tmpFileNm.getName(); + try { + JSmoothModelPersistency.save(new File(tempJSmoothFileName), + jsmoothModel); + } catch (IOException e) { + getLog().warn("IOException writing jsmooth file", e); + // This is not a fatal error + } + } + + /** + * Creates the temporary directory for use + * + * @return The file reference to the temporary directory + * @throws MojoExecutionException + * If the temporary directory cannot be written + */ + private File createTemporaryDirectory() throws MojoExecutionException { + String jsmoothTmpDirPath = project.getBuild().getDirectory() + + File.separator + "jsmooth-temp"; + File jsmoothTmpDir = new File(jsmoothTmpDirPath); + if (!jsmoothTmpDir.exists()) { + if (!jsmoothTmpDir.mkdir()) { + throw new MojoExecutionException( + "Cannot create temporary directory"); + } + } + + return jsmoothTmpDir; + } + + /** + * Modifies the parametes of the jsmooth model file + * + * @param jsmoothModel + * The jsmooth model + * @throws MojoExecutionException + * If the required file cannot be used. + */ + private void manipulateModelFile(JSmoothModelBean jsmoothModel) + throws MojoExecutionException { + + // Set the icon location + if (null != iconLocation && iconLocation.trim().length() > 0) { + File iconFileLoc = resolveFile(iconLocation); + getLog().info( + "Setting Icon location to : " + + iconFileLoc.getAbsolutePath()); + jsmoothModel.setIconLocation(iconFileLoc.getAbsolutePath()); + } + + String finalBuildName = project.getBuild().getFinalName(); + + if (setExeName) { + getLog().info( + "Setting final output name to :" + finalBuildName + ".exe"); + jsmoothModel.setExecutableName(finalBuildName + ".exe"); + } + + if (setJarName) { + // Set the jar file name + getLog().info("Setting jar name to :" + finalBuildName + ".jar"); + jsmoothModel.setJarLocation(finalBuildName + ".jar"); + } + + if (includeDependencies) { + getLog().debug( + "Including dependencies with base scope: " + + dependencyScope); + List<String> impliedScopes = getImpliedScopes(dependencyScope); + @SuppressWarnings ("unchecked") + Set<Artifact> dependencyArtifacts = project.getArtifacts(); + List<String> dependentArtifacts = new ArrayList<String>(dependencyArtifacts + .size()); + + String baseDir = ""; + if (null != dependencyBaseDir) { + baseDir = dependencyBaseDir.trim(); + if (!baseDir.endsWith("/") || !baseDir.endsWith(File.separator)) { + baseDir = baseDir + File.separator; + } + } + + for (Iterator<Artifact> dependencyItr = dependencyArtifacts.iterator(); dependencyItr + .hasNext();) { + Artifact dependencyArtifact = dependencyItr.next(); + if (impliedScopes.contains(dependencyArtifact.getScope())) { + getLog().debug( + "Including dependency: " + + dependencyArtifact.getId()); + String dependencyPath = baseDir + + dependencyArtifact.getFile().getName(); + getLog().debug("Inluding dependency as: " + dependencyPath); + dependentArtifacts.add(dependencyPath); + } + } + + if (!dependentArtifacts.isEmpty()) { + String[] existingClasspath = jsmoothModel.getClassPath(); + if (null != existingClasspath && existingClasspath.length > 0) { + for (int i = 0; i < existingClasspath.length; i++) { + dependentArtifacts.add(existingClasspath[i]); + } + } + + jsmoothModel.setClassPath((String[]) dependentArtifacts + .toArray(new String[dependentArtifacts.size()])); + } + } + } + + /** + * Gets the list of implied scopes for a a given scope. The scope tree used + * for this resolution is: + * <ol> + * <li>compile</li> + * <li>runtime</li> + * <li>test</li> + * </ol> + * + * @param scope The scope defined in the input + * @return The list of implied scopes + */ + private List<String> getImpliedScopes(String scope) { + List<String> resolvedScopeList = new ArrayList<String>(); + + if (Artifact.SCOPE_COMPILE.equals(scope)) { + resolvedScopeList.add(Artifact.SCOPE_COMPILE); + } else if (Artifact.SCOPE_RUNTIME.equals(scope)) { + resolvedScopeList.add(Artifact.SCOPE_COMPILE); + resolvedScopeList.add(Artifact.SCOPE_RUNTIME); + } else if (Artifact.SCOPE_TEST.equals(scope)) { + resolvedScopeList.add(Artifact.SCOPE_COMPILE); + resolvedScopeList.add(Artifact.SCOPE_RUNTIME); + resolvedScopeList.add(Artifact.SCOPE_TEST); + } + + return resolvedScopeList; + } + + /** + * Gets the Jsmooth file being used. This method assumes the file indicated + * by jsmoothfile is an absolute file, and then tries to resolve it as a + * relative path to the project base directory. + * + * @return The file location of the jsmooth file + * @throws MojoExecutionException + * If the file is not found. + */ + private File resolveFile(String path) throws MojoExecutionException { + + getLog().debug("Resolving path: " + path); + + // Check for empty value + if (null == path || path.trim().length() == 0) { + throw new MojoExecutionException("The path location is required."); + } + + // Assume absolute file location + File fileLoc = new File(path); + if (fileLoc.exists() && fileLoc.canRead() && fileLoc.isFile()) { + return fileLoc; + } + + // If we are here, then the file must be relative + File baseDir = project.getBasedir(); + getLog().debug( + "Using base directory path : " + baseDir.getAbsolutePath()); + String finalFilePath = baseDir.getAbsolutePath() + File.separatorChar + + path; + getLog().debug("Computed file path : " + finalFilePath); + fileLoc = new File(finalFilePath); + if (fileLoc.exists() && fileLoc.canRead() && fileLoc.isFile()) { + return fileLoc; + } + + // If we are here, then the file does not exist at all! + throw new MojoExecutionException("The file specified [" + path + + "] either does not exist, or cannot be resolved " + + "or cannot be read."); + } + + /** + * @return the skipJSmooth + */ + public boolean isSkipJSmooth() { + return skipJSmooth; + } + + /** + * @param skipJSmooth + * the skipJSmooth to set + */ + public void setSkipJSmooth(boolean skipJSmooth) { + this.skipJSmooth = skipJSmooth; + } + + /** + * @return the jsmoothFile + */ + public String getJsmoothFile() { + return jsmoothFile; + } + + /** + * @param jsmoothFile + * the jsmoothFile to set + */ + public void setJsmoothFile(String jsmoothFile) { + this.jsmoothFile = jsmoothFile; + } + + /** + * @return the project + */ + public MavenProject getProject() { + return project; + } + + /** + * @return the iconLocation + */ + public String getIconLocation() { + return iconLocation; + } + + /** + * @param iconLocation + * the iconLocation to set + */ + public void setIconLocation(String iconLocation) { + this.iconLocation = iconLocation; + } + + /** + * @return the setExeName + */ + public boolean isSetExeName() { + return setExeName; + } + + /** + * @param setExeName + * the setExeName to set + */ + public void setSetExeName(boolean setExeName) { + this.setExeName = setExeName; + } + + /** + * @return the setJarName + */ + public boolean isSetJarName() { + return setJarName; + } + + /** + * @param setJarName + * the setJarName to set + */ + public void setSetJarName(boolean setJarName) { + this.setJarName = setJarName; + } + + /** + * @return the includeDependencies + */ + public boolean isIncludeDependencies() { + return includeDependencies; + } + + /** + * @param includeDependencies + * the includeDependencies to set + */ + public void setIncludeDependencies(boolean includeDependencies) { + this.includeDependencies = includeDependencies; + } + + /** + * @return the dependencyBaseDir + */ + public String getDependencyBaseDir() { + return dependencyBaseDir; + } + + /** + * @param dependencyBaseDir + * the dependencyBaseDir to set + */ + public void setDependencyBaseDir(String dependencyBaseDir) { + this.dependencyBaseDir = dependencyBaseDir; + } + + /** + * @return the dependencyScope + */ + public String getDependencyScope() { + return dependencyScope; + } + + /** + * @param dependencyScope + * the dependencyScope to set + */ + public void setDependencyScope(String dependencyScope) { + this.dependencyScope = dependencyScope; + } + +} Property changes on: plugins/maven-jsmooth-plugin/trunk/src/main/java/com/mindtree/techworks/infix/jsmooth/JSmoothCompileMojo.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/maven-jsmooth-plugin/trunk/src/site/apt/index.apt =================================================================== --- plugins/maven-jsmooth-plugin/trunk/src/site/apt/index.apt (rev 0) +++ plugins/maven-jsmooth-plugin/trunk/src/site/apt/index.apt 2010-11-22 14:32:21 UTC (rev 21) @@ -0,0 +1,58 @@ + --------- + MindTree Infix JSmooth Plug-in + -------- + Bindul Bhowmik; meta-keywords=index; meta-description=MindTree Infix (Maven) JSmooth Plug-in + -------- + $Date $ + -------- + +~~ Copyright (c) 2010 MindTree Ltd. +~~ +~~ This file is part of Infix +~~ +~~ Infix is free software: you can redistribute it and/or modify it under the +~~ terms of the GNU General Public License as published by the Free Software +~~ Foundation, either version 3 of the License, or (at your option) any later +~~ version. +~~ +~~ Infix is distributed in the hope that it will be useful, but WITHOUT ANY +~~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +~~ A PARTICULAR PURPOSE. See the GNU General Public License for more details. +~~ +~~ You should have received a copy of the GNU General Public License along with +~~ Infix. If not, see <http://www.gnu.org/licenses/>. + +JSmooth Plugin + + The NSIS Plug-in has been developed to generate Windows Excutables for + {{{http://maven.apache.org}Maven}} managed projects. The Plug-in uses + {{{http://jsmooth.sourceforge.net/} JSmooth}} to generate windows executables. + + The plug-in uses the configuration for generating JSmooth executables that + is consumed and understood by JSmooth. However the plug-in can + inject sections of the file dynamically. + +* Goal's Overview + + The plug-in has one goal: + + * {{{./jsmoothcompile-mojo.html}jsmooth:jsmoothcompile}}: Generates the + executable for the project + +* Stability + + The current version of the plug-in is 0.3.0. Hence the features, configuration + and API of the plug-in are not frozen. Anything in the plug-in is subject + to change at any time until version 1.0 is released. + + The Insight development team shall make every effort to maintain at least 2 + previous releases in the maven repository. Also, we don't have a permanent + maven repository yet. So even the repository location might change. + +* Usage + + Instructions on using the plug-in is described {{{./usage.html}here}}. + +* Examples + + An example for configuring the plug-in is available {{{./insight-jsmooth-conf.html}here}}. \ No newline at end of file Property changes on: plugins/maven-jsmooth-plugin/trunk/src/site/apt/index.apt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/maven-jsmooth-plugin/trunk/src/site/apt/insight-jsmooth-conf.apt =================================================================== --- plugins/maven-jsmooth-plugin/trunk/src/site/apt/insight-jsmooth-conf.apt (rev 0) +++ plugins/maven-jsmooth-plugin/trunk/src/site/apt/insight-jsmooth-conf.apt 2010-11-22 14:32:21 UTC (rev 21) @@ -0,0 +1,129 @@ + --------- + MindTree Infix JSmooth Sample Configuration + -------- + Bindul Bhowmik; meta-keywords=index,configuration,example; meta-description=MindTree Infix (Maven) JSmooth Sample Configuration + -------- + $Date $ + -------- + +~~ Copyright (c) 2010 MindTree Ltd. +~~ +~~ This file is part of Infix +~~ +~~ Infix is free software: you can redistribute it and/or modify it under the +~~ terms of the GNU General Public License as published by the Free Software +~~ Foundation, either version 3 of the License, or (at your option) any later +~~ version. +~~ +~~ Infix is distributed in the hope that it will be useful, but WITHOUT ANY +~~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +~~ A PARTICULAR PURPOSE. See the GNU General Public License for more details. +~~ +~~ You should have received a copy of the GNU General Public License along with +~~ Infix. If not, see <http://www.gnu.org/licenses/>. + +Configure the Plug-in for Insight UI + + The sample Jsmooth project configuration below is the one actually in use + for the {{{http://mindtreeinsight.sourceforge.net/ui/}Insight UI}}. This + is used to generate the Insight UI Executable for Windows platforms. + +* pom.xml configuration + + The section below shows the section used in the pom.xml of the insight ui: + ++------------------------------------------------------------------------------- +<project> + ... + <build> + ... + <plugins> + ... + <plugin> + <groupId>com.mindtree.techworks.insight.releng</groupId> + <artifactId>maven-jsmooth-plugin</artifactId> + <version>0.3.0-SNAPSHOT</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>jsmoothcompile</goal> + </goals> + </execution> + </executions> + <configuration> + <jsmoothFile>src/assembly/insight.jsmooth</jsmoothFile> + <iconLocation>src/assembly/resources/insight.ico</iconLocation> + <setExeName>true</setExeName> + <includeDependencies>true</includeDependencies> + <dependencyBaseDir>lib</dependencyBaseDir> + </configuration> + </plugin> + ... + </plugins> + ... + </build> + ... +</project> ++------------------------------------------------------------------------------- + +* insight.jsmooth + + The insight.jsmooth file used for Insight UI is given below. This format + is not directly used by the Plug-in, just parsed and passed on to the + JSmooth ExeCompiler. + ++------------------------------------------------------------------------------- +<jsmoothproject> + <JVMSearchPath>registry</JVMSearchPath> + <JVMSearchPath>javahome</JVMSearchPath> + <JVMSearchPath>jrepath</JVMSearchPath> + <JVMSearchPath>jdkpath</JVMSearchPath> + <JVMSearchPath>exepath</JVMSearchPath> + <JVMSearchPath>jview</JVMSearchPath> + <arguments></arguments> + <embeddedJar>true</embeddedJar> + <executableName>insight.exe</executableName> + <iconLocation>insight.bat</iconLocation> + <initialMemoryHeap>-1</initialMemoryHeap> + <jarLocation>insight-1.5.0-SNAPSHOT.jar</jarLocation> + <javaProperties> + <name>INSIGHT_HOME</name> + <value>${EXECUTABLEPATH}</value> + </javaProperties> + <mainClassName>com.mindtree.techworks.insight.Insight</mainClassName> + <maximumMemoryHeap>134217728</maximumMemoryHeap> + <maximumVersion></maximumVersion> + <minimumVersion>1.4.2</minimumVersion> + <skeletonName>Autodownload Wrapper</skeletonName> + <skeletonProperties> + <key>Message</key> + <value> + Java has not been found on your computer. Do you want to + download it? + </value> + </skeletonProperties> + <skeletonProperties> + <key>DownloadURL</key> + <value> + http://java.sun.com/update/1.5.0/jinstall-1_5_0_11-windows-i586.cab + </value> + </skeletonProperties> + <skeletonProperties> + <key>SingleProcess</key> + <value>1</value> + </skeletonProperties> + <skeletonProperties> + <key>SingleInstance</key> + <value>1</value> + </skeletonProperties> + <skeletonProperties> + <key>JniSmooth</key> + <value>0</value> + </skeletonProperties> + <skeletonProperties> + <key>Debug</key> + <value>0</value> + </skeletonProperties> +</jsmoothproject> ++------------------------------------------------------------------------------- Property changes on: plugins/maven-jsmooth-plugin/trunk/src/site/apt/insight-jsmooth-conf.apt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/maven-jsmooth-plugin/trunk/src/site/apt/usage.apt =================================================================== --- plugins/maven-jsmooth-plugin/trunk/src/site/apt/usage.apt (rev 0) +++ plugins/maven-jsmooth-plugin/trunk/src/site/apt/usage.apt 2010-11-22 14:32:21 UTC (rev 21) @@ -0,0 +1,108 @@ + --------- + MindTree Infix JSmooth Plug-in Usage + -------- + Bindul Bhowmik; meta-keywords=index,usage; meta-description=MindTree Infix (Maven) JSmooth Plug-in Usage + -------- + $Date $ + -------- + +~~ Copyright (c) 2010 MindTree Ltd. +~~ +~~ This file is part of Infix +~~ +~~ Infix is free software: you can redistribute it and/or modify it under the +~~ terms of the GNU General Public License as published by the Free Software +~~ Foundation, either version 3 of the License, or (at your option) any later +~~ version. +~~ +~~ Infix is distributed in the hope that it will be useful, but WITHOUT ANY +~~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +~~ A PARTICULAR PURPOSE. See the GNU General Public License for more details. +~~ +~~ You should have received a copy of the GNU General Public License along with +~~ Infix. If not, see <http://www.gnu.org/licenses/>. + +Usage + + The Jsmooth Plug-in can be executed using the following command: + +---- +mvn jsmooth:jsmoothcompile +---- + + The plug-in can also be executed automatically during a phase of the build + process if it is configured to participate in a phase of the build process + as an <excution> in the pom.xml. + +* pom.xml Configuration + + The plugin needs to be defined in the pom.xml with the following required + configuration: + +---- +<plugin> + <groupId>com.mindtree.techworks.insight.releng</groupId> + <artifactId>maven-jsmooth-plugin</artifactId> + <configuration> + <jsmoothFile>/path/to/relative/file</jsmoothFile> + </configuration> +</plugin> +---- + + The other optional configurations of this section can be seen in the + {{{./jsmoothcompile-mojo.html}jsmoothcompile goal}} configuration page. + +* Jsmooth Project configuration + + The Jsmooth project configuration is the one generated by the Jsmooth + UI. However, multiple sections of this configuration may be added dynamically + by the plug-in at runtime. + + The sections that may be replaced at the moment are the dependencies (lib) + files, the name of the application jar, the final output file name, etc. + +* Dependencies + + This plug-in depends on Jsmooth, however Jsmooth is currently not available + in any maven repository at the time of writing. To use the Jsmooth plugin + you may download it and install Jsmooth in your local repository using the + {{{http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html}install-file goal}} + of the {{{http://maven.apache.org/plugins/maven-install-plugin/}maven install plug-in}}. + + For your benefit, you may use the following pom.xml file to deploy the + jsmooth jar to your local repository: + ++------------------------------------------------------------------------------- +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>net.charabia</groupId> + <artifactId>jsmoothgen</artifactId> + <version>0.9.9-7</version> + <dependencies> + <dependency> + <groupId>com.wutka</groupId> + <artifactId>dtdparser</artifactId> + <version>1.21</version> + </dependency> + <dependency> + <groupId>com.wutka</groupId> + <artifactId>jox</artifactId> + <version>1.16</version> + </dependency> + </dependencies> +</project> ++------------------------------------------------------------------------------- + + This pom.xml includes the dependencies of the jsmooth project. The + dependencies are available in the Maven central repository. + +Maven Repository Configuration + + The JSmooth plugin is currently not available at the Maven Central repository, + hence to get your maven build system to get the plugin, you may use the + temporary Insight Maven 2 repository at: + + * Documentation in development + \ No newline at end of file Property changes on: plugins/maven-jsmooth-plugin/trunk/src/site/apt/usage.apt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/maven-jsmooth-plugin/trunk/src/site/site.xml =================================================================== --- plugins/maven-jsmooth-plugin/trunk/src/site/site.xml (rev 0) +++ plugins/maven-jsmooth-plugin/trunk/src/site/site.xml 2010-11-22 14:32:21 UTC (rev 21) @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + | + | Copyright (c) 2010 MindTree Ltd. + | + | This file is part of Infix. + | + | Infix is free software: you can redistribute it + | and/or modify it under the terms of the GNU General Public License as + | published by the Free Software Foundation, either version 3 of the License, + | or (at your option) any later version. + | + | Infix is distributed in the hope that it will be + | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + | Public License for more details. + | + | You should have received a copy of the GNU General Public License along with + | Infix. If not, see <http://www.gnu.org/licenses/>. + | +--> +<project xmlns="http://maven.apache.org/DECORATION/1.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.1 http://maven.apache.org/xsd/decoration-1.0.1.xsd"> + <skin> + <groupId>com.mindtree.techworks.infix</groupId> + <artifactId>infix-site-skin</artifactId> + <version>1.0-SNAPSHOT</version> + </skin> + <poweredBy> + <logo name="SourceForge.net" alt="Hosted on SourceForge.net" href="https://sourceforge.net/projects/mvn-infix/" img="http://sflogo.sourceforge.net/sflogo.php?group_id=375270&amp;type=11" width="120" height="30"/> + <logo name="Built with Maven 3" alt="Built with Maven 3" href="http://maven.apache.org/" img="http://maven.apache.org/images/logos/build-by-maven-black.png"/> + <logo name="Valid XHTML 1.1 Strict" alt="Valid XHTML 1.1 Strict" href="http://validator.w3.org/check?uri=referer" img="http://www.w3.org/Icons/valid-xhtml11"/> + <logo name="GPL version 3" alt="GPL v3" href="http://www.gnu.org/licenses/gpl-3.0.html" img="http://www.gnu.org/graphics/gplv3-88x31.png"/> + </poweredBy> + <bannerLeft> + <name>${project.name}</name> + <href>${project.url}</href> + </bannerLeft> + <bannerRight> + <name>by MindTree Infix</name> + <href>${project.parent.url}</href> + </bannerRight> + <version position="left"/> + <publishDate format="dd MMM yyyy" position="left"/> + <body> + <head> + <piwik siteId="1" baseUrl="sourceforge.net/apps/piwik/mvn-infix/"/> + <privacy href="http://mvn-infix.sourceforge.net/privacy.html"/> + <meta name="keywords" content="maven,plugin,plug-in,mindtree,maven2,maven3,mindtree ltd,jsmooth,jsmooth maven"/> + <google-cse cseId="001821074997410371686:oik3n7lzyvg" style="google.loader.themes.MINIMALIST" type="google-hosted"/> + </head> + <links> + <item name="MindTree" href="http://www.mindtree.com/"/> + <item name="Infix" href="http://mvn-infix.sourceforge.net/"/> + </links> + <breadcrumbs> + <item name="Infix" href="../"/> + <item name="Infix Jsmooth Plugin" href="./"/> + </breadcrumbs> + <menu name="Maven JSmooth Plugin"> + <item name="Introduction" href="index.html"/> + <item name="Goals" href="plugin-info.html" /> + <item name="Usage" href="usage.html"/> + <item name="Sitemap" href="./sitemap.html"/> + </menu> + <menu name="Examples"> + <item name="Insight Jsmooth Configuration" href="insight-jsmooth-conf.html"/> + </menu> + <menu ref="reports"/> + <menu ref="parent"/> + </body> +</project> Property changes on: plugins/maven-jsmooth-plugin/trunk/src/site/site.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: skins/infix-site-skin/trunk/src/site/site.xml =================================================================== --- skins/infix-site-skin/trunk/src/site/site.xml 2010-11-22 12:15:10 UTC (rev 20) +++ skins/infix-site-skin/trunk/src/site/site.xml 2010-11-22 14:32:21 UTC (rev 21) @@ -31,6 +31,10 @@ <logo name="Valid XHTML 1.1 Strict" alt="Valid XHTML 1.1 Strict" href="http://validator.w3.org/check?uri=referer" img="http://www.w3.org/Icons/valid-xhtml11"/> <logo name="GPL version 3" alt="GPL v3" href="http://www.gnu.org/licenses/gpl-3.0.html" img="http://www.gnu.org/graphics/gplv3-88x31.png"/> </poweredBy> + <bannerLeft> + <name>${project.name}</name> + <href>${project.url}</href> + </bannerLeft> <bannerRight> <name>by MindTree Infix</name> <href>${project.parent.url}</href> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ mvn-Infix-commits mailing list mvn-Infix-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mvn-infix-commits