Merge branch 'develop' into 8.2.0-Dev

This commit is contained in:
Josh Tynjala
2024-07-01 08:53:48 -07:00
17 changed files with 98 additions and 59 deletions

View File

@@ -12,6 +12,7 @@ buildscript {
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
namespace 'org.haxe.extension'
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

View File

@@ -1,4 +1,2 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.haxe.extension" > <manifest xmlns:android="http://schemas.android.com/apk/res/android" />
</manifest>

View File

@@ -458,12 +458,6 @@
<section if="mac"> <section if="mac">
<vflag name="-install_name" value="@executable_path/lime.hdll" if="LIME_HASHLINK"/> <vflag name="-install_name" value="@executable_path/lime.hdll" if="LIME_HASHLINK"/>
<!--
starting in xcode 15, rpath doesn't automatically include
/usr/local/lib, but we need it for neko
-->
<vflag name="-rpath" value="/usr/local/lib" />
<vflag name="-rpath" value="/opt/homebrew/lib" if="HXCPP_ARM64"/>
<vflag name="-l" value="iconv" /> <vflag name="-l" value="iconv" />
<vflag name="-framework" value="IOKit" /> <vflag name="-framework" value="IOKit" />

BIN
run.n vendored

Binary file not shown.

View File

@@ -165,6 +165,11 @@ class CFFI
{ {
result = __tryLoad(ndllFolder + __sysName() + "64/" + library, library, method, args); result = __tryLoad(ndllFolder + __sysName() + "64/" + library, library, method, args);
} }
if (result == null)
{
result = __tryLoad(ndllFolder + __sysName() + "Arm64/" + library, library, method, args);
}
} }
} }

View File

@@ -46,6 +46,8 @@ class Clipboard
{ {
_text = FlashClipboard.generalClipboard.getData(TEXT_FORMAT); _text = FlashClipboard.generalClipboard.getData(TEXT_FORMAT);
} }
#elseif (js || html5)
_text = cacheText;
#end #end
__updated = true; __updated = true;

View File

