flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erikdebr...@apache.org
Subject svn commit: r1436251 - in /flex/asjs/branches/develop/publisher/src: ./ org/ org/apache/ org/apache/flex/ org/apache/flex/asjs/ org/apache/flex/asjs/components/ org/apache/flex/asjs/enums/ org/apache/flex/asjs/interfaces/
Date Mon, 21 Jan 2013 10:05:53 GMT
Author: erikdebruin
Date: Mon Jan 21 10:05:53 2013
New Revision: 1436251

URL: http://svn.apache.org/viewvc?rev=1436251&view=rev
Log:
- adding ASJS Publisher AIR utility application

Added:
    flex/asjs/branches/develop/publisher/src/
    flex/asjs/branches/develop/publisher/src/Main-app.xml   (with props)
    flex/asjs/branches/develop/publisher/src/Main.mxml   (with props)
    flex/asjs/branches/develop/publisher/src/org/
    flex/asjs/branches/develop/publisher/src/org/apache/
    flex/asjs/branches/develop/publisher/src/org/apache/flex/
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandLine.as   (with props)
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandScript.as   (with
props)
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/Utils.as   (with props)
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/components/
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/components/PathSelectionBox.mxml
  (with props)
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/BrowseTypes.as   (with
props)
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/ScriptNames.as   (with
props)
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/interfaces/
    flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/interfaces/IExecutable.as
  (with props)

