This is an automated email from the ASF dual-hosted git repository. harbs pushed a commit to branch style-project in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit bd06e9412a4a9643de7d3fd713fe15bd2ebabb47 Author: Harbs <[email protected]> AuthorDate: Fri Feb 20 11:05:14 2026 +0200 Initial Style scaffolding --- frameworks/js/projects/StyleJS/build.xml | 138 +++++++++++++++ .../StyleJS/src/main/config/compile-js-config.xml | 107 +++++++++++ .../js/projects/StyleJS/src/test/royale/build.xml | 193 ++++++++++++++++++++ frameworks/projects/Style/asconfig.json | 36 ++++ frameworks/projects/Style/build.xml | 196 +++++++++++++++++++++ frameworks/projects/Style/pom.xml | 161 +++++++++++++++++ frameworks/projects/Style/rat-excludes.txt | 19 ++ .../Style/src/main/config/compile-swf-config.xml | 110 ++++++++++++ .../projects/Style/src/main/resources/defaults.css | 21 +++ .../Style/src/main/resources/style-as-manifest.xml | 23 +++ .../Style/src/main/resources/style-manifest.xml | 24 +++ .../projects/Style/src/main/royale/StyleClasses.as | 34 ++++ .../royale/FlexUnitRoyaleApplication-config.xml | 120 +++++++++++++ .../src/test/royale/FlexUnitRoyaleApplication.mxml | 113 ++++++++++++ .../projects/Style/src/test/royale/build.xml | 124 +++++++++++++ 15 files changed, 1419 insertions(+) diff --git a/frameworks/js/projects/StyleJS/build.xml b/frameworks/js/projects/StyleJS/build.xml new file mode 100644 index 0000000000..dc2e9b6ae8 --- /dev/null +++ b/frameworks/js/projects/StyleJS/build.xml @@ -0,0 +1,138 @@ +<?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="StyleJS" default="main" basedir="."> + <property name="ROYALE_HOME" location="../../../.."/> + + <property file="${ROYALE_HOME}/env.properties"/> + <property environment="env"/> + <property file="${ROYALE_HOME}/local.properties"/> + <property file="${ROYALE_HOME}/build.properties"/> + <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> + + <property name="target.name" value="${ant.project.name}.swc" /> + <tstamp> + <format property="royale.swc-date" pattern="MM/dd/yy HH:mm Z"/> + </tstamp> + <echo>swc-date is ${royale.swc-date}</echo> + + <echo file="${basedir}/${target.name}.properties">target.name.nojs=${ant.project.name}</echo> + <replaceregexp file="${basedir}/${target.name}.properties" match="(.*)JS$" replace="\1" flags="m" /> + <property file="${basedir}/${target.name}.properties"/> + <delete file="${basedir}/${target.name}.properties"/> + + <target name="main" depends="clean,check-compiler,compile" description="Full build of ${ant.project.name}.swc"> + </target> + + <target name="check-for-tests" > + <condition property="skip-tests" > + <not> + <available file="${basedir}/src/test/royale/build.xml" /> + </not> + </condition> + </target> + + <target name="test" depends="check-for-tests,check-compiler" unless="skip-tests"> + <ant dir="src/test/royale" /> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${ROYALE_HOME}/frameworks/js/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/royale" target="clean"/> + </target> + + <target name="compile" depends="check-compiler"> + <echo message="Cross-compiling ${target.name}"/> + <echo message="ROYALE_COMPILER_HOME: ${ROYALE_COMPILER_HOME}"/> + <mkdir dir="${basedir}/target/generated-sources/royale"/> + <java jar="${ROYALE_COMPILER_HOME}/lib/compc.jar" fork="true" > + <jvmarg value="-Xmx384m" /> + <jvmarg value="-Dsun.io.useCanonCaches=false" /> + <jvmarg value="-Droyalelib=${ROYALE_HOME}/frameworks" /> + <arg value="+royalelib=${ROYALE_HOME}/frameworks" /> + <arg value="-compiler.strict-xml=true" /> + <arg value="-compiler.targets=SWF,JSRoyale" /> + <arg line="-metadata.date="${royale.swc-date}"" /> + <arg line="-metadata.dateFormat="MM/dd/yy HH:mm Z"" /> + <arg line="-source-map=true"/> + <arg line="-source-map-source-root=/frameworks/projects/Style/src/main/royale/"/> + <arg line="-swf-debugfile-alias="/org/apache/royale/${release.version}/frameworks/projects/Style/src/main/royale"" /> + <arg value="-output=${basedir}/target/${target.name}" /> + <arg value="-load-config=${ROYALE_HOME}/frameworks/js-config.xml" /> + <arg value="-load-config+=${basedir}/src/main/config/compile-js-config.xml" /> + </java> + <copy file="${basedir}/target/${target.name}" tofile="${ROYALE_HOME}/frameworks/js/libs/${target.name}" /> + </target> + + <target name="copy-js" > + <mkdir dir="${ROYALE_HOME}/frameworks/js/generated-sources"/> + <copy todir="${ROYALE_HOME}/frameworks/js/generated-sources"> + <fileset dir="${basedir}/target/generated-sources/royale"> + <include name="**/**" /> + </fileset> + </copy> + </target> + + <target name="check-compiler" depends="check-compiler-home,check-transpiler-home"> + <path id="lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> + </path> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + </target> + + <target name="check-compiler-home" + description="Set ROYALE_SWF_COMPILER_HOME to point at the compiler."> + + <available file="${ROYALE_HOME}/lib/compiler-mxmlc.jar" + type="file" + property="ROYALE_SWF_COMPILER_HOME" + value="${ROYALE_HOME}"/> + + <fail message="ROYALE_SWF_COMPILER_HOME must be set to a folder with a lib sub-folder containing compiler-mxmlc.jar such as the compiler folder in royale-compiler repo or the root of a Royale SDK" + unless="ROYALE_SWF_COMPILER_HOME"/> + </target> + + <target name="check-transpiler-home" + description="Set ROYALE_COMPILER_HOME to point at the cross-compiler."> + + <available file="${ROYALE_HOME}/js/lib/jsc.jar" + type="file" + property="ROYALE_COMPILER_HOME" + value="${ROYALE_HOME}/js"/> + + <fail message="ROYALE_COMPILER_HOME must be set to a folder with a lib sub-folder containing jsc.jar such as the compiler-jx folder in royale-compiler repo or the js folder of a Royale SDK" + unless="ROYALE_COMPILER_HOME"/> + </target> + +</project> diff --git a/frameworks/js/projects/StyleJS/src/main/config/compile-js-config.xml b/frameworks/js/projects/StyleJS/src/main/config/compile-js-config.xml new file mode 100644 index 0000000000..c4bbd3d7a1 --- /dev/null +++ b/frameworks/js/projects/StyleJS/src/main/config/compile-js-config.xml @@ -0,0 +1,107 @@ +<!-- + + 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. + +--> +<royale-config> + + <compiler> + <accessible>false</accessible> + + <!-- build both SWF and JS. --> + <targets> + <target>SWF</target> + <target>JSRoyale</target> + </targets> + <strict-xml>true</strict-xml> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.royale.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.royale.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <define> + <name>COMPILE::SWF</name> + <value>false</value> + </define> + <define> + <name>COMPILE::JS</name> + <value>true</value> + </define> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <external-library-path append="true"> + <path-element>../../../../../libs/LanguageJS.swc</path-element> + <path-element>../../../../../libs/BindingJS.swc</path-element> + <path-element>../../../../../libs/CoreJS.swc</path-element> + <path-element>../../../../../libs/GraphicsJS.swc</path-element> + <path-element>../../../../../libs/CollectionsJS.swc</path-element> + <path-element>../../../../../libs/XMLJS.swc</path-element> + </external-library-path> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/royale/style</uri> + <manifest>../../../../../../projects/Style/src/main/resources/style-manifest.xml</manifest> + </namespace> + <namespace> + <uri>library://ns.apache.org/royale/svg</uri> + <manifest>../../../../../../projects/Style/src/main/resources/svg-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>../../../../../../projects/Style/src/main/royale</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-file> + <name>defaults.css</name> + <path>../../../../../../projects/Style/src/main/resources/defaults.css</path> + </include-file> + + <include-sources> + </include-sources> + + <include-classes> + <class>StyleClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/royale/style</uri> + <uri>library://ns.apache.org/royale/svg</uri> + </include-namespaces> + + <js-default-initializers>false</js-default-initializers> + + <js-complex-implicit-coercions>false</js-complex-implicit-coercions> + <js-resolve-uncertain>false</js-resolve-uncertain> + <js-vector-index-checks>false</js-vector-index-checks> + +</royale-config> diff --git a/frameworks/js/projects/StyleJS/src/test/royale/build.xml b/frameworks/js/projects/StyleJS/src/test/royale/build.xml new file mode 100644 index 0000000000..1e7bc0c995 --- /dev/null +++ b/frameworks/js/projects/StyleJS/src/test/royale/build.xml @@ -0,0 +1,193 @@ +<?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="StyleJS.test" default="main" basedir="."> + <property name="ROYALE_HOME" location="../../../../../../.."/> + + <property file="${ROYALE_HOME}/env.properties"/> + <property environment="env"/> + <property file="${ROYALE_HOME}/local.properties"/> + <property file="${ROYALE_HOME}/build.properties"/> + <property name="ROYALE_HOME" value="${env.ROYALE_HOME}"/> + <property name="ROYALE_SWF_COMPILER_HOME" value="${env.ROYALE_SWF_COMPILER_HOME}"/> + <property name="target.name" value="StyleJS-${release.version}.swc" /> + + <!-- if not set already, default to an empty string to use Playwright --> + <property name="royaleunit.browser" value=""/> + <property name="royaleunit.browser.args" value=""/> + + <property name="report.dir" value="${basedir}/out" /> + + <target name="main" depends="clean,compile,test" description="Clean test of ${target.name}"> + </target> + + <target name="clean"> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${basedir}/target"> + <include name="**/**"/> + </fileset> + </delete> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${report.dir}"> + <include name="**/**"/> + </fileset> + </delete> + </target> + + <path id="lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> + </path> + <path id="royaleunit.lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="royaleUnitTasks.jar"/> + </path> + + <target name="compile" description="Cross-compiles tests"> + <echo message="Cross-compiling tests"/> + <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> + <echo message="ROYALE_SWF_COMPILER_HOME: ${ROYALE_SWF_COMPILER_HOME}"/> + <echo message="playerglobal.version: ${playerglobal.version}"/> + + <!-- Load the <compc> task. We can't do this at the <project> level --> + <!-- because targets that run before flexTasks.jar gets built would fail. --> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + <!-- + Link in the classes (and their dependencies) for the MXML tags + listed in this project's manifest.xml. + Also link the additional classes (and their dependencies) + listed in RoyaleUIClasses.as, + because these aren't referenced by the manifest classes. + Keep the standard metadata when compiling. + Include the appropriate CSS files and assets in the SWC. + Don't include any resources in the SWC. + Write a bundle list of referenced resource bundles + into the file bundles.properties in this directory. + --> + <mxmlc fork="true" + file="${basedir}/../../../../../../projects/Style/src/test/royale/FlexUnitRoyaleApplication.mxml"> + <jvmarg line="${mxmlc.jvm.args}"/> + <!-- + <jvmarg value="-Xdebug" /> + <jvmarg value="-Xnoagent" /> + <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8763,server=y,suspend=y" /> + --> + <!--<arg value="-debug" />--> + <arg value="-compiler.targets=JSRoyale" /> + <arg value="-js-output=target" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.PLAYERGLOBAL_HOME=${PLAYERGLOBAL_HOME}" /> + </mxmlc> + </target> + + <target name="check-royaleunit-browser" if="royaleunit.browser" unless="skip-tests"> + <!-- + if the royaleunit.browser property was provided manually, + check if the file actually exists + --> + <condition property="royaleunit.browser.valid"> + <or> + <!-- allow an empty string because it'll use Playwright in that case --> + <equals arg1="${royaleunit.browser}" arg2="" /> + <and> + <isset property="royaleunit.browser" /> + <available file="${royaleunit.browser}" type="file" /> + </and> + </or> + </condition> + <fail unless="royaleunit.browser.valid" message="Invalid royaleunit.browser path: "${royaleunit.browser}". To skip RoyaleUnit tests, use -Dskip-tests." /> + </target> + + <target name="test" depends="check-royaleunit-browser" + unless="skip-tests" + xmlns:if="ant:if" xmlns:unless="ant:unless"> + + <macrodef name="debug.test"> + <attribute name="is.needed" default="false"/> + <sequential> + <echo if:true="@{is.needed}">JS-RELEASE TESTS FAILED</echo> + <echo if:true="@{is.needed}">Running backup tests in js-debug build, because release build tests failed</echo> + <royaleunit if:true="@{is.needed}" + player="html" + swf="${basedir}/target/bin/js-debug/index.html" + command="${royaleunit.browser}" + commandArgs="${royaleunit.browser.args}" + workingDir="${basedir}" + toDir="${report.dir}" + haltonfailure="false" + failureProperty="debugBuildFail" + verbose="true" + localTrusted="true" + timeout="90000" /> + <condition if:true="@{is.needed}" property="debugTestResult" value="PASSED" else="FAILED"> + <not> + <isset property="debugBuildFail"/> + </not> + </condition> + </sequential> + </macrodef> + + <!-- Load the <royaleunit> task. We can't do this at the <project> level --> + <!-- because targets that run before royaleUnitTasks.jar gets built would fail. --> + <taskdef resource="royaleUnitTasks.tasks" classpathref="royaleunit.lib.path"/> + + <mkdir dir="${report.dir}" /> + <royaleunit + player="html" + swf="${basedir}/target/bin/js-release/index.html" + command="${royaleunit.browser}" + commandArgs="${royaleunit.browser.args}" + workingDir="${basedir}" + toDir="${report.dir}" + haltonfailure="false" + failureProperty="releaseBuildFail" + verbose="true" + localTrusted="true" + timeout="90000" /> + + <condition property="releaseTestResult" value="PASSED" else="FAILED"> + <not> + <isset property="releaseBuildFail"/> + </not> + </condition> + + <!-- the above runs a test in release build. If it fails, try again in debug-build --> + <debug.test is.needed="${releaseBuildFail}"/> + <!-- if the debug test ran, it will had already set 'debugTestResult', otherwise set it to 'Not tested' below --> + <property name="debugTestResult" value="Not tested" /> + + <property name="testResult"> + ${ant.project.name} RoyaleUnit Release build tests: ${releaseTestResult} + ${ant.project.name} RoyaleUnit Debug build tests: ${debugTestResult} + </property> + + <!-- Generate readable JUnit-style reports --> + <junitreport todir="${report.dir}"> + <fileset dir="${report.dir}"> + <include name="TEST-*.xml" /> + </fileset> + <report format="frames" todir="${report.dir}/html" /> + </junitreport> + + <!-- fail now if release tests are broken (with debug test info as well) --> + <fail if="releaseBuildFail" message="Test Failure ${line.separator}RoyaleUnit Release Build Tests must pass: ${line.separator} ${testResult}" /> + <!-- otherwise just show test result --> + <echo>${testResult}</echo> + </target> +</project> diff --git a/frameworks/projects/Style/asconfig.json b/frameworks/projects/Style/asconfig.json new file mode 100644 index 0000000000..b4d649719c --- /dev/null +++ b/frameworks/projects/Style/asconfig.json @@ -0,0 +1,36 @@ +/* + * 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. + */ +{ + "config": "royale", + "type": "lib", + "compilerOptions": { + "debug": true, + "targets": [ + "JSRoyale","SWF" + ], + "include-classes": [ + "src/main/royale/StyleClasses.as" + ], + "include-sources": [ + "src/main/royale" + ], + "external-library-path": [ + "../../../../royale-typedefs/airglobal/target/airglobal.swc" + ], + "output": "target/Style.swc" + } +} \ No newline at end of file diff --git a/frameworks/projects/Style/build.xml b/frameworks/projects/Style/build.xml new file mode 100644 index 0000000000..e145c897cf --- /dev/null +++ b/frameworks/projects/Style/build.xml @@ -0,0 +1,196 @@ +<?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="Style" default="main" basedir="."> + <property name="ROYALE_HOME" location="../../.."/> + + <property file="${ROYALE_HOME}/env.properties"/> + <property environment="env"/> + <property file="${ROYALE_HOME}/local.properties"/> + <property file="${ROYALE_HOME}/build.properties"/> + <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> + <condition property="AIR_HOME" value="${env.AIR_HOME}"> + <isset property="env.AIR_HOME" /> + </condition> + <property name="AIR_HOME" value="${ROYALE_HOME}"/> + <condition property="PLAYERGLOBAL_HOME" value="${env.PLAYERGLOBAL_HOME}"> + <isset property="env.PLAYERGLOBAL_HOME" /> + </condition> + <property name="PLAYERGLOBAL_HOME" value="${ROYALE_HOME}/frameworks/libs/player"/> + + <property name="target.name" value="${ant.project.name}.swc" /> + + <tstamp> + <format property="royale.swc-date" pattern="MM/dd/yy HH:mm Z"/> + </tstamp> + <echo>swc-date is ${royale.swc-date}</echo> + + <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="${ROYALE_HOME}/frameworks/js/projects/${ant.project.name}JS/" inheritAll="false" > + <property name="ROYALE_SWF_COMPILER_HOME" value="${ROYALE_SWF_COMPILER_HOME}"/> + <property name="ROYALE_COMPILER_HOME" value="${ROYALE_COMPILER_HOME}"/> + <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> + </ant> + </target> + + <target name="copy-swc" if="AIR_HOME"> + <copy file="${basedir}/target/${target.name}" tofile="${ROYALE_HOME}/frameworks/libs/${target.name}" /> + </target> + + <target name="check-for-tests" > + <condition property="skip-tests" > + <not> + <available file="${basedir}/src/test/royale/build.xml" /> + </not> + </condition> + <!-- exclude from js-only build --> + <condition property="skip-swf-tests"> + <or> + <isset property="skip-tests" /> + <not> + <!-- env.AIR_HOME is how we determine if it's a SWF distritbution --> + <isset property="env.AIR_HOME" /> + </not> + </or> + </condition> + </target> + + <target name="test" depends="check-for-tests,check-compiler" unless="skip-tests"> + <antcall target="test-swf" /> + <antcall target="test-js" /> + </target> + + <target name="test-swf" unless="skip-swf-tests"> + <ant dir="src/test/royale" /> + </target> + + <target name="test-js"> + <ant dir="${ROYALE_HOME}/frameworks/js/projects/${ant.project.name}JS/" inheritAll="false" target="test"> + <property name="ROYALE_SWF_COMPILER_HOME" value="${ROYALE_SWF_COMPILER_HOME}"/> + <property name="ROYALE_COMPILER_HOME" value="${ROYALE_COMPILER_HOME}"/> + <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> + <property name="AIR_HOME" value="${AIR_HOME}"/> + <property name="PLAYERGLOBAL_HOME" value="${PLAYERGLOBAL_HOME}"/> + </ant> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${ROYALE_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/royale" target="clean"/> + </target> + + <target name="compile" description="Compiles .as files into .swc" if="AIR_HOME"> + <!-- use antcall so that resultproperty can be used in other projects and + they don't collide when being run one after the other --> + <antcall target="compile-swf" /> + </target> + + <target name="compile-swf"> + <echo message="Compiling libs/${ant.project.name}.swc"/> + <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> + <echo message="ROYALE_SWF_COMPILER_HOME: ${ROYALE_SWF_COMPILER_HOME}"/> + <echo message="ROYALE_COMPILER_HOME: ${ROYALE_COMPILER_HOME}"/> + + <java jar="${ROYALE_COMPILER_HOME}/lib/compc.jar" fork="true" + resultproperty="compcoutput"> + <jvmarg value="-Xmx384m" /> + <jvmarg value="-Dsun.io.useCanonCaches=false" /> + <jvmarg value="-Droyalelib=${ROYALE_HOME}/frameworks" /> + <arg value="+royalelib=${ROYALE_HOME}/frameworks" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.AIR_HOME=${AIR_HOME}" /> + <arg value="-compiler.strict-xml=true" /> + <arg value="-compiler.targets=SWF,JSRoyale" /> + <arg line="-metadata.date="${royale.swc-date}"" /> + <arg line="-metadata.dateFormat="MM/dd/yy HH:mm Z"" /> + <arg line="-source-map=true"/> + <arg line="-source-map-source-root=/frameworks/projects/${ant.project.name}/src/main/royale/"/> + <arg line="-swf-debugfile-alias="/org/apache/royale/${release.version}/frameworks/projects/${ant.project.name}/src/main/royale"" /> + <arg value="-output=${basedir}/target/${target.name}" /> + <arg value="-load-config=${basedir}/src/main/config/compile-swf-config.xml" /> + <arg value="-js-load-config=${ROYALE_HOME}/frameworks/js-config.xml" /> + <arg value="-js-load-config+=${basedir}/../../js/projects/${ant.project.name}JS/src/main/config/compile-js-config.xml" /> + </java> + <fail> + <condition> + <not> + <or> + <equals arg1="${compcoutput}" arg2="0" /> + <equals arg1="${compcoutput}" arg2="2" /> + </or> + </not> + </condition> + </fail> + </target> + + <target name="check-compiler" depends="check-compiler-home,check-transpiler-home"> + <path id="lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> + </path> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + </target> + + <target name="check-compiler-home" + description="Set ROYALE_SWF_COMPILER_HOME to point at the compiler."> + + <available file="${ROYALE_HOME}/lib/compiler-mxmlc.jar" + type="file" + property="ROYALE_SWF_COMPILER_HOME" + value="${ROYALE_HOME}"/> + + <fail message="ROYALE_SWF_COMPILER_HOME must be set to a folder with a lib sub-folder containing compiler-mxmlc.jar such as the compiler folder in royale-compiler repo or the root of a Royale SDK" + unless="ROYALE_SWF_COMPILER_HOME"/> + </target> + + <target name="check-transpiler-home" + description="Set ROYALE_COMPILER_HOME to point at the cross-compiler."> + + <available file="${ROYALE_HOME}/js/lib/jsc.jar" + type="file" + property="ROYALE_COMPILER_HOME" + value="${ROYALE_HOME}/js"/> + + <available file="${env.ROYALE_COMPILER_HOME}/lib/jsc.jar" + type="file" + property="ROYALE_COMPILER_HOME" + value="${env.ROYALE_COMPILER_HOME}"/> + + <fail message="ROYALE_COMPILER_HOME must be set to a folder with a lib sub-folder containing jsc.jar such as the compiler-jx folder in royale-compiler repo or the js folder of a Royale SDK" + unless="ROYALE_COMPILER_HOME"/> + </target> + +</project> diff --git a/frameworks/projects/Style/pom.xml b/frameworks/projects/Style/pom.xml new file mode 100644 index 0000000000..109b5d4517 --- /dev/null +++ b/frameworks/projects/Style/pom.xml @@ -0,0 +1,161 @@ +<?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.royale.framework</groupId> + <artifactId>projects</artifactId> + <version>0.9.13-SNAPSHOT</version> + </parent> + + <artifactId>Style</artifactId> + <version>0.9.13-SNAPSHOT</version> + <packaging>swc</packaging> + + <name>Apache Royale: Framework: Libs: Style</name> + + <build> + <sourceDirectory>src/main/royale</sourceDirectory> + <plugins> + <plugin> + <groupId>org.apache.royale.compiler</groupId> + <artifactId>royale-maven-plugin</artifactId> + <version>${project.royale.compiler.version}</version> + <extensions>true</extensions> + <configuration> + <namespaces> + <namespace> + <uri>library://ns.apache.org/royale/style</uri> + <manifest>${project.basedir}/src/main/resources/style-manifest.xml</manifest> + </namespace> + <namespace> + <type>as</type> + <uri>library://ns.apache.org/royale/style</uri> + <manifest>${project.basedir}/src/main/resources/style-as-manifest.xml</manifest> + </namespace> + <namespace> + <uri>library://ns.apache.org/royale/svg</uri> + <manifest>${project.basedir}/src/main/resources/svg-manifest.xml</manifest> + </namespace> + </namespaces> + <includeClasses> + <includeClass>StyleClasses</includeClass> + </includeClasses> + <includeFiles> + <include-file> + <name>defaults.css</name> + <path>../src/main/resources/defaults.css</path> + </include-file> + </includeFiles> + <allowSubclassOverrides>true</allowSubclassOverrides> + <skipExtern>true</skipExtern> + <skipAS>${royale.skipAS}</skipAS> + <additionalCompilerOptions> + ${project.compiler.options}; + -compiler.fxg-base-class=flash.display.Sprite; + </additionalCompilerOptions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <version>0.16.1</version> + <configuration> + <excludesFile>${project.basedir}/rat-excludes.txt</excludesFile> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Core</artifactId> + <version>0.9.13-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Binding</artifactId> + <version>0.9.13-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Graphics</artifactId> + <version>0.9.13-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Collections</artifactId> + <version>0.9.13-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>XML</artifactId> + <version>0.9.13-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>option-with-swf</id> + <dependencies> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Core</artifactId> + <version>0.9.13-SNAPSHOT</version> + <type>swc</type> + <classifier>swf</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Binding</artifactId> + <version>0.9.13-SNAPSHOT</version> + <type>swc</type> + <classifier>swf</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Graphics</artifactId> + <version>0.9.13-SNAPSHOT</version> + <type>swc</type> + <classifier>swf</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Collections</artifactId> + <version>0.9.13-SNAPSHOT</version> + <type>swc</type> + <classifier>swf</classifier> + </dependency> + </dependencies> + </profile> + </profiles> + +<properties /></project> diff --git a/frameworks/projects/Style/rat-excludes.txt b/frameworks/projects/Style/rat-excludes.txt new file mode 100644 index 0000000000..b94af2c578 --- /dev/null +++ b/frameworks/projects/Style/rat-excludes.txt @@ -0,0 +1,19 @@ +################################################################################ +## +## 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. +## +################################################################################ + diff --git a/frameworks/projects/Style/src/main/config/compile-swf-config.xml b/frameworks/projects/Style/src/main/config/compile-swf-config.xml new file mode 100644 index 0000000000..15fae4e34b --- /dev/null +++ b/frameworks/projects/Style/src/main/config/compile-swf-config.xml @@ -0,0 +1,110 @@ +<!-- + + 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. + +--> +<royale-config> + + <compiler> + <accessible>false</accessible> + + <!-- build both SWF and JS. --> + <targets> + <target>SWF</target> + <target>JSRoyale</target> + </targets> + <strict-xml>true</strict-xml> + + <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/Collections.swc</path-element> + </external-library-path> + + <allow-subclass-overrides>true</allow-subclass-overrides> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.royale.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.royale.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + <fxg-base-class>flash.display.Sprite</fxg-base-class> + + <define> + <name>COMPILE::SWF</name> + <value>true</value> + </define> + <define> + <name>COMPILE::JS</name> + <value>false</value> + </define> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + <name>SWFOverride</name> + </keep-as3-metadata> + + <locale/> + + <library-path/> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/royale/style</uri> + <manifest>../resources/style-manifest.xml</manifest> + </namespace> + <namespace> + <uri>library://ns.apache.org/royale/style</uri> + <manifest>../resources/style-as-manifest.xml</manifest> + </namespace> + <!-- <namespace> + <uri>library://ns.apache.org/royale/svg</uri> + <manifest>../resources/svg-manifest.xml</manifest> + </namespace> --> + </namespaces> + + <source-path> + <path-element>../royale</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-file> + <name>defaults.css</name> + <path>../resources/defaults.css</path> + </include-file> + + <include-classes> + <class>StyleClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/royale/style</uri> + <!-- <uri>library://ns.apache.org/royale/svg</uri> --> + </include-namespaces> + + <target-player>${playerglobal.version}</target-player> + + +</royale-config> diff --git a/frameworks/projects/Style/src/main/resources/defaults.css b/frameworks/projects/Style/src/main/resources/defaults.css new file mode 100644 index 0000000000..3002422fd4 --- /dev/null +++ b/frameworks/projects/Style/src/main/resources/defaults.css @@ -0,0 +1,21 @@ + +/* + * + * 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. + * + */ + +@namespace "library://ns.apache.org/royale/style"; diff --git a/frameworks/projects/Style/src/main/resources/style-as-manifest.xml b/frameworks/projects/Style/src/main/resources/style-as-manifest.xml new file mode 100644 index 0000000000..aa138a3867 --- /dev/null +++ b/frameworks/projects/Style/src/main/resources/style-as-manifest.xml @@ -0,0 +1,23 @@ +<?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> diff --git a/frameworks/projects/Style/src/main/resources/style-manifest.xml b/frameworks/projects/Style/src/main/resources/style-manifest.xml new file mode 100644 index 0000000000..cd0f5b46b7 --- /dev/null +++ b/frameworks/projects/Style/src/main/resources/style-manifest.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + + +<componentPackage> + +</componentPackage> diff --git a/frameworks/projects/Style/src/main/royale/StyleClasses.as b/frameworks/projects/Style/src/main/royale/StyleClasses.as new file mode 100644 index 0000000000..ab40129cdf --- /dev/null +++ b/frameworks/projects/Style/src/main/royale/StyleClasses.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 rpc.swc + * beyond those that are found by dependecy analysis starting + * from the classes specified in manifest.xml. + */ + internal class StyleClasses + { + // import org.apache.royale.style.Foo; Foo; + + } + +} diff --git a/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication-config.xml b/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication-config.xml new file mode 100644 index 0000000000..eced9bd030 --- /dev/null +++ b/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication-config.xml @@ -0,0 +1,120 @@ +<!-- + + 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. + +--> +<royale-config> + + <compiler> + <accessible>false</accessible> + + <targets> + <target>SWF</target> + </targets> + <strict-xml>true</strict-xml> + + <external-library-path> + <path-element>{playerglobalHome}/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}/playerglobal.swc</path-element> + </external-library-path> + + <js-external-library-path> + <path-element>../../../../../../js/libs/js.swc</path-element> + <path-element>../../../../../../js/libs/GCL.swc</path-element> + </js-external-library-path> + + <library-path> + <path-element>../../../../../libs/Style.swc</path-element> + <path-element>../../../../../libs/Basic.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/Collections.swc</path-element> + <path-element>../../../../../libs/Language.swc</path-element> + <path-element>../../../../../libs/Reflection.swc</path-element> + <path-element>../../../../../libs/RoyaleUnit.swc</path-element> + </library-path> + + <js-library-path> + <path-element>../../../../../js/libs/StyleJS.swc</path-element> + <path-element>../../../../../js/libs/BasicJS.swc</path-element> + <path-element>../../../../../js/libs/BindingJS.swc</path-element> + <path-element>../../../../../js/libs/CoreJS.swc</path-element> + <path-element>../../../../../js/libs/GraphicsJS.swc</path-element> + <path-element>../../../../../js/libs/CollectionsJS.swc</path-element> + <path-element>../../../../../js/libs/LanguageJS.swc</path-element> + <path-element>../../../../../js/libs/ReflectionJS.swc</path-element> + <path-element>../../../../../js/libs/RoyaleUnitJS.swc</path-element> + <path-element>../../../../../js/libs/XMLJS.swc</path-element> + </js-library-path> + + <allow-subclass-overrides>true</allow-subclass-overrides> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.royale.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.royale.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + <fxg-base-class>flash.display.Sprite</fxg-base-class> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + <name>SWFOverride</name> + + <!-- RoyaleUnit --> + <name>Test</name> + <name>Before</name> + <name>After</name> + <name>BeforeClass</name> + <name>AfterClass</name> + <name>Ignore</name> + <name>Suite</name> + <name>RunWith</name> + </keep-as3-metadata> + + <locale/> + + <library-path/> + + <namespaces> + <namespace> + <uri>http://ns.adobe.com/mxml/2009</uri> + <manifest>../../../../../mxml-2009-manifest.xml</manifest> + </namespace> + <namespace> + <uri>library://ns.apache.org/royale/style</uri> + <manifest>../../main/resources/style-manifest.xml</manifest> + </namespace> + <namespace> + <uri>library://ns.apache.org/royale/style</uri> + <manifest>../../main/resources/style-as-manifest.xml</manifest> + </namespace> + <namespace> + <uri>library://ns.apache.org/royale/svg</uri> + <manifest>../../main/resources/svg-manifest.xml</manifest> + </namespace> + </namespaces> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <target-player>${playerglobal.version}</target-player> + +</royale-config> diff --git a/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication.mxml b/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication.mxml new file mode 100644 index 0000000000..493ef97c38 --- /dev/null +++ b/frameworks/projects/Style/src/test/royale/FlexUnitRoyaleApplication.mxml @@ -0,0 +1,113 @@ +<?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. + +--> + +<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:js="library://ns.apache.org/royale/basic" + xmlns:test="org.apache.royale.test.*" + applicationComplete="runTests()" + > + <fx:Declarations> + <test:RoyaleUnitCore id="core"/> + </fx:Declarations> + <fx:Script> + <![CDATA[ + COMPILE::SWF + { + import flash.system.fscommand; + import flash.utils.getDefinitionByName; + } + + // import flexUnitTests.DataGridColumnTester; + + import org.apache.royale.events.Event; + import org.apache.royale.test.listeners.CIListener; + import org.apache.royale.test.listeners.BrowserConsoleListener; + import org.apache.royale.test.Runtime; + + //account for swf version variance in some test results due to fixed player bugs etc + public function getSwfVersion():uint{ + COMPILE::SWF{ + return this.stage.loaderInfo.bytes[3]; + + } + return 0; + } + + public function runLocal():Boolean{ + var ret:Boolean = false; + COMPILE::JS{ + ret = window.location.search.indexOf('local')!= -1; + if (!ret) { + console.log('For javascript you can run this locally with console output for debugging purposes, using "?local" appended to the url.\nIt may not work for all browsers with file:// protocol (works with Chrome), in which case you need a local http server') + } + } + return ret + } + + public function getPlayerVersion():String{ + COMPILE::SWF{ + import flash.system.Capabilities; + return Capabilities.version; + } + return ''; + } + + public function runTests():void + { + Runtime.swfVersion = getSwfVersion(); + if (runLocal()) { + core.addListener(new BrowserConsoleListener()); + } else{ + core.addListener(new CIListener()); + } + core.addEventListener(Event.COMPLETE, core_completeHandler); + // Insert test classes here. For example: + // core.runClasses(DataGridColumnTester); + } + + private function core_completeHandler(event:Event):void + { + + COMPILE::SWF + { + var NativeApplication:Class = null; + try + { + NativeApplication = getDefinitionByName("flash.desktop.NativeApplication") as Class; + } + catch (error:Error) {} + if (NativeApplication != null) + { + NativeApplication.nativeApplication.exit(); + } + else + { + fscommand("quit"); + } + } + } + + ]]> + </fx:Script> + <js:valuesImpl> + <js:SimpleValuesImpl /> + </js:valuesImpl> + +</js:Application> diff --git a/frameworks/projects/Style/src/test/royale/build.xml b/frameworks/projects/Style/src/test/royale/build.xml new file mode 100644 index 0000000000..39969d1ca1 --- /dev/null +++ b/frameworks/projects/Style/src/test/royale/build.xml @@ -0,0 +1,124 @@ +<?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="Style.test" default="main" basedir="."> + <property name="ROYALE_HOME" location="../../../../../.."/> + + <property file="${ROYALE_HOME}/env.properties"/> + <property environment="env"/> + <property file="${ROYALE_HOME}/local.properties"/> + <property file="${ROYALE_HOME}/build.properties"/> + <property name="ROYALE_HOME" value="${env.ROYALE_HOME}"/> + <property name="ROYALE_SWF_COMPILER_HOME" value="${env.ROYALE_SWF_COMPILER_HOME}"/> + <property name="target.name" value="Style-${release.version}.swc" /> + + <property name="report.dir" value="${basedir}/out" /> + + <target name="main" depends="clean,compile,test" description="Clean test of ${target.name}"> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${basedir}"> + <include name="FlexUnitRoyaleApplication.swf"/> + </fileset> + </delete> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${report.dir}"> + <include name="**/**"/> + </fileset> + </delete> + </target> + + <path id="lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> + </path> + <path id="royaleunit.lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="royaleUnitTasks.jar"/> + </path> + + <target name="compile" description="Compiles FlexUnitRoyaleApplication.swf"> + <echo message="Compiling FlexUnitRoyaleApplication.swf"/> + <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> + <echo message="ROYALE_SWF_COMPILER_HOME: ${ROYALE_SWF_COMPILER_HOME}"/> + <echo message="playerglobal.version: ${playerglobal.version}"/> + + <!-- Load the <compc> task. We can't do this at the <project> level --> + <!-- because targets that run before flexTasks.jar gets built would fail. --> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + <!-- + Link in the classes (and their dependencies) for the MXML tags + listed in this project's manifest.xml. + Also link the additional classes (and their dependencies) + listed in RoyaleUIClasses.as, + because these aren't referenced by the manifest classes. + Keep the standard metadata when compiling. + Include the appropriate CSS files and assets in the SWC. + Don't include any resources in the SWC. + Write a bundle list of referenced resource bundles + into the file bundles.properties in this directory. + --> + <mxmlc fork="true" + file="${basedir}/FlexUnitRoyaleApplication.mxml" + output="${basedir}/FlexUnitRoyaleApplication.swf"> + <jvmarg line="${mxmlc.jvm.args}"/> + <arg value="-debug" /> + <arg value="-compiler.targets=SWF" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.PLAYERGLOBAL_HOME=${PLAYERGLOBAL_HOME}" /> + </mxmlc> + </target> + + <target name="test"> + <!-- Load the <royaleunit> task. We can't do this at the <project> level --> + <!-- because targets that run before royaleUnitTasks.jar gets built would fail. --> + <taskdef resource="royaleUnitTasks.tasks" classpathref="royaleunit.lib.path"/> + <mkdir dir="${report.dir}" /> + + <!-- If the FLASHPLAYER_DEBUGGER is set, use it. Otherwise, prefer ADL from AIR_HOME. --> + <condition property="royaleunit.command" value="${env.FLASHPLAYER_DEBUGGER}" else=""> + <isset property="env.FLASHPLAYER_DEBUGGER" /> + </condition> + <condition property="royaleunit.player" value="flash" else="air"> + <isset property="env.FLASHPLAYER_DEBUGGER" /> + </condition> + + <royaleunit + command="${royaleunit.command}" + player="${royaleunit.player}" + swf="${basedir}/FlexUnitRoyaleApplication.swf" + workingDir="${basedir}" + toDir="${report.dir}" + haltonfailure="true" + verbose="true" + localTrusted="true" + timeout="90000" /> + + <!-- Generate readable JUnit-style reports --> + <junitreport todir="${report.dir}"> + <fileset dir="${report.dir}"> + <include name="TEST-*.xml" /> + </fileset> + <report format="frames" todir="${report.dir}/html" /> + </junitreport> + + </target> +</project>
