flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [5/8] git commit: [flex-falcon] [refs/heads/dual] - multiple target compiling
Date Tue, 31 Jan 2017 17:08:42 GMT
multiple target compiling


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/283e87ec
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/283e87ec
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/283e87ec

Branch: refs/heads/dual
Commit: 283e87ec2c0b4a3724ae0578c3a327436b08b221
Parents: 55ee968
Author: Alex Harui <aharui@apache.org>
Authored: Sat Jan 28 22:29:47 2017 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Sat Jan 28 22:29:47 2017 -0800

----------------------------------------------------------------------
 .../flex/compiler/clients/JSConfiguration.java  | 57 ++++++++++++++++++++
 .../apache/flex/compiler/clients/MXMLJSC.java   |  2 +
 .../mxml/flexjs/TestFlexJSMXMLApplication.java  | 33 ++++++++++++
 .../flexjs/files/FlexJSTest_again_Flash.mxml    | 51 ++++++++++++++++++
 .../flex/compiler/config/Configuration.java     |  4 +-
 5 files changed, 145 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/283e87ec/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSConfiguration.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSConfiguration.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSConfiguration.java
index a06698d..35d3a4b 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSConfiguration.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/JSConfiguration.java
@@ -33,6 +33,7 @@ import org.apache.flex.compiler.internal.config.annotations.Arguments;
 import org.apache.flex.compiler.internal.config.annotations.Config;
 import org.apache.flex.compiler.internal.config.annotations.InfiniteArguments;
 import org.apache.flex.compiler.internal.config.annotations.Mapping;
+import org.apache.flex.compiler.internal.config.annotations.SoftPrerequisites;
 
 import com.google.common.collect.ImmutableList;
 
@@ -111,4 +112,60 @@ public class JSConfiguration extends Configuration
         sourceMap = value;
     }
 
+    //
+    // 'compiler.js-external-library-path' option
+    //
+
+    private final List<String> jsexternalLibraryPath = new ArrayList<String>();
+
+    @Override
+    public List<String> getCompilerExternalLibraryPath()
+    {
+    	if (jsexternalLibraryPath.size() > 0)
+    		return jsexternalLibraryPath;
+    	return super.getCompilerExternalLibraryPath();
+    }
+
+    @Config(allowMultiple = true, isPath = true)
+    @Mapping({ "compiler", "js-external-library-path" })
+    @Arguments(Arguments.PATH_ELEMENT)
+    @InfiniteArguments
+    public void setCompilerJsExternalLibraryPath(ConfigurationValue cv, String[] pathlist)
throws ConfigurationException
+    {
+        final ImmutableList<String> pathElements = ImmutableList.copyOf(pathlist);
+        final ImmutableList<String> resolvedPaths = expandTokens(pathElements, locales,
cv,
+                !reportMissingCompilerLibraries);
+        jsexternalLibraryPath.addAll(resolvedPaths);
+    }
+
+    //
+    // 'compiler.js-library-path' option
+    //
+
+    private final List<String> jslibraryPath = new ArrayList<String>();
+
+    @Override
+    public List<String> getCompilerLibraryPath()
+    {
+    	if (jslibraryPath.size() > 0)
+    		return jslibraryPath;
+    	return super.getCompilerLibraryPath();
+    }
+
+    /**
+     * Links SWC files to the resulting application SWF file. The compiler only links in
those classes for the SWC file
+     * that are required. You can specify a directory or individual SWC files.
+     */
+    @Config(allowMultiple = true, isPath = true)
+    @Mapping({ "compiler", "js-library-path" })
+    @Arguments(Arguments.PATH_ELEMENT)
+    @InfiniteArguments
+    public void setCompilerJsLibraryPath(ConfigurationValue cv, String[] pathlist) throws
CannotOpen
+    {
+        final ImmutableList<String> resolvedPaths = expandTokens(Arrays.asList(pathlist),
locales, cv,
+                !reportMissingCompilerLibraries);
+        jslibraryPath.addAll(resolvedPaths);
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/283e87ec/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
index 8a96d6d..12ac04f 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/MXMLJSC.java
@@ -395,6 +395,8 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
     		if (!(arg.startsWith("-compiler.targets") ||
     			  arg.startsWith("-closure-lib") ||
     			  arg.startsWith("-remove-circulars") ||
+    			  arg.startsWith("-compiler.js-external-library-path") ||
+    			  arg.startsWith("-compiler.js-library-path") ||
     			  arg.startsWith("-source-map")))
     			list.add(arg);						
     	}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/283e87ec/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
index 70dec15..0f4e0de 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
@@ -811,6 +811,39 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         assertThat(result, is(0));
     }
 