Added: flex/asjs/branches/develop/publisher/src/Main-app.xml
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/publisher/src/Main-app.xml?rev=1436251&view=auto
==============================================================================
--- flex/asjs/branches/develop/publisher/src/Main-app.xml (added)
+++ flex/asjs/branches/develop/publisher/src/Main-app.xml Mon Jan 21 10:05:53 2013
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<application xmlns="http://ns.adobe.com/air/application/3.4">
+
+<!-- Adobe AIR Application Descriptor File Template.
+
+	Specifies parameters for identifying, installing, and launching AIR applications.
+
+	xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/3.4
+			The last segment of the namespace specifies the version 
+			of the AIR runtime required for this application to run.
+			
+	minimumPatchLevel - The minimum patch level of the AIR runtime required to run 
+			the application. Optional.
+-->
+
+	<!-- A universally unique application identifier. Must be unique across all AIR applications.
+	Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.)
Required. -->
+	<id>Main</id>
+
+	<!-- Used as the filename for the application. Required. -->
+	<filename>Main</filename>
+
+	<!-- The name that is displayed in the AIR application installer. 
+	May have multiple values for each language. See samples or xsd schema file. Optional. -->
+	<name>Main</name>
+	
+	<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents
application version which can be used to check for application upgrade. 
+	Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
+	An updated version of application must have a versionNumber value higher than the previous
version. Required for namespace >= 2.5 . -->
+	<versionNumber>0.0.0</versionNumber>
+		         
+	<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of
the application, as it should be shown to users. Optional. -->
+	<!-- <versionLabel></versionLabel> -->
+
+	<!-- Description, displayed in the AIR application installer.
+	May have multiple values for each language. See samples or xsd schema file. Optional. -->
+	<!-- <description></description> -->
+
+	<!-- Copyright information. Optional -->
+	<!-- <copyright></copyright> -->
+
+	<!-- Publisher ID. Used if you're updating an application created prior to 1.5.3 -->
+	<!-- <publisherID></publisherID> -->
+
+	<!-- Settings for the application's initial window. Required. -->
+	<initialWindow>
+		<!-- The main SWF or HTML file of the application. Required. -->
+		<!-- Note: In Flash Builder, the SWF reference is set automatically. -->
+		<content>[This value will be overwritten by Flash Builder in the output app.xml]</content>
+		
+		<!-- The title of the main window. Optional. -->
+		<!-- <title></title> -->
+
+		<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default
standard. -->
+		<!-- <systemChrome></systemChrome> -->
+
+		<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional.
Default false. -->
+		<!-- <transparent></transparent> -->
+
+		<!-- Whether the window is initially visible. Optional. Default false. -->
+		<!-- <visible></visible> -->
+
+		<!-- Whether the user can minimize the window. Optional. Default true. -->
+		<!-- <minimizable></minimizable> -->
+
+		<!-- Whether the user can maximize the window. Optional. Default true. -->
+		<!-- <maximizable></maximizable> -->
+
+		<!-- Whether the user can resize the window. Optional. Default true. -->
+		<!-- <resizable></resizable> -->
+
+		<!-- The window's initial width in pixels. Optional. -->
+		<!-- <width></width> -->
+
+		<!-- The window's initial height in pixels. Optional. -->
+		<!-- <height></height> -->
+
+		<!-- The window's initial x position. Optional. -->
+		<!-- <x></x> -->
+
+		<!-- The window's initial y position. Optional. -->
+		<!-- <y></y> -->
+
+		<!-- The window's minimum size, specified as a width/height pair in pixels, such as
"400 200". Optional. -->
+		<!-- <minSize></minSize> -->
+
+		<!-- The window's initial maximum size, specified as a width/height pair in pixels,
such as "1600 1200". Optional. -->
+		<!-- <maxSize></maxSize> -->
+
+        <!-- The aspect ratio of the app ("portrait" or "landscape" or "any"). Optional.
Mobile only. Default is the natural orientation of the device -->
+
+        <!-- <aspectRatio></aspectRatio> -->
+
+        <!-- Whether the app will begin auto-orienting on launch. Optional. Mobile only.
Default false -->
+
+        <!-- <autoOrients></autoOrients> -->
+
+        <!-- Whether the app launches in full screen. Optional. Mobile only. Default false
-->
+
+        <!-- <fullScreen></fullScreen> -->
+
+        <!-- The render mode for the app (either auto, cpu, gpu, or direct). Optional.
Default auto -->
+
+        <!-- <renderMode></renderMode> -->
+
+        <!-- Whether the default direct mode rendering context allocates storage for depth
and stencil buffers.  Optional.  Default false. -->
+        <!-- <depthAndStencil></depthAndStencil> -->
+
+		<!-- Whether or not to pan when a soft keyboard is raised or lowered (either "pan" or
"none").  Optional.  Defaults "pan." -->
+		<!-- <softKeyboardBehavior></softKeyboardBehavior> -->
+
+	<autoOrients>false</autoOrients>
+        <fullScreen>false</fullScreen>
+        <visible>false</visible>
+    </initialWindow>
+
+	<!-- We recommend omitting the supportedProfiles element, -->
+	<!-- which in turn permits your application to be deployed to all -->
+	<!-- devices supported by AIR. If you wish to restrict deployment -->
+	<!-- (i.e., to only mobile devices) then add this element and list -->
+	<!-- only the profiles which your application does support. -->
+	<supportedProfiles>extendedDesktop</supportedProfiles>
+
+	<!-- Languages supported by application -->
+	<!-- Only these languages can be specified -->
+	<!-- <supportedLanguages>en de cs es fr it ja ko nl pl pt ru sv tr zh</supportedLanguages>
-->
+
+	<!-- The subpath of the standard default installation location to use. Optional. -->
+	<!-- <installFolder></installFolder> -->
+
+	<!-- The subpath of the Programs menu to use. (Ignored on operating systems without a
Programs menu.) Optional. -->
+	<!-- <programMenuFolder></programMenuFolder> -->
+
+	<!-- The icon the system uses for the application. For at least one resolution,
+	specify the path to a PNG file included in the AIR package. Optional. -->
+	<!-- <icon>
+		<image16x16></image16x16>
+		<image29x29></image29x29>
+		<image32x32></image32x32>
+		<image36x36></image36x36>
+		<image48x48></image48x48>
+		<image50x50></image50x50>
+		<image57x57></image57x57>
+		<image58x58></image58x58>
+		<image72x72></image72x72>
+		<image100x100></image100x100>
+		<image114x114></image114x114>
+		<image128x128></image128x128>
+		<image144x144></image144x144>
+		<image512x512></image512x512>
+		<image1024x1024></image1024x1024>
+	</icon> -->
+
+	<!-- Whether the application handles the update when a user double-clicks an update version
+	of the AIR file (true), or the default AIR application installer handles the update (false).
+	Optional. Default false. -->
+	<!-- <customUpdateUI></customUpdateUI> -->
+	
+	<!-- Whether the application can be launched when the user clicks a link in a web browser.
+	Optional. Default false. -->
+	<!-- <allowBrowserInvocation></allowBrowserInvocation> -->
+
+	<!-- Listing of file types for which the application can register. Optional. -->
+	<!-- <fileTypes> -->
+
+		<!-- Defines one file type. Optional. -->
+		<!-- <fileType> -->
+
+			<!-- The name that the system displays for the registered file type. Required. -->
+			<!-- <name></name> -->
+
+			<!-- The extension to register. Required. -->
+			<!-- <extension></extension> -->
+			
+			<!-- The description of the file type. Optional. -->
+			<!-- <description></description> -->
+			
+			<!-- The MIME content type. -->
+			<!-- <contentType></contentType> -->
+			
+			<!-- The icon to display for the file type. Optional. -->
+			<!-- <icon>
+				<image16x16></image16x16>
+				<image32x32></image32x32>
+				<image48x48></image48x48>
+				<image128x128></image128x128>
+			</icon> -->
+			
+		<!-- </fileType> -->
+	<!-- </fileTypes> -->
+
+    <!-- iOS specific capabilities -->
+	<!-- <iPhone> -->
+		<!-- A list of plist key/value pairs to be added to the application Info.plist -->
+		<!-- <InfoAdditions>
+            <![CDATA[
+                <key>UIDeviceFamily</key>
+                <array>
+                    <string>1</string>
+                    <string>2</string>
+                </array>
+                <key>UIStatusBarStyle</key>
+                <string>UIStatusBarStyleBlackOpaque</string>
+                <key>UIRequiresPersistentWiFi</key>
+                <string>YES</string>
+            ]]>
+        </InfoAdditions> -->
+        <!-- A list of plist key/value pairs to be added to the application Entitlements.plist
-->
+		<!-- <Entitlements>
+            <![CDATA[
+                <key>keychain-access-groups</key>
+                <array>
+                    <string></string>
+                    <string></string>
+                </array>
+            ]]>
+        </Entitlements> -->
+	<!-- Display Resolution for the app (either "standard" or "high"). Optional. Default
"standard" -->
+	<!-- <requestedDisplayResolution></requestedDisplayResolution> -->
+	<!-- </iPhone> -->
+
+	<!-- Specify Android specific tags that get passed to AndroidManifest.xml file. -->
+    <!--<android> -->
+    <!--	<manifestAdditions>
+		<![CDATA[
+			<manifest android:installLocation="auto">
+				<uses-permission android:name="android.permission.INTERNET"/>
+				<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+				<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+				<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
+				<application android:enabled="true">
+					<activity android:excludeFromRecents="false">
+						<intent-filter>
+							<action android:name="android.intent.action.MAIN"/>
+							<category android:name="android.intent.category.LAUNCHER"/>
+						</intent-filter>
+					</activity>
+				</application>
+            </manifest>
+		]]>
+        </manifestAdditions> -->
+	    <!-- Color depth for the app (either "32bit" or "16bit"). Optional. Default 16bit
before namespace 3.0, 32bit after -->
+        <!-- <colorDepth></colorDepth> -->
+    <!-- </android> -->
+	<!-- End of the schema for adding the android specific tags in AndroidManifest.xml file
-->
+
+</application>

