Minor cleanup
This commit is contained in:
@@ -504,8 +504,6 @@ class Cairo {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Get & Set Methods
|
// Get & Set Methods
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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" ]);
|
||||||
@@ -200,69 +217,89 @@ class TVOSHelper {
|
|||||||
var launcher = PathHelper.findTemplate (templatePaths, "bin/ios-sim");
|
var launcher = PathHelper.findTemplate (templatePaths, "bin/ios-sim");
|
||||||
Sys.command ("chmod", [ "+x", launcher ]);
|
Sys.command ("chmod", [ "+x", launcher ]);
|
||||||
|
|
||||||
// device config
|
// device config
|
||||||
var defaultDevice = "apple-tv-1080p";
|
var defaultDevice = "apple-tv-1080p";
|
||||||
var devices:Array<String> = ["apple-tv-1080p"];
|
var devices:Array<String> = ["apple-tv-1080p"];
|
||||||
var oldDevices:Map<String, String> = ["appletv" => "apple-tv-1080p"];
|
var oldDevices:Map<String, String> = ["appletv" => "apple-tv-1080p"];
|
||||||
|
|
||||||
var deviceFlag:String = null;
|
var deviceFlag:String = null;
|
||||||
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))
|
|
||||||
{
|
|
||||||
deviceFlag = oldDevices[key];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check known device in command line args
|
if (project.targetFlags.exists (key)) {
|
||||||
if(deviceFlag == null)
|
|
||||||
{
|
|
||||||
for( i in 0...devices.length )
|
|
||||||
{
|
|
||||||
if (project.targetFlags.exists(devices[i]))
|
|
||||||
{
|
|
||||||
deviceFlag = devices[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// default to iphone 6
|
deviceFlag = oldDevices[key];
|
||||||
if(deviceFlag == null)
|
break;
|
||||||
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:EReg = new EReg(deviceFlag+",", "i");
|
|
||||||
if(r.match(deviceTypeList[i]))
|
|
||||||
{
|
|
||||||
deviceTypeID = deviceTypeList[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(deviceTypeID == null)
|
// check known device in command line args
|
||||||
LogHelper.warn("Device \""+deviceFlag+"\" was not found");
|
if (deviceFlag == null) {
|
||||||
else
|
|
||||||
LogHelper.info("Launch app on \""+deviceTypeID+"\"");
|
|
||||||
|
|
||||||
|
for (i in 0...devices.length) {
|
||||||
|
|
||||||
// run command with --devicetypeid if exists
|
if (project.targetFlags.exists (devices[i])) {
|
||||||
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 {
|
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 = "";
|
var applicationPath = "";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user