+    @Test
+    public void testFlexJSMainFileDualFlash()
+    {
+    	/* this should error because a Flash APi is used */
+        MXMLJSC mxmlc = new MXMLJSC();
+        String[] args = new String[18];
+        args[0] = "-compiler.targets=SWF,JSFlex";
+        args[1] = "-remove-circulars";
+        args[2] = "-library-path=" + new File(FilenameNormalization.normalize(env.ASJS +
"/frameworks/libs/Core.swc")).getPath();
+        args[3] = "-library-path+=" + new File(FilenameNormalization.normalize(env.ASJS +
"/frameworks/libs/Binding.swc")).getPath();
+        args[4] = "-library-path+=" + new File(FilenameNormalization.normalize(env.ASJS +
"/frameworks/libs/Network.swc")).getPath();
+        args[5] = "-library-path+=" + new File(FilenameNormalization.normalize(env.ASJS +
"/frameworks/libs/Collections.swc")).getPath();
+        args[6] = "-library-path+=" + new File(FilenameNormalization.normalize(env.ASJS +
"/frameworks/projects/Basic/target/Basic.swc")).getPath();
+        args[7] = "-external-library-path+=" + testAdapter.getPlayerglobal().getPath();
+        args[8] = "-output=" + new File(testAdapter.getTempDir(), "bin-debug/FlexJSTest_again_Flash.swf").getPath();
+        if (env.GOOG != null)
+        	args[9] = "-closure-lib=" + new File(FilenameNormalization.normalize(env.GOOG)).getPath();
+        else
+        	args[9] = "-define=COMPILE::temp,false";
+        args[10] = "-compiler.allow-subclass-overrides";
+        args[11] = "-compiler.js-library-path=" + new File(FilenameNormalization.normalize(env.ASJS
+ "/frameworks/js/FlexJS/libs/CoreJS.swc")).getPath();
+        args[12] = "-compiler.js-library-path+=" + new File(FilenameNormalization.normalize(env.ASJS
+ "/frameworks/js/FlexJS/libs/BindingJS.swc")).getPath();
+        args[13] = "-compiler.js-library-path+=" + new File(FilenameNormalization.normalize(env.ASJS
+ "/frameworks/js/FlexJS/libs/NetworkJS.swc")).getPath();
+        args[14] = "-compiler.js-library-path+=" + new File(FilenameNormalization.normalize(env.ASJS
+ "/frameworks/js/FlexJS/libs/CollectionsJS.swc")).getPath();
+        args[15] = "-compiler.js-library-path+=" + new File(FilenameNormalization.normalize(env.ASJS
+ "/frameworks/js/FlexJS/libs/BasicJS.swc")).getPath();
+        args[16] = "-compiler.js-external-library-path=" + new File(FilenameNormalization.normalize(env.ASJS
+ "/js/libs/js.swc")).getPath();
+        args[17] = new File(testAdapter.getUnitTestBaseDir(), "flexjs/files/FlexJSTest_again_Flash.mxml").getPath();
+
+        int result = mxmlc.mainNoExit(args, errors, true);
+        assertThat(result, is(3));
+        assertErrors("Access of possibly undefined property scrollRect.");
+    }
+
     @Override
     protected void addSourcePaths(List<File> sourcePaths)
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/283e87ec/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_Flash.mxml
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_Flash.mxml b/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_Flash.mxml
new file mode 100644
index 0000000..286664d
--- /dev/null
+++ b/compiler-jx/src/test/resources/flexjs/files/FlexJSTest_again_Flash.mxml
@@ -0,0 +1,51 @@
+<?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.
+
+-->
+<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+				   xmlns:local="*"
+				   xmlns:basic="library://ns.apache.org/flexjs/basic" 
+				   xmlns:models="models.*" 
+				   xmlns:controllers="controllers.*"
+				   initialize="MyModel(model).labelText='Hello World'; scrollRect = null"
+				   >
+	<basic:valuesImpl>
+		<basic:SimpleCSSValuesImpl />
+	</basic:valuesImpl>
+	<basic:initialView>
+		<local:MyInitialView />
+	</basic:initialView>
+	<basic:model>
+		<models:MyModel />
+	</basic:model>
+	<basic:controller>
+		<controllers:MyController />
+	</basic:controller>
+    <basic:beads>
+        <basic:HTTPService id="service">
+            <basic:LazyCollection id="collection">
+                <basic:inputParser>
+                    <basic:JSONInputParser />
+                </basic:inputParser>
+                <basic:itemConverter>
+                    <local:StockDataJSONItemConverter />
+                </basic:itemConverter> 
+            </basic:LazyCollection>
+        </basic:HTTPService>
+    </basic:beads>
+</basic:Application>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/283e87ec/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java b/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java
index 3fbf713..7d9f3d7 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/config/Configuration.java
@@ -2224,7 +2224,7 @@ public class Configuration
     //
 
     private final List<String> libraryPath = new ArrayList<String>();
-    private boolean reportMissingCompilerLibraries = true;
+    protected boolean reportMissingCompilerLibraries = true;
 
     /**
      * Sets whether to report missing libraries in the configuration. If this is false any
missing libraries will not be
@@ -2264,7 +2264,7 @@ public class Configuration
     // 'compiler.locale' option
     //
 
-    private final List<String> locales = new ArrayList<String>();
+    protected final List<String> locales = new ArrayList<String>();
 
     public List<String> getCompilerLocales()
     {


Mime
View raw message