You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2021/02/23 00:16:32 UTC
[royale-compiler] branch develop updated: playerglobal-sourcegen =>
compiler-playerglobalc
This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new 5914975 playerglobal-sourcegen => compiler-playerglobalc
5914975 is described below
commit 5914975670700c85616f4564260ef89f416b4446
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Feb 22 16:16:12 2021 -0800
playerglobal-sourcegen => compiler-playerglobalc
PLAYERGLOBALC is now a FlexTool, similar to EXTERNC/COMPC/MXMLC
---
build.xml | 12 ++--
.../royale/compiler/clients/RoyaleToolGroup.java | 1 +
.../build.xml | 53 ++++++++-------
.../pom.xml | 34 +++++-----
.../royale/compiler/clients/PLAYERGLOBALC.java | 76 ++++++++++++----------
pom.xml | 2 +-
6 files changed, 95 insertions(+), 83 deletions(-)
diff --git a/build.xml b/build.xml
index 9831d89..3bfdd65 100644
--- a/build.xml
+++ b/build.xml
@@ -65,18 +65,15 @@
<ant dir="compiler-test-utils" />
<ant dir="compiler-common" />
<ant dir="compiler-externc" />
+ <ant dir="compiler-playerglobalc" />
<ant dir="compiler" />
</target>
<target name="swf" depends="sdk, javadoc, tests" description="Builds SWF compiler, builds Royale Javadoc, and runs SWF compiler tests."/>
- <target name="main" depends="swf, jx, oem, debugger, anttasks, royaleunit.anttasks, playerglobal-source-gen" description="Builds Royale SWF compiler, then Royale JS Transpiler"/>
+ <target name="main" depends="swf, jx, oem, debugger, anttasks, royaleunit.anttasks" description="Builds Royale SWF compiler, then Royale JS Transpiler"/>
<target name="jx" depends="compiler.jx, compiler.jx.tests" description="Builds Royale JS Transpiler" />
-
- <target name="playerglobal-source-gen" depends="compiler.jx">
- <ant dir="playerglobal-source-gen" />
- </target>
<target name="oem" depends="compiler.oem" description="Builds FB Integration JAR" />
@@ -135,6 +132,7 @@
<ant dir="compiler-jburg-types" target="clean"/>
<ant dir="compiler-common" target="clean"/>
<ant dir="compiler-externc" target="clean"/>
+ <ant dir="compiler-playerglobalc" target="clean"/>
<ant dir="compiler" target="clean"/>
<ant dir="compiler/src/test" target="clean"/>
<ant dir="compiler-jx" target="clean"/>
@@ -144,7 +142,6 @@
<ant dir="royale-ant-tasks" target="clean"/>
<ant dir="royaleunit-ant-tasks" target="clean"/>
<ant dir="debugger" target="clean"/>
- <ant dir="playerglobal-source-gen" target="clean"/>
</target>
<target name="wipe" description="Wipes out everything that didn't come from Git.">
@@ -153,6 +150,7 @@
<ant dir="compiler-jburg-types" target="wipe"/>
<ant dir="compiler-common" target="wipe"/>
<ant dir="compiler-externc" target="wipe"/>
+ <ant dir="compiler-playerglobalc" target="wipe"/>
<ant dir="compiler" target="wipe"/>
<ant dir="compiler/src/tests" target="wipe"/>
</target>
@@ -163,6 +161,7 @@
<ant dir="compiler-test-utils" target="wipe"/>
<ant dir="compiler-common" target="wipe"/>
<ant dir="compiler-externc" target="wipe"/>
+ <ant dir="compiler-playerglobalc" target="wipe"/>
<ant dir="compiler" target="wipe"/>
<ant dir="compiler/src/test" target="wipe"/>
<ant dir="compiler-jx" target="super-clean"/>
@@ -172,7 +171,6 @@
<ant dir="royale-ant-tasks" target="wipe"/>
<ant dir="royaleunit-ant-tasks" target="wipe"/>
<ant dir="debugger" target="clean"/>
- <ant dir="playerglobal-source-gen" target="wipe"/>
<delete dir="${basedir}/out" failonerror="false" includeEmptyDirs="true"/>
<delete dir="${basedir}/temp" failonerror="false" includeEmptyDirs="true"/>
<!-- remove legacy folders if they exist -->
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/RoyaleToolGroup.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/RoyaleToolGroup.java
index 4a60041..d2bf90f 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/RoyaleToolGroup.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/RoyaleToolGroup.java
@@ -32,6 +32,7 @@ public class RoyaleToolGroup extends AbstractFlexToolGroup {
addFlexTool(new MXMLJSC());
addFlexTool(new ASDOCJSC(new MXMLRoyaleASDocDITABackend()));
addFlexTool(new EXTERNC());
+ addFlexTool(new PLAYERGLOBALC());
}
}
diff --git a/playerglobal-source-gen/build.xml b/compiler-playerglobalc/build.xml
similarity index 64%
rename from playerglobal-source-gen/build.xml
rename to compiler-playerglobalc/build.xml
index cdded40..de0de31 100644
--- a/playerglobal-source-gen/build.xml
+++ b/compiler-playerglobalc/build.xml
@@ -19,7 +19,7 @@
-->
-<project name="playerglobal-source-gen" default="main" basedir=".">
+<project name="compiler-playerglobalc" default="main" basedir=".">
<!--
@@ -27,10 +27,10 @@
-->
- <!-- The 'playerglobal-source-gen' property is the absolute path, with forward slashes, -->
- <!-- to the 'playerglobal-source-gen' directory that contains this file. -->
- <!-- All input paths are expressed as absolute paths starting with ${playerglobal-source-gen}. -->
- <pathconvert property="playerglobal-source-gen" dirsep="/">
+ <!-- The 'compiler-playerglobalc' property is the absolute path, with forward slashes, -->
+ <!-- to the 'compiler-playerglobalc' directory that contains this file. -->
+ <!-- All input paths are expressed as absolute paths starting with ${compiler-playerglobalc}. -->
+ <pathconvert property="compiler-playerglobalc" dirsep="/">
<path location="${basedir}"/>
</pathconvert>
@@ -45,7 +45,8 @@
<!-- Properties can be overridden locally by loading a local.properties file -->
<!-- Java 8 users probably need javadoc.params=-Xdoclint:none -->
- <property file="${playerglobal-source-gen}/local.properties"/>
+ <property file="${compiler-playerglobalc}/local.properties"/>
+ <property file="${basedir}/../env.properties"/>
<property name="src.depend" value="true"/>
@@ -67,34 +68,35 @@
<!--
- playerglobal-source-gen
+ compiler-playerglobalc
-->
<target name="compile" >
- <mkdir dir="${playerglobal-source-gen}/target/classes"/>
- <javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${playerglobal-source-gen}/target/classes" includeAntRuntime="true" includes="**/*.java"
+ <mkdir dir="${compiler-playerglobalc}/target/classes"/>
+ <javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${compiler-playerglobalc}/target/classes" includeAntRuntime="true" includes="**/*.java"
source="${javac.src}" target="${javac.src}">
<compilerarg value="-Xlint:all,-path,-fallthrough"/>
- <src path="${playerglobal-source-gen}/src/main/java"/>
+ <src path="${compiler-playerglobalc}/src/main/java"/>
<classpath>
- <pathelement location="${playerglobal-source-gen}/target/classes"/>
- <fileset dir="${playerglobal-source-gen}/../compiler-jx/lib" includes="dom4j.jar"/>
- <fileset dir="${playerglobal-source-gen}/../compiler/lib/external" includes="commons-io.jar"/>
+ <pathelement location="${compiler-playerglobalc}/target/classes"/>
+ <fileset dir="${compiler-playerglobalc}/../compiler-jx/lib" includes="dom4j.jar"/>
+ <fileset dir="${compiler-playerglobalc}/../compiler/lib" includes="compiler-common.jar,external/flex-tool-api.jar"/>
+ <fileset dir="${compiler-playerglobalc}/../compiler/lib/external" includes="commons-io.jar"/>
</classpath>
</javac>
</target>
<target name="prebuild">
- <mkdir dir="${playerglobal-source-gen}/target/classes" />
- <mkdir dir="${playerglobal-source-gen}/target/classes/META-INF" />
+ <mkdir dir="${compiler-playerglobalc}/target/classes" />
+ <mkdir dir="${compiler-playerglobalc}/target/classes/META-INF" />
</target>
<target name="main" depends="prebuild,compile" >
<mkdir dir="${sdk}"/>
- <copy file="${basedir}/../LICENSE.base" tofile="${playerglobal-source-gen}/target/classes/META-INF/LICENSE"/>
- <copy file="${basedir}/../NOTICE.base" tofile="${playerglobal-source-gen}/target/classes/META-INF/NOTICE"/>
- <jar file="${sdk}/playerglobal-source-gen.jar" basedir="${playerglobal-source-gen}/target/classes" includes="**/*.properties,org/apache/**/*,com/google/javascript/**/*,META-INF/**/*">
+ <copy file="${basedir}/../LICENSE.base" tofile="${compiler-playerglobalc}/target/classes/META-INF/LICENSE"/>
+ <copy file="${basedir}/../NOTICE.base" tofile="${compiler-playerglobalc}/target/classes/META-INF/NOTICE"/>
+ <jar file="${sdk}/compiler-playerglobalc.jar" basedir="${compiler-playerglobalc}/target/classes" includes="**/*.properties,org/apache/**/*,com/google/javascript/**/*,META-INF/**/*">
<include name="META-INF/LICENSE"/>
<include name="META-INF/NOTICE"/>
<manifest>
@@ -102,8 +104,8 @@
<attribute name="Implementation-Title" value="${manifest.Implementation-Title}"/>
<attribute name="Implementation-Version" value="${manifest.Implementation-Version}.${build.number}"/>
<attribute name="Implementation-Vendor" value="${manifest.Implementation-Vendor}"/>
- <attribute name="Main-Class" value="org.apache.royale.playerglobal.PlayerglobalSourceGen" />
- <attribute name="Class-Path" value="../../compiler/lib/external/commons-io.jar ../../lib/external/commons-io.jar ../../compiler-jx/lib/dom4j.jar dom4j.jar"/>
+ <attribute name="Main-Class" value="org.apache.royale.compiler.clients.PLAYERGLOBALC" />
+ <attribute name="Class-Path" value="../../compiler/lib/external/commons-io.jar ../../lib/external/commons-io.jar ../../compiler-jx/lib/dom4j.jar dom4j.jar ../../compiler/lib/compiler-common.jar ../../lib/compiler-common.jar ../../compiler/lib/external/flex-tool-api.jar ../../lib/external/flex-tool-api.jar"/>
<!-- The .. in the line above allows the compiler to load the env.properties file -->
</manifest>
</jar>
@@ -116,8 +118,8 @@
</target>
<target name="jar-test" >
- <!--<echo>using playerglobal-source-gen.jar from ${sdk}</echo>
- <java jar="${sdk}/playerglobal-source-gen.jar" fork="true"
+ <!--<echo>using compiler-playerglobalc.jar from ${sdk}</echo>
+ <java jar="${sdk}/compiler-playerglobalc.jar" fork="true"
failonerror="true">
<arg value="playerglobal/bundles/en_US/docs"/>
</java>-->
@@ -130,12 +132,13 @@
-->
<target name="clean" description="clean">
- <delete dir="${playerglobal-source-gen}/target/classes"/>
- <delete file="${playerglobal-source-gen}/target/playerglobal.swc"/>
+ <delete dir="${compiler-playerglobalc}/target/classes"/>
+ <delete file="${compiler-playerglobalc}/target/playerglobal.swc"/>
+ <delete file="${compiler-playerglobalc}/target/airglobal.swc"/>
</target>
<target name="wipe" depends="clean" description="Wipes everything that didn't come from Git.">
- <delete dir="${playerglobal-source-gen}/target"/>
+ <delete dir="${compiler-playerglobalc}/target"/>
</target>
</project>
diff --git a/playerglobal-source-gen/pom.xml b/compiler-playerglobalc/pom.xml
similarity index 71%
rename from playerglobal-source-gen/pom.xml
rename to compiler-playerglobalc/pom.xml
index 3550979..37528e2 100644
--- a/playerglobal-source-gen/pom.xml
+++ b/compiler-playerglobalc/pom.xml
@@ -27,32 +27,32 @@
<version>0.9.8-SNAPSHOT</version>
</parent>
- <artifactId>playerglobal-source-gen</artifactId>
+ <artifactId>compiler-playerglobalc</artifactId>
<version>0.9.8-SNAPSHOT</version>
<build>
- <finalName>${project.artifactId}</finalName>
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <mainClass>org.apache.royale.playerglobal.PlayerglobalSourceGen</mainClass>
- </manifest>
- <manifestEntries>
- <Sealed>false</Sealed>
- <Class-Path>../../lib/external/commons-io.jar dom4j.jar</Class-Path>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencies>
<dependency>
+ <groupId>org.apache.royale.compiler</groupId>
+ <artifactId>compiler-common</artifactId>
+ <version>0.9.8-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
diff --git a/playerglobal-source-gen/src/main/java/org/apache/royale/playerglobal/PlayerglobalSourceGen.java b/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java
similarity index 97%
rename from playerglobal-source-gen/src/main/java/org/apache/royale/playerglobal/PlayerglobalSourceGen.java
rename to compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java
index 4309623..71c4b14 100644
--- a/playerglobal-source-gen/src/main/java/org/apache/royale/playerglobal/PlayerglobalSourceGen.java
+++ b/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java
@@ -17,7 +17,7 @@
*
*/
-package org.apache.royale.playerglobal;
+package org.apache.royale.compiler.clients;
import java.io.File;
import java.io.IOException;
@@ -32,6 +32,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.io.FileUtils;
+import org.apache.flex.tools.FlexTool;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
@@ -46,28 +47,9 @@ import org.dom4j.io.SAXReader;
* java -jar playerglobal-source-gen.jar flex-sdk/frameworks/projects/playerglobal/bundles/en_US/docs/
* java -jar playerglobal-source-gen.jar flex-sdk/frameworks/projects/playerglobal/bundles/en_US/docs/ target/generated-sources/
*/
-class PlayerglobalSourceGen {
- public static void main(String[] args) {
- if (args.length == 0) {
- System.err.println("Must specify docs folder path");
- System.exit(1);
- }
- if (args.length > 2) {
- System.err.println("Too many arguments. Required docs folder path. Optional target folder path.");
- System.exit(1);
- }
- File sourceFolder = new File(args[0]);
- File targetFolder = (args.length == 2) ? new File(args[1])
- : new File(System.getProperty("user.dir"), "target/generated-sources/");
- PlayerglobalSourceGen sourceGen = new PlayerglobalSourceGen(sourceFolder, targetFolder);
- try {
- sourceGen.generateSources();
- } catch (Exception e) {
- System.err.println(e.getMessage());
- System.exit(1);
- }
- }
+class PLAYERGLOBALC implements FlexTool {
+ private static final String OUTPUT_FOLDER_NAME = "playerglobal";
private static final List<String> VECTOR_SUFFIXES = Arrays.asList("$double", "$int", "$uint", "$object");
//From the docs: Methods of the Object class are dynamically created on Object's prototype.
private static final List<String> OBJECT_PROTOTYPE_METHODS = Arrays.asList("hasOwnProperty", "isPrototypeOf",
@@ -97,9 +79,43 @@ class PlayerglobalSourceGen {
private File targetFolder;
private File currentFile;
- public PlayerglobalSourceGen(File sourceFolder, File targetFolder) {
- this.sourceFolder = sourceFolder;
- this.targetFolder = targetFolder;
+ /**
+ * Java program entry point.
+ *
+ * @param args command line arguments
+ */
+ public static void main(final String[] args)
+ {
+ PLAYERGLOBALC compiler = new PLAYERGLOBALC();
+ int exitCode = compiler.execute(args);
+ System.exit(exitCode);
+ }
+
+ public PLAYERGLOBALC() {
+
+ }
+
+ @Override
+ public String getName() {
+ // TODO: Change this to a flex-tool-api constant ...
+ return "PLAYERGLOBALC";
+ }
+
+ @Override
+ public int execute(String[] args) {
+ if(sourceFolder == null) {
+ sourceFolder = new File(System.getProperty("user.dir"), "src/main/docs/");
+ }
+ if(targetFolder == null) {
+ targetFolder = new File(System.getProperty("user.dir"), "target/generated-sources/");
+ }
+ try {
+ generateSources();
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ return 1;
+ }
+ return 0;
}
public void generateSources() throws Exception {
@@ -121,20 +137,14 @@ class PlayerglobalSourceGen {
}
private void preclean() throws Exception {
- File playerglobalFolder = new File(targetFolder, "playerglobal");
+ File playerglobalFolder = new File(targetFolder, OUTPUT_FOLDER_NAME);
FileUtils.deleteDirectory(playerglobalFolder);
- File airglobalFolder = new File(targetFolder, "airglobal");
- FileUtils.deleteDirectory(airglobalFolder);
}
private void writeFileForDefinition(String fullyQualifiedName, boolean airOnly, String contents)
throws IOException {
StringBuilder fileNameBuilder = new StringBuilder();
- if (airOnly) {
- fileNameBuilder.append("airglobal");
- } else {
- fileNameBuilder.append("playerglobal");
- }
+ fileNameBuilder.append(OUTPUT_FOLDER_NAME);
String[] parts = fullyQualifiedName.split("\\.");
for (String part : parts) {
fileNameBuilder.append("/");
diff --git a/pom.xml b/pom.xml
index 84b4a2f..c1c641d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -100,13 +100,13 @@
<modules>
<module>compiler-common</module>
<module>compiler-externc</module>
+ <module>compiler-playerglobalc</module>
<module>compiler</module>
<module>compiler-jx</module>
<module>compiler-test-utils</module>
<module>swfutils</module>
<module>debugger</module>
<module>flex-compiler-oem</module>
- <module>playerglobal-source-gen</module>
<module>royale-ant-tasks</module>
<module>royaleunit-ant-tasks</module>
<!--<module>royale-maven-extension</module>-->