Repository: flex-falcon Updated Branches: refs/heads/feature/maven-migration-test 4236c48a6 -> 316710d68
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/externs/js/src/main/config/externc-config.xml ---------------------------------------------------------------------- diff --git a/externs/js/src/main/config/externc-config.xml b/externs/js/src/main/config/externc-config.xml new file mode 100644 index 0000000..f4a3b20 --- /dev/null +++ b/externs/js/src/main/config/externc-config.xml @@ -0,0 +1,173 @@ +<!-- + + 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</name></exclude> 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. + +--> +<flex-config> + + <compiler> + <accessible>true</accessible> + + <!-- + <external-library-path> + <path-element>${env.PLAYERGLOBAL_HOME}/${playerglobal.version}/playerglobal.swc</path-element> + <path-element>../../libs/framework.swc</path-element> + <path-element>../../libs/mx/mx.swc</path-element> + <path-element>../../libs/osmf.swc</path-element> + <path-element>../../libs/textLayout.swc</path-element> + </external-library-path> + + <keep-as3-metadata> + <name>SkinPart</name> + </keep-as3-metadata> + + <mxml> + <minimum-supported-version>4.0.0</minimum-supported-version> + </mxml> + --> + + <locale/> + + <library-path/> + + <!-- + <namespaces> + <namespace> + <uri>library://ns.adobe.com/flex/spark</uri> + <manifest>manifest.xml</manifest> + </namespace> + </namespaces> + --> + + <source-path> + <path-element>src</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <external> + <path-element>../javascript/missing.js</path-element> + <path-element>../../../target/downloads/es3.js</path-element> + <path-element>../../../target/downloads/es5.js</path-element> + <path-element>../../../target/downloads/es6.js</path-element> + <path-element>../../../target/downloads/browser/w3c_anim_timing.js</path-element> + <path-element>../../../target/downloads/browser/w3c_audio.js</path-element> + <path-element>../../../target/downloads/browser/w3c_batterystatus.js</path-element> + <path-element>../../../target/downloads/browser/w3c_css.js</path-element> + <path-element>../../../target/downloads/browser/w3c_css3d.js</path-element> + <path-element>../../../target/downloads/browser/w3c_device_sensor_event.js</path-element> + <path-element>../../../target/downloads/browser/w3c_dom1.js</path-element> + <path-element>../../../target/downloads/browser/w3c_dom2.js</path-element> + <path-element>../../../target/downloads/browser/w3c_dom3.js</path-element> + <path-element>../../../target/downloads/browser/w3c_elementtraversal.js</path-element> + <path-element>../../../target/downloads/browser/w3c_encoding.js</path-element> + <path-element>../../../target/downloads/browser/w3c_event.js</path-element> + <path-element>../../../target/downloads/browser/w3c_event3.js</path-element> + <path-element>../../../target/downloads/browser/w3c_geolocation.js</path-element> + <path-element>../../../target/downloads/browser/w3c_indexeddb.js</path-element> + <path-element>../../../target/downloads/browser/w3c_navigation_timing.js</path-element> + <path-element>../../../target/downloads/browser/w3c_range.js</path-element> + <path-element>../../../target/downloads/browser/w3c_rtc.js</path-element> + <path-element>../../../target/downloads/browser/w3c_selectors.js</path-element> + <!-- path-element>../../../target/downloads/browser/w3c_serviceworker.js</path-element> --> + <!-- path-element>../../../target/downloads/browser/w3c_webcrypto.js</path-element> --> + <path-element>../../../target/downloads/browser/w3c_xml.js</path-element> + + <!-- path-element>externs/fetchapi</path-element> --> + + <path-element>../../../target/downloads/browser/window.js</path-element> + + <path-element>../../../target/downloads/browser/ie_dom.js</path-element> + <path-element>../../../target/downloads/browser/gecko_dom.js</path-element> + <path-element>../../../target/downloads/browser/gecko_xml.js</path-element> + <path-element>../../../target/downloads/browser/gecko_event.js</path-element> + + <path-element>../../../target/downloads/browser/webkit_css.js</path-element> + <path-element>../../../target/downloads/browser/webkit_dom.js</path-element> + <path-element>../../../target/downloads/browser/webkit_event.js</path-element> + <!-- path-element>externs/webkit_notifications.js</path-element> --> + + <path-element>../../../target/downloads/browser/iphone.js</path-element> + <path-element>../../../target/downloads/browser/chrome.js</path-element> + <path-element>../../../target/downloads/browser/flash.js</path-element> + + <path-element>../../../target/downloads/browser/page_visibility.js</path-element> + <path-element>../../../target/downloads/browser/fileapi.js</path-element> + <path-element>../../../target/downloads/browser/html5.js</path-element> + + <path-element>../../../target/downloads/browser/webgl.js</path-element> + <path-element>../../../target/downloads/browser/webstorage.js</path-element> + + <path-element>../../../target/downloads/svg.js</path-element> + </external> + + <as-root>../../../target/generated-sources/externc</as-root> + + <field-exclude> + <class>Window</class> + <field>focus</field> + </field-exclude> + + <class-exclude> + <class>controlRange</class> + </class-exclude> + + <exclude> + <class>Array</class> + <name>toSource</name> + </exclude> + <exclude> + <class>Date</class> + <name>valueOf</name> + </exclude> + <exclude> + <class>String</class> + <name>valueOf</name> + </exclude> + <exclude><class>FontFaceSet</class><name>delete</name></exclude> + + <exclude><class>CSSStyleDeclaration</class><name>cssText</name></exclude> + <exclude><class>CSSStyleRule</class><name>style</name></exclude> + <exclude><class>CSSFontFaceRule</class><name>style</name></exclude> + <exclude><class>CSSPageRule</class><name>style</name></exclude> + + <exclude><class>Generator</class><name>throw</name></exclude> + <exclude><class>Generator</class><name>return</name></exclude> + <exclude><class>HTMLMenuItemElement</class><name>default</name></exclude> + <exclude><class>MessageEvent</class><name>data</name></exclude><!-- TODO returns T --> + <exclude><class>MessageEvent</class><name>initMessageEventNS</name></exclude> <!-- TODO param T --> + <exclude><class>MessageEvent</class><name>initMessageEvent</name></exclude> <!-- TODO param T --> + <exclude><class>MessageEvent</class><name>default</name></exclude> + <exclude><class>Object</class><name>is</name></exclude> + <exclude><class>Promise</class><name>catch</name></exclude> + + <exclude><class>IDBCursor</class><name>continue</name></exclude> + <exclude><class>IDBCursor</class><name>delete</name></exclude> + <exclude><class>IDBObjectStore</class><name>delete</name></exclude> + + <!-- TODO method treated like field --> + <field-exclude><class>Iterator</class><field>next</field></field-exclude> + <exclude><class>Generator</class><name>next</name></exclude> + <exclude><class>LinkStyle</class><name>sheet</name></exclude> + + <!-- SVG --> + <exclude><class>SVGStylable</class><name>className</name></exclude> + <exclude><class>SVGStylable</class><name>style</name></exclude> + <exclude><class>SVGLocatable</class><name>farthestViewportElement</name></exclude> + <exclude><class>SVGLocatable</class><name>nearestViewportElement</name></exclude> + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/externs/js/src/main/config/generate-config.xml ---------------------------------------------------------------------- diff --git a/externs/js/src/main/config/generate-config.xml b/externs/js/src/main/config/generate-config.xml deleted file mode 100644 index f4a3b20..0000000 --- a/externs/js/src/main/config/generate-config.xml +++ /dev/null @@ -1,173 +0,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</name></exclude> 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. - ---> -<flex-config> - - <compiler> - <accessible>true</accessible> - - <!-- - <external-library-path> - <path-element>${env.PLAYERGLOBAL_HOME}/${playerglobal.version}/playerglobal.swc</path-element> - <path-element>../../libs/framework.swc</path-element> - <path-element>../../libs/mx/mx.swc</path-element> - <path-element>../../libs/osmf.swc</path-element> - <path-element>../../libs/textLayout.swc</path-element> - </external-library-path> - - <keep-as3-metadata> - <name>SkinPart</name> - </keep-as3-metadata> - - <mxml> - <minimum-supported-version>4.0.0</minimum-supported-version> - </mxml> - --> - - <locale/> - - <library-path/> - - <!-- - <namespaces> - <namespace> - <uri>library://ns.adobe.com/flex/spark</uri> - <manifest>manifest.xml</manifest> - </namespace> - </namespaces> - --> - - <source-path> - <path-element>src</path-element> - </source-path> - - <warn-no-constructor>false</warn-no-constructor> - </compiler> - - <external> - <path-element>../javascript/missing.js</path-element> - <path-element>../../../target/downloads/es3.js</path-element> - <path-element>../../../target/downloads/es5.js</path-element> - <path-element>../../../target/downloads/es6.js</path-element> - <path-element>../../../target/downloads/browser/w3c_anim_timing.js</path-element> - <path-element>../../../target/downloads/browser/w3c_audio.js</path-element> - <path-element>../../../target/downloads/browser/w3c_batterystatus.js</path-element> - <path-element>../../../target/downloads/browser/w3c_css.js</path-element> - <path-element>../../../target/downloads/browser/w3c_css3d.js</path-element> - <path-element>../../../target/downloads/browser/w3c_device_sensor_event.js</path-element> - <path-element>../../../target/downloads/browser/w3c_dom1.js</path-element> - <path-element>../../../target/downloads/browser/w3c_dom2.js</path-element> - <path-element>../../../target/downloads/browser/w3c_dom3.js</path-element> - <path-element>../../../target/downloads/browser/w3c_elementtraversal.js</path-element> - <path-element>../../../target/downloads/browser/w3c_encoding.js</path-element> - <path-element>../../../target/downloads/browser/w3c_event.js</path-element> - <path-element>../../../target/downloads/browser/w3c_event3.js</path-element> - <path-element>../../../target/downloads/browser/w3c_geolocation.js</path-element> - <path-element>../../../target/downloads/browser/w3c_indexeddb.js</path-element> - <path-element>../../../target/downloads/browser/w3c_navigation_timing.js</path-element> - <path-element>../../../target/downloads/browser/w3c_range.js</path-element> - <path-element>../../../target/downloads/browser/w3c_rtc.js</path-element> - <path-element>../../../target/downloads/browser/w3c_selectors.js</path-element> - <!-- path-element>../../../target/downloads/browser/w3c_serviceworker.js</path-element> --> - <!-- path-element>../../../target/downloads/browser/w3c_webcrypto.js</path-element> --> - <path-element>../../../target/downloads/browser/w3c_xml.js</path-element> - - <!-- path-element>externs/fetchapi</path-element> --> - - <path-element>../../../target/downloads/browser/window.js</path-element> - - <path-element>../../../target/downloads/browser/ie_dom.js</path-element> - <path-element>../../../target/downloads/browser/gecko_dom.js</path-element> - <path-element>../../../target/downloads/browser/gecko_xml.js</path-element> - <path-element>../../../target/downloads/browser/gecko_event.js</path-element> - - <path-element>../../../target/downloads/browser/webkit_css.js</path-element> - <path-element>../../../target/downloads/browser/webkit_dom.js</path-element> - <path-element>../../../target/downloads/browser/webkit_event.js</path-element> - <!-- path-element>externs/webkit_notifications.js</path-element> --> - - <path-element>../../../target/downloads/browser/iphone.js</path-element> - <path-element>../../../target/downloads/browser/chrome.js</path-element> - <path-element>../../../target/downloads/browser/flash.js</path-element> - - <path-element>../../../target/downloads/browser/page_visibility.js</path-element> - <path-element>../../../target/downloads/browser/fileapi.js</path-element> - <path-element>../../../target/downloads/browser/html5.js</path-element> - - <path-element>../../../target/downloads/browser/webgl.js</path-element> - <path-element>../../../target/downloads/browser/webstorage.js</path-element> - - <path-element>../../../target/downloads/svg.js</path-element> - </external> - - <as-root>../../../target/generated-sources/externc</as-root> - - <field-exclude> - <class>Window</class> - <field>focus</field> - </field-exclude> - - <class-exclude> - <class>controlRange</class> - </class-exclude> - - <exclude> - <class>Array</class> - <name>toSource</name> - </exclude> - <exclude> - <class>Date</class> - <name>valueOf</name> - </exclude> - <exclude> - <class>String</class> - <name>valueOf</name> - </exclude> - <exclude><class>FontFaceSet</class><name>delete</name></exclude> - - <exclude><class>CSSStyleDeclaration</class><name>cssText</name></exclude> - <exclude><class>CSSStyleRule</class><name>style</name></exclude> - <exclude><class>CSSFontFaceRule</class><name>style</name></exclude> - <exclude><class>CSSPageRule</class><name>style</name></exclude> - - <exclude><class>Generator</class><name>throw</name></exclude> - <exclude><class>Generator</class><name>return</name></exclude> - <exclude><class>HTMLMenuItemElement</class><name>default</name></exclude> - <exclude><class>MessageEvent</class><name>data</name></exclude><!-- TODO returns T --> - <exclude><class>MessageEvent</class><name>initMessageEventNS</name></exclude> <!-- TODO param T --> - <exclude><class>MessageEvent</class><name>initMessageEvent</name></exclude> <!-- TODO param T --> - <exclude><class>MessageEvent</class><name>default</name></exclude> - <exclude><class>Object</class><name>is</name></exclude> - <exclude><class>Promise</class><name>catch</name></exclude> - - <exclude><class>IDBCursor</class><name>continue</name></exclude> - <exclude><class>IDBCursor</class><name>delete</name></exclude> - <exclude><class>IDBObjectStore</class><name>delete</name></exclude> - - <!-- TODO method treated like field --> - <field-exclude><class>Iterator</class><field>next</field></field-exclude> - <exclude><class>Generator</class><name>next</name></exclude> - <exclude><class>LinkStyle</class><name>sheet</name></exclude> - - <!-- SVG --> - <exclude><class>SVGStylable</class><name>className</name></exclude> - <exclude><class>SVGStylable</class><name>style</name></exclude> - <exclude><class>SVGLocatable</class><name>farthestViewportElement</name></exclude> - <exclude><class>SVGLocatable</class><name>nearestViewportElement</name></exclude> - -</flex-config> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/externs/node/pom.xml ---------------------------------------------------------------------- diff --git a/externs/node/pom.xml b/externs/node/pom.xml index cace5e5..9e448ab 100644 --- a/externs/node/pom.xml +++ b/externs/node/pom.xml @@ -57,6 +57,7 @@ <artifactId>flexjs-externs-js</artifactId> <version>0.6.0-SNAPSHOT</version> <type>swc</type> + <scope>external</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/externs/node/src/main/config/compile-as-config.xml ---------------------------------------------------------------------- diff --git a/externs/node/src/main/config/compile-as-config.xml b/externs/node/src/main/config/compile-as-config.xml new file mode 100644 index 0000000..db19882 --- /dev/null +++ b/externs/node/src/main/config/compile-as-config.xml @@ -0,0 +1,42 @@ +<!-- + + 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. + +--> +<flex-config> + + <compiler> + <accessible>true</accessible> + + <external-library-path> + </external-library-path> + + <source-path> + <path-element>generated-sources/externc/functions</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-sources> + <path-element>generated-sources/externc/functions</path-element> + </include-sources> + + <include-file> + <name>externs/node.js</name> + <path>../src/main/javascript/node.js</path> + </include-file> +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/externs/node/src/main/config/compile-config.xml ---------------------------------------------------------------------- diff --git a/externs/node/src/main/config/compile-config.xml b/externs/node/src/main/config/compile-config.xml deleted file mode 100644 index 750846d..0000000 --- a/externs/node/src/main/config/compile-config.xml +++ /dev/null @@ -1,43 +0,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. - ---> -<flex-config> - - <compiler> - <accessible>true</accessible> - - <external-library-path> - <path-element>../../../../js/target/flexjs-externs-js-0.6.0-SNAPSHOT.swc</path-element> - </external-library-path> - - <source-path> - <path-element>../../../target/generated-sources/externc/functions</path-element> - </source-path> - - <warn-no-constructor>false</warn-no-constructor> - </compiler> - - <include-sources> - <path-element>../../../target/generated-sources/externc/functions</path-element> - </include-sources> - - <include-file> - <name>externs/node.js</name> - <path>../javascript/node.js</path> - </include-file> -</flex-config> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/externs/node/src/main/config/externc-config.xml ---------------------------------------------------------------------- diff --git a/externs/node/src/main/config/externc-config.xml b/externs/node/src/main/config/externc-config.xml new file mode 100644 index 0000000..ecde54f --- /dev/null +++ b/externs/node/src/main/config/externc-config.xml @@ -0,0 +1,39 @@ +<!-- + + 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</name></exclude> 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. + +--> +<flex-config> + + <compiler> + <accessible>true</accessible> + + <locale/> + + <source-path> + <path-element>src/main/javascript</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <external> + <path-element>../javascript/node.js</path-element> + </external> + + <as-root>../../../target/generated-sources/externc</as-root> + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/externs/node/src/main/config/generate-config.xml ---------------------------------------------------------------------- diff --git a/externs/node/src/main/config/generate-config.xml b/externs/node/src/main/config/generate-config.xml deleted file mode 100644 index ecde54f..0000000 --- a/externs/node/src/main/config/generate-config.xml +++ /dev/null @@ -1,39 +0,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</name></exclude> 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. - ---> -<flex-config> - - <compiler> - <accessible>true</accessible> - - <locale/> - - <source-path> - <path-element>src/main/javascript</path-element> - </source-path> - - <warn-no-constructor>false</warn-no-constructor> - </compiler> - - <external> - <path-element>../javascript/node.js</path-element> - </external> - - <as-root>../../../target/generated-sources/externc</as-root> - -</flex-config> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/flexjs-maven-plugin/pom.xml ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/pom.xml b/flexjs-maven-plugin/pom.xml index 003f7e1..ed82859 100644 --- a/flexjs-maven-plugin/pom.xml +++ b/flexjs-maven-plugin/pom.xml @@ -57,6 +57,11 @@ <version>2.2.1</version> </dependency> <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>${maven.version}</version> + </dependency> + <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileASMojo.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileASMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileASMojo.java new file mode 100644 index 0000000..0061e09 --- /dev/null +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileASMojo.java @@ -0,0 +1,213 @@ +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * 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.flex.maven.flexjs; + +import org.apache.flex.maven.flexjs.types.FlexScope; +import org.apache.flex.tools.FlexTool; +import org.apache.flex.tools.FlexToolGroup; +import org.apache.flex.tools.FlexToolRegistry; +import org.apache.maven.RepositoryUtils; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.*; +import org.eclipse.aether.RepositorySystemSession; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.xpath.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.Set; + +/** + * goal which compiles a project into a flexjs swc library. + */ +@Mojo(name="compile-as",defaultPhase = LifecyclePhase.PROCESS_SOURCES) +public class CompileASMojo + extends AbstractMojo +{ + + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject project; + + @Parameter(defaultValue="${basedir}/src/main/config/compile-as-config.xml") + private File compileAsConfigFile; + + @Parameter(defaultValue="${project.build.directory}") + private File outputDirectory; + + @Parameter(defaultValue = "${project.artifactId}-${project.version}.swc") + private String outputFileName; + + @Parameter(readonly = true, defaultValue = "${repositorySystemSession}") + private RepositorySystemSession repositorySystemSession; + + @Component + private ProjectDependenciesResolver projectDependenciesResolver; + + public void execute() + throws MojoExecutionException + { + if(!compileAsConfigFile.exists()) { + getLog().info(" - compilation config file '" + compileAsConfigFile.getPath() + + "' not found, skipping compilation"); + return; + } + + // Prepare the config file. + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + try { + // Resolve all the dependencies. + Set<Artifact> resolvedDependencies = resolveDependencies(); + + // Parse the input document. + DocumentBuilder builder = factory.newDocumentBuilder(); + Document configuration = builder.parse(new FileInputStream(compileAsConfigFile)); + + // Append the path-elements for the compile scope. + Set<Artifact> compileDependencies = getDependenciesForScope(resolvedDependencies, FlexScope.COMPILE); + outputLibraryPath(configuration, "flex-config/compiler/library-path", compileDependencies); + + // Append the path-elements for the external scope. + Set<Artifact> externalDependencies = getDependenciesForScope(resolvedDependencies, FlexScope.EXTERNAL); + outputLibraryPath(configuration, "flex-config/compiler/external-library-path", externalDependencies); + + // Write the modified config-file to the output directory. + File configFileOutput = new File(outputDirectory, "compile-as-config.xml"); + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + DOMSource source = new DOMSource(configuration); + StreamResult result = new StreamResult(configFileOutput); + transformer.transform(source, result); + + // Get the falcon tool group. + FlexToolRegistry toolRegistry = new FlexToolRegistry(); + FlexToolGroup toolGroup = toolRegistry.getToolGroup("Falcon"); + if(toolGroup == null) { + throw new MojoExecutionException("Could not find tool group: Falcon"); + } + + // Get an instance of the compiler and run the build. + FlexTool compc = toolGroup.getFlexTool(FlexTool.FLEX_TOOL_COMPC); + File outputFile = new File(outputDirectory, outputFileName); + String[] args = {"+flexlib=externs", "-debug", "-load-config=" + configFileOutput.getPath(), + "-output=" + outputFile.getPath(), "-define=COMPILE::AS3,true", "-define=COMPILE::JS,false"}; + compc.execute(args); + + // Attach the file created by the compiler as artifact file to maven. + project.getArtifact().setFile(outputFile); + + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } catch (TransformerConfigurationException e) { + e.printStackTrace(); + } catch (TransformerException e) { + e.printStackTrace(); + } + } + + private Set<Artifact> resolveDependencies() throws MojoExecutionException { + DefaultDependencyResolutionRequest dependencyResolutionRequest = + new DefaultDependencyResolutionRequest(project, repositorySystemSession); + DependencyResolutionResult dependencyResolutionResult; + + try { + dependencyResolutionResult = projectDependenciesResolver.resolve(dependencyResolutionRequest); + } catch (DependencyResolutionException ex) { + throw new MojoExecutionException(ex.getMessage(), ex); + } + + Set<Artifact> artifacts = new LinkedHashSet<Artifact>(); + if (dependencyResolutionResult.getDependencyGraph() != null + && !dependencyResolutionResult.getDependencyGraph().getChildren().isEmpty()) { + RepositoryUtils.toArtifacts(artifacts, dependencyResolutionResult.getDependencyGraph().getChildren(), + Collections.singletonList(project.getArtifact().getId()), null); + } + return artifacts; + } + + private Set<Artifact> getDependenciesForScope(Set<Artifact> dependencies, FlexScope scope) { + Set<Artifact> artifacts = new LinkedHashSet<Artifact>(); + for(Artifact dependency : dependencies) { + FlexScope dependencyScope = FlexScope.COMPILE; + if(dependency.getScope() != null) { + dependencyScope = FlexScope.valueOf(dependency.getScope().toUpperCase()); + } + if(dependencyScope == scope) { + artifacts.add(dependency); + } + } + return artifacts; + } + + private void outputLibraryPath(Document configDocument, String baseXPath, Set<Artifact> artifacts) { + if(!artifacts.isEmpty()) { + XPathFactory xPathfactory = XPathFactory.newInstance(); + XPath xpath = xPathfactory.newXPath(); + try { + XPathExpression expr = xpath.compile(baseXPath); + Element externalLibraryPath = (Element) expr.evaluate(configDocument, XPathConstants.NODE); + if(externalLibraryPath != null) { + // Remove any existing path-elements (They are leftovers from the ant build). + Node child = externalLibraryPath.getFirstChild(); + while(child != null) { + externalLibraryPath.removeChild(child); + child = externalLibraryPath.getFirstChild(); + } + + // Add the new path-elements. + for (Artifact artifact : artifacts) { + Element newPathElement = configDocument.createElement("path-element"); + newPathElement.setTextContent(artifact.getFile().getAbsolutePath()); + externalLibraryPath.appendChild(newPathElement); + } + } else { + throw new RuntimeException("Could not find root element " + baseXPath); + } + } catch (XPathExpressionException e) { + throw new RuntimeException("Error adding path-element", e); + } + } + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java new file mode 100644 index 0000000..5ca7c5a --- /dev/null +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileJSMojo.java @@ -0,0 +1,105 @@ +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * 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.flex.maven.flexjs; + +import org.apache.flex.tools.FlexTool; +import org.apache.flex.tools.FlexToolGroup; +import org.apache.flex.tools.FlexToolRegistry; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectDependenciesResolver; +import org.eclipse.aether.RepositorySystemSession; + +import java.io.File; + +/** + * goal which compiles a project into a flexjs swc library. + */ +@Mojo(name="compile-js",defaultPhase = LifecyclePhase.PROCESS_SOURCES) +public class CompileJSMojo + extends AbstractMojo +{ + + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject project; + + @Parameter(defaultValue="${basedir}/src/main/config/compile-js-config.xml") + private File compileJsConfigFile; + + @Parameter(defaultValue="${project.build.directory}") + private File outputDirectory; + + @Parameter(defaultValue = "${project.artifactId}-${project.version}.swc") + private String outputFileName; + + @Parameter(readonly = true, defaultValue = "${repositorySystemSession}") + private RepositorySystemSession repositorySystemSession; + + @Component + private ProjectDependenciesResolver projectDependenciesResolver; + + public void execute() + throws MojoExecutionException + { + if(!compileJsConfigFile.exists()) { + getLog().info(" - compilation config file '" + compileJsConfigFile.getPath() + + "' not found, skipping compilation"); + return; + } + + File generatedSourcesOutputDir = new File(outputDirectory, "generated-sources/flexjs"); + if(!generatedSourcesOutputDir.exists()) { + if(!generatedSourcesOutputDir.mkdirs()) { + throw new MojoExecutionException("Could not create directory " + generatedSourcesOutputDir.getPath()); + } + } + + // Get the falcon tool group. + FlexToolRegistry toolRegistry = new FlexToolRegistry(); + FlexToolGroup toolGroup = toolRegistry.getToolGroup("FlexJS"); + if(toolGroup == null) { + throw new MojoExecutionException("Could not find tool group: Falcon"); + } + + // Get an instance of the compiler and run the build. + FlexTool compc = toolGroup.getFlexTool(FlexTool.FLEX_TOOL_COMPC); + File outputFile = new File(outputDirectory, outputFileName); + +/* <!--arg value="+flexlib=${FLEX_HOME}/frameworks" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" /> + <arg value="+env.AIR_HOME=${env.AIR_HOME}" /> + <arg value="-external-library-path+=${JS.SWC}" /> + <!-- this is not on external-library path otherwise goog.requires are not generated --> + <arg value="-library-path+=${GCL.SWC}" />*/ + + String[] args = {"+flexlib=../../..", "-js-output-type=FLEXJS", "-keep-asdoc", "-load-config=" + compileJsConfigFile.getPath(), + "-output=" + new File(outputDirectory.getPath(), "generated-sources/flexjs").getPath(), + "-define=COMPILE::AS3,false", "-define=COMPILE::JS,true"}; + compc.execute(args); + + // Attach the file created by the compiler as artifact file to maven. + project.getArtifact().setFile(outputFile); + + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileMojo.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileMojo.java deleted file mode 100644 index ca2b28a..0000000 --- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/CompileMojo.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2001-2005 The Apache Software Foundation. - * - * 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.flex.maven.flexjs; - -import org.apache.flex.tools.FlexTool; -import org.apache.flex.tools.FlexToolGroup; -import org.apache.flex.tools.FlexToolRegistry; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; - -import java.io.File; - -/** - * goal which compiles a project into a flexjs swc library. - */ -@Mojo(name="compile",defaultPhase = LifecyclePhase.PROCESS_SOURCES) -public class CompileMojo - extends AbstractMojo -{ - - @Parameter(defaultValue = "${project}", readonly = true) - public MavenProject project; - - @Parameter(defaultValue="${basedir}/src/main/config/compile-config.xml") - private File configFile; - - @Parameter(defaultValue="${project.build.directory}") - private File outputDirectory; - - @Parameter(defaultValue = "${project.artifactId}-${project.version}.swc") - private String outputFileName; - - public void execute() - throws MojoExecutionException - { - FlexToolRegistry toolRegistry = new FlexToolRegistry(); - FlexToolGroup toolGroup = toolRegistry.getToolGroup("Falcon"); - if(toolGroup == null) { - throw new MojoExecutionException("Could not find tool group: Falcon"); - } - - FlexTool compc = toolGroup.getFlexTool(FlexTool.FLEX_TOOL_COMPC); - File outputFile = new File(outputDirectory, outputFileName); - String[] args = {"+flexlib=externs", "-debug", "-load-config=" + configFile.getPath(), - "-output=" + outputFile.getPath()}; - compc.execute(args); - - // Attach the file created by the compiler as artifact file to maven. - project.getArtifact().setFile(outputFile); - } - -} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/ExterncMojo.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/ExterncMojo.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/ExterncMojo.java index 02acfcd..53e8a56 100644 --- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/ExterncMojo.java +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/ExterncMojo.java @@ -35,7 +35,7 @@ public class ExterncMojo extends AbstractMojo { - @Parameter(defaultValue="${basedir}/src/main/config/generate-config.xml") + @Parameter(defaultValue="${basedir}/src/main/config/externc-config.xml") private File configFile; public void execute() http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/trust/DefaultTrustHandler.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/trust/DefaultTrustHandler.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/trust/DefaultTrustHandler.java index 858d3fd..deb887e 100644 --- a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/trust/DefaultTrustHandler.java +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/trust/DefaultTrustHandler.java @@ -52,7 +52,7 @@ public class DefaultTrustHandler implements TrustHandler { securityTrustFile.getPath(), e); } } else { - System.out.println(" - Creating new FlashPlayer security trust file at: " + securityTrustFile.getPath()); + System.out.println(" - Updating FlashPlayer security trust file at: " + securityTrustFile.getPath()); } // Check if the current directory is already listed in the file, if not, append it to the file. http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/types/FlexScope.java ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/types/FlexScope.java b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/types/FlexScope.java new file mode 100644 index 0000000..d9929b1 --- /dev/null +++ b/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/types/FlexScope.java @@ -0,0 +1,12 @@ +package org.apache.flex.maven.flexjs.types; + +/** + * Created by christoferdutz on 18.04.16. + */ +public enum FlexScope { + + COMPILE, + TEST, + EXTERNAL + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/316710d6/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml ---------------------------------------------------------------------- diff --git a/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml index 766d90f..7329c8f 100644 --- a/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml +++ b/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml @@ -19,7 +19,8 @@ org.apache.maven.plugins:maven-resources-plugin:resources </process-resources> <compile> - org.apache.flex.flexjs.compiler:flexjs-maven-plugin:compile + org.apache.flex.flexjs.compiler:flexjs-maven-plugin:compile-js, + org.apache.flex.flexjs.compiler:flexjs-maven-plugin:compile-as </compile> <process-test-resources> org.apache.maven.plugins:maven-resources-plugin:testResources