Adding teabrwsr profile. Use 'mvn -Pteabrwsr install' to generate ZIP with static pages powered by teavm teavm
authorJaroslav Tulach <jtulach@netbeans.org>
Tue, 04 Mar 2014 09:28:20 +0100
branchteavm
changeset 91c20135305ad2
parent 90 eff392cfe687
child 92 8697860c6af0
Adding teabrwsr profile. Use 'mvn -Pteabrwsr install' to generate ZIP with static pages powered by teavm
minesweeper/pom.xml
minesweeper/src/main/assembly/teabrwsr.xml
minesweeper/src/main/webapp/pages/index.html
     1.1 --- a/minesweeper/pom.xml	Tue Mar 04 09:24:17 2014 +0100
     1.2 +++ b/minesweeper/pom.xml	Tue Mar 04 09:28:20 2014 +0100
     1.3 @@ -297,7 +297,72 @@
     1.4                    </plugin>
     1.5                </plugins>
     1.6            </build>
     1.7 -          
     1.8 +      </profile>
     1.9 +      <profile>
    1.10 +          <id>teabrwsr</id>
    1.11 +          <build>
    1.12 +              <plugins>
    1.13 +                  <plugin>
    1.14 +                      <groupId>org.teavm</groupId>
    1.15 +                      <artifactId>teavm-maven-plugin</artifactId>
    1.16 +                      <version>0.0.1-SNAPSHOT</version>
    1.17 +                      <dependencies>
    1.18 +                          <dependency>
    1.19 +                              <groupId>org.teavm</groupId>
    1.20 +                              <artifactId>teavm-classlib</artifactId>
    1.21 +                              <version>0.0.1-SNAPSHOT</version>
    1.22 +                          </dependency>
    1.23 +                          <!-- This module adds html4j support. It mainly includes JavaScriptBuilder support.
    1.24 +                          Also there are some little patches to JCL emulation, that are required to pass TCK -->
    1.25 +                          <dependency>
    1.26 +                              <groupId>org.teavm</groupId>
    1.27 +                              <artifactId>teavm-html4j</artifactId>
    1.28 +                              <version>0.0.1-SNAPSHOT</version>
    1.29 +                          </dependency>
    1.30 +                      </dependencies>
    1.31 +                      <executions>
    1.32 +                          <execution>
    1.33 +                              <id>generate-minesweeper</id>
    1.34 +                              <goals>
    1.35 +                                  <goal>build-javascript</goal>
    1.36 +                              </goals>
    1.37 +                              <phase>process-classes</phase>
    1.38 +                              <configuration>
    1.39 +                                  <!-- Whether we want TeaVM to minify (obfuscate) the generated JavaScript -->
    1.40 +                                  <minifying>false</minifying>
    1.41 +                                  <mainClass>org.apidesign.demo.minesweeper.MinesModel</mainClass>
    1.42 +                                  <!-- Don't include main page - we created it by ourselves -->
    1.43 +                                  <mainPageIncluded>false</mainPageIncluded>
    1.44 +                                  <targetDirectory>${project.build.directory}/teavm</targetDirectory>
    1.45 +                                  <!-- This transformer adds null checks before virtual calls. It is not included
    1.46 +                                  by default as we don't always need these null checks -->
    1.47 +                                  <transformers>
    1.48 +                                      <param>org.teavm.javascript.NullPointerExceptionTransformer</param>
    1.49 +                                  </transformers>
    1.50 +                              </configuration>
    1.51 +                          </execution>
    1.52 +                      </executions>
    1.53 +                  </plugin>
    1.54 +                  <plugin>
    1.55 +                      <artifactId>maven-assembly-plugin</artifactId>
    1.56 +                      <version>2.4</version>
    1.57 +                      <executions>
    1.58 +                          <execution>
    1.59 +                              <id>distro-assembly</id>
    1.60 +                              <phase>package</phase>
    1.61 +                              <goals>
    1.62 +                                  <goal>single</goal>
    1.63 +                              </goals>
    1.64 +                              <configuration>
    1.65 +                                  <descriptors>
    1.66 +                                      <descriptor>src/main/assembly/teabrwsr.xml</descriptor>
    1.67 +                                  </descriptors>
    1.68 +                              </configuration>
    1.69 +                          </execution>
    1.70 +                      </executions>                
    1.71 +                  </plugin>      
    1.72 +              </plugins>
    1.73 +          </build>
    1.74        </profile>
    1.75    </profiles>  
    1.76  </project>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/minesweeper/src/main/assembly/teabrwsr.xml	Tue Mar 04 09:28:20 2014 +0100
     2.3 @@ -0,0 +1,47 @@
     2.4 +<?xml version="1.0"?>
     2.5 +<!--
     2.6 +
     2.7 +    The MIT License (MIT)
     2.8 +
     2.9 +    Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
    2.10 +
    2.11 +    Permission is hereby granted, free of charge, to any person obtaining a copy
    2.12 +    of this software and associated documentation files (the "Software"), to deal
    2.13 +    in the Software without restriction, including without limitation the rights
    2.14 +    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    2.15 +    copies of the Software, and to permit persons to whom the Software is
    2.16 +    furnished to do so, subject to the following conditions:
    2.17 +
    2.18 +    The above copyright notice and this permission notice shall be included in
    2.19 +    all copies or substantial portions of the Software.
    2.20 +
    2.21 +    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.22 +    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.23 +    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.24 +    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.25 +    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    2.26 +    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    2.27 +    THE SOFTWARE.
    2.28 +
    2.29 +-->
    2.30 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    2.31 +  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    2.32 +  
    2.33 +  <id>teabrwsr</id>
    2.34 +  <formats>
    2.35 +      <format>zip</format>
    2.36 +  </formats>
    2.37 +  <baseDirectory>public_html</baseDirectory>
    2.38 +  <fileSets>
    2.39 +      <fileSet>
    2.40 +          <directory>src/main/webapp/pages</directory>
    2.41 +          <outputDirectory>/</outputDirectory>
    2.42 +          <filtered>true</filtered>
    2.43 +      </fileSet>
    2.44 +      <fileSet>
    2.45 +          <directory>${project.build.directory}/teavm/</directory>
    2.46 +          <outputDirectory>/</outputDirectory>
    2.47 +          <filtered>false</filtered>
    2.48 +      </fileSet>
    2.49 +  </fileSets>
    2.50 +</assembly>
     3.1 --- a/minesweeper/src/main/webapp/pages/index.html	Tue Mar 04 09:24:17 2014 +0100
     3.2 +++ b/minesweeper/src/main/webapp/pages/index.html	Tue Mar 04 09:28:20 2014 +0100
     3.3 @@ -143,12 +143,21 @@
     3.4                  role="button">Learn more &raquo;</a></p>
     3.5         </div>
     3.6      </div>
     3.7 -        
     3.8 +
     3.9 +        <!-- boot bck2brwsr -->
    3.10          <script type="text/javascript" src="bck2brwsr.js"></script>
    3.11          <script>
    3.12              var vm = bck2brwsr('${project.build.finalName}.jar');
    3.13              vm.loadClass('org.apidesign.demo.minesweeper.MainBrwsr');
    3.14          </script>
    3.15          
    3.16 +        <!-- boot teavm -->
    3.17 +        <script type="text/javascript" src="knockout-2.2.1.js"></script>
    3.18 +        <script type="text/javascript" src="runtime.js"></script>
    3.19 +        <script type="text/javascript" src="classes.js"></script>
    3.20 +        <script type="text/javascript">
    3.21 +            main(null);
    3.22 +        </script>
    3.23 +        
    3.24      </body>
    3.25  </html>