Propchange: flex/asjs/branches/develop/publisher/src/Main-app.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/asjs/branches/develop/publisher/src/Main.mxml
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/publisher/src/Main.mxml?rev=1436251&view=auto
==============================================================================
--- flex/asjs/branches/develop/publisher/src/Main.mxml (added)
+++ flex/asjs/branches/develop/publisher/src/Main.mxml Mon Jan 21 10:05:53 2013
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
+					   xmlns:s="library://ns.adobe.com/flex/spark" 
+					   xmlns:mx="library://ns.adobe.com/flex/mx"
+					   xmlns:components="org.apache.flex.asjs.components.*"
+					   width="640"
+					   height="480"
+					   currentState="FalconJx"
+					   creationComplete="creationCompleteHandler(event)">
+	
+	<fx:Script><![CDATA[
+		
+		import mx.events.FlexEvent;
+		
+		import org.apache.flex.asjs.CommandScript;
+		import org.apache.flex.asjs.Utils;
+		import org.apache.flex.asjs.enums.BrowseTypes;
+		import org.apache.flex.asjs.enums.ScriptNames;
+		
+
+		
+		//----------------------------------------------------------------------
+		//
+		//    Variables
+		//
+		//----------------------------------------------------------------------
+		
+		private var _commandScript:CommandScript;
+		
+		
+			
+		//----------------------------------------------------------------------
+		//
+		//    Event handlers
+		//
+		//----------------------------------------------------------------------
+		
+		//----------------------------------
+		//    creationCompleteHandler
+		//----------------------------------
+		
+		protected function creationCompleteHandler(event:FlexEvent):void
+		{
+			var command:String;
+			
+			antPath.path = Utils.readPath("ant");
+
+			if (falconJxPath)
+				falconJxPath.path = Utils.readPath("falconJx");
+			
+			projectPath.path = Utils.readPath("project");
+			uiLibPath.path = Utils.readPath("uiLib");
+			
+			_commandScript = new CommandScript();
+			
+			var options:String = "";
+			//options += "-d ";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/generated/src";
+			//options += "-sourcepath ";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/generated/src:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/src:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/tools/AnnotateClass:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/tools/problemEnumGenerator:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/tools/problemlocalizer:";
+			//options +=     ".";
+			options += "-cp ";
+			options +=     "/Users/erik/Documents/ApacheFlex/dependencies/GoogleClosure/compiler/compiler.jar:";
+			options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/lib/commons-io.jar:";
+			options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/generated/classes:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/generated/src:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/src:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/lib/antlr.jar:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/lib/commons-cli.jar:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/lib/guava.jar:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/lib/jburg.jar:";
+			//options +=     "/Users/erik/Documents/ApacheFlex/repo/falcon/compiler/lib/lzma-sdk.jar:";
+			options +=     ".";
+			//options += " -d ";
+			//options +=     "../generated/classes";
+
+			var params:String = "";
+			//params += "-define=CONFIG::performanceInstrumentation,false";
+			//params += " -load-config=\"/Applications/Adobe Flash Builder 4.7/sdks/4.9.0/frameworks/flex-config.xml\"";
+			//params += " +env.PLAYERGLOBAL_HOME=/Users/erik/Documents/ApacheFlex/dependencies/PlayerGlobal/player";
+			//params += " +playerglobal.version=11.1";
+			params += " -output=/Users/erik/Desktop/asjs-test-again/bin-release/Example.js";
+			params += " {2}";
+			
+			command = "";
+			//command += "cd {0}/bin" + "\n"; // path to FalconJx compiler class
+			//command += "java " + options + " org/apache/flex/compiler/clients/MXMLJSC " + params
+ "\n";
+			command += "{0}/bin/mxmlc " + params + "\n";
+			_commandScript.scripts[ScriptNames.COMPILE_FALCONJX] = command;
+			
+			command = "";
+			command += "cd {0}" + "\n";
+			command += "{1} -Denv.FLEX_HOME={2} -Denv.PLAYERGLOBAL_HOME={3} -Dplayerglobal.version=11.1"
+ "\n";
+			_commandScript.scripts[ScriptNames.BUILD_FLEXJS_UI] = command;
+			
+			command = "";
+			command += "\n";
+			_commandScript.scripts[ScriptNames._TEST] = command;
+		}
+		
+		//----------------------------------
+		//    btnBuildFlexJSUI_clickHandler
+		//----------------------------------
+		
+		protected function btnBuildFlexJSUI_clickHandler(event:MouseEvent):void
+		{
+			_commandScript.exec(ScriptNames.BUILD_FLEXJS_UI, [
+				uiLibPath.path, 
+				antPath.path, 
+				"/Users/erik/Documents/apacheFlex/repo/sdk",
+				"/Users/erik/Documents/ApacheFlex/dependencies/PlayerGlobal/player"]);
+		}
+		
+		//----------------------------------
+		//    btnCompileProjectToJS_clickHandler
+		//----------------------------------
+		
+		protected function btnCompileProjectToJS_clickHandler(event:MouseEvent):void
+		{
+			/*_commandScript.exec(ScriptNames.COMPILE_FALCONJS, [
+				falconJSPath.path,
+				uiLibPath.path, 
+				projectPath.path]);*/
+			
+			_commandScript.exec(ScriptNames.COMPILE_FALCONJX, [
+					falconJxPath.path,
+					uiLibPath.path, 
+					projectPath.path]);
+		}
+		
+	]]></fx:Script>
+	
+	<fx:Declarations />
+	
+	<s:states>
+		<s:State name="FalconJx" />
+		<s:State name="settings" />
+	</s:states>
+	
+	<s:Panel id="pnlGeneral" left="10" top="10" right="10"
+			 width="100%" height="100">
+		<s:VGroup left="10" right="10" top="10" bottom="10"
+				  gap="10">
+			<components:PathSelectionBox id="antPath" 
+										 width="100%"
+										 pathName="ant"
+										 hint="e.g. /usr/share/ant/bin/ant"
+										 instruction="Enter the path to your ANT installation directory:" />
+		</s:VGroup>
+	</s:Panel>
+	
+	<s:Panel id="pnlProject" left="10" top="120" right="10" bottom="40"
+			 width="100%" height="100%">
+		<s:VGroup left="10" right="10" top="10" bottom="10"
+				  gap="10">
+			<components:PathSelectionBox id="projectPath" 
+										 width="100%"
+										 browseType="{BrowseTypes.BROWSE_FILE}"
+										 pathName="project"
+										 hint="e.g. /Users/Documents/myProject/myMain.mxml"
+										 instruction="Enter the path to your PROJECT main file:" />
+			
+			<components:PathSelectionBox id="uiLibPath" 
+										 width="100%"
+										 pathName="uiLib"
+										 hint="e.g. /Users/Documents/myUILib"
+										 instruction="Enter the path to the UI library of choice:" />
+			
+			<components:PathSelectionBox id="falconJxPath" 
+										 width="100%"
+										 pathName="falconJx"
+										 hint="e.g. /Users/Documents/myCompiler"
+										 instruction="Enter the path to the FalconJx compiler:" />
+		</s:VGroup>
+	</s:Panel>
+	
+	<s:HGroup bottom="10"
+			  width="100%"
+			  horizontalAlign="center">
+		<s:Button id="btnBuildFlexJSUI" label="Build FlexJS UI"
+				  bottom="10"
+				  horizontalCenter="0"
+				  click="btnBuildFlexJSUI_clickHandler(event)" />
+		
+		<s:Button id="btnCompileProjectToJS" label="Compile Project to JS"
+				  bottom="10"
+				  horizontalCenter="0"
+				  click="btnCompileProjectToJS_clickHandler(event)" />
+	</s:HGroup>
+	
+</s:WindowedApplication>

