Recognizes NetBeans manifest tags
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 23 Nov 2014 21:59:21 +0100
changeset 17281d850aa501bb
parent 1727 86e61729f754
child 1729 384468666b2d
Recognizes NetBeans manifest tags
pom.xml
rt/aot-nb-test/pom.xml
rt/aot-nb-test/src/test/java/org/apidesign/bck2brwsr/aot/nb/test/LookupGetTest.java
rt/aot/pom.xml
rt/aot/src/main/java/org/apidesign/bck2brwsr/aot/Bck2BrwsrJars.java
rt/aot/src/test/java/org/apidesign/bck2brwsr/aot/ExportPublicPackagesTest.java
rt/pom.xml
     1.1 --- a/pom.xml	Sun Nov 23 21:55:46 2014 +0100
     1.2 +++ b/pom.xml	Sun Nov 23 21:59:21 2014 +0100
     1.3 @@ -177,6 +177,11 @@
     1.4              <version>${netbeans.version}</version>
     1.5          </dependency>
     1.6          <dependency>
     1.7 +            <groupId>org.netbeans.modules</groupId>
     1.8 +            <artifactId>org-netbeans-libs-javacimpl</artifactId>
     1.9 +            <version>${netbeans.version}</version>
    1.10 +        </dependency>
    1.11 +        <dependency>
    1.12              <groupId>org.netbeans.api</groupId>
    1.13              <artifactId>org-netbeans-spi-java-hints</artifactId>
    1.14              <version>${netbeans.version}</version>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/rt/aot-nb-test/pom.xml	Sun Nov 23 21:59:21 2014 +0100
     2.3 @@ -0,0 +1,66 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<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">
     2.6 +    <modelVersion>4.0.0</modelVersion>
     2.7 +    <parent>
     2.8 +        <groupId>org.apidesign.bck2brwsr</groupId>
     2.9 +        <artifactId>rt</artifactId>
    2.10 +        <version>1.0-SNAPSHOT</version>
    2.11 +    </parent>
    2.12 +    <artifactId>aot-nb-test</artifactId>
    2.13 +    <name>Ahead of Time + NetBeans Tags Test</name>
    2.14 +    <packaging>jar</packaging>
    2.15 +    <dependencies>
    2.16 +        <dependency>
    2.17 +            <groupId>org.netbeans.api</groupId>
    2.18 +            <artifactId>org-netbeans-libs-javacapi</artifactId>
    2.19 +        </dependency>
    2.20 +        <dependency>
    2.21 +            <groupId>org.netbeans.modules</groupId>
    2.22 +            <artifactId>org-netbeans-libs-javacimpl</artifactId>
    2.23 +        </dependency>
    2.24 +        <dependency>
    2.25 +            <groupId>org.testng</groupId>
    2.26 +            <artifactId>testng</artifactId>
    2.27 +            <scope>test</scope>
    2.28 +        </dependency>
    2.29 +        <dependency>
    2.30 +            <groupId>org.apidesign.bck2brwsr</groupId>
    2.31 +            <artifactId>vmtest</artifactId>
    2.32 +            <version>${project.version}</version>
    2.33 +            <scope>test</scope>
    2.34 +            <type>jar</type>
    2.35 +        </dependency>
    2.36 +        <dependency>
    2.37 +            <groupId>${project.groupId}</groupId>
    2.38 +            <artifactId>launcher.http</artifactId>
    2.39 +            <version>${project.version}</version>
    2.40 +            <scope>test</scope>
    2.41 +        </dependency>
    2.42 +        <dependency>
    2.43 +            <groupId>org.netbeans.api</groupId>
    2.44 +            <artifactId>org-openide-util-lookup</artifactId>
    2.45 +        </dependency>
    2.46 +    </dependencies>
    2.47 +    <build>
    2.48 +        <plugins>
    2.49 +            <plugin>
    2.50 +                <groupId>org.apache.maven.plugins</groupId>
    2.51 +                <artifactId>maven-compiler-plugin</artifactId>
    2.52 +                <version>2.5.1</version>
    2.53 +                <configuration>
    2.54 +                    <source>1.7</source>
    2.55 +                    <target>1.7</target>
    2.56 +                </configuration>
    2.57 +            </plugin>
    2.58 +            <plugin>
    2.59 +                <groupId>org.apache.maven.plugins</groupId>
    2.60 +                <artifactId>maven-surefire-plugin</artifactId>
    2.61 +                <configuration>
    2.62 +                    <systemProperties>
    2.63 +                        <vmtest.js>brwsr</vmtest.js>
    2.64 +                    </systemProperties>
    2.65 +                </configuration>
    2.66 +            </plugin>     
    2.67 +        </plugins>
    2.68 +    </build>
    2.69 +</project>
    2.70 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/rt/aot-nb-test/src/test/java/org/apidesign/bck2brwsr/aot/nb/test/LookupGetTest.java	Sun Nov 23 21:59:21 2014 +0100
     3.3 @@ -0,0 +1,38 @@
     3.4 +/**
     3.5 + * Back 2 Browser Bytecode Translator
     3.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     3.7 + *
     3.8 + * This program is free software: you can redistribute it and/or modify
     3.9 + * it under the terms of the GNU General Public License as published by
    3.10 + * the Free Software Foundation, version 2 of the License.
    3.11 + *
    3.12 + * This program is distributed in the hope that it will be useful,
    3.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.15 + * GNU General Public License for more details.
    3.16 + *
    3.17 + * You should have received a copy of the GNU General Public License
    3.18 + * along with this program. Look for COPYING file in the top folder.
    3.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
    3.20 + */
    3.21 +package org.apidesign.bck2brwsr.aot.nb.test;
    3.22 +
    3.23 +import org.apidesign.bck2brwsr.vmtest.Compare;
    3.24 +import org.apidesign.bck2brwsr.vmtest.VMTest;
    3.25 +import org.openide.util.Lookup;
    3.26 +import org.testng.annotations.Factory;
    3.27 +
    3.28 +/**
    3.29 + *
    3.30 + * @author Jaroslav Tulach
    3.31 + */
    3.32 +public class LookupGetTest {
    3.33 +    
    3.34 +    @Compare public boolean getDefault() {
    3.35 +        return Lookup.getDefault() != null;
    3.36 +    }
    3.37 +
    3.38 +    @Factory public static Object[] create() {
    3.39 +        return VMTest.create(LookupGetTest.class);
    3.40 +    }
    3.41 +}
     4.1 --- a/rt/aot/pom.xml	Sun Nov 23 21:55:46 2014 +0100
     4.2 +++ b/rt/aot/pom.xml	Sun Nov 23 21:59:21 2014 +0100
     4.3 @@ -33,5 +33,11 @@
     4.4              <version>1.6.1</version>
     4.5              <type>jar</type>
     4.6          </dependency>
     4.7 +        <dependency>
     4.8 +            <groupId>org.testng</groupId>
     4.9 +            <artifactId>testng</artifactId>
    4.10 +            <version>6.8.1</version>
    4.11 +            <scope>test</scope>
    4.12 +        </dependency>
    4.13      </dependencies>
    4.14  </project>
     5.1 --- a/rt/aot/src/main/java/org/apidesign/bck2brwsr/aot/Bck2BrwsrJars.java	Sun Nov 23 21:55:46 2014 +0100
     5.2 +++ b/rt/aot/src/main/java/org/apidesign/bck2brwsr/aot/Bck2BrwsrJars.java	Sun Nov 23 21:59:21 2014 +0100
     5.3 @@ -187,6 +187,16 @@
     5.4                      break;
     5.5                  }
     5.6              }
     5.7 +            return;
     5.8 +        }
     5.9 +        exp = mainAttr.getValue("OpenIDE-Module-Public-Packages");
    5.10 +        if (exp != null) {
    5.11 +            for (String def : exp.split(",")) {
    5.12 +                def = def.trim();
    5.13 +                if (def.endsWith(".*")) {
    5.14 +                    keep.add(def.substring(0, def.length() - 1).replace('.', '/'));
    5.15 +                }
    5.16 +            }
    5.17          }
    5.18      }
    5.19      
     6.1 --- a/rt/aot/src/test/java/org/apidesign/bck2brwsr/aot/ExportPublicPackagesTest.java	Sun Nov 23 21:55:46 2014 +0100
     6.2 +++ b/rt/aot/src/test/java/org/apidesign/bck2brwsr/aot/ExportPublicPackagesTest.java	Sun Nov 23 21:59:21 2014 +0100
     6.3 @@ -66,8 +66,22 @@
     6.4          Set<String> keep = new TreeSet<>();
     6.5          Bck2BrwsrJars.exportPublicPackages(attr, keep);
     6.6          
     6.7 -        assertEquals(keep.size(), 7, "Two: " + keep);
     6.8 +        assertEquals(keep.size(), 7, "Seven: " + keep);
     6.9          assertEquals(keep.toString(), "[org/eclipse/mylyn/commons/core/, org/eclipse/mylyn/commons/core/io/, org/eclipse/mylyn/commons/core/net/, org/eclipse/mylyn/commons/core/operations/, org/eclipse/mylyn/commons/core/storage/, org/eclipse/mylyn/internal/commons/core/, org/eclipse/mylyn/internal/commons/core/operations/]");
    6.10      }
    6.11 +    
    6.12 +    @Test public void lookupHeaders() throws Exception {
    6.13 +        Attributes attr = new Attributes();
    6.14 +        attr.putValue("OpenIDE-Module-Public-Packages",
    6.15 +            "org.openide.util.*, org.openide.util.lookup.*, org.openide.util.lookup.implspi.*"
    6.16 +        );
    6.17 +        Set<String> keep = new TreeSet<>();
    6.18 +        Bck2BrwsrJars.exportPublicPackages(attr, keep);
    6.19 +        
    6.20 +        assertEquals(keep.size(), 3, "Three: " + keep);
    6.21 +        assertTrue(keep.contains("org/openide/util/"), "main pkg: " + keep);
    6.22 +        assertTrue(keep.contains("org/openide/util/lookup/"), "util pkg: " + keep);
    6.23 +        assertTrue(keep.contains("org/openide/util/lookup/implspi/"), "spiimpl pkg: " + keep);
    6.24 +    }
    6.25  
    6.26  }
     7.1 --- a/rt/pom.xml	Sun Nov 23 21:55:46 2014 +0100
     7.2 +++ b/rt/pom.xml	Sun Nov 23 21:59:21 2014 +0100
     7.3 @@ -18,6 +18,7 @@
     7.4      <module>vm</module>
     7.5      <module>vmtest</module>
     7.6      <module>aot</module>
     7.7 +    <module>aot-nb-test</module>
     7.8    </modules>
     7.9    <profiles>
    7.10        <profile>