From 2ec8a818f04ab7eda8dd65a4da6a0536fd234f4f Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Fri, 22 Jul 2016 08:28:00 -0700 Subject: [PATCH] Minor cleanup --- lime/graphics/cairo/Cairo.hx | 2 - lime/graphics/utils/ImageDataUtil.hx | 2 +- lime/project/HXProject.hx | 4 +- lime/tools/helpers/AntHelper.hx | 6 +- lime/tools/helpers/AssetHelper.hx | 2 +- lime/tools/helpers/BlackBerryHelper.hx | 4 +- lime/tools/helpers/FileHelper.hx | 4 +- lime/tools/helpers/IOSHelper.hx | 4 +- lime/tools/helpers/JavaHelper.hx | 6 +- lime/tools/helpers/PlatformHelper.hx | 6 +- lime/tools/helpers/StringHelper.hx | 4 +- lime/tools/helpers/TVOSHelper.hx | 291 ++++++++++++++----------- lime/tools/helpers/WebOSHelper.hx | 6 +- lime/tools/helpers/ZipHelper.hx | 4 +- lime/utils/LZMA.hx | 2 +- tools/RunScript.hx | 2 +- tools/utils/JavaExternGenerator.hx | 6 +- 17 files changed, 195 insertions(+), 160 deletions(-) diff --git a/lime/graphics/cairo/Cairo.hx b/lime/graphics/cairo/Cairo.hx index 409d3a444..06698cfa1 100644 --- a/lime/graphics/cairo/Cairo.hx +++ b/lime/graphics/cairo/Cairo.hx @@ -502,8 +502,6 @@ class Cairo { } - - // Get & Set Methods diff --git a/lime/graphics/utils/ImageDataUtil.hx b/lime/graphics/utils/ImageDataUtil.hx index f2efcde5b..6dd633e60 100644 --- a/lime/graphics/utils/ImageDataUtil.hx +++ b/lime/graphics/utils/ImageDataUtil.hx @@ -333,7 +333,7 @@ class ImageDataUtil { var format = image.buffer.format; var premultiplied = image.buffer.premultiplied; - if (premultiplied) fillColor.multiplyAlpha(); + if (premultiplied) fillColor.multiplyAlpha (); var dataView = new ImageDataView (image, rect); var row; diff --git a/lime/project/HXProject.hx b/lime/project/HXProject.hx index 49514b95a..a3495b1fb 100644 --- a/lime/project/HXProject.hx +++ b/lime/project/HXProject.hx @@ -1294,5 +1294,5 @@ class HXProject { } - -} + +} \ No newline at end of file diff --git a/lime/tools/helpers/AntHelper.hx b/lime/tools/helpers/AntHelper.hx index f7cd97186..3dd787f87 100644 --- a/lime/tools/helpers/AntHelper.hx +++ b/lime/tools/helpers/AntHelper.hx @@ -41,6 +41,6 @@ class AntHelper { ProcessHelper.runCommand (workingDirectory, ant, commands); } - - -} + + +} \ No newline at end of file diff --git a/lime/tools/helpers/AssetHelper.hx b/lime/tools/helpers/AssetHelper.hx index 4b62d1f71..ec2467179 100644 --- a/lime/tools/helpers/AssetHelper.hx +++ b/lime/tools/helpers/AssetHelper.hx @@ -133,5 +133,5 @@ class AssetHelper { } - + } \ No newline at end of file diff --git a/lime/tools/helpers/BlackBerryHelper.hx b/lime/tools/helpers/BlackBerryHelper.hx index fd552ff08..9af5ba798 100644 --- a/lime/tools/helpers/BlackBerryHelper.hx +++ b/lime/tools/helpers/BlackBerryHelper.hx @@ -434,8 +434,8 @@ class BlackBerryHelper { ProcessHelper.runCommand (workingDirectory, exe, [ "-getFile", "logs/log", "-", "-device", deviceIP, "-password", devicePassword, targetPath ] ); } - - + + } diff --git a/lime/tools/helpers/FileHelper.hx b/lime/tools/helpers/FileHelper.hx index 92d86dbdb..475717ba4 100644 --- a/lime/tools/helpers/FileHelper.hx +++ b/lime/tools/helpers/FileHelper.hx @@ -475,5 +475,5 @@ class FileHelper { } - -} + +} \ No newline at end of file diff --git a/lime/tools/helpers/IOSHelper.hx b/lime/tools/helpers/IOSHelper.hx index d6e66db2d..2e1c6a253 100644 --- a/lime/tools/helpers/IOSHelper.hx +++ b/lime/tools/helpers/IOSHelper.hx @@ -324,5 +324,5 @@ class IOSHelper { } - -} + +} \ No newline at end of file diff --git a/lime/tools/helpers/JavaHelper.hx b/lime/tools/helpers/JavaHelper.hx index bbb620c0e..0ffa6a2e7 100644 --- a/lime/tools/helpers/JavaHelper.hx +++ b/lime/tools/helpers/JavaHelper.hx @@ -12,6 +12,6 @@ class JavaHelper { FileHelper.recursiveCopyTemplate (templatePaths, "java/ndll/" + platformName, targetPath); } - - -} + + +} \ No newline at end of file diff --git a/lime/tools/helpers/PlatformHelper.hx b/lime/tools/helpers/PlatformHelper.hx index 628941c12..695c333f7 100644 --- a/lime/tools/helpers/PlatformHelper.hx +++ b/lime/tools/helpers/PlatformHelper.hx @@ -101,6 +101,6 @@ class PlatformHelper { return _hostPlatform; } - - -} + + +} \ No newline at end of file diff --git a/lime/tools/helpers/StringHelper.hx b/lime/tools/helpers/StringHelper.hx index c2ea7eda5..a837b6ef6 100644 --- a/lime/tools/helpers/StringHelper.hx +++ b/lime/tools/helpers/StringHelper.hx @@ -271,6 +271,6 @@ class StringHelper { return string + "\n" + StringTools.lpad ("", character, string.length); } - - + + } \ No newline at end of file diff --git a/lime/tools/helpers/TVOSHelper.hx b/lime/tools/helpers/TVOSHelper.hx index 39dd5eb1e..3ddd52b9e 100644 --- a/lime/tools/helpers/TVOSHelper.hx +++ b/lime/tools/helpers/TVOSHelper.hx @@ -57,6 +57,84 @@ class TVOSHelper { } + private static function getIOSVersion (project:HXProject):Void { + + if (!project.environment.exists("TVOS_VER")) { + + if (!project.environment.exists("DEVELOPER_DIR")) { + + var proc = new Process ("xcode-select", ["--print-path"]); + var developer_dir = proc.stdout.readLine (); + proc.close (); + project.environment.set ("DEVELOPER_DIR", developer_dir); + + } + + var dev_path = project.environment.get ("DEVELOPER_DIR") + "/Platforms/AppleTVOS.platform/Developer/SDKs"; + + if (FileSystem.exists (dev_path)) { + + var best = ""; + var files = FileSystem.readDirectory (dev_path); + var extract_version = ~/^AppleTVOS(.*).sdk$/; + + for (file in files) { + + if (extract_version.match (file)) { + + var ver = extract_version.matched (1); + + if (ver > best) { + + best = ver; + + } + + } + + } + + if (best != "") { + + project.environment.set ("TVOS_VER", best); + + } + + } + + } + + } + + + private static function getOSXVersion ():String { + + var output = ProcessHelper.runProcess ("", "sw_vers", [ "-productVersion" ]); + return StringTools.trim (output); + + } + + + public static function getProvisioningFile ():String { + + var path = PathHelper.expand ("~/Library/MobileDevice/Provisioning Profiles"); + var files = FileSystem.readDirectory (path); + + for (file in files) { + + if (Path.extension (file) == "mobileprovision") { + + return path + "/" + file; + + } + + } + + return ""; + + } + + public static function getSDKDirectory (project:HXProject):String { initialize (project); @@ -86,67 +164,6 @@ class TVOSHelper { } - private static function getIOSVersion (project:HXProject):Void { - - if (!project.environment.exists("TVOS_VER")) { - if (!project.environment.exists("DEVELOPER_DIR")) { - var proc = new Process("xcode-select", ["--print-path"]); - var developer_dir = proc.stdout.readLine(); - proc.close(); - project.environment.set("DEVELOPER_DIR", developer_dir); - } - var dev_path = project.environment.get("DEVELOPER_DIR") + "/Platforms/AppleTVOS.platform/Developer/SDKs"; - - if (FileSystem.exists (dev_path)) { - var best = ""; - var files = FileSystem.readDirectory (dev_path); - var extract_version = ~/^AppleTVOS(.*).sdk$/; - for (file in files) { - if (extract_version.match (file)) { - var ver = extract_version.matched (1); - if (ver > best) - best = ver; - } - } - - - if (best != "") - project.environment.set ("TVOS_VER", best); - } - } - - } - - - private static function getOSXVersion ():String { - - var output = ProcessHelper.runProcess ("", "sw_vers", [ "-productVersion" ]); - - return StringTools.trim (output); - - } - - - public static function getProvisioningFile ():String { - - var path = PathHelper.expand ("~/Library/MobileDevice/Provisioning Profiles"); - var files = FileSystem.readDirectory (path); - - for (file in files) { - - if (Path.extension (file) == "mobileprovision") { - - return path + "/" + file; - - } - - } - - return ""; - - } - - private static function getXcodeVersion ():String { var output = ProcessHelper.runProcess ("", "xcodebuild", [ "-version" ]); @@ -199,70 +216,90 @@ class TVOSHelper { var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); var launcher = PathHelper.findTemplate (templatePaths, "bin/ios-sim"); Sys.command ("chmod", [ "+x", launcher ]); - - // device config - var defaultDevice = "apple-tv-1080p"; - var devices:Array = ["apple-tv-1080p"]; - var oldDevices:Map = ["appletv" => "apple-tv-1080p"]; - - var deviceFlag:String = null; - var deviceTypeID = null; - - // check if old device flag and convert to current - for (key in oldDevices.keys()) - { - if (project.targetFlags.exists(key)) - { - deviceFlag = oldDevices[key]; - break; - } - } - - // check known device in command line args - if(deviceFlag == null) - { - for( i in 0...devices.length ) - { - if (project.targetFlags.exists(devices[i])) - { - deviceFlag = devices[i]; - break; - } - } - } - - // default to iphone 6 - if(deviceFlag == null) - deviceFlag = defaultDevice; - - // check if device is available - // $ ios-sim showdevicetypes - var devicesOutput:String = ProcessHelper.runProcess ("", launcher, [ "showdevicetypes" ] ); - var deviceTypeList:Array = devicesOutput.split("\n"); - - for ( i in 0...deviceTypeList.length ) - { - var r:EReg = new EReg(deviceFlag+",", "i"); - if(r.match(deviceTypeList[i])) - { - deviceTypeID = deviceTypeList[i]; - break; - } - } - - if(deviceTypeID == null) - LogHelper.warn("Device \""+deviceFlag+"\" was not found"); - else - LogHelper.info("Launch app on \""+deviceTypeID+"\""); - - - // run command with --devicetypeid if exists - if(deviceTypeID != null) - ProcessHelper.runCommand ("", launcher, [ "launch", FileSystem.fullPath (applicationPath), /*"--sdk", project.environment.get ("IPHONE_VER"),*/ "--devicetypeid", deviceTypeID, "--timeout", "60" ] ); - else - ProcessHelper.runCommand ("", launcher, [ "launch", FileSystem.fullPath (applicationPath), /*"--sdk", project.environment.get ("IPHONE_VER"), "--devicetypeid", deviceTypeID,*/ "--timeout", "60" ] ); - - } else { + + // device config + var defaultDevice = "apple-tv-1080p"; + var devices:Array = ["apple-tv-1080p"]; + var oldDevices:Map = ["appletv" => "apple-tv-1080p"]; + + var deviceFlag:String = null; + var deviceTypeID = null; + + // check if old device flag and convert to current + for (key in oldDevices.keys ()) { + + if (project.targetFlags.exists (key)) { + + deviceFlag = oldDevices[key]; + break; + + } + + } + + // check known device in command line args + if (deviceFlag == null) { + + for (i in 0...devices.length) { + + if (project.targetFlags.exists (devices[i])) { + + deviceFlag = devices[i]; + break; + + } + + } + + } + + // default to iphone 6 + if (deviceFlag == null) { + + deviceFlag = defaultDevice; + + } + + // check if device is available + // $ ios-sim showdevicetypes + var devicesOutput:String = ProcessHelper.runProcess ("", launcher, [ "showdevicetypes" ]); + var deviceTypeList:Array = devicesOutput.split ("\n"); + + for (i in 0...deviceTypeList.length) { + + var r = new EReg (deviceFlag + ",", "i"); + + if (r.match (deviceTypeList[i])) { + + deviceTypeID = deviceTypeList[i]; + break; + + } + + } + + if (deviceTypeID == null) { + + LogHelper.warn("Device \"" + deviceFlag + "\" was not found"); + + } else { + + LogHelper.info("Launch app on \"" + deviceTypeID + "\""); + + } + + // run command with --devicetypeid if exists + if (deviceTypeID != null) { + + ProcessHelper.runCommand ("", launcher, [ "launch", FileSystem.fullPath (applicationPath), /*"--sdk", project.environment.get ("IPHONE_VER"),*/ "--devicetypeid", deviceTypeID, "--timeout", "60" ]); + + } else { + + ProcessHelper.runCommand ("", launcher, [ "launch", FileSystem.fullPath (applicationPath), /*"--sdk", project.environment.get ("IPHONE_VER"), "--devicetypeid", deviceTypeID,*/ "--timeout", "60" ]); + + } + + } else { var applicationPath = ""; @@ -325,5 +362,5 @@ class TVOSHelper { } - -} + +} \ No newline at end of file diff --git a/lime/tools/helpers/WebOSHelper.hx b/lime/tools/helpers/WebOSHelper.hx index c64b53de7..ed60685b5 100644 --- a/lime/tools/helpers/WebOSHelper.hx +++ b/lime/tools/helpers/WebOSHelper.hx @@ -73,6 +73,6 @@ class WebOSHelper { runPalmCommand (project, "", "log", args); } - - -} + + +} \ No newline at end of file diff --git a/lime/tools/helpers/ZipHelper.hx b/lime/tools/helpers/ZipHelper.hx index 943d18c0d..640f12507 100644 --- a/lime/tools/helpers/ZipHelper.hx +++ b/lime/tools/helpers/ZipHelper.hx @@ -121,5 +121,5 @@ class ZipHelper { } - -} + +} \ No newline at end of file diff --git a/lime/utils/LZMA.hx b/lime/utils/LZMA.hx index a0b810b34..cf5574c42 100644 --- a/lime/utils/LZMA.hx +++ b/lime/utils/LZMA.hx @@ -1,7 +1,7 @@ package lime.utils; -import haxe.io.Bytes; +import haxe.io.Bytes; @:deprecated class LZMA { diff --git a/tools/RunScript.hx b/tools/RunScript.hx index 01ac425c0..1bde8f816 100644 --- a/tools/RunScript.hx +++ b/tools/RunScript.hx @@ -117,7 +117,7 @@ class RunScript { } - + public static function runCommand (path:String, command:String, args:Array, throwErrors:Bool = true):Int { var oldPath:String = ""; diff --git a/tools/utils/JavaExternGenerator.hx b/tools/utils/JavaExternGenerator.hx index 276148c5c..54c039525 100644 --- a/tools/utils/JavaExternGenerator.hx +++ b/tools/utils/JavaExternGenerator.hx @@ -123,7 +123,7 @@ class JavaExternGenerator } - + private function extractAndroidClasses() { if (!extractedAndroidClasses) @@ -161,7 +161,7 @@ class JavaExternGenerator extractedAndroidClasses = true; } - + private function generate(inClass:String, inMembers:Map) { Lib.println(inClass); @@ -887,7 +887,7 @@ class JavaExternGenerator parseTypes(args, 0); } - + private function toHaxeType(inStr:String) { parsedTypes = [];