Propchange: flex/asjs/branches/develop/publisher/src/Main.mxml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandLine.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandLine.as?rev=1436251&view=auto
==============================================================================
--- flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandLine.as (added)
+++ flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandLine.as Mon Jan 21
10:05:53 2013
@@ -0,0 +1,144 @@
+package org.apache.flex.asjs
+{
+
+import flash.desktop.NativeProcess;
+import flash.desktop.NativeProcessStartupInfo;
+import flash.events.NativeProcessExitEvent;
+import flash.events.ProgressEvent;
+import flash.filesystem.File;
+import flash.system.Capabilities;
+
+import mx.utils.StringUtil;
+
+import org.apache.flex.asjs.interfaces.IExecutable;
+
+public class CommandLine implements IExecutable
+{
+	
+	//----------------------------------------------------------------------
+	//
+	//    Constructor
+	//
+	//----------------------------------------------------------------------
+	
+	public function CommandLine() {}
+
+	
+	
+	//----------------------------------------------------------------------
+	//
+	//    Variables
+	//
+	//----------------------------------------------------------------------
+
+	private var _nativeProcess:NativeProcess;
+	
+	
+	
+	//----------------------------------------------------------------------
+	//
+	//    Methods
+	//
+	//----------------------------------------------------------------------
+	
+	//----------------------------------
+	//    exec
+	//----------------------------------
+	
+	public function exec(command:String, params:Array = null):void
+	{
+		if (params)
+			command = StringUtil.substitute(command, params);
+		
+		if (!_nativeProcess)
+			init();
+		
+		_nativeProcess.standardInput.writeUTFBytes(command);
+	}
+	
+	//----------------------------------
+	//    getCommandExecutablePaths
+	//----------------------------------
+	
+	public function getCommandExecutable():File
+	{
+		var commandExecutableName:String;
+		var commandExecutablePath:String;
+		
+		if (Capabilities.os.indexOf("Windows") != -1)
+		{
+			commandExecutableName = "cmd.exe";
+			
+			commandExecutablePath = "c:\\" + commandExecutableName;
+		}
+		else
+		{
+			commandExecutableName = "bash";
+			
+			commandExecutablePath = "/bin/" + commandExecutableName;
+		}
+		
+		return new File().resolvePath(commandExecutablePath);
+	}
+	
+	//----------------------------------
+	//    init
+	//----------------------------------
+	
+	private function init():void
+	{
+		if (NativeProcess.isSupported)
+		{
+			_nativeProcess = new NativeProcess();
+			_nativeProcess.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, errorHandler);
+			_nativeProcess.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, outputHandler);
+			_nativeProcess.addEventListener(NativeProcessExitEvent.EXIT, exitHandler);
+
+			var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
+			nativeProcessStartupInfo.executable = getCommandExecutable();
+			
+			_nativeProcess.start(nativeProcessStartupInfo);
+		}
+		else
+		{
+			throw new Error("Application Error: NativeProcess is not supported.");
+		}
+	}
+	
+	
+	
+	//----------------------------------------------------------------------
+	//
+	//    Event handlers
+	//
+	//----------------------------------------------------------------------
+	
+	//----------------------------------
+	//    errorHandler
+	//----------------------------------
+	
+	public function errorHandler(event:ProgressEvent):void
+	{
+		trace("ERROR: " + _nativeProcess.standardError.readUTFBytes(_nativeProcess.standardError.bytesAvailable));
+	}
+	
+	//----------------------------------
+	//    exitHandler
+	//----------------------------------
+	
+	public function exitHandler(event:NativeProcessExitEvent):void
+	{
+		trace("EXIT CODE: " + event.exitCode);
+	}
+	
+	//----------------------------------
+	//    outputHandler
+	//----------------------------------
+	
+	public function outputHandler(event:ProgressEvent):void
+	{
+		trace(_nativeProcess.standardOutput.readUTFBytes(_nativeProcess.standardOutput.bytesAvailable));
+	}
+	
+}
+}
\ No newline at end of file

