Repository: flex-asjs Updated Branches: refs/heads/feature/spriteflexjs-refactor 3aeda903d -> 5a725328d
A new project to hold spriteflexjs refactor that does not see extern classes like HTMLCanvasElement Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a6cb0b48 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a6cb0b48 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a6cb0b48 Branch: refs/heads/feature/spriteflexjs-refactor Commit: a6cb0b48ca62451b7a58d023b7fc748156a5c8ac Parents: 6096099 Author: Carlos Rovira <carlosrov...@apache.org> Authored: Wed Feb 15 20:35:21 2017 +0100 Committer: Carlos Rovira <carlosrov...@apache.org> Committed: Wed Feb 15 21:52:10 2017 +0100 ---------------------------------------------------------------------- .../projects/spriteflexjs/.vscode/tasks.json | 10 ++ frameworks/projects/spriteflexjs/asconfig.json | 21 ++++ frameworks/projects/spriteflexjs/build.xml | 116 +++++++++++++++++++ frameworks/projects/spriteflexjs/pom.xml | 67 +++++++++++ .../src/main/config/compile-as-config.xml | 82 +++++++++++++ .../spriteflexjs/src/main/flex/SomeClass.as | 37 ++++++ .../spriteflexjs/src/main/flex/SpriteClasses.as | 34 ++++++ .../src/main/resources/sprite-as-manifest.xml | 25 ++++ .../src/main/resources/sprite-manifest.xml | 26 +++++ 9 files changed, 418 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a6cb0b48/frameworks/projects/spriteflexjs/.vscode/tasks.json ---------------------------------------------------------------------- diff --git a/frameworks/projects/spriteflexjs/.vscode/tasks.json b/frameworks/projects/spriteflexjs/.vscode/tasks.json new file mode 100644 index 0000000..c207148 --- /dev/null +++ b/frameworks/projects/spriteflexjs/.vscode/tasks.json @@ -0,0 +1,10 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + //"--flexHome=/Users/carlosrovira/Dev/Flex/sdks/flexjs-0.8.0" + "version": "0.1.0", + "command": "mvn", + "args": ["clean", "install", "-DskipTests"], + "isShellCommand": true, + "showOutput": "always" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a6cb0b48/frameworks/projects/spriteflexjs/asconfig.json ---------------------------------------------------------------------- diff --git a/frameworks/projects/spriteflexjs/asconfig.json b/frameworks/projects/spriteflexjs/asconfig.json new file mode 100644 index 0000000..706a181 --- /dev/null +++ b/frameworks/projects/spriteflexjs/asconfig.json @@ -0,0 +1,21 @@ +{ + "config": "flex", + "compilerOptions": { + "debug": true, + "js-output-type": "flexjs", + "define": [ + { + "name": "COMPILE::SWF", + "value": true + }, + { + "name": "COMPILE::JS", + "value": false + } + ] + }, + "files": + [ + "src/main/flex/MDLClasses.as" + ] +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a6cb0b48/frameworks/projects/spriteflexjs/build.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/spriteflexjs/build.xml b/frameworks/projects/spriteflexjs/build.xml new file mode 100644 index 0000000..faae86c --- /dev/null +++ b/frameworks/projects/spriteflexjs/build.xml @@ -0,0 +1,116 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + + +<project name="Sprite" default="main" basedir="."> + <property name="FLEXJS_HOME" location="../../.."/> + + <property file="${FLEXJS_HOME}/env.properties"/> + <property environment="env"/> + <property file="${FLEXJS_HOME}/build.properties"/> + <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> + + <property name="target.name" value="${ant.project.name}.swc" /> + + <target name="main" depends="clean,check-compiler,compile,compile-js,copy-swc,test" description="Full build of ${ant.project.name}.swc"> + </target> + + <target name="compile-js"> + <ant dir="${FLEXJS_HOME}/frameworks/js/FlexJS/projects/${ant.project.name}JS/" inheritAll="false" /> + </target> + + <target name="copy-swc"> + <copy file="${basedir}/target/${target.name}" tofile="${FLEXJS_HOME}/frameworks/libs/${target.name}" /> + </target> + + <target name="check-for-tests" > + <condition property="skip-tests" > + <not> + <available file="${basedir}/src/test/flex/build.xml" /> + </not> + </condition> + </target> + + <target name="test" depends="check-for-tests" unless="skip-tests"> + <ant dir="src/test/flex" /> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${FLEXJS_HOME}/frameworks/libs"> + <include name="${target.name}"/> + </fileset> + </delete> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${basedir}/target"> + <include name="**/**"/> + </fileset> + </delete> + <antcall target="clean-tests" /> + </target> + + <target name="clean-tests" depends="check-for-tests" unless="skip-tests"> + <ant dir="src/test/flex" target="clean"/> + </target> + + <target name="compile" description="Compiles .as files into .swc"> + <echo message="Compiling libs/${ant.project.name}.swc"/> + <echo message="FLEX_HOME: ${FLEX_HOME}"/> + <echo message="FALCON_HOME: ${FALCON_HOME}"/> + + <compc fork="true" + output="${basedir}/target/${target.name}"> + <jvmarg line="${compc.jvm.args}"/> + <load-config filename="${basedir}/src/main/config/compile-as-config.xml" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.AIR_HOME=${env.AIR_HOME}" /> + <arg value="-define=COMPILE::SWF,true" /> + <arg value="-define=COMPILE::JS,false" /> + </compc> + <copy file="${basedir}/target/${target.name}" tofile="${FLEXJS_HOME}/frameworks/libs/${target.name}" /> + </target> + + <target name="check-compiler" depends="check-falcon-home"> + <path id="lib.path"> + <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/> + </path> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + </target> + + <target name="check-falcon-home" unless="FALCON_HOME" + description="Check FALCON_HOME is a directory."> + + <echo message="FALCON_HOME is ${env.FALCON_HOME}"/> + + <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${env.FALCON_HOME}"/> + + <available file="${FLEXJS_HOME}/../flex-falcon/compiler/lib/falcon-mxmlc.jar" + type="file" + property="FALCON_HOME" + value="${FLEXJS_HOME}/../flex-falcon/compiler"/> + + <fail message="FALCON_HOME must be set to a folder with a lib sub-folder containing falcon-mxmlc.jar such as the compiler folder in flex-falcon repo or a FlexJS SDK folder" + unless="FALCON_HOME"/> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a6cb0b48/frameworks/projects/spriteflexjs/pom.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/spriteflexjs/pom.xml b/frameworks/projects/spriteflexjs/pom.xml new file mode 100644 index 0000000..e5682e1 --- /dev/null +++ b/frameworks/projects/spriteflexjs/pom.xml @@ -0,0 +1,67 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.flex.flexjs.framework</groupId> + <artifactId>projects</artifactId> + <version>0.8.0-SNAPSHOT</version> + </parent> + + <artifactId>spriteflexjs</artifactId> + <version>0.8.0-SNAPSHOT</version> + <packaging>swc</packaging> + + <name>Apache Flex - FlexJS: Framework: Libs: spriteflexjs</name> + + <build> + <sourceDirectory>src/main/flex</sourceDirectory> + <plugins> + <plugin> + <groupId>org.apache.flex.flexjs.compiler</groupId> + <artifactId>flexjs-maven-plugin</artifactId> + <version>${flexjs.compiler.version}</version> + <extensions>true</extensions> + <configuration> + <namespaces> + <namespace> + <uri>library://ns.apache.org/flexjs/sprite</uri> + <manifest>${project.basedir}/src/main/resources/sprite-manifest.xml</manifest> + </namespace> + <namespace> + <type>as</type> + <uri>library://ns.apache.org/flexjs/sprite</uri> + <manifest>${project.basedir}/src/main/resources/sprite-as-manifest.xml</manifest> + </namespace> + </namespaces> + <includeClasses> + <includeClass>SpriteClasses</includeClass> + </includeClasses> + <includeLookupOnly>true</includeLookupOnly> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a6cb0b48/frameworks/projects/spriteflexjs/src/main/config/compile-as-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/spriteflexjs/src/main/config/compile-as-config.xml b/frameworks/projects/spriteflexjs/src/main/config/compile-as-config.xml new file mode 100644 index 0000000..e34c3a1 --- /dev/null +++ b/frameworks/projects/spriteflexjs/src/main/config/compile-as-config.xml @@ -0,0 +1,82 @@ +<!-- + + 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>false</accessible> + + <external-library-path> + <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> + <path-element>../../../../../libs/Binding.swc</path-element> + <path-element>../../../../../libs/Core.swc</path-element> + <path-element>../../../../../libs/Graphics.swc</path-element> + <path-element>../../../../../libs/HTML.swc</path-element> + </external-library-path> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <library-path/> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/flexjs/sprite</uri> + <manifest>../resources/sprite-manifest.xml</manifest> + </namespace> + <namespace> + <uri>library://ns.apache.org/flexjs/sprite</uri> + <manifest>../resources/sprite-as-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>../flex</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-lookup-only>true</include-lookup-only> + + <include-classes> + <class>SpriteClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/flexjs/sprite</uri> + </include-namespaces> + + <target-player>${playerglobal.version}</target-player> + + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a6cb0b48/frameworks/projects/spriteflexjs/src/main/flex/SomeClass.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spriteflexjs/src/main/flex/SomeClass.as b/frameworks/projects/spriteflexjs/src/main/flex/SomeClass.as new file mode 100644 index 0000000..137beef --- /dev/null +++ b/frameworks/projects/spriteflexjs/src/main/flex/SomeClass.as @@ -0,0 +1,37 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + public class SomeClass + { + public var canvas:HTMLCanvasElement; + public var c2d:CanvasRenderingContext2D; + + public function start2():void + { + var button:Element = document.createElement("button"); + button.onclick = function ():void { + alert("Hello browser from FalconJX!"); + }; + button.textContent = "Say Hello"; + document.body.appendChild(button); + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a6cb0b48/frameworks/projects/spriteflexjs/src/main/flex/SpriteClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spriteflexjs/src/main/flex/SpriteClasses.as b/frameworks/projects/spriteflexjs/src/main/flex/SpriteClasses.as new file mode 100644 index 0000000..edce96c --- /dev/null +++ b/frameworks/projects/spriteflexjs/src/main/flex/SpriteClasses.as @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + + /** + * @private + * This class is used to link additional classes into sprite.swc + * beyond those that are found by dependecy analysis starting + * from the classes specified in manifest.xml. + */ + internal class SpriteClasses + { + import SomeClass; SomeClass; + } + +} + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a6cb0b48/frameworks/projects/spriteflexjs/src/main/resources/sprite-as-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/spriteflexjs/src/main/resources/sprite-as-manifest.xml b/frameworks/projects/spriteflexjs/src/main/resources/sprite-as-manifest.xml new file mode 100644 index 0000000..e38496a --- /dev/null +++ b/frameworks/projects/spriteflexjs/src/main/resources/sprite-as-manifest.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + + +<componentPackage> + + +</componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a6cb0b48/frameworks/projects/spriteflexjs/src/main/resources/sprite-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/spriteflexjs/src/main/resources/sprite-manifest.xml b/frameworks/projects/spriteflexjs/src/main/resources/sprite-manifest.xml new file mode 100644 index 0000000..9d8bc45 --- /dev/null +++ b/frameworks/projects/spriteflexjs/src/main/resources/sprite-manifest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + + +<componentPackage> + + <component id="SomeClass" class="SomeClass"/> + +</componentPackage>