Minor cleanup

This commit is contained in:
Joshua Granick
2016-07-22 08:28:00 -07:00
parent c94f3258c3
commit 2ec8a818f0
17 changed files with 195 additions and 160 deletions

View File

@@ -504,8 +504,6 @@ class Cairo {
// Get & Set Methods // Get & Set Methods

View File

@@ -333,7 +333,7 @@ class ImageDataUtil {
var format = image.buffer.format; var format = image.buffer.format;
var premultiplied = image.buffer.premultiplied; var premultiplied = image.buffer.premultiplied;
if (premultiplied) fillColor.multiplyAlpha(); if (premultiplied) fillColor.multiplyAlpha ();
var dataView = new ImageDataView (image, rect); var dataView = new ImageDataView (image, rect);
var row; var row;

View File

@@ -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 { public static function getSDKDirectory (project:HXProject):String {
initialize (project); 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 { private static function getXcodeVersion ():String {
var output = ProcessHelper.runProcess ("", "xcodebuild", [ "-version" ]); var output = ProcessHelper.runProcess ("", "xcodebuild", [ "-version" ]);
@@ -209,58 +226,78 @@ class TVOSHelper {
var deviceTypeID = null; var deviceTypeID = null;
// check if old device flag and convert to current // check if old device flag and convert to current
for (key in oldDevices.keys()) for (key in oldDevices.keys ()) {
{
if (project.targetFlags.exists(key)) if (project.targetFlags.exists (key)) {
{
deviceFlag = oldDevices[key]; deviceFlag = oldDevices[key];
break; break;
} }
} }
// check known device in command line args // check known device in command line args
if(deviceFlag == null) if (deviceFlag == null) {
{
for( i in 0...devices.length ) for (i in 0...devices.length) {
{
if (project.targetFlags.exists(devices[i])) if (project.targetFlags.exists (devices[i])) {
{
deviceFlag = devices[i]; deviceFlag = devices[i];
break; break;
} }
} }
} }
// default to iphone 6 // default to iphone 6
if(deviceFlag == null) if (deviceFlag == null) {
deviceFlag = defaultDevice; deviceFlag = defaultDevice;
}
// check if device is available // check if device is available
// $ ios-sim showdevicetypes // $ ios-sim showdevicetypes
var devicesOutput:String = ProcessHelper.runProcess ("", launcher, [ "showdevicetypes" ] ); var devicesOutput:String = ProcessHelper.runProcess ("", launcher, [ "showdevicetypes" ]);
var deviceTypeList:Array<String> = devicesOutput.split("\n"); var deviceTypeList:Array<String> = devicesOutput.split ("\n");
for (i in 0...deviceTypeList.length) {
var r = new EReg (deviceFlag + ",", "i");
if (r.match (deviceTypeList[i])) {
for ( i in 0...deviceTypeList.length )
{
var r:EReg = new EReg(deviceFlag+",", "i");
if(r.match(deviceTypeList[i]))
{
deviceTypeID = deviceTypeList[i]; deviceTypeID = deviceTypeList[i];
break; break;
}
} }
if(deviceTypeID == null) }
LogHelper.warn("Device \""+deviceFlag+"\" was not found");
else
LogHelper.info("Launch app on \""+deviceTypeID+"\"");
if (deviceTypeID == null) {
LogHelper.warn("Device \"" + deviceFlag + "\" was not found");
} else {
LogHelper.info("Launch app on \"" + deviceTypeID + "\"");
}
// run command with --devicetypeid if exists // run command with --devicetypeid if exists
if(deviceTypeID != null) 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" ]);
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 { } else {