Propchange: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandLine.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandScript.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandScript.as?rev=1436251&view=auto
==============================================================================
--- flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandScript.as (added)
+++ flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandScript.as Mon Jan
21 10:05:53 2013
@@ -0,0 +1,83 @@
+package org.apache.flex.asjs
+{
+
+import flash.utils.Dictionary;
+
+import mx.utils.StringUtil;
+
+import org.apache.flex.asjs.interfaces.IExecutable;
+
+public class CommandScript implements IExecutable
+{
+
+	//----------------------------------------------------------------------
+	//
+	//    Constructor
+	//
+	//----------------------------------------------------------------------
+	
+	public function CommandScript() 
+	{
+		this.scripts = new Dictionary();
+		
+		_commandLine = new CommandLine();
+	}
+	
+	
+	
+	//----------------------------------------------------------------------
+	//
+	//    Variables
+	//
+	//----------------------------------------------------------------------
+	
+	private var _commandLine:CommandLine;
+	
+	
+	
+	//----------------------------------------------------------------------
+	//
+	//    Properties
+	//
+	//----------------------------------------------------------------------
+	
+	//----------------------------------
+	//    scripts
+	//----------------------------------
+	
+	public var scripts:Dictionary;
+	
+	
+	
+	//----------------------------------------------------------------------
+	//
+	//    Methods
+	//
+	//----------------------------------------------------------------------
+	
+	//----------------------------------
+	//    exec
+	//----------------------------------
+	
+	public function exec(scriptName:String, params:Array = null):void
+	{
+		var script:String = scripts[scriptName];
+		
+		if (params)
+			script = StringUtil.substitute(script, params);
+		
+		var command:String, commands:Array = script.split("\n");
+			
+		var n:int = commands.length - 1; // last line is always empty
+		for (var i:int = 0; i < n; i++)
+		{
+			command = commands[i];
+			
+			trace("COMMAND: " + command);
+
+			_commandLine.exec(commands[i] + "\n", null);
+		}
+	}
+	
+}
+}
\ No newline at end of file

