You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/06/15 08:30:46 UTC
[12/48] git commit: [flex-utilities] [refs/heads/develop] - move
ant_on_air into flex-installer
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/Project.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Project.as b/ant_on_air/src/org/apache/flex/ant/tags/Project.as
deleted file mode 100644
index f7628e7..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/Project.as
+++ /dev/null
@@ -1,241 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import flash.events.Event;
-
- import mx.core.IFlexModuleFactory;
- import mx.utils.StringUtil;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.filesetClasses.Reference;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
- import org.apache.flex.xml.ITagHandler;
-
- [Mixin]
- public class Project extends TaskHandler
- {
- /** Message priority of "error". */
- public static const MSG_ERR:int = 0;
- /** Message priority of "warning". */
- public static const MSG_WARN:int = 1;
- /** Message priority of "information". */
- public static const MSG_INFO:int = 2;
- /** Message priority of "verbose". */
- public static const MSG_VERBOSE:int = 3;
- /** Message priority of "debug". */
- public static const MSG_DEBUG:int = 4;
-
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["project"] = Project;
- }
-
- public function Project()
- {
- }
-
- private var _status:Boolean;
- /**
- * true if tasks completed successfully.
- * Do not monitor this property to determine if the project is done executing.
- * This property is set to true and a failing task sets it to false.
- */
- public function get status():Boolean
- {
- return _status;
- }
-
- public function set status(value:Boolean):void
- {
- if (_status != value)
- {
- _status = value;
- ant.dispatchEvent(new Event("statusChanged"));
- }
- }
-
- private var _failureMessage:String;
- /**
- * null if tasks completed successfully.
- * if status == false, then this will be
- * set if a <fail> message set status to false
- * or some other condition set status to false.
- *
- */
- public function get failureMessage():String
- {
- return _failureMessage;
- }
-
- public function set failureMessage(value:String):void
- {
- if (_failureMessage != value)
- {
- _failureMessage = value;
- ant.dispatchEvent(new Event("failureMessageChanged"));
- }
- }
-
- public function get basedir():String
- {
- return getAttributeValue("@basedir");
- }
-
- public function get defaultTarget():String
- {
- return getAttributeValue("@default");
- }
-
- public var refids:Object = {};
-
- private var targets:Array;
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
-
- this.callbackMode = callbackMode;
-
- status = true;
-
- if (context.targets == null)
- context.targets = defaultTarget;
-
- targets = context.targets.split(",");
-
- // execute all children in order except for targets
- return executeChildren();
- }
-
- private var current:int = 0;
-
- private function executeChildren():Boolean
- {
- if (!status)
- {
- dispatchEvent(new Event(Event.COMPLETE));
- return true;
- }
-
- if (current == numChildren)
- return executeTargets();
-
- while (current < numChildren)
- {
- var child:ITagHandler = getChildAt(current++);
- if (child is Target)
- continue;
- if (child is TaskHandler)
- {
- var task:TaskHandler = TaskHandler(child);
- if (!task.execute(callbackMode, context))
- {
- task.addEventListener(Event.COMPLETE, childCompleteHandler);
- return false;
- }
- if (!status)
- {
- dispatchEvent(new Event(Event.COMPLETE));
- return true;
- }
- }
- }
- return executeTargets();
- }
-
- private function executeTargets():Boolean
- {
- while (targets.length > 0)
- {
- var targetName:String = targets.shift();
- if (!executeTarget(targetName))
- return false;
- if (!status)
- {
- dispatchEvent(new Event(Event.COMPLETE));
- return true;
- }
-
- }
- if (targets.length == 0)
- dispatchEvent(new Event(Event.COMPLETE));
-
- return true;
- }
-
- public function getTarget(targetName:String):Target
- {
- targetName = StringUtil.trim(targetName);
- var n:int = numChildren;
- for (var i:int = 0; i < n; i++)
- {
- var child:ITagHandler = getChildAt(i);
- if (child is Target)
- {
- var t:Target = child as Target;
- if (t.name == targetName)
- {
- return t;
- }
- }
- }
- trace("missing target: ", targetName);
- throw new Error("missing target: " + targetName);
- return null;
- }
-
- public function executeTarget(targetName:String):Boolean
- {
- var t:Target = getTarget(targetName);
- if (!t.execute(callbackMode, context))
- {
- t.addEventListener(Event.COMPLETE, completeHandler);
- return false;
- }
- return true;
- }
-
- private function completeHandler(event:Event):void
- {
- event.target.removeEventListener(Event.COMPLETE, completeHandler);
- executeTargets();
- }
-
- private function childCompleteHandler(event:Event):void
- {
- event.target.removeEventListener(Event.COMPLETE, childCompleteHandler);
- executeChildren();
- }
-
- private var references:Object = {};
-
- public function addReference(referenceName:String, value:Object):void
- {
- references[referenceName] = value;
- }
- public function getReference(referenceName:String):Reference
- {
- if (references.hasOwnProperty(referenceName))
- return references[referenceName];
-
- return null;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/Property.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Property.as b/ant_on_air/src/org/apache/flex/ant/tags/Property.as
deleted file mode 100644
index 3acf3a3..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/Property.as
+++ /dev/null
@@ -1,234 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import flash.desktop.NativeProcess;
- import flash.desktop.NativeProcessStartupInfo;
- import flash.events.Event;
- import flash.events.NativeProcessExitEvent;
- import flash.events.ProgressEvent;
- import flash.filesystem.File;
- import flash.filesystem.FileMode;
- import flash.filesystem.FileStream;
- import flash.system.Capabilities;
- import flash.utils.IDataInput;
-
- import mx.core.IFlexModuleFactory;
- import mx.utils.StringUtil;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
-
- [Mixin]
- public class Property extends TaskHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["property"] = Property;
- }
-
- public function Property()
- {
- }
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
-
- if (name && (value || location || refid) && !context.hasOwnProperty(name))
- {
- if (value)
- context[name] = value;
- else if (refid)
- context[name] = context[ant.project.refids[refid]];
- else
- context[name] = location;
- }
- else if (fileName != null)
- {
- try {
- var f:File = new File(fileName);
- }
- catch (e:Error)
- {
- ant.output(fileName);
- ant.output(e.message);
- if (failonerror)
- {
- ant.project.failureMessage = e.message;
- ant.project.status = false;
- }
- return true;
- }
-
- if (f.exists)
- {
- var fs:FileStream = new FileStream();
- fs.open(f, FileMode.READ);
- var data:String = fs.readUTFBytes(fs.bytesAvailable);
- var propLines:Array = data.split("\n");
- var collectingParts:Boolean;
- var val:String;
- var key:String;
- for each (var line:String in propLines)
- {
- if (line.charAt(line.length - 1) == "\r")
- line = line.substr(0, line.length - 1);
- if (collectingParts)
- {
- if (line.charAt(line.length - 1) == "\\")
- val += line.substr(0, line.length - 1);
- else
- {
- collectingParts = false;
- val += line;
- val = StringUtil.trim(val);
- val = val.replace(/\\n/g, "\n");
- if (!context.hasOwnProperty(key))
- context[key] = ant.getValue(val, context);
- }
- continue;
- }
- var parts:Array = line.split("=");
- if (parts.length >= 2)
- {
- key = StringUtil.trim(parts[0]);
- if (parts.length == 2)
- val = parts[1];
- else
- {
- parts.shift();
- val = parts.join("=");
- }
- if (val.charAt(val.length - 1) == "\\")
- {
- collectingParts = true;
- val = val.substr(0, val.length - 1);
- }
- else if (!context.hasOwnProperty(key))
- context[key] = ant.getValue(StringUtil.trim(val), context);
- }
-
- }
- fs.close();
- }
- }
- else if (envPrefix != null)
- {
- requestEnvironmentVariables();
- return false;
- }
- return true;
- }
-
- private function get fileName():String
- {
- return getNullOrAttributeValue("@file");
- }
-
- private function get refid():String
- {
- return getNullOrAttributeValue("@refid");
- }
-
- private function get value():String
- {
- return getNullOrAttributeValue("@value");
- }
-
- private function get location():String
- {
- return getNullOrAttributeValue("@location");
- }
-
- private function get envPrefix():String
- {
- return getNullOrAttributeValue("@environment");
- }
-
- private var process:NativeProcess;
-
- public function requestEnvironmentVariables():void
- {
- var file:File = File.applicationDirectory;
- if (Capabilities.os.toLowerCase().indexOf('win') == -1)
- file = new File("/bin/bash");
- else
- file = file.resolvePath("C:\\Windows\\System32\\cmd.exe");
- var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
- nativeProcessStartupInfo.executable = file;
- var args:Vector.<String> = new Vector.<String>();
- if (Capabilities.os.toLowerCase().indexOf('win') == -1)
- args.push("-c");
- else
- args.push("/c");
- args.push("set");
- nativeProcessStartupInfo.arguments = args;
- process = new NativeProcess();
- process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
- process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onOutputErrorData);
- process.start(nativeProcessStartupInfo);
- process.addEventListener(NativeProcessExitEvent.EXIT, exitHandler);
- }
-
- private function exitHandler(event:NativeProcessExitEvent):void
- {
- dispatchEvent(new Event(Event.COMPLETE));
- }
-
- private function onOutputErrorData(event:ProgressEvent):void
- {
- var stdError:IDataInput = process.standardError;
- var data:String = stdError.readUTFBytes(process.standardError.bytesAvailable);
- trace("Got Error Output: ", data);
- }
-
- private function onOutputData(event:ProgressEvent):void
- {
- var stdOut:IDataInput = process.standardOutput;
- var data:String = stdOut.readUTFBytes(process.standardOutput.bytesAvailable);
- trace("Got: ", data);
- var propLines:Array;
- if (Capabilities.os.indexOf('Mac OS') > -1)
- propLines = data.split("\n");
- else
- propLines = data.split("\r\n");
- var prefix:String = envPrefix;
- for each (var line:String in propLines)
- {
- var parts:Array = line.split("=");
- if (parts.length >= 2)
- {
- var key:String = envPrefix + "." + StringUtil.trim(parts[0]);
- var val:String;
- if (parts.length == 2)
- val = parts[1];
- else
- {
- parts.shift();
- val = parts.join("=");
- }
- if (!context.hasOwnProperty(key))
- context[key] = val;
- }
- }
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/PropertyFile.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/PropertyFile.as b/ant_on_air/src/org/apache/flex/ant/tags/PropertyFile.as
deleted file mode 100644
index 1d2c067..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/PropertyFile.as
+++ /dev/null
@@ -1,84 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import flash.filesystem.File;
- import flash.filesystem.FileMode;
- import flash.filesystem.FileStream;
-
- import mx.core.IFlexModuleFactory;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
-
- [Mixin]
- public class PropertyFile extends TaskHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["propertyfile"] = PropertyFile;
- }
-
- public function PropertyFile()
- {
- }
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
-
- try {
- var f:File = new File(fileName);
- }
- catch (e:Error)
- {
- ant.output(fileName);
- ant.output(e.message);
- if (failonerror)
- {
- ant.project.failureMessage = e.message;
- ant.project.status = false;
- }
- return true;
- }
-
- var fs:FileStream = new FileStream();
- fs.open(f, FileMode.WRITE);
- var n:int = numChildren;
- for (var i:int = 0; i < n; i++)
- {
- var entry:Entry = getChildAt(i) as Entry;
- entry.setContext(context);
- if (entry)
- {
- var s:String = entry.key + "=" + entry.value + "\n";
- fs.writeUTFBytes(s);
- }
- }
- fs.close();
- return true;
- }
-
- private function get fileName():String
- {
- return getAttributeValue("@file");
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Replace.as b/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
deleted file mode 100644
index 2873ee1..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
+++ /dev/null
@@ -1,142 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import flash.filesystem.File;
- import flash.filesystem.FileMode;
- import flash.filesystem.FileStream;
-
- import mx.core.IFlexModuleFactory;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
- import org.apache.flex.xml.ITagHandler;
-
- [Mixin]
- public class Replace extends TaskHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["replace"] = Replace;
- }
-
- public function Replace()
- {
- super();
- }
-
- private function get file():String
- {
- return getAttributeValue("@file");
- }
-
- private function get token():String
- {
- return getNullOrAttributeValue("@token");
- }
-
- private function get value():String
- {
- return getAttributeValue("@value");
- }
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
-
- try {
- var f:File = File.applicationDirectory.resolvePath(file);
- }
- catch (e:Error)
- {
- ant.output(file);
- ant.output(e.message);
- if (failonerror)
- {
- ant.project.failureMessage = e.message;
- ant.project.status = false;
- }
- return true;
- }
-
- var fs:FileStream = new FileStream();
- fs.open(f, FileMode.READ);
- var s:String = fs.readUTFBytes(fs.bytesAvailable);
- fs.close();
- var tokens:Vector.<String> = new Vector.<String>();
- var reps:Vector.<String> = new Vector.<String>();
- if (token != null)
- {
- tokens.push(token);
- reps.push(value);
- }
- if (numChildren > 0)
- {
- for (var i:int = 0; i < numChildren; i++)
- {
- var child:ITagHandler = getChildAt(i);
- if(child is ReplaceFilter)
- {
- var rf:ReplaceFilter = child as ReplaceFilter;
- rf.setContext(context);
- tokens.push(rf.token);
- reps.push(rf.value);
- }
- else if(child is ReplaceToken)
- {
- var rt:ReplaceToken = child as ReplaceToken;
- rt.setContext(context);
- tokens.push(rt.text);
- }
- else if(child is ReplaceValue)
- {
- var rv:ReplaceValue = child as ReplaceValue;
- rv.setContext(context);
- reps.push(rv.text);
- }
- }
- }
- var n:int = tokens.length;
- var c:int = 0;
- for (i = 0; i < n; i++)
- {
- var cur:int = 0;
- // only look at the portion we haven't looked at yet.
- // otherwise certain kinds of replacements can
- // cause infinite looping, like replacing
- // 'foo' with 'food'
- do
- {
- c = s.indexOf(tokens[i], cur)
- if (c != -1)
- {
- var firstHalf:String = s.substr(0, c);
- var secondHalf:String = s.substr(c);
- s = firstHalf + secondHalf.replace(tokens[i], reps[i]);
- cur = c + reps[i].length;
- }
- } while (c != -1)
- }
- fs.open(f, FileMode.WRITE);
- fs.writeUTFBytes(s);
- fs.close();
- return true;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/ReplaceFilter.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/ReplaceFilter.as b/ant_on_air/src/org/apache/flex/ant/tags/ReplaceFilter.as
deleted file mode 100644
index e4f69d1..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/ReplaceFilter.as
+++ /dev/null
@@ -1,50 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import mx.core.IFlexModuleFactory;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TagHandler;
-
- [Mixin]
- public class ReplaceFilter extends TagHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["replacefilter"] = ReplaceFilter;
- }
-
- public function ReplaceFilter()
- {
- super();
- }
-
- public function get token():String
- {
- return getAttributeValue("@token");
- }
-
- public function get value():String
- {
- return getAttributeValue("@value");
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as b/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as
deleted file mode 100644
index 8bb811d..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as
+++ /dev/null
@@ -1,44 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import mx.core.IFlexModuleFactory;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TagHandler;
-
- [Mixin]
- public class ReplaceToken extends TagHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["replacetoken"] = ReplaceToken;
- }
-
- public function ReplaceToken()
- {
- super();
- }
-
- public function get text():String
- {
- return ant.getValue(xml.text().toString(), context);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as b/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as
deleted file mode 100644
index 227d8a9..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as
+++ /dev/null
@@ -1,44 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import mx.core.IFlexModuleFactory;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TagHandler;
-
- [Mixin]
- public class ReplaceValue extends TagHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["replacevalue"] = ReplaceValue;
- }
-
- public function ReplaceValue()
- {
- super();
- }
-
- public function get text():String
- {
- return ant.getValue(xml.text().toString(), context);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/TStamp.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/TStamp.as b/ant_on_air/src/org/apache/flex/ant/tags/TStamp.as
deleted file mode 100644
index 0646a1f..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/TStamp.as
+++ /dev/null
@@ -1,68 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import mx.core.IFlexModuleFactory;
- import mx.resources.ResourceManager;
-
- import flash.globalization.DateTimeFormatter;
- import flash.globalization.LocaleID;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
-
- [ResourceBundle("ant")]
- [Mixin]
- public class TStamp extends TaskHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["tstamp"] = TStamp;
- }
-
- public function TStamp()
- {
- }
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
-
- var d:Date = new Date();
- var df:DateTimeFormatter = new DateTimeFormatter(LocaleID.DEFAULT);
- df.setDateTimePattern("yyyyMMdd");
- var dstamp:String = df.format(d);
- context["DSTAMP"] = dstamp;
- df.setDateTimePattern("hhmm");
- var tstamp:String = df.format(d);
- context["TSTAMP"] = tstamp;
- df.setDateTimePattern("MMMM dd yyyy");
- var today:String = df.format(d);
- context["TODAY"] = today;
-
- return true;
- }
-
- private function get prefix():String
- {
- return getAttributeValue("@prefix");
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/Target.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Target.as b/ant_on_air/src/org/apache/flex/ant/tags/Target.as
deleted file mode 100644
index 8c3272c..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/Target.as
+++ /dev/null
@@ -1,203 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import flash.events.Event;
- import flash.net.LocalConnection;
-
- import mx.core.IFlexModuleFactory;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
-
- [Mixin]
- public class Target extends TaskHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["target"] = Target;
- }
-
- public function Target()
- {
- }
-
- private function get ifProperty():String
- {
- return getNullOrAttributeValue("@if");
- }
-
- private function get unlessProperty():String
- {
- return getNullOrAttributeValue("@unless");
- }
-
- public function get depends():String
- {
- return getNullOrAttributeValue("@depends");
- }
-
- private var dependsList:Array;
-
- private function processDepends():Boolean
- {
- if (dependsList.length == 0)
- {
- continueOnToSteps();
- return true;
- }
-
- while (dependsList.length > 0)
- {
- var depend:String = dependsList.shift();
- var t:Target = ant.project.getTarget(depend);
- if (!t.execute(callbackMode, context))
- {
- t.addEventListener(Event.COMPLETE, dependCompleteHandler);
- return false;
- }
- }
-
- return continueOnToSteps();
- }
-
- private function dependCompleteHandler(event:Event):void
- {
- event.target.removeEventListener(Event.COMPLETE, dependCompleteHandler);
- if (!ant.project.status)
- {
- if (!inExecute)
- dispatchEvent(new Event(Event.COMPLETE));
- return;
- }
- processDepends();
- }
-
- private var inExecute:Boolean;
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
-
- current = 0;
- inExecute = true;
- this.callbackMode = callbackMode;
- if (depends)
- {
- dependsList = depends.split(",");
- if (!processDepends())
- {
- inExecute = false;
- return false;
- }
- }
-
- var ok:Boolean = continueOnToSteps();
- inExecute = false;
- return ok;
- }
-
- private function continueOnToSteps():Boolean
- {
- if (!ant.project.status)
- return true;
- ant.output("\n" + name + ":");
- return processSteps();
- }
-
- private var current:int = 0;
-
- private function processSteps():Boolean
- {
- // try forcing GC before each step
- try {
- var lc1:LocalConnection = new LocalConnection();
- var lc2:LocalConnection = new LocalConnection();
-
- lc1.connect("name");
- lc2.connect("name");
- }
- catch (error:Error)
- {
- }
-
-
- if (ifProperty != null)
- {
- if (!context.hasOwnProperty(ifProperty))
- {
- dispatchEvent(new Event(Event.COMPLETE));
- return true;
- }
- }
-
- if (unlessProperty != null)
- {
- if (context.hasOwnProperty(unlessProperty))
- {
- dispatchEvent(new Event(Event.COMPLETE));
- return true;
- }
- }
-
- if (current == numChildren)
- {
- dispatchEvent(new Event(Event.COMPLETE));
- return true;
- }
-
- while (current < numChildren)
- {
- var step:TaskHandler = getChildAt(current++) as TaskHandler;
- if (!step.execute(callbackMode, context))
- {
- step.addEventListener(Event.COMPLETE, completeHandler);
- return false;
- }
- if (!ant.project.status)
- {
- if (!inExecute)
- dispatchEvent(new Event(Event.COMPLETE));
- return true;
- }
- if (callbackMode)
- {
- ant.functionToCall = processSteps;
- return false;
- }
- }
- dispatchEvent(new Event(Event.COMPLETE));
- return true;
- }
-
- private function completeHandler(event:Event):void
- {
- event.target.removeEventListener(Event.COMPLETE, completeHandler);
- if (!ant.project.status)
- {
- dispatchEvent(new Event(Event.COMPLETE));
- return;
- }
- if (callbackMode)
- ant.functionToCall = processSteps;
- else
- processSteps();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Touch.as b/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
deleted file mode 100644
index 6982f43..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
+++ /dev/null
@@ -1,79 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import flash.filesystem.File;
- import flash.filesystem.FileMode;
- import flash.filesystem.FileStream;
-
- import mx.core.IFlexModuleFactory;
- import mx.resources.ResourceManager;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
-
- [ResourceBundle("ant")]
- [Mixin]
- public class Touch extends TaskHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["touch"] = Touch;
- }
-
- public function Touch()
- {
- }
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
-
- try {
- var f:File = new File(fileName);
- }
- catch (e:Error)
- {
- ant.output(fileName);
- ant.output(e.message);
- if (failonerror)
- {
- ant.project.failureMessage = e.message;
- ant.project.status = false;
- }
- return true;
- }
-
- var s:String = ResourceManager.getInstance().getString('ant', 'TOUCH');
- s = s.replace("%1", f.nativePath);
- ant.output(ant.formatOutput("touch", s));
-
- var fs:FileStream = new FileStream();
- fs.open(f, FileMode.APPEND);
- fs.close();
- return true;
- }
-
- private function get fileName():String
- {
- return getAttributeValue("@file");
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Untar.as b/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
deleted file mode 100644
index 92b313d..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
+++ /dev/null
@@ -1,194 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import com.probertson.utils.GZIPEncoder;
- import de.ketzler.utils.SimpleUntar;
-
- import flash.desktop.NativeProcess;
- import flash.desktop.NativeProcessStartupInfo;
- import flash.events.Event;
- import flash.events.ProgressEvent;
- import flash.events.NativeProcessExitEvent;
- import flash.filesystem.File;
- import flash.system.Capabilities;
-
- import mx.core.IFlexModuleFactory;
- import mx.resources.ResourceManager;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
-
- [ResourceBundle("ant")]
- [Mixin]
- public class Untar extends TaskHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["untar"] = Untar;
- }
-
- public function Untar()
- {
- super();
- }
-
- private function get src():String
- {
- return getAttributeValue("@src");
- }
-
- private function get dest():String
- {
- return getAttributeValue("@dest");
- }
-
- private function get overwrite():Boolean
- {
- return getAttributeValue("@overwrite") == "true";
- }
-
- private function get compression():String
- {
- return getNullOrAttributeValue("@compression");
- }
-
- private var destFile:File;
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
-
- try {
- var srcFile:File = File.applicationDirectory.resolvePath(src);
- }
- catch (e:Error)
- {
- ant.output(src);
- ant.output(e.message);
- if (failonerror)
- {
- ant.project.failureMessage = e.message;
- ant.project.status = false;
- }
- return true;
- }
-
- try {
- destFile = File.applicationDirectory.resolvePath(dest);
- if (!destFile.exists)
- destFile.createDirectory();
- }
- catch (e:Error)
- {
- ant.output(dest);
- ant.output(e.message);
- if (failonerror)
- {
- ant.project.failureMessage = e.message;
- ant.project.status = false;
- }
- return true;
- }
-
- return untar(srcFile);
- }
-
- private var _process:NativeProcess;
-
- private function untar(source:File):Boolean
- {
- if (Capabilities.os.indexOf("Win") != -1)
- {
- winUntar(source);
- return true;
- }
-
- var tar:File;
- var startupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
- var arguments:Vector.<String> = new Vector.<String>();
-
- if (Capabilities.os.indexOf("Linux") != -1)
- tar = new File("/bin/tar");
- else
- tar = new File("/usr/bin/tar");
-
- arguments.push("xf");
- arguments.push(source.nativePath);
- arguments.push("-C");
- arguments.push(destFile.nativePath);
-
- startupInfo.executable = tar;
- startupInfo.arguments = arguments;
-
- var s:String = ResourceManager.getInstance().getString('ant', 'UNZIP');
- s = s.replace("%1", source.nativePath);
- s = s.replace("%2", destFile.nativePath);
- ant.output(ant.formatOutput("untar", s));
-
- _process = new NativeProcess();
- _process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, unTarFileProgress);
- _process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, unTarError);
- _process.addEventListener(NativeProcessExitEvent.EXIT, unTarComplete);
- _process.start(startupInfo);
-
- return false;
-
- }
-
- private function unTarError(event:Event):void {
- var output:String = _process.standardError.readUTFBytes(_process.standardError.bytesAvailable);
- ant.output(output);
- if (failonerror)
- {
- ant.project.failureMessage = output;
- ant.project.status = false;
- }
- dispatchEvent(new Event(Event.COMPLETE));
- }
-
- private function unTarFileProgress(event:Event):void {
- var output:String = _process.standardOutput.readUTFBytes(_process.standardOutput.bytesAvailable);
- ant.output(output);
- }
-
- private function unTarComplete(event:NativeProcessExitEvent):void {
- _process.closeInput();
- _process.exit(true);
- dispatchEvent(new Event(Event.COMPLETE));
- }
-
- private function winUntar(source:File):void
- {
- if (compression == "gzip")
- {
- var tarName:String = source.nativePath + ".tar";
- var tarFile:File = File.applicationDirectory.resolvePath(tarName);
- var gz:GZIPEncoder = new GZIPEncoder();
- gz.uncompressToFile(source, tarFile);
- source = tarFile;
- }
- var su:SimpleUntar = new SimpleUntar();
- su.sourcePath = source.nativePath;
- su.targetPath = destFile.nativePath;
- su.extract();
- dispatchEvent(new Event(Event.COMPLETE));
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as b/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
deleted file mode 100644
index f4f385d..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
+++ /dev/null
@@ -1,214 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import flash.events.ErrorEvent;
- import flash.events.Event;
- import flash.filesystem.File;
- import flash.filesystem.FileMode;
- import flash.filesystem.FileStream;
- import flash.utils.ByteArray;
-
- import mx.core.IFlexModuleFactory;
- import mx.resources.ResourceManager;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
- import org.apache.flex.xml.ITagHandler;
- import org.as3commons.zip.Zip;
- import org.as3commons.zip.ZipEvent;
- import org.as3commons.zip.ZipFile;
-
- [ResourceBundle("ant")]
- [Mixin]
- public class Unzip extends TaskHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["unzip"] = Unzip;
- }
-
- public function Unzip()
- {
- super();
- }
-
- private function get src():String
- {
- return getAttributeValue("@src");
- }
-
- private function get dest():String
- {
- return getAttributeValue("@dest");
- }
-
- private function get overwrite():Boolean
- {
- return getAttributeValue("@overwrite") == "true";
- }
-
- private var srcFile:File;
- private var destFile:File;
- private var patternSet:PatternSet;
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
- if (numChildren > 0)
- {
- // look for a patternset
- for (var i:int = 0; i < numChildren; i++)
- {
- var child:ITagHandler = getChildAt(i);
- if (child is PatternSet)
- {
- patternSet = child as PatternSet;
- patternSet.setContext(context);
- break;
- }
- }
- }
-
- try {
- srcFile = File.applicationDirectory.resolvePath(src);
- }
- catch (e:Error)
- {
- ant.output(src);
- ant.output(e.message);
- if (failonerror)
- {
- ant.project.failureMessage = e.message;
- ant.project.status = false;
- }
- return true;
- }
-
- try {
- destFile = File.applicationDirectory.resolvePath(dest);
- if (!destFile.exists)
- destFile.createDirectory();
- }
- catch (e:Error)
- {
- ant.output(dest);
- ant.output(e.message);
- if (failonerror)
- {
- ant.project.failureMessage = e.message;
- ant.project.status = false;
- }
- return true;
- }
-
-
- var s:String = ResourceManager.getInstance().getString('ant', 'UNZIP');
- s = s.replace("%1", srcFile.nativePath);
- s = s.replace("%2", destFile.nativePath);
- ant.output(ant.formatOutput("unzip", s));
- ant.functionToCall = dounzip;
- return false;
- }
-
- private function dounzip():void
- {
- unzip(srcFile);
- dispatchEvent(new Event(Event.COMPLETE));
- }
-
- private function unzip(fileToUnzip:File):void {
- var zipFileBytes:ByteArray = new ByteArray();
- var fs:FileStream = new FileStream();
- var fzip:Zip = new Zip();
-
- fs.open(fileToUnzip, FileMode.READ);
- fs.readBytes(zipFileBytes);
- fs.close();
-
- fzip.addEventListener(ZipEvent.FILE_LOADED, onFileLoaded);
- fzip.addEventListener(Event.COMPLETE, onUnzipComplete, false, 0, true);
- fzip.addEventListener(ErrorEvent.ERROR, onUnzipError, false, 0, true);
-
- // synchronous, so no progress events
- fzip.loadBytes(zipFileBytes);
- }
-
- private function isDirectory(f:ZipFile):Boolean {
- if (f.filename.substr(f.filename.length - 1) == "/" || f.filename.substr(f.filename.length - 1) == "\\") {
- return true;
- }
- return false;
- }
-
- private function onFileLoaded(e:ZipEvent):void {
- try {
- var fzf:ZipFile = e.file;
- if (patternSet)
- {
- if (!(patternSet.matches(fzf.filename)))
- return;
- }
- var f:File = destFile.resolvePath(fzf.filename);
- var fs:FileStream = new FileStream();
-
- if (isDirectory(fzf)) {
- // Is a directory, not a file. Dont try to write anything into it.
- return;
- }
-
- fs.open(f, FileMode.WRITE);
- fs.writeBytes(fzf.content);
- fs.close();
-
- // attempt to shrink bytearray so memory doesn't store every uncompressed byte
- fzf.setContent(null, false);
-
- } catch (error:Error) {
- ant.output(error.message);
- if (failonerror)
- {
- ant.project.failureMessage = error.message;
- ant.project.status = false;
- }
- }
- }
-
- private function onUnzipComplete(event:Event):void {
- var fzip:Zip = event.target as Zip;
- fzip.close();
- fzip.removeEventListener(ZipEvent.FILE_LOADED, onFileLoaded);
- fzip.removeEventListener(Event.COMPLETE, onUnzipComplete);
- fzip.removeEventListener(ErrorEvent.ERROR, onUnzipError);
- }
-
- private function onUnzipError(event:Event):void {
- var fzip:Zip = event.target as Zip;
- fzip.close();
- fzip.removeEventListener(ZipEvent.FILE_LOADED, onFileLoaded);
- fzip.removeEventListener(Event.COMPLETE, onUnzipComplete);
- fzip.removeEventListener(ErrorEvent.ERROR, onUnzipError);
- if (failonerror)
- {
- ant.project.failureMessage = event.toString();
- ant.project.status = false;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/XmlProperty.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/XmlProperty.as b/ant_on_air/src/org/apache/flex/ant/tags/XmlProperty.as
deleted file mode 100644
index c7c5b03..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/XmlProperty.as
+++ /dev/null
@@ -1,118 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags
-{
- import flash.filesystem.File;
- import flash.filesystem.FileMode;
- import flash.filesystem.FileStream;
-
- import mx.core.IFlexModuleFactory;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.supportClasses.TaskHandler;
-
- [Mixin]
- public class XmlProperty extends TaskHandler
- {
- public static function init(mf:IFlexModuleFactory):void
- {
- Ant.antTagProcessors["xmlproperty"] = XmlProperty;
- }
-
- public function XmlProperty()
- {
- }
-
- override public function execute(callbackMode:Boolean, context:Object):Boolean
- {
- super.execute(callbackMode, context);
-
- try {
- var f:File = new File(fileName);
- }
- catch (e:Error)
- {
- ant.output(fileName);
- ant.output(e.message);
- if (failonerror)
- {
- ant.project.failureMessage = e.message;
- ant.project.status = false;
- }
- return true;
- }
-
- var fs:FileStream = new FileStream();
- fs.open(f, FileMode.READ);
- var data:String = fs.readUTFBytes(fs.bytesAvailable);
- var xml:XML = XML(data);
- createProperties(xml, xml.name());
- fs.close();
- return true;
- }
-
- private function createProperties(xml:XML, prefix:String):void
- {
- var children:XMLList = xml.*;
- for each (var node:XML in children)
- {
- var val:String;
- var key:String;
- if (node.nodeKind() == "text")
- {
- key = prefix;
- val = node.toString();
- if (!context.hasOwnProperty(key))
- context[key] = val;
- }
- else if (node.nodeKind() == "element")
- {
- key = prefix + "." + node.name();
- var id:String = node.@id.toString();
- if (id)
- ant.project.refids[id] = key;
- createProperties(node, key);
- }
- }
- if (collapse)
- {
- var attrs:XMLList = xml.attributes();
- var n:int = attrs.length();
- for (var i:int = 0; i < n; i++)
- {
- key = prefix + "." + attrs[i].name();
- val = xml.attribute(attrs[i].name()).toString();
- if (!context.hasOwnProperty(key))
- context[key] = val;
- }
- }
- }
-
- private function get fileName():String
- {
- return getAttributeValue("@file");
- }
-
- private function get collapse():Boolean
- {
- return getAttributeValue("@collapseAttributes") == "true";
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/Character.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/Character.as b/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/Character.as
deleted file mode 100644
index d2b6b87..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/Character.as
+++ /dev/null
@@ -1,34 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags.filesetClasses
-{
- public class Character
- {
- public function Character()
- {
- super();
- }
-
- public static function isLetter(c:String):Boolean
- {
- return "a" <= c && c <= "z" ||
- "A" <= c && c <= "Z";
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/CollectionUtils.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/CollectionUtils.as b/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/CollectionUtils.as
deleted file mode 100644
index 0717a4e..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/CollectionUtils.as
+++ /dev/null
@@ -1,41 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.ant.tags.filesetClasses
-{
- public class CollectionUtils
- {
- public function CollectionUtils()
- {
- super();
- }
-
- private static var target:String;
-
- private static function callback(item:String, index:int, list:Vector.<String>):Boolean
- {
- return CollectionUtils.target == item;
- }
-
- public static function frequency(list:Vector.<String>, c:String):int
- {
- target = c;
- return list.filter(callback).length;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/DataType.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/DataType.as b/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/DataType.as
deleted file mode 100644
index 16acca7..0000000
--- a/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/DataType.as
+++ /dev/null
@@ -1,330 +0,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.
-*
-*/
-
-package org.apache.flex.ant.tags.filesetClasses
-{
- import flash.system.ApplicationDomain;
- import flash.utils.getQualifiedClassName;
-
- import org.apache.flex.ant.Ant;
- import org.apache.flex.ant.tags.Project;
- import org.apache.flex.ant.tags.filesetClasses.exceptions.BuildException;
-
- /**
- * Ported from org.apache.tools.ant.types.DataType.java on 12/3/13
- * Base class for those classes that can appear inside the build file
- * as stand alone data types.
- *
- * <p>This class handles the common description attribute and provides
- * a default implementation for reference handling and checking for
- * circular references that is appropriate for types that can not be
- * nested inside elements of the same type (i.e. <patternset>
- * but not <path>).</p>
- *
- */
- public class DataType
- {
- // CheckStyle:VisibilityModifier OFF
-
- /**
- * Value to the refid attribute.
- *
- * @deprecated since 1.7.
- * The user should not be directly referencing
- * variable. Please use {@link #getRefid} instead.
- */
- protected var ref:Reference;
-
- /**
- * Are we sure we don't hold circular references?
- *
- * <p>Subclasses are responsible for setting this value to false
- * if we'd need to investigate this condition (usually because a
- * child element has been added that is a subclass of
- * DataType).</p>
- *
- * @deprecated since 1.7.
- * The user should not be directly referencing
- * variable. Please use {@link #setChecked} or
- * {@link #isChecked} instead.
- */
- protected var checked:Boolean = true;
- // CheckStyle:VisibilityModifier ON
-
- /**
- * Has the refid attribute of this element been set?
- * @return true if the refid attribute has been set
- */
- public function isReference():Boolean
- {
- return ref != null;
- }
-
- /**
- * Set the value of the refid attribute.
- *
- * <p>Subclasses may need to check whether any other attributes
- * have been set as well or child elements have been created and
- * thus override this method. if they do the must call
- * <code>super.setRefid</code>.</p>
- * @param ref the reference to use
- */
- public function setRefid(ref:Reference):void
- {
- this.ref = ref;
- checked = false;
- }
-
- /**
- * Gets as descriptive as possible a name used for this datatype instance.
- * @return <code>String</code> name.
- */
- protected function getDataTypeName():String
- {
- return "DataType";
- }
-
- /**
- * Check to see whether any DataType we hold references to is
- * included in the Stack (which holds all DataType instances that
- * directly or indirectly reference this instance, including this
- * instance itself).
- *
- * <p>If one is included, throw a BuildException created by {@link
- * #circularReference circularReference}.</p>
- *
- * <p>This implementation is appropriate only for a DataType that
- * cannot hold other DataTypes as children.</p>
- *
- * <p>The general contract of this method is that it shouldn't do
- * anything if {@link #checked <code>checked</code>} is true and
- * set it to true on exit.</p>
- * @param stack the stack of references to check.
- * @param project the project to use to dereference the references.
- * @throws BuildException on error.
- */
- protected function dieOnCircularReference(stack:Vector.<String> = null, project:Project = null):void
- {
- if (!project)
- project = Ant.currentAnt.project;
-
- if (!stack)
- stack = new Vector.<String>();
-
- if (checked || !isReference()) {
- return;
- }
- var o:Object = ref.getReferencedObject(project);
-
- if (o is DataType) {
- if (stack.indexOf(o) != -1) {
- throw circularReference();
- } else {
- stack.push(o);
- DataType(o).dieOnCircularReference(Vector.<String>([id]), project);
- stack.pop();
- }
- }
- checked = true;
- }
-
- /**
- * Allow DataTypes outside org.apache.tools.ant.types to indirectly call
- * dieOnCircularReference on nested DataTypes.
- * @param dt the DataType to check.
- * @param stk the stack of references to check.
- * @param p the project to use to dereference the references.
- * @throws BuildException on error.
- * @since Ant 1.7
- */
- public static function invokeCircularReferenceCheck(dt:DataType, stk:Vector.<String>,
- p:Project):void
- {
- dt.dieOnCircularReference(stk, p);
- }
-
- /**
- * Allow DataTypes outside org.apache.tools.ant.types to indirectly call
- * dieOnCircularReference on nested DataTypes.
- *
- * <p>Pushes dt on the stack, runs dieOnCircularReference and pops
- * it again.</p>
- * @param dt the DataType to check.
- * @param stk the stack of references to check.
- * @param p the project to use to dereference the references.
- * @throws BuildException on error.
- * @since Ant 1.8.0
- */
- public static function pushAndInvokeCircularReferenceCheck(dt:DataType,
- stk:Vector.<String>,
- p:Project):void
- {
- stk.push(dt);
- dt.dieOnCircularReference(stk, p);
- stk.pop();
- }
-
- /**
- * Performs the check for circular references and returns the
- * referenced object.
- * @param p the Ant Project instance against which to resolve references.
- * @return the dereferenced object.
- * @throws BuildException if the reference is invalid (circular ref, wrong class, etc).
- * @since Ant 1.7
- */
- protected function getCheckedRef(p:Project = null):Object
- {
- if (!p)
- p = Ant.currentAnt.project;
- return getCheckedRefActual(Class(ApplicationDomain.currentDomain.getDefinition(getQualifiedClassName(this))),
- getDataTypeName(), p);
- }
-
- /**
- * Performs the check for circular references and returns the
- * referenced object. This version allows the fallback Project instance to be specified.
- * @param requiredClass the class that this reference should be a subclass of.
- * @param dataTypeName the name of the datatype that the reference should be
- * (error message use only).
- * @param project the fallback Project instance for dereferencing.
- * @return the dereferenced object.
- * @throws BuildException if the reference is invalid (circular ref, wrong class, etc),
- * or if <code>project</code> is <code>null</code>.
- * @since Ant 1.7
- */
- protected function getCheckedRefActual(requiredClass:Class,
- dataTypeName:String, project:Project):Object {
- if (project == null) {
- throw new BuildException("No Project specified");
- }
- dieOnCircularReference(null, project);
- var o:Object = ref.getReferencedObject(project);
- var oClass:Class = ApplicationDomain.currentDomain.getDefinition(getQualifiedClassName(o)) as Class;
- if (!(requiredClass is oClass)) {
- Ant.log("Class " + oClass + " is not a subclass of " + requiredClass,
- Project.MSG_VERBOSE);
- var msg:String = ref.getRefId() + " doesn\'t denote a " + dataTypeName;
- throw new BuildException(msg);
- }
- return o;
- }
-
- /**
- * Creates an exception that indicates that refid has to be the
- * only attribute if it is set.
- * @return the exception to throw
- */
- protected function tooManyAttributes():BuildException
- {
- return new BuildException("You must not specify more than one "
- + "attribute when using refid");
- }
-
- /**
- * Creates an exception that indicates that this XML element must
- * not have child elements if the refid attribute is set.
- * @return the exception to throw
- */
- protected function noChildrenAllowed():BuildException
- {
- return new BuildException("You must not specify nested elements "
- + "when using refid");
- }
-
- /**
- * Creates an exception that indicates the user has generated a
- * loop of data types referencing each other.
- * @return the exception to throw
- */
- protected function circularReference():BuildException
- {
- return new BuildException("This data type contains a circular "
- + "reference.");
- }
-
- /**
- * The flag that is used to indicate that circular references have been checked.
- * @return true if circular references have been checked
- */
- protected function isChecked():Boolean
- {
- return checked;
- }
-
- /**
- * Set the flag that is used to indicate that circular references have been checked.
- * @param checked if true, if circular references have been checked
- */
- protected function setChecked(checked:Boolean):void
- {
- this.checked = checked;
- }
-
- /**
- * get the reference set on this object
- * @return the reference or null
- */
- public function getRefid():Reference
- {
- return ref;
- }
-
- /**
- * check that it is ok to set attributes, i.e that no reference is defined
- * @since Ant 1.6
- * @throws BuildException if not allowed
- */
- protected function checkAttributesAllowed():void
- {
- if (isReference()) {
- throw tooManyAttributes();
- }
- }
-
- /**
- * check that it is ok to add children, i.e that no reference is defined
- * @since Ant 1.6
- * @throws BuildException if not allowed
- */
- protected function checkChildrenAllowed():void
- {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- }
-
- /**
- * Basic DataType toString().
- * @return this DataType formatted as a String.
- */
- public function toString():String {
- var d:String = getDescription();
- return d == null ? getDataTypeName() : getDataTypeName() + " " + d;
- }
-
- /**
- * Basic description
- */
- public function getDescription():String
- {
- return null;
- }
-
- public var id:String;
- }
-}