Minor cleanup
This commit is contained in:
@@ -504,8 +504,6 @@ class Cairo {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Get & Set Methods
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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" ]);
|
||||
@@ -209,58 +226,78 @@ class TVOSHelper {
|
||||
var deviceTypeID = null;
|
||||
|
||||
// check if old device flag and convert to current
|
||||
for (key in oldDevices.keys())
|
||||
{
|
||||
if (project.targetFlags.exists(key))
|
||||
{
|
||||
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]))
|
||||
{
|
||||
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)
|
||||
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");
|
||||
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])) {
|
||||
|
||||
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+"\"");
|
||||
}
|
||||
|
||||
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" ] );
|
||||
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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user