Propchange: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/CommandScript.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/Utils.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/Utils.as?rev=1436251&view=auto
==============================================================================
--- flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/Utils.as (added)
+++ flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/Utils.as Mon Jan 21 10:05:53
2013
@@ -0,0 +1,60 @@
+package org.apache.flex.asjs
+{
+
+import flash.data.EncryptedLocalStore;
+import flash.utils.ByteArray;
+
+public class Utils
+{
+
+	//----------------------------------------------------------------------
+	//
+	//    Class constants
+	//
+	//----------------------------------------------------------------------
+	
+	private static const PATH:String = "Path";
+	
+	//----------------------------------------------------------------------
+	//
+	//    Class methods
+	//
+	//----------------------------------------------------------------------
+	
+	//----------------------------------
+	//    readELS
+	//----------------------------------
+	
+	public static function readPath(name:String):String
+	{
+		var elsValue:ByteArray = EncryptedLocalStore.getItem(name + PATH);
+		if (!elsValue)
+			return "";
+		else
+			return elsValue.readUTFBytes(elsValue.length);
+	}
+	
+	//----------------------------------
+	//    writeELS
+	//----------------------------------
+	
+	public static function writePath(name:String, value:String):void
+	{
+		var data:ByteArray = new ByteArray();
+		data.writeUTFBytes(value);
+		
+		EncryptedLocalStore.setItem(name + PATH, data);
+	}
+	
+	
+	
+	//----------------------------------------------------------------------
+	//
+	//    Constructor
+	//
+	//----------------------------------------------------------------------
+	
+	public function Utils() {}
+	
+}
+}
\ No newline at end of file

