Modifying the archetype to generate static ZIP file to be uploaded on a static web server emul
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 15 Feb 2013 20:09:36 +0100
branchemul
changeset 744341d8ed644df
parent 743 6dc02c92ba9e
child 745 51ce6a73fcb2
Modifying the archetype to generate static ZIP file to be uploaded on a static web server
launcher/src/main/resources/org/apidesign/bck2brwsr/launcher/harness.xhtml
mojo/src/main/resources/META-INF/maven/archetype-metadata.xml
mojo/src/main/resources/archetype-resources/bck2brwsr-assembly.xml
mojo/src/main/resources/archetype-resources/pom.xml
mojo/src/main/resources/archetype-resources/src/main/java/App.java
mojo/src/main/resources/archetype-resources/src/main/resources/index.html
mojo/src/main/resources/archetype-resources/src/main/resources/index.xhtml
     1.1 --- a/launcher/src/main/resources/org/apidesign/bck2brwsr/launcher/harness.xhtml	Fri Feb 15 19:33:21 2013 +0100
     1.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/launcher/harness.xhtml	Fri Feb 15 20:09:36 2013 +0100
     1.3 @@ -24,7 +24,10 @@
     1.4          <title>Bck2Brwsr Harness</title>
     1.5      </head>
     1.6      <body>
     1.7 -        <script src="/vm.js"></script>
     1.8 +        <script src="/bck2brwsr.js"></script>
     1.9 +        <script>
    1.10 +            var vm = bck2brwsr();
    1.11 +        </script>
    1.12          
    1.13          <h1>Bck2Brwsr Execution Harness</h1>
    1.14          
     2.1 --- a/mojo/src/main/resources/META-INF/maven/archetype-metadata.xml	Fri Feb 15 19:33:21 2013 +0100
     2.2 +++ b/mojo/src/main/resources/META-INF/maven/archetype-metadata.xml	Fri Feb 15 20:09:36 2013 +0100
     2.3 @@ -30,6 +30,7 @@
     2.4        <directory>src/main/resources</directory>
     2.5        <includes>
     2.6          <include>**/*.xhtml</include>
     2.7 +        <include>**/*.html</include>
     2.8        </includes>
     2.9      </fileSet>
    2.10      <fileSet filtered="true" packaged="true">
    2.11 @@ -44,5 +45,11 @@
    2.12          <include>nbactions.xml</include>
    2.13        </includes>
    2.14      </fileSet>
    2.15 +    <fileSet filtered="true" packaged="false">
    2.16 +      <directory></directory>
    2.17 +      <includes>
    2.18 +        <include>bck2brwsr-assembly.xml</include>
    2.19 +      </includes>
    2.20 +    </fileSet>
    2.21    </fileSets>    
    2.22  </archetype-descriptor>
    2.23 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/mojo/src/main/resources/archetype-resources/bck2brwsr-assembly.xml	Fri Feb 15 20:09:36 2013 +0100
     3.3 @@ -0,0 +1,61 @@
     3.4 +<?xml version="1.0"?>
     3.5 +<!--
     3.6 +
     3.7 +    Back 2 Browser Bytecode Translator
     3.8 +    Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     3.9 +
    3.10 +    This program is free software: you can redistribute it and/or modify
    3.11 +    it under the terms of the GNU General Public License as published by
    3.12 +    the Free Software Foundation, version 2 of the License.
    3.13 +
    3.14 +    This program is distributed in the hope that it will be useful,
    3.15 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.16 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.17 +    GNU General Public License for more details.
    3.18 +
    3.19 +    You should have received a copy of the GNU General Public License
    3.20 +    along with this program. Look for COPYING file in the top folder.
    3.21 +    If not, see http://opensource.org/licenses/GPL-2.0.
    3.22 +
    3.23 +-->
    3.24 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3.25 +  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    3.26 +  
    3.27 +  <id>bck2brwsr</id>
    3.28 +  <formats>
    3.29 +      <format>zip</format>
    3.30 +  </formats>
    3.31 +  <baseDirectory>public_html</baseDirectory>
    3.32 +  <dependencySets>
    3.33 +    <dependencySet>
    3.34 +        <useProjectArtifact>false</useProjectArtifact>
    3.35 +        <scope>runtime</scope>
    3.36 +        <outputDirectory>lib</outputDirectory>
    3.37 +        <includes>
    3.38 +            <include>*:jar</include>
    3.39 +            <include>*:rt</include>
    3.40 +        </includes>
    3.41 +    </dependencySet>
    3.42 +    <dependencySet>
    3.43 +        <useProjectArtifact>false</useProjectArtifact>
    3.44 +        <scope>provided</scope>
    3.45 +        <includes>
    3.46 +            <include>*:js</include>
    3.47 +        </includes>
    3.48 +        <unpack>true</unpack>
    3.49 +        <outputDirectory>/</outputDirectory>
    3.50 +    </dependencySet>
    3.51 +  </dependencySets> 
    3.52 +  <files>
    3.53 +    <file>
    3.54 +      <source>${project.build.directory}/${project.build.finalName}.jar</source>
    3.55 +      <outputDirectory>/</outputDirectory>
    3.56 +    </file>
    3.57 +    <file>
    3.58 +      <source>${project.build.directory}/classes/${package.replace('.','/')}/index.html</source>
    3.59 +      <outputDirectory>/</outputDirectory>
    3.60 +      <destName>index.html</destName>
    3.61 +    </file>
    3.62 +  </files>
    3.63 +
    3.64 +</assembly>
    3.65 \ No newline at end of file
     4.1 --- a/mojo/src/main/resources/archetype-resources/pom.xml	Fri Feb 15 19:33:21 2013 +0100
     4.2 +++ b/mojo/src/main/resources/archetype-resources/pom.xml	Fri Feb 15 20:09:36 2013 +0100
     4.3 @@ -27,7 +27,7 @@
     4.4                      </execution>
     4.5                  </executions>
     4.6                  <configuration>
     4.7 -                    <startpage>${package.replace('.','/')}/index.xhtml</startpage>
     4.8 +                    <startpage>${package.replace('.','/')}/index.html</startpage>
     4.9                  </configuration>
    4.10              </plugin>
    4.11           <plugin>
    4.12 @@ -39,14 +39,46 @@
    4.13                 <target>1.7</target>
    4.14              </configuration>
    4.15           </plugin>
    4.16 +         <plugin>
    4.17 +             <groupId>org.apache.maven.plugins</groupId>
    4.18 +             <artifactId>maven-jar-plugin</artifactId>
    4.19 +             <version>2.4</version>
    4.20 +             <configuration>
    4.21 +                 <archive>
    4.22 +                     <manifest>
    4.23 +                         <addClasspath>true</addClasspath>
    4.24 +                         <classpathPrefix>lib/</classpathPrefix>
    4.25 +                     </manifest>
    4.26 +                 </archive>
    4.27 +             </configuration>
    4.28 +         </plugin>
    4.29 +         <plugin>
    4.30 +             <artifactId>maven-assembly-plugin</artifactId>
    4.31 +             <version>2.4</version>
    4.32 +             <executions>
    4.33 +                 <execution>
    4.34 +                     <id>distro-assembly</id>
    4.35 +                     <phase>package</phase>
    4.36 +                     <goals>
    4.37 +                         <goal>single</goal>
    4.38 +                     </goals>
    4.39 +                     <configuration>
    4.40 +                         <descriptors>
    4.41 +                             <descriptor>bck2brwsr-assembly.xml</descriptor>
    4.42 +                         </descriptors>
    4.43 +                     </configuration>
    4.44 +                 </execution>
    4.45 +             </executions>                
    4.46 +         </plugin>      
    4.47        </plugins>
    4.48    </build>
    4.49  
    4.50    <dependencies>
    4.51      <dependency>
    4.52        <groupId>org.apidesign.bck2brwsr</groupId>
    4.53 -      <artifactId>emul.mini</artifactId>
    4.54 +      <artifactId>emul</artifactId>
    4.55        <version>0.3-SNAPSHOT</version>
    4.56 +      <classifier>rt</classifier>
    4.57      </dependency>
    4.58      <dependency>
    4.59        <groupId>org.apidesign.bck2brwsr</groupId>
    4.60 @@ -61,6 +93,14 @@
    4.61      </dependency>
    4.62      <dependency>
    4.63        <groupId>org.apidesign.bck2brwsr</groupId>
    4.64 +      <artifactId>vm4brwsr</artifactId>
    4.65 +      <classifier>js</classifier>
    4.66 +      <type>zip</type>
    4.67 +      <version>0.3-SNAPSHOT</version>
    4.68 +      <scope>provided</scope>
    4.69 +    </dependency>
    4.70 +    <dependency>
    4.71 +      <groupId>org.apidesign.bck2brwsr</groupId>
    4.72        <artifactId>vmtest</artifactId>
    4.73        <version>0.3-SNAPSHOT</version>
    4.74        <scope>test</scope>
     5.1 --- a/mojo/src/main/resources/archetype-resources/src/main/java/App.java	Fri Feb 15 19:33:21 2013 +0100
     5.2 +++ b/mojo/src/main/resources/archetype-resources/src/main/java/App.java	Fri Feb 15 20:09:36 2013 +0100
     5.3 @@ -9,7 +9,7 @@
     5.4  /** Edit the index.xhtml file. Use 'id' to name certain HTML elements.
     5.5   * Use this class to define behavior of the elements.
     5.6   */
     5.7 -@Page(xhtml="index.xhtml", className="Index", properties={
     5.8 +@Page(xhtml="index.html", className="Index", properties={
     5.9      @Property(name="name", type=String.class)
    5.10  })
    5.11  public class App {
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/mojo/src/main/resources/archetype-resources/src/main/resources/index.html	Fri Feb 15 20:09:36 2013 +0100
     6.3 @@ -0,0 +1,22 @@
     6.4 +<?xml version="1.0" encoding="UTF-8"?>
     6.5 +<!DOCTYPE html>
     6.6 +<html xmlns="http://www.w3.org/1999/xhtml">
     6.7 +    <head>
     6.8 +        <title>Bck2Brwsr's Hello World</title>
     6.9 +    </head>
    6.10 +    <body>
    6.11 +        <h1 data-bind="text: helloMessage">Loading Bck2Brwsr's Hello World...</h1>
    6.12 +        Your name: <input id='input' data-bind="value: name, valueUpdate: 'afterkeydown'"></input>
    6.13 +        <button id="hello">Say Hello!</button>
    6.14 +        <p>
    6.15 +            <canvas id="canvas" width="300" height="50">
    6.16 +            </canvas>
    6.17 +        </p>
    6.18 +
    6.19 +        <script src="bck2brwsr.js"></script>
    6.20 +        <script type="text/javascript">
    6.21 +            var vm = bck2brwsr('${artifactId}-${version}.jar');
    6.22 +            vm.loadClass('${package}.App');
    6.23 +        </script>
    6.24 +    </body>
    6.25 +</html>
     7.1 --- a/mojo/src/main/resources/archetype-resources/src/main/resources/index.xhtml	Fri Feb 15 19:33:21 2013 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,22 +0,0 @@
     7.4 -<?xml version="1.0" encoding="UTF-8"?>
     7.5 -<!DOCTYPE html>
     7.6 -<html xmlns="http://www.w3.org/1999/xhtml">
     7.7 -    <head>
     7.8 -        <title>Bck2Brwsr's Hello World</title>
     7.9 -    </head>
    7.10 -    <body>
    7.11 -        <h1 data-bind="text: helloMessage">Loading Bck2Brwsr's Hello World...</h1>
    7.12 -        Your name: <input id='input' data-bind="value: name, valueUpdate: 'afterkeydown'"></input>
    7.13 -        <button id="hello">Say Hello!</button>
    7.14 -        <p>
    7.15 -            <canvas id="canvas" width="300" height="50">
    7.16 -            </canvas>
    7.17 -        </p>
    7.18 -
    7.19 -        <script src="/bck2brwsr.js"></script>
    7.20 -        <script src="/vm.js"></script>
    7.21 -        <script type="text/javascript">
    7.22 -            vm.loadClass('${package}.App');
    7.23 -        </script>
    7.24 -    </body>
    7.25 -</html>