@@ -8,8 +8,6 @@ class AndroidHelper
{ {
private static var adbName:String; private static var adbName:String;
private static var adbPath:String; private static var adbPath:String;
private static var androidName:String;
private static var androidPath:String;
private static var emulatorName:String; private static var emulatorName:String;
private static var emulatorPath:String; private static var emulatorPath:String;
@@ -159,30 +157,33 @@ class AndroidHelper
public static function initialize(project:HXProject):Void public static function initialize(project:HXProject):Void
{ {
adbPath = project.environment.get("ANDROID_SDK") + "/tools/"; adbPath = project.environment.get("ANDROID_SDK") + "/platform-tools/";
androidPath = project.environment.get("ANDROID_SDK") + "/tools/"; emulatorPath = project.environment.get("ANDROID_SDK") + "/emulator/";
emulatorPath = project.environment.get("ANDROID_SDK") + "/tools/";
adbName = "adb"; adbName = "adb";
androidName = "android";
emulatorName = "emulator"; emulatorName = "emulator";
if (System.hostPlatform == WINDOWS) if (System.hostPlatform == WINDOWS)
{ {
adbName += ".exe"; adbName += ".exe";
androidName += ".bat";
emulatorName += ".exe"; emulatorName += ".exe";
} }
if (!FileSystem.exists(adbPath + adbName)) if (!FileSystem.exists(adbPath + adbName))
{ {
adbPath = project.environment.get("ANDROID_SDK") + "/platform-tools/"; // in older SDKs, adb was located in /tools/
adbPath = project.environment.get("ANDROID_SDK") + "/tools/";
}
if (!FileSystem.exists(emulatorPath + emulatorName))
{
// in older SDKs, emulator was located in /tools/
emulatorPath = project.environment.get("ANDROID_SDK") + "/tools/";
} }
if (System.hostPlatform != WINDOWS) if (System.hostPlatform != WINDOWS)
{ {
adbName = "./" + adbName; adbName = "./" + adbName;
androidName = "./" + androidName;
emulatorName = "./" + emulatorName; emulatorName = "./" + emulatorName;
} }
@@ -194,8 +195,18 @@ class AndroidHelper
public static function install(project:HXProject, targetPath:String, deviceID:String = null):String public static function install(project:HXProject, targetPath:String, deviceID:String = null):String
{ {
if (!FileSystem.exists(adbPath + adbName))
{
Log.error("adb not found in Android SDK: " + project.environment.get("ANDROID_SDK"));
}
if (project.targetFlags.exists("emulator") || project.targetFlags.exists("simulator")) if (project.targetFlags.exists("emulator") || project.targetFlags.exists("simulator"))
{ {
if (!FileSystem.exists(emulatorPath + emulatorName))
{
Log.error("emulator not found in Android SDK: " + project.environment.get("ANDROID_SDK"));
}
Log.info("", "Searching for Android emulator"); Log.info("", "Searching for Android emulator");
var devices = listDevices(); var devices = listDevices();
@@ -280,16 +291,13 @@ class AndroidHelper
public static function listAVDs():Array<String> public static function listAVDs():Array<String>
{ {
var avds = new Array<String>(); var avds = new Array<String>();
var output = System.runProcess(androidPath, androidName, ["list", "avd"]); var output = System.runProcess(emulatorPath, emulatorName, ["-list-avds"]);
if (output != null && output != "") if (output != null && output != "")
{ {
// -list-avds returns only the avd names, separated by line breaks
for (line in output.split("\n")) for (line in output.split("\n"))
{ {
if (line.indexOf("Name") > -1) avds.push(StringTools.trim(line));
{
avds.push(StringTools.trim(line.substr(line.indexOf("Name") + 6)));
}
} }
} }
@@ -343,6 +351,11 @@ class AndroidHelper
public static function trace(project:HXProject, debug:Bool, deviceID:String = null, customFilter:String = null):Void public static function trace(project:HXProject, debug:Bool, deviceID:String = null, customFilter:String = null):Void
{ {
if (!FileSystem.exists(adbPath + adbName))
{
Log.error("adb not found in Android SDK: " + project.environment.get("ANDROID_SDK"));
}
// Use -DFULL_LOGCAT or <set name="FULL_LOGCAT" /> if you do not want to filter log messages // Use -DFULL_LOGCAT or <set name="FULL_LOGCAT" /> if you do not want to filter log messages
var args = ["logcat"]; var args = ["logcat"];
@@ -395,6 +408,11 @@ class AndroidHelper
public static function uninstall(packageName:String, deviceID:String = null):Void public static function uninstall(packageName:String, deviceID:String = null):Void
{ {
if (!FileSystem.exists(adbPath + adbName))
{
Log.error("adb not found in Android SDK");
}
var args = ["uninstall", packageName]; var args = ["uninstall", packageName];
if (deviceID != null && deviceID != "") if (deviceID != null && deviceID != "")

View File

@@ -894,7 +894,10 @@ class ProjectXMLParser extends HXProject
Log.error(substitute(element.att.value)); Log.error(substitute(element.att.value));
case "echo": case "echo":
Log.println(substitute(element.att.value)); if (command != "display")
{
Log.println(substitute(element.att.value));
}
case "log": case "log":
var verbose = ""; var verbose = "";
@@ -908,21 +911,24 @@ class ProjectXMLParser extends HXProject
{ {
Log.error(substitute(element.att.error), verbose); Log.error(substitute(element.att.error), verbose);
} }
else if (element.has.warn) else if (command != "display")
{ {
Log.warn(substitute(element.att.warn), verbose); if (element.has.warn)
} {
else if (element.has.info) Log.warn(substitute(element.att.warn), verbose);
{ }
Log.info(substitute(element.att.info), verbose); else if (element.has.info)
} {
else if (element.has.value) Log.info(substitute(element.att.info), verbose);
{ }
Log.info(substitute(element.att.value), verbose); else if (element.has.value)
} {
else if (verbose != "") Log.info(substitute(element.att.value), verbose);
{ }
Log.info("", verbose); else if (verbose != "")
{
Log.info("", verbose);
}
} }
case "path": case "path":

BIN
svg.n

Binary file not shown.

View File

@@ -13,6 +13,7 @@ System.setProperty('java.awt.headless','false')
} */ } */
android { android {
namespace "::APP_PACKAGE::"
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
::if (ANDROID_GRADLE_PLUGIN>="4.0")::ndkPath '::ANDROID_NDK_ROOT_ESCAPED::'::end:: ::if (ANDROID_GRADLE_PLUGIN>="4.0")::ndkPath '::ANDROID_NDK_ROOT_ESCAPED::'::end::

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="::APP_PACKAGE::" android:versionCode="::APP_BUILD_NUMBER::" android:versionName="::APP_VERSION::" android:installLocation="::ANDROID_INSTALL_LOCATION::"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="::APP_BUILD_NUMBER::" android:versionName="::APP_VERSION::" android:installLocation="::ANDROID_INSTALL_LOCATION::">
<uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <uses-feature android:name="android.hardware.touchscreen" android:required="false" />

View File

@@ -12,6 +12,7 @@ buildscript {
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
android { android {
namespace "org.haxe.extension.::extensionLowerCase::"
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
} }

View File

@@ -1,6 +1,2 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.haxe.extension.::extensionLowerCase::" > <manifest xmlns:android="http://schemas.android.com/apk/res/android" />
</manifest>

View File

@@ -485,15 +485,14 @@ class CommandLineTools
} }
case MAC: case MAC:
// if (System.hostArchitecture == X64) { if (System.hostArchitecture == X64)
{
untyped $loader.path = $array(path + "Mac64/", $loader.path); untyped $loader.path = $array(path + "Mac64/", $loader.path);
}
// } else { else if (System.hostArchitecture == ARM64)
{
// untyped $loader.path = $array (path + "Mac/", $loader.path); untyped $loader.path = $array(path + "MacArm64/", $loader.path);
}
// }
case LINUX: case LINUX:
var arguments = Sys.args(); var arguments = Sys.args();

View File

@@ -35,7 +35,7 @@ class RunScript
if (!rebuildBinaries) return; if (!rebuildBinaries) return;
var platforms = ["Windows", "Mac", "Mac64", "Linux", "Linux64"]; var platforms = ["Windows", "Mac", "Mac64", "MacArm64", "Linux", "Linux64"];
for (platform in platforms) for (platform in platforms)
{ {
@@ -64,7 +64,7 @@ class RunScript
System.runCommand(limeDirectory, "neko", args.concat(["windows", toolsDirectory])); System.runCommand(limeDirectory, "neko", args.concat(["windows", toolsDirectory]));
} }
case "Mac", "Mac64": case "Mac", "Mac64", "MacArm64":
if (System.hostPlatform == MAC) if (System.hostPlatform == MAC)
{ {
System.runCommand(limeDirectory, "neko", args.concat(["mac", toolsDirectory])); System.runCommand(limeDirectory, "neko", args.concat(["mac", toolsDirectory]));

View File

@@ -67,8 +67,14 @@ class SVGExport
// } // }
case MAC: case MAC:
untyped $loader.path = $array(path + "Mac/", $loader.path); if (System.hostArchitecture == X64)
untyped $loader.path = $array(path + "Mac64/", $loader.path); {
untyped $loader.path = $array(path + "Mac64/", $loader.path);
}
else if (System.hostArchitecture == ARM64)
{
untyped $loader.path = $array(path + "MacArm64/", $loader.path);
}
case LINUX: case LINUX:
var arguments = Sys.args(); var arguments = Sys.args();

View File

@@ -2,6 +2,7 @@ package;
import haxe.io.Eof; import haxe.io.Eof;
import hxp.Haxelib; import hxp.Haxelib;
import hxp.HostArchitecture;
import hxp.HXML; import hxp.HXML;
import hxp.Log; import hxp.Log;
import hxp.Path; import hxp.Path;
@@ -190,6 +191,17 @@ class MacPlatform extends PlatformTarget
NekoHelper.createExecutable(project.templatePaths, "mac" + dirSuffix.toLowerCase(), targetDirectory + "/obj/ApplicationMain.n", executablePath); NekoHelper.createExecutable(project.templatePaths, "mac" + dirSuffix.toLowerCase(), targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries(project.templatePaths, "mac" + dirSuffix.toLowerCase(), executableDirectory); NekoHelper.copyLibraries(project.templatePaths, "mac" + dirSuffix.toLowerCase(), executableDirectory);
// starting in xcode 15, rpath doesn't automatically include
// /usr/local/lib, but we need it for libneko dylib
System.runCommand("", "install_name_tool", ["-add_rpath", "/usr/local/lib", Path.join([executableDirectory, "lime.ndll"])]);
if (System.hostArchitecture == HostArchitecture.ARM64)
{
// on Apple Silicon, the user may have installed Neko with
// Homebrew, which has a different path. however, if the
// Homebrew path doesn't exist, that's okay.
System.runCommand("", "install_name_tool", ["-add_rpath", "/opt/homebrew/lib", Path.join([executableDirectory, "lime.ndll"])]);
}
} }
else if (targetType == "hl") else if (targetType == "hl")
{ {
@@ -584,7 +596,7 @@ class MacPlatform extends PlatformTarget
private inline function get_dirSuffix():String private inline function get_dirSuffix():String
{ {
return targetArchitecture == X64 ? "64" : ""; return targetArchitecture == X64 ? "64" : targetArchitecture == ARM64 ? "Arm64" : "";
} }
/** /**