# HG changeset patch # User Jaroslav Tulach # Date 1357761326 -3600 # Node ID 0236ad6ab4d21de9db6eac03abb5179ce893e0b2 # Parent 3497ecd097df8cf58f402d8ce2ae0746ce18c5be bck2brwsr archetype diff -r 3497ecd097df -r 0236ad6ab4d2 mojo/pom.xml --- a/mojo/pom.xml Tue Jan 08 16:32:11 2013 +0100 +++ b/mojo/pom.xml Wed Jan 09 20:55:26 2013 +0100 @@ -11,7 +11,7 @@ mojo 0.3-SNAPSHOT maven-plugin - Maven Mojo to Compile to JavaScript + Bck2Brwsr Maven Project http://maven.apache.org diff -r 3497ecd097df -r 0236ad6ab4d2 mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java --- a/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java Tue Jan 08 16:32:11 2013 +0100 +++ b/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java Wed Jan 09 20:55:26 2013 +0100 @@ -44,6 +44,9 @@ /** Resource to show as initial page */ @Parameter private String startpage; + + @Parameter + private String startpackage; @Parameter(defaultValue="${project}") private MavenProject prj; @@ -63,9 +66,9 @@ Closeable httpServer; try { - httpServer = Launcher.showURL(url, startpage); + httpServer = Launcher.showURL(url, startpage()); } catch (Exception ex) { - throw new MojoExecutionException("Can't open " + startpage, ex); + throw new MojoExecutionException("Can't open " + startpage(), ex); } System.in.read(); httpServer.close(); @@ -73,34 +76,12 @@ throw new MojoExecutionException("Can't show the browser", ex); } } - - private static File findNonEmptyFolder(File dir) throws MojoExecutionException { - if (!dir.isDirectory()) { - throw new MojoExecutionException("Not a directory " + dir); - } - File[] arr = dir.listFiles(); - if (arr.length == 1 && arr[0].isDirectory()) { - return findNonEmptyFolder(arr[0]); - } - return dir; - } - - private static long collectAllClasses(String prefix, File toCheck, List arr) { - File[] files = toCheck.listFiles(); - if (files != null) { - long newest = 0L; - for (File f : files) { - long lastModified = collectAllClasses(prefix + f.getName() + "/", f, arr); - if (newest < lastModified) { - newest = lastModified; - } - } - return newest; - } else if (toCheck.getName().endsWith(".class")) { - arr.add(prefix.substring(0, prefix.length() - 7)); - return toCheck.lastModified(); + + private String startpage() { + if (startpackage == null) { + return startpage; } else { - return 0L; + return startpackage.replace('.', '/') + '/' + startpage; } } diff -r 3497ecd097df -r 0236ad6ab4d2 mojo/src/main/resources/META-INF/maven/archetype-metadata.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mojo/src/main/resources/META-INF/maven/archetype-metadata.xml Wed Jan 09 20:55:26 2013 +0100 @@ -0,0 +1,42 @@ + + + + + + src/main/java + + **/*.java + + + + src/main/resources + + **/*.xhtml + + + + + + nbactions.xml + + + + \ No newline at end of file diff -r 3497ecd097df -r 0236ad6ab4d2 mojo/src/main/resources/archetype-resources/nbactions.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mojo/src/main/resources/archetype-resources/nbactions.xml Wed Jan 09 20:55:26 2013 +0100 @@ -0,0 +1,10 @@ + + + + run + + process-classes + org.apidesign.bck2brwsr:mojo:0.3-SNAPSHOT:brwsr + + + diff -r 3497ecd097df -r 0236ad6ab4d2 mojo/src/main/resources/archetype-resources/pom.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mojo/src/main/resources/archetype-resources/pom.xml Wed Jan 09 20:55:26 2013 +0100 @@ -0,0 +1,58 @@ + + + 4.0.0 + + ${groupId} + ${artifactId} + ${version} + jar + + ${artifactId} + + + UTF-8 + + + + + org.apidesign.bck2brwsr + mojo + 0.3-SNAPSHOT + + + + brwsr + + + + + ${package} + index.xhtml + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + + + + + org.apidesign.bck2brwsr + emul + 0.3-SNAPSHOT + + + org.apidesign.bck2brwsr + javaquery.api + 0.3-SNAPSHOT + + + diff -r 3497ecd097df -r 0236ad6ab4d2 mojo/src/main/resources/archetype-resources/src/main/java/App.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mojo/src/main/resources/archetype-resources/src/main/java/App.java Wed Jan 09 20:55:26 2013 +0100 @@ -0,0 +1,15 @@ +package ${package}; + +import org.apidesign.bck2brwsr.htmlpage.api.OnClick; +import org.apidesign.bck2brwsr.htmlpage.api.Page; + +/** Edit the index.xhtml file. Use 'id' to name certain HTML elements. + * Use this class to define behavior of the elements. + */ +@Page(xhtml="index.xhtml", className="Index") +public class App { + @OnClick(id="hello") + static void hello() { + Index.HELLO.setDisabled(true); + } +} diff -r 3497ecd097df -r 0236ad6ab4d2 mojo/src/main/resources/archetype-resources/src/main/resources/index.xhtml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mojo/src/main/resources/archetype-resources/src/main/resources/index.xhtml Wed Jan 09 20:55:26 2013 +0100 @@ -0,0 +1,16 @@ + + + + + Bck2Brwsr's Hello World + + + + + + + + + diff -r 3497ecd097df -r 0236ad6ab4d2 pom.xml --- a/pom.xml Tue Jan 08 16:32:11 2013 +0100 +++ b/pom.xml Wed Jan 09 20:55:26 2013 +0100 @@ -73,6 +73,7 @@ javap/** * .*/** + mojo/src/main/resources/archetype-resources/**