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:38 UTC

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

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