Is there a reason this wasn't fixed by changing the *.xml files in 
royale-maven-plugin/src/main/resources/config?

I would rather not see this in code.

Of course, I could be wrong...
-Alex

On 12/9/19, 1:29 PM, "[email protected]" <[email protected]> wrote:

    This is an automated email from the ASF dual-hosted git repository.
    
    joshtynjala pushed a commit to branch develop
    in repository 
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-compiler.git&amp;data=02%7C01%7Caharui%40adobe.com%7Cde0a7f8153fe4b4c2a2808d77ceedbe5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637115237688041632&amp;sdata=H85oQILNteD2V30NtzN0RGRKQu98PVLYO%2FNPn6VfKXI%3D&amp;reserved=0
    
    
    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 
"https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&amp;data=02%7C01%7Caharui%40adobe.com%7Cde0a7f8153fe4b4c2a2808d77ceedbe5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637115237688041632&amp;sdata=71log%2FgMvbwKu1eHCxwQ0pw1DXC80grNNoxSjOFzHG8%3D&amp;reserved=0";;
    +    }
    +
    +    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