Propchange: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/Utils.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/components/PathSelectionBox.mxml
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/components/PathSelectionBox.mxml?rev=1436251&view=auto
==============================================================================
--- flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/components/PathSelectionBox.mxml
(added)
+++ flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/components/PathSelectionBox.mxml
Mon Jan 21 10:05:53 2013
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
+		 xmlns:s="library://ns.adobe.com/flex/spark" 
+		 xmlns:mx="library://ns.adobe.com/flex/mx">
+	
+	<fx:Script><![CDATA[
+		
+		import org.apache.flex.asjs.Utils;
+		import org.apache.flex.asjs.enums.BrowseTypes;
+		
+		//----------------------------------------------------------------------
+		//
+		//    Properties
+		//
+		//----------------------------------------------------------------------
+		
+		//----------------------------------
+		//    browseType
+		//----------------------------------
+		
+		private var _browseType:BrowseTypes = BrowseTypes.BROWSE_DIR;
+
+		public function get browseType():BrowseTypes
+		{
+			return _browseType;
+		}
+
+		public function set browseType(value:BrowseTypes):void
+		{
+			_browseType = value;
+		}
+		
+		//----------------------------------
+		//    hint
+		//----------------------------------
+		
+		private var _hint:String;
+
+		[Bindable]
+		public function get hint():String
+		{
+			return _hint;
+		}
+
+		public function set hint(value:String):void
+		{
+			_hint = value;
+		}
+
+		//----------------------------------
+		//    instruction
+		//----------------------------------
+		
+		private var _instruction:String;
+		
+		[Bindable]
+		public function get instruction():String
+		{
+			return _instruction;
+		}
+		
+		public function set instruction(value:String):void
+		{
+			_instruction = value;
+		}
+		
+		//----------------------------------
+		//    path
+		//----------------------------------
+		
+		private var _path:String;
+		
+		[Bindable]
+		public function get path():String
+		{
+			return _path;
+		}
+
+		public function set path(value:String):void
+		{
+			_path = value;
+		}
+
+		//----------------------------------
+		//    pathName
+		//----------------------------------
+		
+		public var pathName:String;
+		
+		
+		
+		//----------------------------------------------------------------------
+		//
+		//    Event handlers
+		//
+		//----------------------------------------------------------------------
+		
+		//----------------------------------
+		//    select_clickHandler
+		//----------------------------------
+		
+		protected function select_clickHandler(event:MouseEvent):void
+		{
+			var file:File = new File();
+			file.addEventListener(Event.SELECT, select_completeHandler);
+			
+			if (browseType == BrowseTypes.BROWSE_DIR)
+				file.browseForDirectory("Select the " + pathName.toUpperCase() + " directory");
+			else
+				file.browse();
+		}
+		
+		//----------------------------------
+		//    select_completeHandler
+		//----------------------------------
+		
+		protected function select_completeHandler(event:Event):void
+		{
+			if (event.target is File)
+				path = File(event.target).nativePath;
+			
+			Utils.writePath(pathName, path);
+		}
+		
+	]]></fx:Script>
+	
+	<s:layout>
+		<s:VerticalLayout/>
+	</s:layout>
+	
+	<fx:Declarations />
+	
+	<fx:Binding source="path" destination="tiSelect.text" twoWay="true" />
+	
+	<s:Label text="{instruction}"/>
+	
+	<s:HGroup width="100%">
+		<s:TextInput id="tiSelect"
+					 width="100%" 
+					 prompt="{hint}"
+					 focusOut="select_completeHandler(event)"/>
+		
+		<s:Button label="Select..."
+				  right="0"
+				  click="select_clickHandler(event)" />
+	</s:HGroup>
+	
+</s:Group>

