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 68133c6  royale-maven-plugin: BaseMojo provides missing 
mxml-2009-manifest.xml that is required to use core types like Array, String, 
Boolean, etc. in MXML (closes #103)
68133c6 is described below

commit 68133c6a17ad593d970b2972d99acae094d4ed20
Author: Josh Tynjala <[email protected]>
AuthorDate: Mon Dec 9 12:53:02 2019 -0800

    royale-maven-plugin: BaseMojo provides missing mxml-2009-manifest.xml that 
is required to use core types like Array, String, Boolean, etc. in MXML (closes 
#103)
---
 .../java/org/apache/royale/maven/BaseMojo.java     | 45 +++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

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 c4c91c2..6cf3509 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
@@ -108,6 +108,21 @@ public abstract class BaseMojo
 
     protected abstract File getOutput() throws MojoExecutionException;
 
+    protected String getLanguageManifestFileName()
+    {
+        return "mxml-2009-manifest.xml";
+    }
+
+    protected String getLanguageNamespaceURI()
+    {
+        return "http://ns.adobe.com/mxml/2009";;
+    }
+
+    protected String getLanguageManifestContents()
+    {
+        return "<?xml version=\"1.0\"?>\n<componentPackage>\n<component 
id=\"Array\" class=\"Array\" lookupOnly=\"true\"/>\n<component id=\"Boolean\" 
class=\"Boolean\" lookupOnly=\"true\"/>\n<component id=\"Class\" 
class=\"Class\" lookupOnly=\"true\"/>\n<component id=\"Date\" class=\"Date\" 
lookupOnly=\"true\"/>\n<component id=\"DesignLayer\" 
class=\"mx.core.DesignLayer\"/>\n<component id=\"Function\" class=\"Function\" 
lookupOnly=\"true\"/>\n<component id=\"int\" class=\"int\" lookupOnl [...]
+    }
+
     protected VelocityContext getVelocityContext() throws 
MojoExecutionException {
         VelocityContext context = new VelocityContext();
 
@@ -130,7 +145,12 @@ public abstract class BaseMojo
         context.put("swfExternalLibraries", swfExternalLibraries);
         context.put("themeLibraries", themeLibraries);
         context.put("sourcePaths", sourcePaths);
-        context.put("namespaces", getNamespaces());
+        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("jsNamespaces", getNamespacesJS());
         context.put("namespaceUris", getNamespaceUris());
         context.put("includeClasses", includeClasses);
@@ -163,6 +183,14 @@ public abstract class BaseMojo
         return namespaces;
     }
 
+    protected Namespace getLanguageNamespace() {
+        File manifestFile = new File(outputDirectory, 
getLanguageManifestFileName());
+        Namespace namespace = new Namespace();
+        namespace.setUri(getLanguageNamespaceURI());
+        namespace.setManifest(manifestFile.getAbsolutePath());
+        return namespace;
+    }
+
     protected List<Namespace> getNamespacesJS() {
         List<Namespace> namespaces = new LinkedList<Namespace>();
         if(this.namespaces != null) {
@@ -293,6 +321,21 @@ public abstract class BaseMojo
                 }
             }
         }
+        File manifestFile = new File(outputDirectory, 
getLanguageManifestFileName());
+        try {
+            writer = new FileWriter(manifestFile);
+            writer.write(getLanguageManifestContents());
+        } catch (IOException e) {
+            throw new MojoExecutionException("Error creating config file at " 
+ configFile.getPath());
+        } finally {
+            if(writer != null) {
+                try {
+                    writer.close();
+                } catch (IOException e) {
+                    throw new MojoExecutionException("Error creating config 
file at " + configFile.getPath());
+                }
+            }
+        }
 
         // Get the tool group.
         FlexToolRegistry toolRegistry = new FlexToolRegistry();

Reply via email to