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 2019/12/10 19:24:37 UTC

[royale-compiler] branch develop updated (e65ffae -> b0c6008)

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git.


    from e65ffae  royale-maven-plugin: just some better FileWriter management
     new 0fa9132  royale-maven-plugin: generates mxml-language-manifest.xml instead of hard-coding (references #103)
     new b0c6008  royale-maven-plugin: the MXML language manifest is added separately from other namespaces because it shouldn't affect the namespaces collection used by the template (references #103)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/royale/maven/BaseMojo.java     | 32 ++++++++++---
 .../org/apache/royale/maven/ManifestComponent.java | 54 ++++++++++++++++++++++
 .../main/resources/config/compile-app-config.xml   |  6 +++
 .../resources/config/compile-asdoc-js-config.xml   | 12 +++--
 .../resources/config/compile-asdoc-swf-config.xml  |  6 +++
 .../resources/config/compile-extern-config.xml     |  6 +++
 .../main/resources/config/compile-js-config.xml    |  6 +++
 .../main/resources/config/compile-swf-config.xml   |  6 +++
 .../main/resources/config/mxml-2009-manifest.xml   | 42 -----------------
 .../resources/config/mxml-language-manifest.xml    | 15 +++---
 10 files changed, 124 insertions(+), 61 deletions(-)
 create mode 100644 royale-maven-plugin/src/main/java/org/apache/royale/maven/ManifestComponent.java
 delete mode 100644 royale-maven-plugin/src/main/resources/config/mxml-2009-manifest.xml
 copy compiler-common/src/main/java/org/apache/royale/compiler/internal/config/localization/package.html => royale-maven-plugin/src/main/resources/config/mxml-language-manifest.xml (75%)


[royale-compiler] 01/02: royale-maven-plugin: generates mxml-language-manifest.xml instead of hard-coding (references #103)

Posted by jo...@apache.org.
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

commit 0fa9132f32c2fd6f70902a7e6e72683824869662
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Dec 10 10:50:38 2019 -0800

    royale-maven-plugin: generates mxml-language-manifest.xml instead of hard-coding (references #103)
    
    In the future, this will be more flexible, to allow additions or deletions
---
 .../java/org/apache/royale/maven/BaseMojo.java     | 24 +++++++++-
 .../org/apache/royale/maven/ManifestComponent.java | 54 ++++++++++++++++++++++
 .../main/resources/config/mxml-2009-manifest.xml   | 42 -----------------
 .../resources/config/mxml-language-manifest.xml    | 24 ++++++++++
 4 files changed, 101 insertions(+), 43 deletions(-)

diff --git a/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java b/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java
index 24346ac..cef9149 100644
--- a/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java
+++ b/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java
@@ -110,7 +110,7 @@ public abstract class BaseMojo
 
     protected String getLanguageManifestFileName()
     {
-        return "mxml-2009-manifest.xml";
+        return "mxml-language-manifest.xml";
     }
 
     protected String getLanguageNamespaceURI()
@@ -160,6 +160,7 @@ public abstract class BaseMojo
             context.put("includeLookupOnly", includeLookupOnly);
         }
         context.put("output", getOutput());
+        context.put("manifestComponents", getLanguageManifestComponents());
 
         return context;
     }
@@ -204,6 +205,27 @@ public abstract class BaseMojo
         return namespaceUris;
     }
 
