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

View File

@@ -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;

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 {
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" ]);
@@ -200,69 +217,89 @@ class TVOSHelper {
var launcher = PathHelper.findTemplate (templatePaths, "bin/ios-sim");
Sys.command ("chmod", [ "+x", launcher ]);
// device config
var defaultDevice = "apple-tv-1080p";
var devices:Array<String> = ["apple-tv-1080p"];
var oldDevices:Map<String, String> = ["appletv" => "apple-tv-1080p"];
// device config
var defaultDevice = "apple-tv-1080p";
var devices:Array<String> = ["apple-tv-1080p"];
var oldDevices:Map<String, String> = ["appletv" => "apple-tv-1080p"];
var deviceFlag:String = null;
var deviceTypeID = null;
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 if old device flag and convert to current
for (key in oldDevices.keys ()) {
// 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;
}
}
}
if (project.targetFlags.exists (key)) {
// default to iphone 6
if(deviceFlag == null)
deviceFlag = defaultDevice;
deviceFlag = oldDevices[key];
break;
// check if device is available
// $ ios-sim showdevicetypes
var devicesOutput:String = ProcessHelper.runProcess ("", launcher, [ "showdevicetypes" ] );
var deviceTypeList:Array<String> = 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+"\"");
// check known device in command line args
if (deviceFlag == null) {
for (i in 0...devices.length) {
// 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" ] );
if (project.targetFlags.exists (devices[i])) {
} else {
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<String> = 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 = "";