Propchange: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/components/PathSelectionBox.mxml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/BrowseTypes.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/BrowseTypes.as?rev=1436251&view=auto
==============================================================================
--- flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/BrowseTypes.as (added)
+++ flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/BrowseTypes.as Mon
Jan 21 10:05:53 2013
@@ -0,0 +1,50 @@
+package org.apache.flex.asjs.enums
+{
+public class BrowseTypes
+{
+
+	//----------------------------------------------------------------------
+	//
+	//    Class constants
+	//
+	//----------------------------------------------------------------------
+	
+	public static const BROWSE_DIR:BrowseTypes = new BrowseTypes("dir");
+	public static const BROWSE_FILE:BrowseTypes = new BrowseTypes("file");
+	
+	//----------------------------------------------------------------------
+	//
+	//    Constructor
+	//
+	//----------------------------------------------------------------------
+	
+	public function BrowseTypes(stringValue:String) 
+	{
+		this.stringValue = stringValue;
+	}
+	
+	//--------------------------------------------------------------------------
+	//
+	//    Variables
+	//
+	//--------------------------------------------------------------------------
+	
+	private var stringValue:String;
+	
+	//--------------------------------------------------------------------------
+	//
+	//    Methods
+	//
+	//--------------------------------------------------------------------------
+	
+	//----------------------------------
+	//    toString
+	//----------------------------------
+	
+	public function toString():String
+	{
+		return stringValue;
+	}
+	
+}
+}
\ No newline at end of file

Propchange: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/BrowseTypes.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/ScriptNames.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/ScriptNames.as?rev=1436251&view=auto
==============================================================================
--- flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/ScriptNames.as (added)
+++ flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/ScriptNames.as Mon
Jan 21 10:05:53 2013
@@ -0,0 +1,29 @@
+package org.apache.flex.asjs.enums
+{
+public class ScriptNames
+{
+
+	//----------------------------------------------------------------------
+	//
+	//    Class constants
+	//
+	//----------------------------------------------------------------------
+	
+	public static const _TEST:String = "_test";
+	
+	public static const BUILD_FLEXJS_UI:String = "buildFlexJSUI";
+	
+	public static const COMPILE_FALCONJS:String = "compileFalconJS";
+	
+	public static const COMPILE_FALCONJX:String = "compileFalconJx";
+	
+	//----------------------------------------------------------------------
+	//
+	//    Constructor
+	//
+	//----------------------------------------------------------------------
+	
+	public function ScriptNames() {}
+	
+}
+}
\ No newline at end of file

Propchange: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/enums/ScriptNames.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/interfaces/IExecutable.as
URL: http://svn.apache.org/viewvc/flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/interfaces/IExecutable.as?rev=1436251&view=auto
==============================================================================
--- flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/interfaces/IExecutable.as
(added)
+++ flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/interfaces/IExecutable.as
Mon Jan 21 10:05:53 2013
@@ -0,0 +1,7 @@
+package org.apache.flex.asjs.interfaces
+{
+public interface IExecutable
+{
+	function exec(command:String, params:Array = null):void;
+}
+}
\ No newline at end of file

Propchange: flex/asjs/branches/develop/publisher/src/org/apache/flex/asjs/interfaces/IExecutable.as
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message