+    protected List<ManifestComponent> getLanguageManifestComponents()
+    {
+        List<ManifestComponent> manifestComponents = new ArrayList<ManifestComponent>();
+        manifestComponents.add(new ManifestComponent("Array", "Array", true));
+        manifestComponents.add(new ManifestComponent("Boolean", "Boolean", true));
+        manifestComponents.add(new ManifestComponent("Class", "Class", true));
+        manifestComponents.add(new ManifestComponent("Date", "Date", true));
+        manifestComponents.add(new ManifestComponent("DesignLayer", "mx.core.DesignLayer", false));
+        manifestComponents.add(new ManifestComponent("Function", "Function", true));
+        manifestComponents.add(new ManifestComponent("int", "int", true));
+        manifestComponents.add(new ManifestComponent("Number", "Number", true));
+        manifestComponents.add(new ManifestComponent("Object", "Object", true));
+        manifestComponents.add(new ManifestComponent("RegExp", "RegExp", true));
+        manifestComponents.add(new ManifestComponent("String", "String", true));
+        manifestComponents.add(new ManifestComponent("uint", "uint", true));
+        manifestComponents.add(new ManifestComponent("Vector", "__AS3__.vec.Vector", true));
+        manifestComponents.add(new ManifestComponent("XML", "XML", true));
+        manifestComponents.add(new ManifestComponent("XMLList", "XMLList", true));
+        return manifestComponents;
+    }
+
     @SuppressWarnings("unchecked")
     protected List<String> getSourcePaths() {
         List<String> sourcePaths = new LinkedList<String>();
diff --git a/royale-maven-plugin/src/main/java/org/apache/royale/maven/ManifestComponent.java b/royale-maven-plugin/src/main/java/org/apache/royale/maven/ManifestComponent.java
new file mode 100644
index 0000000..4fe1bbb
--- /dev/null
+++ b/royale-maven-plugin/src/main/java/org/apache/royale/maven/ManifestComponent.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.royale.maven;
+
+/**
+ * Created by joshtynjala on 10.12.19.
+ */
+public class ManifestComponent {
+	public ManifestComponent(String id, String qualifiedName, boolean lookupOnly) {
+		this.id = id;
+		this.qualifiedName = qualifiedName;
+		this.lookupOnly = lookupOnly;
+	}
+
+	private String id;
+	private String qualifiedName;
+	private boolean lookupOnly;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getQualifiedName() {
+        return qualifiedName;
+    }
+
+    public void setQualifiedName(String qualifiedName) {
+        this.qualifiedName = qualifiedName;
+    }
+
+    public boolean getLookupOnly() {
+        return lookupOnly;
+    }
+
+    public void setLookupOnlys(boolean lookupOnly) {
+        this.lookupOnly = lookupOnly;
+    }
+}
diff --git a/royale-maven-plugin/src/main/resources/config/mxml-2009-manifest.xml b/royale-maven-plugin/src/main/resources/config/mxml-2009-manifest.xml
deleted file mode 100644
index 0d5294f..0000000
--- a/royale-maven-plugin/src/main/resources/config/mxml-2009-manifest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
--->
-<!--
-
-    MXML 2009 Components
-
--->
-<componentPackage>
-    <!-- AS3 built-ins -->
-    <component id="Array" class="Array" lookupOnly="true"/>
-    <component id="Boolean" class="Boolean" lookupOnly="true"/>
-    <component id="Class" class="Class" lookupOnly="true"/>
-    <component id="Date" class="Date" lookupOnly="true"/>
-    <component id="DesignLayer" class="mx.core.DesignLayer"/>
-    <component id="Function" class="Function" lookupOnly="true"/>
-    <component id="int" class="int" lookupOnly="true"/>
-    <component id="Number" class="Number" lookupOnly="true"/>
-    <component id="Object" class="Object" lookupOnly="true"/>
-    <component id="RegExp" class="RegExp" lookupOnly="true"/>
-    <component id="String" class="String" lookupOnly="true"/>
-    <component id="uint" class="uint" lookupOnly="true"/>
-    <component id="Vector" class="__AS3__.vec.Vector" lookupOnly="true"/>
-    <component id="XML" class="XML" lookupOnly="true"/>
-    <component id="XMLList" class="XMLList" lookupOnly="true"/>
-</componentPackage>
\ No newline at end of file
diff --git a/royale-maven-plugin/src/main/resources/config/mxml-language-manifest.xml b/royale-maven-plugin/src/main/resources/config/mxml-language-manifest.xml
new file mode 100644
index 0000000..2699c9b
--- /dev/null
+++ b/royale-maven-plugin/src/main/resources/config/mxml-language-manifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<componentPackage>
+#foreach($manifestComponent in $manifestComponents)
+  <component id="$manifestComponent.id" class="$manifestComponent.qualifiedName" #if($manifestComponent.lookupOnly) lookupOnly="true" #end/>
+#end
+</componentPackage>
\ No newline at end of file


[royale-compiler] 02/02: royale-maven-plugin: the MXML language manifest is added separately from other namespaces because it shouldn't affect the namespaces collection used by the template (references #103)

Posted by jo...@apache.org.
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

commit b0c6008d7b7f305c3e7c628027bb2334b31de336
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Dec 10 10:53:48 2019 -0800

    royale-maven-plugin: the MXML language manifest is added separately from other namespaces because it shouldn't affect the namespaces collection used by the template (references #103)
    
    This caused issue where the MXML language namespace could be added to things like include-namespace, which is wrong. This will prevent the same issue in the future.
---
 .../src/main/java/org/apache/royale/maven/BaseMojo.java      |  8 ++------
 .../src/main/resources/config/compile-app-config.xml         |  6 ++++++
 .../src/main/resources/config/compile-asdoc-js-config.xml    | 12 +++++++++---
 .../src/main/resources/config/compile-asdoc-swf-config.xml   |  6 ++++++
 .../src/main/resources/config/compile-extern-config.xml      |  6 ++++++
 .../src/main/resources/config/compile-js-config.xml          |  6 ++++++
 .../src/main/resources/config/compile-swf-config.xml         |  6 ++++++
 7 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java b/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java
index cef9149..f1cf374 100644
--- a/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java
+++ b/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java
@@ -140,12 +140,8 @@ public abstract class BaseMojo
         context.put("swfExternalLibraries", swfExternalLibraries);
         context.put("themeLibraries", themeLibraries);
         context.put("sourcePaths", sourcePaths);
-        List<Namespace> namespaces = getNamespaces();
-        // not good to put the language namespace into getNamespaces() because
-        // the result of getNamespaces() is used in places where the language 
-        // namespace should not be included.
-        namespaces.add(getLanguageNamespace());
-        context.put("namespaces", namespaces);
+        context.put("languageNamespace", getLanguageNamespace());
+        context.put("namespaces", getNamespaces());
         context.put("jsNamespaces", getNamespacesJS());
         context.put("namespaceUris", getNamespaceUris());
         context.put("includeClasses", includeClasses);
diff --git a/royale-maven-plugin/src/main/resources/config/compile-app-config.xml b/royale-maven-plugin/src/main/resources/config/compile-app-config.xml
index ea275ed..c3fa2fa 100644
--- a/royale-maven-plugin/src/main/resources/config/compile-app-config.xml
+++ b/royale-maven-plugin/src/main/resources/config/compile-app-config.xml
@@ -129,6 +129,12 @@
         <manifest>$namespace.manifest</manifest>
       </namespace>
 #end
+#if($languageNamespace)
+      <namespace>
+        <uri>$languageNamespace.uri</uri>
+        <manifest>$languageNamespace.manifest</manifest>
+      </namespace>
+#end
     </namespaces>
 
     <!-- Enable post-link SWF optimization. -->
diff --git a/royale-maven-plugin/src/main/resources/config/compile-asdoc-js-config.xml b/royale-maven-plugin/src/main/resources/config/compile-asdoc-js-config.xml
index 0f63100..a47c349 100644
--- a/royale-maven-plugin/src/main/resources/config/compile-asdoc-js-config.xml
+++ b/royale-maven-plugin/src/main/resources/config/compile-asdoc-js-config.xml
@@ -40,9 +40,15 @@
 
     <namespaces>
 #foreach($namespace in $namespaces)            <namespace>
-      <uri>$namespace.uri</uri>
-      <manifest>$namespace.manifest</manifest>
-    </namespace>
+        <uri>$namespace.uri</uri>
+        <manifest>$namespace.manifest</manifest>
+      </namespace>
+#end
+#if($languageNamespace)
+      <namespace>
+        <uri>$languageNamespace.uri</uri>
+        <manifest>$languageNamespace.manifest</manifest>
+      </namespace>
 #end
     </namespaces>
 
diff --git a/royale-maven-plugin/src/main/resources/config/compile-asdoc-swf-config.xml b/royale-maven-plugin/src/main/resources/config/compile-asdoc-swf-config.xml
index 896c5bd3..965fdd0 100644
--- a/royale-maven-plugin/src/main/resources/config/compile-asdoc-swf-config.xml
+++ b/royale-maven-plugin/src/main/resources/config/compile-asdoc-swf-config.xml
@@ -49,6 +49,12 @@
                 <manifest>$namespace.manifest</manifest>
             </namespace>
 #end
+#if($languageNamespace)
+            <namespace>
+                <uri>$languageNamespace.uri</uri>
+                <manifest>$languageNamespace.manifest</manifest>
+            </namespace>
+#end
         </namespaces>
 
         <keep-as3-metadata>
diff --git a/royale-maven-plugin/src/main/resources/config/compile-extern-config.xml b/royale-maven-plugin/src/main/resources/config/compile-extern-config.xml
index ae61341..5bb1c99 100644
--- a/royale-maven-plugin/src/main/resources/config/compile-extern-config.xml
+++ b/royale-maven-plugin/src/main/resources/config/compile-extern-config.xml
@@ -44,6 +44,12 @@
                 <manifest>$namespace.manifest</manifest>
             </namespace>
 #end
+#if($languageNamespace)
+            <namespace>
+                <uri>$languageNamespace.uri</uri>
+                <manifest>$languageNamespace.manifest</manifest>
+            </namespace>
+#end
         </namespaces>
 
         <warn-no-constructor>false</warn-no-constructor>
diff --git a/royale-maven-plugin/src/main/resources/config/compile-js-config.xml b/royale-maven-plugin/src/main/resources/config/compile-js-config.xml
index 82ada4b..689a1fc 100644
--- a/royale-maven-plugin/src/main/resources/config/compile-js-config.xml
+++ b/royale-maven-plugin/src/main/resources/config/compile-js-config.xml
@@ -66,6 +66,12 @@
                 <manifest>$namespace.manifest</manifest>
             </namespace>
 #end
+#if($languageNamespace)
+            <namespace>
+                <uri>$languageNamespace.uri</uri>
+                <manifest>$languageNamespace.manifest</manifest>
+            </namespace>
+#end
         </namespaces>
 
         <warn-no-constructor>false</warn-no-constructor>
diff --git a/royale-maven-plugin/src/main/resources/config/compile-swf-config.xml b/royale-maven-plugin/src/main/resources/config/compile-swf-config.xml
index 80eaddd..dd96e02 100644
--- a/royale-maven-plugin/src/main/resources/config/compile-swf-config.xml
+++ b/royale-maven-plugin/src/main/resources/config/compile-swf-config.xml
@@ -69,6 +69,12 @@
                 <manifest>$namespace.manifest</manifest>
             </namespace>
 #end
+#if($languageNamespace)
+            <namespace>
+                <uri>$languageNamespace.uri</uri>
+                <manifest>$languageNamespace.manifest</manifest>
+            </namespace>
+#end
         </namespaces>
 
         <js-namespaces>