http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dd503343/compiler/src/test/java/as/ASKeywordTests.java ---------------------------------------------------------------------- diff --cc compiler/src/test/java/as/ASKeywordTests.java index 1602b3c,0000000..8223620 mode 100644,000000..100644 --- a/compiler/src/test/java/as/ASKeywordTests.java +++ b/compiler/src/test/java/as/ASKeywordTests.java @@@ -1,347 -1,0 +1,368 @@@ +/* + * + * 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. + * + */ + +package as; + +import org.junit.Test; + +/** + * Feature tests for AS Namespaces. + */ +public class ASKeywordTests extends ASFeatureTestsBase +{ + @Test + public void ASKeyword_SwitchStatement() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var foo:String;", + "public function hasSwitch(switcher:int):Boolean {", + " trace('hey, a method named namespace worked');", + " switch (switcher) {", + " case 1:", + " foo = 'bar';", + " break;", + " default:", + " foo = 'baz';", + " break;", + " }", + " return true;", + "}", + }; + String[] testCode = new String[] + { + "hasSwitch(1);", + "assertEqual('switch worked', foo, 'bar');", + "hasSwitch(0);", + "assertEqual('switch worked', foo, 'baz');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void ASKeyword_Namespace_as_method_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var foo:String;", + "public function namespace(instance:Object):Boolean {", + " trace('hey, a method named namespace worked');", + " foo = 'as';", + " return true;", + "}", + }; + String[] testCode = new String[] + { + "namespace(this);", + "assertEqual('method named namespace', foo, 'as');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void ASKeyword_Default_as_method_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var foo:String;", + "public function default(instance:Object):Boolean {", + " trace('hey, a method named default worked');", + " foo = 'as';", + " return true;", + "}", + }; + String[] testCode = new String[] + { + "default(this);", + "assertEqual('method named default', foo, 'as');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void ASKeyword_for_as_method_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var foo:String;", + "public function for(instance:Object):Boolean {", + " trace('hey, a method named default worked');", + " foo = 'as';", + " return true;", + "}", + }; + String[] testCode = new String[] + { + "this.for(this);", + "assertEqual('method named default', foo, 'as');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void ASKeyword_Get_as_method_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var foo:String;", + "public function get(instance:Object):Boolean {", + " trace('hey, a method named get worked');", + " foo = 'as';", + " return true;", + "}", + }; + String[] testCode = new String[] + { + "get(this);", + "assertEqual('method named get', foo, 'as');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void ASKeyword_Get_as_getter_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var foo:String;", + "public function get get():Boolean {", + " trace('hey, a getter named get worked');", + " foo = 'as';", + " return true;", + "}", + }; + String[] testCode = new String[] + { + "var bar:Boolean = get;", + "assertEqual('getter named get', foo, 'as');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void ASKeyword_Get_as_member_expression_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var foo:String;", + "public function get get():Boolean {", + " trace('hey, a getter named get worked');", + " foo = 'as';", + " return true;", + "}", + }; + String[] testCode = new String[] + { + "var bar:Boolean = this.get;", + "assertEqual('getter named get', foo, 'as');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void ASKeyword_as_method_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var foo:String;", + "public function as(instance:Object):Boolean {", + " trace('hey, a method named as worked');", + " foo = 'as';", + " return true;", + "}", + }; + String[] testCode = new String[] + { + "as(this);", + "assertEqual('method named as', foo, 'as');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void ASKeyword_as_property_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var foo:String;", + "public function get as():String {", + " return foo;", + "}", + "public function set as(value:String):void {", + " foo = value;", + "}", + }; + String[] testCode = new String[] + { + "as = 'bar';", + "assertEqual('property named as', as, 'bar');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void ASKeyword_as_variable_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var as:String;", + }; + String[] testCode = new String[] + { + "as = 'bar';", + "assertEqual('variable named as', as, 'bar');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test ++ public void ASKeyword_default_as_variable_name() ++ { ++ // all tests can assume that flash.display.Sprite ++ // flash.system.System and flash.events.Event have been imported ++ String[] imports = new String[] ++ { ++ }; ++ String[] declarations = new String[] ++ { ++ "public var default:String;", ++ }; ++ String[] testCode = new String[] ++ { ++ "default = 'bar';", ++ "assertEqual('variable named default', default, 'bar');", ++ }; ++ String source = getAS(imports, declarations, testCode, new String[0]); ++ compileAndRun(source); ++ } ++ ++ @Test + public void ASKeyword_as_member_expression() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var as:String;", + }; + String[] testCode = new String[] + { + "this.as = 'bar';", + "assertEqual('variable named as', this.as, 'bar');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test + public void AS_new_function_returned_from_function() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + }; + String[] testCode = new String[] + { + "function getClass(index:Number):Class {", + " if (index == 0) return Inner;", + " return Number;", + "}", + "var foo:Inner = new getClass(0)('foo');", + "assertEqual('foo.value', foo.value, 'foo');", + }; + String[] extra = new String[] + { + "class Inner {", + " public function Inner(value:String) {", + " this.value = value;", + " }", + " public var value:String;", + "}", + }; + String source = getAS(imports, declarations, testCode, extra); + compileAndRun(source); + } +}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dd503343/externs/js/pom.xml ---------------------------------------------------------------------- diff --cc externs/js/pom.xml index c41fae1,0000000..bd3dd0f mode 100644,000000..100644 --- a/externs/js/pom.xml +++ b/externs/js/pom.xml @@@ -1,159 -1,0 +1,160 @@@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.flexjs.externs</groupId> + <artifactId>flexjs-externs</artifactId> + <version>0.6.0-SNAPSHOT</version> + </parent> + + <artifactId>flexjs-externs-js</artifactId> + <version>0.6.0-SNAPSHOT</version> + <packaging>swc</packaging> + + <name>Apache Flex - FlexJS: Externs: JS</name> + + <build> + <plugins> + <!-- Download JavaScript form GitHub --> + <plugin> + <groupId>com.googlecode.maven-download-plugin</groupId> + <artifactId>download-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <id>get-createjs</id> + <phase>validate</phase> + <goals> + <goal>wget</goal> + </goals> + <configuration> + <url>https://closureidl.googlecode.com/files/svg.js</url> + <outputFileName>svg.js</outputFileName> + <outputDirectory>${project.build.directory}/downloads</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.flex.flexjs.compiler</groupId> + <artifactId>compiler-build-tools</artifactId> + <version>0.6.0-SNAPSHOT</version> + <executions> + <execution> + <id>unpack-closure-externs</id> + <phase>validate</phase> + <goals> + <goal>unpack-resources</goal> + </goals> + <configuration> + <resource>externs.zip</resource> + </configuration> + </execution> + <execution> + <id>pre-process-javascript-sources-svg</id> + <phase>validate</phase> + <goals> + <goal>pre-process-sources</goal> + </goals> + <configuration> + <operations> + <replace-regexp-operation><match>@type \{function\(new:.*</match><replace/></replace-regexp-operation> + <replace-regexp-operation><match>Window\.prototype\..*</match><replace/></replace-regexp-operation> + <replace-regexp-operation><match>EventListener\|\(function\(Event\)</match><replace>EventListener|(function(!Event)</replace></replace-regexp-operation> + </operations> + <includes> + <include>svg.js</include> + </includes> + </configuration> + </execution> + <execution> + <id>pre-process-javascript-sources-es3</id> + <phase>validate</phase> + <goals> + <goal>pre-process-sources</goal> + </goals> + <configuration> + <operations> + <replace-regexp-operation><match>(The constructor of the current object\.\n.*)@type\s\{Function\}</match><replace>$1@type {Class}</replace></replace-regexp-operation> + <replace-regexp-operation><match>Object\.prototype\.constructor\s=\sfunction\(\)\s\{\};</match><replace>Object.prototype.constructor;</replace></replace-regexp-operation> - <replace-regexp-operation><match>(Transposes the elements of an array in place.*\n.*\n.*)(\n.*\s@this)</match><replace>$1 @return {!Array<?>}$2</replace></replace-regexp-operation> ++ <replace-regexp-operation><match>(Transposes the elements of an array in place.*\n.*\n.*)(\n.*\s@this)</match><replace>$1\n \* @return {!Array<?>}$2</replace></replace-regexp-operation> ++ <replace-regexp-operation><match>(Sorts the elements of an array in place.*\n..*)(\n.*\s@param)</match><replace>$1\n \* @return {!Array<?>}$2</replace></replace-regexp-operation> + </operations> + <includes> + <include>es3.js</include> + </includes> + </configuration> + </execution> + </executions> + <!-- + Dependency to the closure compiler externs artifact so + the "unpack-resources" goal can find the externs.zip + --> + <dependencies> + <dependency> + <groupId>com.google.javascript</groupId> + <artifactId>closure-compiler-externs</artifactId> + <version>v20151015</version> + </dependency> + </dependencies> + </plugin> + <plugin> + <groupId>org.apache.flex.flexjs.compiler</groupId> + <artifactId>flexjs-maven-plugin</artifactId> + <version>0.6.0-SNAPSHOT</version> + <extensions>true</extensions> + <dependencies> + <dependency> + <groupId>org.apache.flex.flexjs.compiler</groupId> + <artifactId>compiler-jx</artifactId> + <version>0.6.0-SNAPSHOT</version> + </dependency> + </dependencies> + </plugin> + <plugin> + <groupId>org.apache.flex.flexjs.compiler</groupId> + <artifactId>compiler-build-tools</artifactId> + <version>0.6.0-SNAPSHOT</version> + <executions> + <execution> + <id>pre-process-actionscript-sources</id> + <phase>process-sources</phase> + <goals> + <goal>pre-process-sources</goal> + </goals> + <configuration> + <operations> + <replace-regexp-operation><match>base\:Number\)</match><replace>base:Number = 10)</replace></replace-regexp-operation> + </operations> + <downloadesSourceDirectory>target/generated-sources/externc</downloadesSourceDirectory> + <includes> + <include>functions/parseInt.as</include> + </includes> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dd503343/externs/js/src/main/config/externc-config.xml ---------------------------------------------------------------------- diff --cc externs/js/src/main/config/externc-config.xml index f4a3b20,0000000..8ce6c29 mode 100644,000000..100644 --- a/externs/js/src/main/config/externc-config.xml +++ b/externs/js/src/main/config/externc-config.xml @@@ -1,173 -1,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/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/dd503343/externs/node/pom.xml ---------------------------------------------------------------------- diff --cc externs/node/pom.xml index 9e448ab,0000000..7233c7a mode 100644,000000..100644 --- a/externs/node/pom.xml +++ b/externs/node/pom.xml @@@ -1,64 -1,0 +1,90 @@@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.flexjs.externs</groupId> + <artifactId>flexjs-externs</artifactId> + <version>0.6.0-SNAPSHOT</version> + </parent> + + <artifactId>flexjs-externs-node</artifactId> + <version>0.6.0-SNAPSHOT</version> + <packaging>swc</packaging> + + <name>Apache Flex - FlexJS: Externs: Node</name> + + <build> + <plugins> ++ <!-- Download JavaScript form GitHub --> ++ <plugin> ++ <groupId>com.googlecode.maven-download-plugin</groupId> ++ <artifactId>download-maven-plugin</artifactId> ++ <version>1.2.1</version> ++ <executions> ++ <execution> ++ <id>get-closure-sources</id> ++ <phase>validate</phase> ++ <goals> ++ <goal>wget</goal> ++ </goals> ++ <configuration> ++ <url>https://github.com/google/closure-compiler/archive/master.zip</url> ++ <!-- ++ Give it a number matching the date so we can ++ trigger a new download by updating the date ++ --> ++ <outputFileName>closure-compiler-20160421.zip</outputFileName> ++ <outputDirectory>${project.build.directory}/downloads</outputDirectory> ++ <unpack>true</unpack> ++ </configuration> ++ </execution> ++ </executions> ++ </plugin> ++ + <plugin> + <groupId>org.apache.flex.flexjs.compiler</groupId> + <artifactId>flexjs-maven-plugin</artifactId> + <version>0.6.0-SNAPSHOT</version> + <extensions>true</extensions> + <dependencies> + <dependency> + <groupId>org.apache.flex.flexjs.compiler</groupId> + <artifactId>compiler-jx</artifactId> + <version>0.6.0-SNAPSHOT</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.flex.flexjs.externs</groupId> + <artifactId>flexjs-externs-js</artifactId> + <version>0.6.0-SNAPSHOT</version> + <type>swc</type> + <scope>external</scope> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dd503343/externs/node/src/main/config/compile-as-config.xml ---------------------------------------------------------------------- diff --cc externs/node/src/main/config/compile-as-config.xml index db19882,0000000..2af392d mode 100644,000000..100644 --- a/externs/node/src/main/config/compile-as-config.xml +++ b/externs/node/src/main/config/compile-as-config.xml @@@ -1,42 -1,0 +1,159 @@@ +<!-- + + 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/constants</path-element> ++ <path-element>generated-sources/externc/classes</path-element> + <path-element>generated-sources/externc/functions</path-element> ++ <path-element>generated-sources/externc/typedefs</path-element> ++ <path-element>generated-sources/externc/duplicates</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-sources> ++ <path-element>generated-sources/externc/constants</path-element> ++ <path-element>generated-sources/externc/classes</path-element> + <path-element>generated-sources/externc/functions</path-element> ++ <path-element>generated-sources/externc/typedefs</path-element> ++ <path-element>generated-sources/externc/duplicates</path-element> + </include-sources> + + <include-file> - <name>externs/node.js</name> - <path>../src/main/javascript/node.js</path> ++ <name>externs/missing.js</name> ++ <path>../src/main/javascript/missing.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/assert.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/assert.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/buffer.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/buffer.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/child_process.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/child_process.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/cluster.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/cluster.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/crypto.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/crypto.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/dgram.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/dgram.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/dns.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/dns.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/domain.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/domain.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/events.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/events.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/fs.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/fs.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/http.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/http.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/https.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/https.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/net.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/net.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/os.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/os.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/path.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/path.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/punycode.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/punycode.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/querystring.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/querystring.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/readline.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/readline.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/repl.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/repl.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/stream.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/stream.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/string_decoder.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/string_decoder.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/tls.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/tls.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/tty.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/tty.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/url.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/url.js</path> + </include-file> ++ <include-file> ++ <name>externs/util.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/util.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/vm.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/vm.js</path> ++ </include-file> ++ <include-file> ++ <name>externs/zlib.js</name> ++ <path>downloads/closure-compiler-master/contrib/nodejs/zlib.js</path> ++ </include-file> ++ +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dd503343/externs/node/src/main/config/externc-config.xml ---------------------------------------------------------------------- diff --cc externs/node/src/main/config/externc-config.xml index ecde54f,0000000..ce578d2 mode 100644,000000..100644 --- a/externs/node/src/main/config/externc-config.xml +++ b/externs/node/src/main/config/externc-config.xml @@@ -1,39 -1,0 +1,71 @@@ +<!-- + + 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> ++ <path-element>../javascript/missing.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/assert.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/buffer.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/child_process.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/cluster.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/crypto.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/dgram.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/dns.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/domain.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/events.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/fs.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/globals.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/http.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/https.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/net.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/os.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/path.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/punycode.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/querystring.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/readline.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/repl.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/stream.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/string_decoder.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/tls.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/tty.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/url.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/util.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/vm.js</path-element> ++ <path-element>../../../target/downloads/closure-compiler-master/contrib/nodejs/zlib.js</path-element> + </external> ++ <exclude> ++ <class>Buffer</class> ++ <name>toJSON</name> ++ </exclude> + + <as-root>../../../target/generated-sources/externc</as-root> + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dd503343/externs/node/src/main/javascript/missing.js ---------------------------------------------------------------------- diff --cc externs/node/src/main/javascript/missing.js index 0000000,0000000..d6c73f3 new file mode 100644 --- /dev/null +++ b/externs/node/src/main/javascript/missing.js @@@ -1,0 -1,0 +1,25 @@@ ++/* ++ * ++ * 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. ++ * ++ */ ++ ++/** ++ * @fileoverview Externs for Node.js ++ * @see https://nodejs.org/api/ ++ * @externs ++ */ ++ http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dd503343/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/ExterncMojo.java ---------------------------------------------------------------------- diff --cc flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/ExterncMojo.java index 53e8a56,0000000..dd14db5 mode 100644,000000..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 @@@ -1,62 -1,0 +1,62 @@@ +/* + * 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 java.io.File; + +/** + * goal which generates actionscript code from javascript. + */ - @Mojo(name="generate",defaultPhase = LifecyclePhase.PROCESS_SOURCES) ++@Mojo(name="generate-extern",defaultPhase = LifecyclePhase.PROCESS_SOURCES) +public class ExterncMojo + extends AbstractMojo +{ + + @Parameter(defaultValue="${basedir}/src/main/config/externc-config.xml") + private File configFile; + + public void execute() + throws MojoExecutionException + { + if(!configFile.exists()) { + getLog().info("Skipping Generation of ActionScript code due to missing config file: " + + configFile.getPath()); + return; + } + + FlexToolRegistry toolRegistry = new FlexToolRegistry(); + FlexToolGroup toolGroup = toolRegistry.getToolGroup("FlexJS"); + if(toolGroup == null) { + throw new MojoExecutionException("Could not find tool group: FlexJS"); + } + + // TODO: Change this to a flex-tool-api constant ... + FlexTool compc = toolGroup.getFlexTool("EXTERNC"); + String[] args = {"+flexlib=externs", "-debug", "-load-config=" + configFile.getPath()}; + compc.execute(args); + } + +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dd503343/flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml ---------------------------------------------------------------------- diff --cc flexjs-maven-plugin/src/main/resources/META-INF/plexus/components.xml index 7329c8f,0000000..c84be9c mode 100644,000000..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 @@@ -1,71 -1,0 +1,71 @@@ +<?xml version="1.0"?> +<component-set> + <components> + <component> + <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role> + <role-hint>swc</role-hint> + <implementation> + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + </implementation> + <configuration> + <lifecycles> + <lifecycle> + <id>default</id> + <phases> + <generate-sources> - org.apache.flex.flexjs.compiler:flexjs-maven-plugin:generate ++ org.apache.flex.flexjs.compiler:flexjs-maven-plugin:generate-extern + </generate-sources> + <process-resources> + org.apache.maven.plugins:maven-resources-plugin:resources + </process-resources> + <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 + </process-test-resources> + <!--generate-test-sources> + + </generate-test-sources--> + <!--generate-test-resources> + + </generate-test-resources--> + <!--test-compile> + org.apache.flex.flexjs.compiler:flexjs-maven-plugin:testCompile + </test-compile--> + <process-test-classes> + org.apache.flex.flexjs.compiler:flexjs-maven-plugin:trust + </process-test-classes> + <!--test> + org.apache.maven.plugins:maven-surefire-plugin:test + </test--> + <!--package> + org.apache.flex.flexjs.compiler:flexjs-maven-plugin:package + </package--> + <install> + org.apache.maven.plugins:maven-install-plugin:install + </install> + <deploy> + org.apache.maven.plugins:maven-deploy-plugin:deploy + </deploy> + </phases> + </lifecycle> + </lifecycles> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>swc</role-hint> + <implementation> + org.apache.maven.artifact.handler.DefaultArtifactHandler + </implementation> + <configuration> + <type>swc</type> + <extension>swc</extension> + <language>flex</language> + <addedToClasspath>true</addedToClasspath> + </configuration> + </component> + </components> +</component-set>