1.1 --- a/boot-fx/pom.xml Fri Jan 24 05:50:15 2014 +0100
1.2 +++ b/boot-fx/pom.xml Fri Jan 24 08:24:33 2014 +0100
1.3 @@ -23,6 +23,10 @@
1.4 <artifactId>maven-bundle-plugin</artifactId>
1.5 </plugin>
1.6 <plugin>
1.7 + <groupId>org.netbeans.html</groupId>
1.8 + <artifactId>html4j-maven-plugin</artifactId>
1.9 + </plugin>
1.10 + <plugin>
1.11 <groupId>org.apache.maven.plugins</groupId>
1.12 <artifactId>maven-surefire-plugin</artifactId>
1.13 <configuration>
2.1 --- a/geo/pom.xml Fri Jan 24 05:50:15 2014 +0100
2.2 +++ b/geo/pom.xml Fri Jan 24 08:24:33 2014 +0100
2.3 @@ -22,6 +22,10 @@
2.4 <groupId>org.apache.felix</groupId>
2.5 <artifactId>maven-bundle-plugin</artifactId>
2.6 </plugin>
2.7 + <plugin>
2.8 + <groupId>org.netbeans.html</groupId>
2.9 + <artifactId>html4j-maven-plugin</artifactId>
2.10 + </plugin>
2.11 </plugins>
2.12 </build>
2.13 <dependencies>
3.1 --- a/html4j-maven-plugin/pom.xml Fri Jan 24 05:50:15 2014 +0100
3.2 +++ b/html4j-maven-plugin/pom.xml Fri Jan 24 08:24:33 2014 +0100
3.3 @@ -8,7 +8,7 @@
3.4 <version>0.8-SNAPSHOT</version>
3.5 </parent>
3.6 <packaging>maven-plugin</packaging>
3.7 - <groupId>org.apidesign.html</groupId>
3.8 + <groupId>org.netbeans.html</groupId>
3.9 <artifactId>html4j-maven-plugin</artifactId>
3.10 <version>0.8-SNAPSHOT</version>
3.11 <name>html4j-maven-plugin</name>
3.12 @@ -38,31 +38,6 @@
3.13 </execution>
3.14 </executions>
3.15 </plugin>
3.16 - <plugin>
3.17 - <groupId>org.apache.maven.plugins</groupId>
3.18 - <artifactId>maven-compiler-plugin</artifactId>
3.19 - <version>2.3.2</version>
3.20 - <configuration>
3.21 - <source>1.6</source>
3.22 - <target>1.6</target>
3.23 - </configuration>
3.24 - </plugin>
3.25 - <plugin>
3.26 - <groupId>org.apidesign.html</groupId>
3.27 - <artifactId>html4j-maven-plugin</artifactId>
3.28 - <version>${project.version}</version>
3.29 - <executions>
3.30 - <execution>
3.31 - <goals>
3.32 - <goal>process-js-annotations</goal>
3.33 - </goals>
3.34 - <phase>process-test-classes</phase>
3.35 - <configuration>
3.36 - <classes>${project.build.directory}/test-classes</classes>
3.37 - </configuration>
3.38 - </execution>
3.39 - </executions>
3.40 - </plugin>
3.41 </plugins>
3.42 </build>
3.43
3.44 @@ -86,12 +61,6 @@
3.45 <type>jar</type>
3.46 </dependency>
3.47 <dependency>
3.48 - <groupId>org.netbeans.html</groupId>
3.49 - <artifactId>net.java.html.boot</artifactId>
3.50 - <version>${project.version}</version>
3.51 - <type>jar</type>
3.52 - </dependency>
3.53 - <dependency>
3.54 <groupId>org.testng</groupId>
3.55 <artifactId>testng</artifactId>
3.56 <scope>test</scope>
4.1 --- a/html4j-maven-plugin/src/main/java/org/apidesign/html/mojo/ProcessJsAnnotationsMojo.java Fri Jan 24 05:50:15 2014 +0100
4.2 +++ b/html4j-maven-plugin/src/main/java/org/apidesign/html/mojo/ProcessJsAnnotationsMojo.java Fri Jan 24 08:24:33 2014 +0100
4.3 @@ -42,107 +42,84 @@
4.4 */
4.5 package org.apidesign.html.mojo;
4.6
4.7 +import java.io.BufferedReader;
4.8 import java.io.File;
4.9 import java.io.FileInputStream;
4.10 import java.io.FileNotFoundException;
4.11 import java.io.FileOutputStream;
4.12 +import java.io.FileReader;
4.13 +import java.io.FileWriter;
4.14 import java.io.IOException;
4.15 import java.io.InputStream;
4.16 +import java.lang.reflect.Method;
4.17 import java.net.MalformedURLException;
4.18 import java.net.URL;
4.19 import java.net.URLClassLoader;
4.20 import java.util.ArrayList;
4.21 -import java.util.Enumeration;
4.22 -import java.util.HashMap;
4.23 import java.util.List;
4.24 -import java.util.Map;
4.25 -import java.util.logging.Level;
4.26 -import java.util.logging.Logger;
4.27 -import java.util.zip.ZipEntry;
4.28 -import java.util.zip.ZipFile;
4.29 import org.apache.maven.artifact.Artifact;
4.30 import org.apache.maven.plugin.AbstractMojo;
4.31 import org.apache.maven.plugin.MojoExecutionException;
4.32 import org.apache.maven.plugin.MojoFailureException;
4.33 +import org.apache.maven.plugins.annotations.Component;
4.34 import org.apache.maven.plugins.annotations.LifecyclePhase;
4.35 import org.apache.maven.plugins.annotations.Mojo;
4.36 import org.apache.maven.plugins.annotations.Parameter;
4.37 import org.apache.maven.plugins.annotations.ResolutionScope;
4.38 import org.apache.maven.project.MavenProject;
4.39 -import org.netbeans.html.boot.impl.FnUtils;
4.40
4.41 @Mojo(
4.42 name="process-js-annotations",
4.43 - requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
4.44 + requiresDependencyResolution = ResolutionScope.COMPILE,
4.45 defaultPhase= LifecyclePhase.PROCESS_CLASSES
4.46 )
4.47 public final class ProcessJsAnnotationsMojo extends AbstractMojo {
4.48 - @Parameter(defaultValue = "${project}")
4.49 + @Component
4.50 private MavenProject prj;
4.51
4.52 @Parameter(defaultValue = "${project.build.directory}/classes")
4.53 private File classes;
4.54
4.55 - /** Checks all "provided" dependency JAR files and if they contain
4.56 - * usage of JavaScriptXXX annotation, their classes are expanded into the
4.57 - * <code>classes</code> directory.
4.58 - */
4.59 - @Parameter(defaultValue = "false")
4.60 - private boolean processProvided;
4.61 -
4.62 public ProcessJsAnnotationsMojo() {
4.63 }
4.64
4.65 @Override
4.66 public void execute() throws MojoExecutionException, MojoFailureException {
4.67 + List<URL> arr = new ArrayList<URL>();
4.68 + for (Artifact a : prj.getArtifacts()) {
4.69 + final File f = a.getFile();
4.70 + if (f != null) {
4.71 + try {
4.72 + arr.add(f.toURI().toURL());
4.73 + } catch (MalformedURLException ex) {
4.74 + throw new IllegalStateException(ex);
4.75 + }
4.76 + }
4.77 + }
4.78 + URLClassLoader l = new URLClassLoader(arr.toArray(new URL[arr.size()]));
4.79 try {
4.80 - processClasses(classes);
4.81 + processClasses(l, classes);
4.82 } catch (IOException ex) {
4.83 throw new MojoExecutionException("Problem converting JavaScriptXXX annotations", ex);
4.84 }
4.85 -
4.86 - if (processProvided) {
4.87 - List<URL> arr = new ArrayList<URL>();
4.88 - for (Artifact a : prj.getArtifacts()) {
4.89 - final File f = a.getFile();
4.90 - if (f != null) {
4.91 - try {
4.92 - arr.add(f.toURI().toURL());
4.93 - } catch (MalformedURLException ex) {
4.94 - throw new IllegalStateException(ex);
4.95 + }
4.96 +
4.97 + private void processClasses(ClassLoader l, File f) throws IOException, MojoExecutionException {
4.98 + if (!f.exists()) {
4.99 + return;
4.100 + }
4.101 + if (f.isDirectory()) {
4.102 + boolean classes = new File(f, "net.java.html.js.classes").exists();
4.103 + File[] arr = f.listFiles();
4.104 + if (arr != null) {
4.105 + for (File file : arr) {
4.106 + if (classes || file.isDirectory()) {
4.107 + processClasses(l, file);
4.108 }
4.109 }
4.110 }
4.111 - URLClassLoader l = new URLClassLoader(arr.toArray(new URL[arr.size()]));
4.112 - for (Artifact a : prj.getArtifacts()) {
4.113 - if (!"provided".equals(a.getScope())) {
4.114 - continue;
4.115 - }
4.116 - final File f = a.getFile();
4.117 - if (f != null) {
4.118 - try {
4.119 - processClasses(f, classes, l);
4.120 - } catch (IOException ex) {
4.121 - throw new MojoExecutionException("Problem converting JavaScriptXXX annotations in " + f, ex);
4.122 - }
4.123 - }
4.124 - }
4.125 - }
4.126 - }
4.127 -
4.128 - private void processClasses(File f) throws IOException, MojoExecutionException {
4.129 - if (f.isDirectory()) {
4.130 - File[] arr = f.listFiles();
4.131 - if (arr != null) {
4.132 - for (File file : arr) {
4.133 - processClasses(file);
4.134 - }
4.135 - }
4.136 return;
4.137 }
4.138 - if (!f.exists()) {
4.139 - throw new MojoExecutionException("Does not exist: " + f);
4.140 - }
4.141
4.142 if (!f.getName().endsWith(".class")) {
4.143 return;
4.144 @@ -155,10 +132,19 @@
4.145 } finally {
4.146 is.close();
4.147 }
4.148 -
4.149 - byte[] newArr = FnUtils.transform(arr, null);
4.150 - if (newArr == null || newArr == arr) {
4.151 - return;
4.152 +
4.153 + byte[] newArr = null;
4.154 + try {
4.155 + Class<?> fnUtils = l.loadClass("org.netbeans.html.boot.impl.FnUtils");
4.156 + Method transform = fnUtils.getMethod("transform", byte[].class, ClassLoader.class);
4.157 +
4.158 + newArr = (byte[]) transform.invoke(null, arr, l);
4.159 + if (newArr == null || newArr == arr) {
4.160 + return;
4.161 + }
4.162 + filterClass(new File(f.getParentFile(), "net.java.html.js.classes"), f.getName());
4.163 + } catch (Exception ex) {
4.164 + throw new MojoExecutionException("Can't process " + f, ex);
4.165 }
4.166 getLog().info("Processing " + f);
4.167 writeArr(f, newArr);
4.168 @@ -184,46 +170,40 @@
4.169 }
4.170 }
4.171
4.172 - private void processClasses(File jar, File target, ClassLoader l) throws IOException {
4.173 - ZipFile zf = new ZipFile(jar);
4.174 - Enumeration<? extends ZipEntry> en = zf.entries();
4.175 - Map<String,byte[]> waiting = new HashMap<String, byte[]>();
4.176 - boolean found = false;
4.177 - while (en.hasMoreElements()) {
4.178 - ZipEntry ze = en.nextElement();
4.179 - if (ze.getName().endsWith("/")) {
4.180 + private static void filterClass(File f, String className) throws IOException {
4.181 + if (!f.exists()) {
4.182 + return;
4.183 + }
4.184 + if (className.endsWith(".class")) {
4.185 + className = className.substring(0, className.length() - 6);
4.186 + }
4.187 +
4.188 + BufferedReader r = new BufferedReader(new FileReader(f));
4.189 + List<String> arr = new ArrayList<String>();
4.190 + boolean modified = false;
4.191 + for (;;) {
4.192 + String line = r.readLine();
4.193 + if (line == null) {
4.194 + break;
4.195 + }
4.196 + if (line.endsWith(className)) {
4.197 + modified = true;
4.198 continue;
4.199 }
4.200 - byte[] arr = new byte[(int)ze.getSize()];
4.201 - InputStream is = zf.getInputStream(ze);
4.202 - try {
4.203 - readArr(arr, is);
4.204 - } finally {
4.205 - is.close();
4.206 - }
4.207 - if (ze.getName().endsWith(".class")) {
4.208 - byte[] newArr = FnUtils.transform(arr, l);
4.209 - if (newArr == null || newArr == arr) {
4.210 - waiting.put(ze.getName(), arr);
4.211 - continue;
4.212 + arr.add(line);
4.213 + }
4.214 + r.close();
4.215 +
4.216 + if (modified) {
4.217 + if (arr.isEmpty()) {
4.218 + f.delete();
4.219 + } else {
4.220 + FileWriter w = new FileWriter(f);
4.221 + for (String l : arr) {
4.222 + w.write(l);
4.223 + w.write("\n");
4.224 }
4.225 - File t = new File(target, ze.getName().replace('/', File.separatorChar));
4.226 - t.getParentFile().mkdirs();
4.227 - writeArr(t, newArr);
4.228 - found = true;
4.229 - getLog().info("Found " + ze.getName() + " in " + jar + " - will copy all classes");
4.230 - } else {
4.231 - waiting.put(ze.getName(), arr);
4.232 - }
4.233 - }
4.234 -
4.235 - if (found) {
4.236 - for (Map.Entry<String, byte[]> entry : waiting.entrySet()) {
4.237 - String name = entry.getKey();
4.238 - byte[] arr = entry.getValue();
4.239 - File t = new File(target, name.replace('/', File.separatorChar));
4.240 - t.getParentFile().mkdirs();
4.241 - writeArr(t, arr);
4.242 + w.close();
4.243 }
4.244 }
4.245 }
5.1 --- a/html4j-maven-plugin/src/test/java/org/apidesign/html/mojo/GenerateBodyTest.java Fri Jan 24 05:50:15 2014 +0100
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,87 +0,0 @@
5.4 -/**
5.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5.6 - *
5.7 - * Copyright 2013-2013 Oracle and/or its affiliates. All rights reserved.
5.8 - *
5.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
5.10 - * Other names may be trademarks of their respective owners.
5.11 - *
5.12 - * The contents of this file are subject to the terms of either the GNU
5.13 - * General Public License Version 2 only ("GPL") or the Common
5.14 - * Development and Distribution License("CDDL") (collectively, the
5.15 - * "License"). You may not use this file except in compliance with the
5.16 - * License. You can obtain a copy of the License at
5.17 - * http://www.netbeans.org/cddl-gplv2.html
5.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
5.19 - * specific language governing permissions and limitations under the
5.20 - * License. When distributing the software, include this License Header
5.21 - * Notice in each file and include the License file at
5.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
5.23 - * particular file as subject to the "Classpath" exception as provided
5.24 - * by Oracle in the GPL Version 2 section of the License file that
5.25 - * accompanied this code. If applicable, add the following below the
5.26 - * License Header, with the fields enclosed by brackets [] replaced by
5.27 - * your own identifying information:
5.28 - * "Portions Copyrighted [year] [name of copyright owner]"
5.29 - *
5.30 - * Contributor(s):
5.31 - *
5.32 - * The Original Software is NetBeans. The Initial Developer of the Original
5.33 - * Software is Oracle. Portions Copyright 2013-2013 Oracle. All Rights Reserved.
5.34 - *
5.35 - * If you wish your version of this file to be governed by only the CDDL
5.36 - * or only the GPL Version 2, indicate your decision by adding
5.37 - * "[Contributor] elects to include this software in this distribution
5.38 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
5.39 - * single choice of license, a recipient has the option to distribute
5.40 - * your version of this file under either the CDDL, the GPL Version 2 or
5.41 - * to extend the choice of license to its licensees as provided above.
5.42 - * However, if you add GPL Version 2 code and therefore, elected the GPL
5.43 - * Version 2 license, then the option applies only if the new code is
5.44 - * made subject to such option by the copyright holder.
5.45 - */
5.46 -package org.apidesign.html.mojo;
5.47 -
5.48 -import java.io.Closeable;
5.49 -import java.io.IOException;
5.50 -import java.io.Reader;
5.51 -import java.net.URL;
5.52 -import net.java.html.js.JavaScriptBody;
5.53 -import org.apidesign.html.boot.spi.Fn;
5.54 -import static org.testng.Assert.*;
5.55 -import org.testng.annotations.Test;
5.56 -
5.57 -public class GenerateBodyTest implements Fn.Presenter {
5.58 - @JavaScriptBody(args = {}, body = "return true;")
5.59 - public static native boolean generateMe();
5.60 -
5.61 - @Test public void generateMeReturnsTrue() throws IOException {
5.62 - Closeable c = Fn.activate(this);
5.63 - try {
5.64 - assertTrue(generateMe(), "Body has been generated");
5.65 - } finally {
5.66 - c.close();
5.67 - }
5.68 - }
5.69 -
5.70 - @Override
5.71 - public Fn defineFn(String code, String... names) {
5.72 - return new Fn(this) {
5.73 - @Override
5.74 - public Object invoke(Object thiz, Object... args) throws Exception {
5.75 - return Boolean.TRUE;
5.76 - }
5.77 - };
5.78 - }
5.79 -
5.80 - @Override
5.81 - public void displayPage(URL page, Runnable onPageLoad) {
5.82 - throw new IllegalStateException();
5.83 - }
5.84 -
5.85 - @Override
5.86 - public void loadScript(Reader code) throws Exception {
5.87 - throw new Exception();
5.88 - }
5.89 -
5.90 -}
6.1 --- a/json-tck/pom.xml Fri Jan 24 05:50:15 2014 +0100
6.2 +++ b/json-tck/pom.xml Fri Jan 24 08:24:33 2014 +0100
6.3 @@ -23,6 +23,10 @@
6.4 <artifactId>maven-bundle-plugin</artifactId>
6.5 </plugin>
6.6 <plugin>
6.7 + <groupId>org.netbeans.html</groupId>
6.8 + <artifactId>html4j-maven-plugin</artifactId>
6.9 + </plugin>
6.10 + <plugin>
6.11 <groupId>org.apache.maven.plugins</groupId>
6.12 <artifactId>maven-javadoc-plugin</artifactId>
6.13 <configuration>
7.1 --- a/ko-osgi-test/pom.xml Fri Jan 24 05:50:15 2014 +0100
7.2 +++ b/ko-osgi-test/pom.xml Fri Jan 24 08:24:33 2014 +0100
7.3 @@ -20,6 +20,10 @@
7.4 <artifactId>maven-bundle-plugin</artifactId>
7.5 </plugin>
7.6 <plugin>
7.7 + <groupId>org.netbeans.html</groupId>
7.8 + <artifactId>html4j-maven-plugin</artifactId>
7.9 + </plugin>
7.10 + <plugin>
7.11 <artifactId>maven-failsafe-plugin</artifactId>
7.12 <version>2.16</version>
7.13 <configuration>
8.1 --- a/ko-ws-tyrus/pom.xml Fri Jan 24 05:50:15 2014 +0100
8.2 +++ b/ko-ws-tyrus/pom.xml Fri Jan 24 08:24:33 2014 +0100
8.3 @@ -19,6 +19,10 @@
8.4 <artifactId>maven-bundle-plugin</artifactId>
8.5 </plugin>
8.6 <plugin>
8.7 + <groupId>org.netbeans.html</groupId>
8.8 + <artifactId>html4j-maven-plugin</artifactId>
8.9 + </plugin>
8.10 + <plugin>
8.11 <groupId>org.apache.maven.plugins</groupId>
8.12 <artifactId>maven-javadoc-plugin</artifactId>
8.13 <configuration>
9.1 --- a/ko4j/pom.xml Fri Jan 24 05:50:15 2014 +0100
9.2 +++ b/ko4j/pom.xml Fri Jan 24 08:24:33 2014 +0100
9.3 @@ -23,6 +23,10 @@
9.4 <artifactId>maven-bundle-plugin</artifactId>
9.5 </plugin>
9.6 <plugin>
9.7 + <groupId>org.netbeans.html</groupId>
9.8 + <artifactId>html4j-maven-plugin</artifactId>
9.9 + </plugin>
9.10 + <plugin>
9.11 <groupId>org.apache.maven.plugins</groupId>
9.12 <artifactId>maven-javadoc-plugin</artifactId>
9.13 <configuration>
10.1 --- a/pom.xml Fri Jan 24 05:50:15 2014 +0100
10.2 +++ b/pom.xml Fri Jan 24 08:24:33 2014 +0100
10.3 @@ -139,6 +139,29 @@
10.4 </instructions>
10.5 </configuration>
10.6 </plugin>
10.7 + <plugin>
10.8 + <groupId>org.netbeans.html</groupId>
10.9 + <artifactId>html4j-maven-plugin</artifactId>
10.10 + <version>${project.version}</version>
10.11 + <executions>
10.12 + <execution>
10.13 + <id>classes</id>
10.14 + <goals>
10.15 + <goal>process-js-annotations</goal>
10.16 + </goals>
10.17 + </execution>
10.18 + <execution>
10.19 + <id>test-classes</id>
10.20 + <phase>process-test-classes</phase>
10.21 + <goals>
10.22 + <goal>process-js-annotations</goal>
10.23 + </goals>
10.24 + <configuration>
10.25 + <classes>${project.build.directory}/test-classes</classes>
10.26 + </configuration>
10.27 + </execution>
10.28 + </executions>
10.29 + </plugin>
10.30 </plugins>
10.31 </pluginManagement>
10.32 </build>
11.1 --- a/sound/pom.xml Fri Jan 24 05:50:15 2014 +0100
11.2 +++ b/sound/pom.xml Fri Jan 24 08:24:33 2014 +0100
11.3 @@ -22,6 +22,10 @@
11.4 <groupId>org.apache.felix</groupId>
11.5 <artifactId>maven-bundle-plugin</artifactId>
11.6 </plugin>
11.7 + <plugin>
11.8 + <groupId>org.netbeans.html</groupId>
11.9 + <artifactId>html4j-maven-plugin</artifactId>
11.10 + </plugin>
11.11 </plugins>
11.12 </build>
11.13 <dependencies>