diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9ed88eb4b..dba7727553 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -93,7 +93,7 @@ jobs: lime build SimpleAudio linux -release -verbose -nocolor macos: - runs-on: macos-12 + runs-on: macos-13 steps: - uses: actions/checkout@v4 @@ -353,7 +353,7 @@ jobs: lime create SimpleAudio -verbose -nocolor -eval lime build SimpleAudio android -release -verbose -nocolor -eval ios: - runs-on: macos-12 + runs-on: macos-13 steps: - uses: actions/checkout@v4 @@ -659,7 +659,7 @@ jobs: needs: package-haxelib strategy: matrix: - os: [windows-latest, ubuntu-20.04, macos-12] + os: [windows-latest, ubuntu-20.04, macos-13] runs-on: ${{ matrix.os }} steps: @@ -709,7 +709,7 @@ jobs: needs: package-haxelib strategy: matrix: - os: [windows-latest, ubuntu-20.04, macos-12] + os: [windows-latest, ubuntu-20.04, macos-13] runs-on: ${{ matrix.os }} steps: @@ -816,7 +816,7 @@ jobs: strategy: matrix: haxe-version: [3.4.7, 4.2.5] - os: [windows-latest, ubuntu-20.04, macos-12] + os: [windows-latest, ubuntu-20.04, macos-13] runs-on: ${{ matrix.os }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ca7f078e3..bf7fe81c89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,27 @@ Changelog ========= +8.2.2 (12/19/2024) +------------------ + +* Fixed broken breakpoints in HTML5 debug builds. +* Fixed unecessary operations in `Promise` by inlining some getter functions. +* Fixed failure to read `gradle-plugin` attribute in `` tag. +* Fixed failed installation of app on iOS Simulator by choosing only simulators that are considered available. +* Fixed `lime test ios` to install and launch on a device when using Xcode 16 or newer. +* Fixed reported version of OpenAL library. +* Fixed memory cleanup when encoding PNG and JPEG images. +* Fixed error reporting `@rpath/libhl.dylib` not found on macOS when using HashLink nightly build. +* Fixed building HashLink on macOS that required cleaning between compiles. +* Fixed `embedBytes()` macro incorrectly running when `embedByteArray()` macro was also running. +* Fixed `ImageDataUtil.copyPixels()` causing crash on HashLink. +* Fixed missing `neko` target flag when cross-compiling to Windows without `-mingw` or `-cpp` flags. +* Fixed occasional failure running Lime tools by switching certain paths from relative to absolute. +* Fixed missing warning when `lime rebuild` commands fail because C++ source is not available from Haxelib. +* Fixed command instructions to specify requirement for absolute paths when setting up a platform. +* Added detection of `-cpp` flag when cross-compiling to Windows, which works like `-mingw`. +* Updated FreeType submodule to version 2.12.1 again. Resolved issues encountered when using this version in Lime 8.2.0. + 8.2.1 (11/01/2024) ------------------ diff --git a/project/Build.xml b/project/Build.xml index 4f82125bab..7fe7c97f2d 100755 --- a/project/Build.xml +++ b/project/Build.xml @@ -110,6 +110,12 @@ + + +
diff --git a/project/lib/custom/openal/build/version.h b/project/lib/custom/openal/build/version.h index 6210fdef5b..94173db776 100644 --- a/project/lib/custom/openal/build/version.h +++ b/project/lib/custom/openal/build/version.h @@ -1,8 +1,8 @@ /* Define to the library version */ -#define ALSOFT_VERSION "1.19.0" +#define ALSOFT_VERSION "1.20.1" /* Define the branch being built */ #define ALSOFT_GIT_BRANCH "master" /* Define the hash of the head commit */ -#define ALSOFT_GIT_COMMIT_HASH "96aacac" +#define ALSOFT_GIT_COMMIT_HASH "f5e0eef3" diff --git a/project/lib/freetype b/project/lib/freetype index 86bc8a9505..e8ebfe988b 160000 --- a/project/lib/freetype +++ b/project/lib/freetype @@ -1 +1 @@ -Subproject commit 86bc8a95056c97a810986434a3f268cbe67f2902 +Subproject commit e8ebfe988b5f57bfb9a3ecb13c70d9791bce9ecf diff --git a/project/lib/freetype-files.xml b/project/lib/freetype-files.xml index 15e0c3476a..c9e9e69e58 100644 --- a/project/lib/freetype-files.xml +++ b/project/lib/freetype-files.xml @@ -110,13 +110,7 @@ - - - - - - - + @@ -126,8 +120,13 @@ + + + + + diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index d213c61e74..1718f4aa00 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -2052,7 +2052,17 @@ namespace lime { } else { - ImageDataUtil::CopyPixels (image, sourceImage, sourceRect, destPoint, alphaImage, alphaPoint, mergeAlpha); + if (!alphaPoint) { + + Vector2 _alphaPoint = Vector2 (0, 0); + + ImageDataUtil::CopyPixels (image, sourceImage, sourceRect, destPoint, alphaImage, &_alphaPoint, mergeAlpha); + + } else { + + ImageDataUtil::CopyPixels (image, sourceImage, sourceRect, destPoint, alphaImage, alphaPoint, mergeAlpha); + + } } diff --git a/project/src/graphics/format/JPEG.cpp b/project/src/graphics/format/JPEG.cpp index 9253e45aae..d0d14bd496 100644 --- a/project/src/graphics/format/JPEG.cpp +++ b/project/src/graphics/format/JPEG.cpp @@ -487,6 +487,8 @@ namespace lime { } + jpeg_destroy_compress (&cinfo); + return true; } diff --git a/project/src/graphics/format/PNG.cpp b/project/src/graphics/format/PNG.cpp index 1f3a3a0c06..c532bced6f 100644 --- a/project/src/graphics/format/PNG.cpp +++ b/project/src/graphics/format/PNG.cpp @@ -237,6 +237,8 @@ namespace lime { if (!info_ptr) { + png_destroy_write_struct (&png_ptr, NULL); + return false; } @@ -310,6 +312,8 @@ namespace lime { } + png_destroy_write_struct (&png_ptr, &info_ptr); + return true; } diff --git a/project/src/text/Font.cpp b/project/src/text/Font.cpp index 52903b73e7..8234ccad30 100644 --- a/project/src/text/Font.cpp +++ b/project/src/text/Font.cpp @@ -12,6 +12,7 @@ #include FT_BITMAP_H #include FT_SFNT_NAMES_H #include FT_TRUETYPE_IDS_H +#include FT_TRUETYPE_TABLES_H #include FT_GLYPH_H #include FT_OUTLINE_H #endif @@ -536,6 +537,98 @@ namespace lime { wchar_t* family_name = GetFamilyName (); + #ifdef LIME_FREETYPE_SWF_METRICS + + // this should more closely match how [Embed] works in AS3 when + // embedding a font in a SWF + + int calculatedAscender = 0; + int calculatedDescender = 0; + int calculatedHeight = 0; + + TT_OS2* os2 = (TT_OS2*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_os2); + TT_HoriHeader* hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_hhea); + + if (os2 && os2->version != 0xFFFFU) { + + calculatedAscender = (FT_Short)os2->usWinAscent; + calculatedDescender = -(FT_Short)os2->usWinDescent; + calculatedHeight = calculatedAscender - calculatedDescender; + + } else if (hhea) { + + calculatedAscender = hhea->Ascender; + calculatedDescender = hhea->Descender; + calculatedHeight = calculatedAscender - calculatedDescender + hhea->Line_Gap; + + } else { + + // should never happen, but let's have a fallback to be safe + calculatedAscender = ((FT_Face)face)->ascender; + calculatedDescender = ((FT_Face)face)->descender; + calculatedHeight = ((FT_Face)face)->height; + + } + + #elif defined(LIME_FREETYPE_LEGACY_METRICS) + + // this is FreeType's font metrics algorithm from 2.9.1 + // it behaves more like SWF than the new algorithm + + TT_OS2* os2 = (TT_OS2*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_os2); + TT_HoriHeader* hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_hhea); + + int calculatedAscender = 0; + int calculatedDescender = 0; + int calculatedHeight = 0; + + if (hhea) { + + calculatedAscender = hhea->Ascender; + calculatedDescender = hhea->Descender; + calculatedHeight = calculatedAscender - calculatedDescender + hhea->Line_Gap; + + } + + if (!( calculatedAscender || calculatedDescender )) + { + if (os2 && os2->version != 0xFFFFU) + { + if (os2->sTypoAscender || os2->sTypoDescender) + { + + calculatedAscender = os2->sTypoAscender; + calculatedDescender = os2->sTypoDescender; + calculatedHeight = calculatedAscender - calculatedDescender + os2->sTypoLineGap; + + } + else + { + + calculatedAscender = (FT_Short)os2->usWinAscent; + calculatedDescender = -(FT_Short)os2->usWinDescent; + calculatedHeight = calculatedAscender - calculatedDescender; + + } + } + } + + if (!calculatedAscender || !calculatedDescender) { + + calculatedAscender = ((FT_Face)face)->ascender; + calculatedDescender = ((FT_Face)face)->descender; + calculatedHeight = ((FT_Face)face)->height; + + } + + #else + + int calculatedAscender = ((FT_Face)face)->ascender; + int calculatedDescender = ((FT_Face)face)->descender; + int calculatedHeight = ((FT_Face)face)->height; + + #endif + if (useCFFIValue) { value ret = alloc_empty_object (); @@ -548,9 +641,9 @@ namespace lime { alloc_field (ret, val_id ("family_name"), family_name == NULL ? alloc_string (((FT_Face)face)->family_name) : alloc_wstring (family_name)); alloc_field (ret, val_id ("style_name"), alloc_string (((FT_Face)face)->style_name)); alloc_field (ret, val_id ("em_size"), alloc_int (((FT_Face)face)->units_per_EM)); - alloc_field (ret, val_id ("ascend"), alloc_int (((FT_Face)face)->ascender)); - alloc_field (ret, val_id ("descend"), alloc_int (((FT_Face)face)->descender)); - alloc_field (ret, val_id ("height"), alloc_int (((FT_Face)face)->height)); + alloc_field (ret, val_id ("ascend"), alloc_int (calculatedAscender)); + alloc_field (ret, val_id ("descend"), alloc_int (calculatedDescender)); + alloc_field (ret, val_id ("height"), alloc_int (calculatedHeight)); delete family_name; @@ -647,9 +740,9 @@ namespace lime { hl_dyn_setp (ret, hl_hash_utf8 ("family_name"), &hlt_bytes, _family_name); hl_dyn_setp (ret, hl_hash_utf8 ("style_name"), &hlt_bytes, style_name); hl_dyn_seti (ret, hl_hash_utf8 ("em_size"), &hlt_i32, ((FT_Face)face)->units_per_EM); - hl_dyn_seti (ret, hl_hash_utf8 ("ascend"), &hlt_i32, ((FT_Face)face)->ascender); - hl_dyn_seti (ret, hl_hash_utf8 ("descend"), &hlt_i32, ((FT_Face)face)->descender); - hl_dyn_seti (ret, hl_hash_utf8 ("height"), &hlt_i32, ((FT_Face)face)->height); + hl_dyn_seti (ret, hl_hash_utf8 ("ascend"), &hlt_i32, calculatedAscender); + hl_dyn_seti (ret, hl_hash_utf8 ("descend"), &hlt_i32, calculatedDescender); + hl_dyn_seti (ret, hl_hash_utf8 ("height"), &hlt_i32, calculatedHeight); // 'glyphs' field hl_varray* _glyphs = (hl_varray*)hl_alloc_array (&hlt_dynobj, num_glyphs); @@ -721,15 +814,161 @@ namespace lime { int Font::GetAscender () { + #ifdef LIME_FREETYPE_SWF_METRICS + + // this should more closely match how [Embed] works in AS3 when + // embedding a font in a SWF + + TT_OS2* os2 = (TT_OS2*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_os2); + TT_HoriHeader* hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_hhea); + + if (os2 && os2->version != 0xFFFFU) { + + return (FT_Short)os2->usWinAscent; + + } else if (hhea) { + + return hhea->Ascender; + + } + + // should never happen, but let's have a fallback to be safe return ((FT_Face)face)->ascender; + #elif defined(LIME_FREETYPE_LEGACY_METRICS) + + // this is FreeType's font metrics algorithm from 2.9.1 + // it behaves more like SWF than the new algorithm + + TT_OS2* os2 = (TT_OS2*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_os2); + TT_HoriHeader* hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_hhea); + + int calculatedAscender = 0; + int calculatedDescender = 0; + + if (hhea) { + + calculatedAscender = hhea->Ascender; + calculatedDescender = hhea->Descender; + } + + if (!( calculatedAscender || calculatedDescender )) + { + if (os2 && os2->version != 0xFFFFU) + { + if (os2->sTypoAscender || os2->sTypoDescender) + { + + calculatedAscender = os2->sTypoAscender; + calculatedDescender = os2->sTypoDescender; + + } + else + { + + calculatedAscender = (FT_Short)os2->usWinAscent; + calculatedDescender = -(FT_Short)os2->usWinDescent; + + } + } + } + + if (!calculatedAscender || !calculatedDescender) { + + calculatedAscender = ((FT_Face)face)->ascender; + calculatedDescender = ((FT_Face)face)->descender; + + } + + return calculatedAscender; + + #else + + return ((FT_Face)face)->ascender; + + #endif + } int Font::GetDescender () { + #ifdef LIME_FREETYPE_SWF_METRICS + + // this should more closely match how [Embed] works in AS3 when + // embedding a font in a SWF + + TT_OS2* os2 = (TT_OS2*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_os2); + TT_HoriHeader* hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_hhea); + + if (os2 && os2->version != 0xFFFFU) { + + return -(FT_Short)os2->usWinDescent; + + } + else if (hhea) { + + return hhea->Descender; + + } + + // should never happen, but let's have a fallback to be safe return ((FT_Face)face)->descender; + #elif defined(LIME_FREETYPE_LEGACY_METRICS) + + // this is FreeType's font metrics algorithm from 2.9.1 + // it behaves more like SWF than the new algorithm + + TT_OS2* os2 = (TT_OS2*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_os2); + TT_HoriHeader* hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_hhea); + + int calculatedAscender = 0; + int calculatedDescender = 0; + + if (hhea) { + + calculatedAscender = hhea->Ascender; + calculatedDescender = hhea->Descender; + + } + + if (!( calculatedAscender || calculatedDescender )) + { + if (os2 && os2->version != 0xFFFFU) + { + if (os2->sTypoAscender || os2->sTypoDescender) + { + + calculatedAscender = os2->sTypoAscender; + calculatedDescender = os2->sTypoDescender; + + } + else + { + + calculatedAscender = (FT_Short)os2->usWinAscent; + calculatedDescender = -(FT_Short)os2->usWinDescent; + + } + } + } + + if (!calculatedAscender || !calculatedDescender) { + + calculatedAscender = ((FT_Face)face)->ascender; + calculatedDescender = ((FT_Face)face)->descender; + + } + + return calculatedDescender; + + #else + + return ((FT_Face)face)->descender; + + #endif + } @@ -911,8 +1150,88 @@ namespace lime { int Font::GetHeight () { + #ifdef LIME_FREETYPE_SWF_METRICS + + // this should more closely match how [Embed] works in AS3 when + // embedding a font in a SWF + + TT_OS2* os2 = (TT_OS2*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_os2); + TT_HoriHeader* hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_hhea); + + if (os2 && os2->version != 0xFFFFU) { + + int calculatedAscender = (FT_Short)os2->usWinAscent; + int calculatedDescender = -(FT_Short)os2->usWinDescent; + return calculatedAscender - calculatedDescender; + + } else if (hhea) { + + int calculatedAscender = hhea->Ascender; + int calculatedDescender = hhea->Descender; + return calculatedAscender - calculatedDescender + hhea->Line_Gap; + + } + + // should never happen, but let's have a fallback to be safe return ((FT_Face)face)->height; + #elif defined(LIME_FREETYPE_LEGACY_METRICS) + + // this is FreeType's font metrics algorithm from 2.9.1 + // it behaves more like SWF than the new algorithm + + TT_OS2* os2 = (TT_OS2*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_os2); + TT_HoriHeader* hhea = (TT_HoriHeader*)FT_Get_Sfnt_Table(((FT_Face)face), ft_sfnt_hhea); + + int calculatedAscender = 0; + int calculatedDescender = 0; + int calculatedHeight = 0; + + if (hhea) { + + calculatedAscender = hhea->Ascender; + calculatedDescender = hhea->Descender; + calculatedHeight = calculatedAscender - calculatedDescender + hhea->Line_Gap; + + } + + if (!( calculatedAscender || calculatedDescender )) + { + if (os2 && os2->version != 0xFFFFU) + { + if (os2->sTypoAscender || os2->sTypoDescender) + { + + calculatedAscender = os2->sTypoAscender; + calculatedDescender = os2->sTypoDescender; + calculatedHeight = calculatedAscender - calculatedDescender + os2->sTypoLineGap; + + } + else + { + + calculatedAscender = (FT_Short)os2->usWinAscent; + calculatedDescender = -(FT_Short)os2->usWinDescent; + calculatedHeight = calculatedAscender - calculatedDescender; + + } + } + } + + if (!calculatedHeight) { + + calculatedHeight = ((FT_Face)face)->height; + + } + + return calculatedHeight; + + #else + + return ((FT_Face)face)->height; + + #endif + } @@ -989,7 +1308,7 @@ namespace lime { unsigned char g = bitmap.buffer[i * pitch + j * 3 + 1]; unsigned char b = bitmap.buffer[i * pitch + j * 3 + 2]; unsigned char a = (r + g + b) / 3; - + //Red position[(i * width + j) * 4 + 0] = r; //Green @@ -1039,10 +1358,10 @@ namespace lime { return totalOffset; } - + void Font::SetSize(size_t size, size_t dpi) { - //We changed the function signature to include a dpi argument which changes this from + //We changed the function signature to include a dpi argument which changes this from //the default value of 72 for dpi. Any public api that uses this should probably be changed //to allow setting the dpi in an appropriate future release. size_t hdpi = dpi; diff --git a/run.n b/run.n index 2789ab0ca7..deae46fd3a 100644 Binary files a/run.n and b/run.n differ diff --git a/src/lime/_internal/macros/AssetsMacro.hx b/src/lime/_internal/macros/AssetsMacro.hx index 5871daa800..a5b403ee86 100644 --- a/src/lime/_internal/macros/AssetsMacro.hx +++ b/src/lime/_internal/macros/AssetsMacro.hx @@ -31,6 +31,16 @@ class AssetsMacro var fields = embedData(":file"); if (fields == null) return null; + for (autoBuild in Context.getLocalClass().get().meta.extract(":autoBuild")) + { + switch (autoBuild.params[0]) + { + case macro lime._internal.macros.AssetsMacro.embedByteArray(): + return null; + default: + } + } + var superCall = Context.defined("html5") ? macro super(bytes.b.buffer) : Context.defined("hl") ? macro super(bytes.b, bytes.length) : macro super(bytes.length, bytes.b); diff --git a/src/lime/app/Promise.hx b/src/lime/app/Promise.hx index 627f32063d..42b9420131 100644 --- a/src/lime/app/Promise.hx +++ b/src/lime/app/Promise.hx @@ -61,13 +61,13 @@ class Promise Whether the `Promise` (and related `Future`) has finished with a completion state. This will be `false` if the `Promise` has not been resolved with a completion or error state. **/ - public var isComplete(get, null):Bool; + public var isComplete(get, never):Bool; /** Whether the `Promise` (and related `Future`) has finished with an error state. This will be `false` if the `Promise` has not been resolved with a completion or error state. **/ - public var isError(get, null):Bool; + public var isError(get, never):Bool; #if commonjs private static function __init__() @@ -179,12 +179,12 @@ class Promise } // Get & Set Methods - @:noCompletion private function get_isComplete():Bool + @:noCompletion private inline function get_isComplete():Bool { return future.isComplete; } - @:noCompletion private function get_isError():Bool + @:noCompletion private inline function get_isError():Bool { return future.isError; } diff --git a/src/lime/tools/CPPHelper.hx b/src/lime/tools/CPPHelper.hx index 2fcf06639b..e2877c9205 100644 --- a/src/lime/tools/CPPHelper.hx +++ b/src/lime/tools/CPPHelper.hx @@ -201,8 +201,14 @@ class CPPHelper path = project.config.get("project.rebuild.path"); } - if (path == null || !FileSystem.exists(path)) + if (path == null) + { + return; + } + + if (!FileSystem.exists(path)) { + Log.warn("Skipping rebuild. Path not found: " + path + "\nIf you are using a release from Haxelib, source code for native binaries may not be bundled. To rebuild, you may need to check out the full repository."); return; } @@ -215,6 +221,7 @@ class CPPHelper if (!FileSystem.exists(Path.combine(path, buildFile))) { + Log.warn("Skipping rebuild. Path not found: " + path + "\nIf you are using a release from Haxelib, source code for native binaries may not be bundled. To rebuild, you may need to check out the full repository."); return; } diff --git a/src/lime/tools/HXProject.hx b/src/lime/tools/HXProject.hx index 26e90bdee3..52a6813f21 100644 --- a/src/lime/tools/HXProject.hx +++ b/src/lime/tools/HXProject.hx @@ -765,7 +765,7 @@ class HXProject extends Script defines.set("targetType", "cpp"); defines.set("cpp", "1"); } - else if (target == Platform.WINDOWS && targetFlags.exists("mingw")) + else if (target == Platform.WINDOWS && (targetFlags.exists("cpp") || targetFlags.exists("mingw"))) { defines.set("targetType", "cpp"); defines.set("cpp", "1"); @@ -773,6 +773,8 @@ class HXProject extends Script } else { + targetFlags.set("neko", "1"); + defines.set("targetType", "neko"); defines.set("neko", "1"); } diff --git a/src/lime/tools/HashlinkHelper.hx b/src/lime/tools/HashlinkHelper.hx index 40c48836cb..727b463b7b 100644 --- a/src/lime/tools/HashlinkHelper.hx +++ b/src/lime/tools/HashlinkHelper.hx @@ -20,7 +20,7 @@ class HashlinkHelper case MAC: "Mac"; case WINDOWS: "Windows"; default: - Log.error('Hashlink is not supported on ${project.target} (Supported: Windows, Mac and Linux)'); + Log.error('HashLink is not supported on ${project.target} (Supported: Windows, Mac and Linux)'); Sys.exit(1); ""; }; diff --git a/src/lime/tools/IOSHelper.hx b/src/lime/tools/IOSHelper.hx index 253ddc52c6..b7c7edf4aa 100644 --- a/src/lime/tools/IOSHelper.hx +++ b/src/lime/tools/IOSHelper.hx @@ -324,6 +324,12 @@ class IOSHelper var currentDeviceID = XCodeHelper.getSimulatorID(project); + if (Log.verbose) + { + var currentSimulatorName = XCodeHelper.getSimulatorName(project); + Log.info("Using iOS simulator: " + currentSimulatorName); + } + try { System.runProcess("", "open", ["-Ra", "iOS Simulator"], true, false); @@ -353,21 +359,44 @@ class IOSHelper applicationPath = workingDirectory + "/build/" + configuration + "-iphoneos/" + project.app.file + ".app"; } - var templatePaths = [ - Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end) - ].concat(project.templatePaths); - var launcher = System.findTemplate(templatePaths, "bin/ios-deploy"); - Sys.command("chmod", ["+x", launcher]); - - // var xcodeVersion = getXcodeVersion (); - - System.runCommand("", launcher, [ - "install", - "--noninteractive", - "--debug", - "--bundle", - FileSystem.fullPath(applicationPath) - ]); + var xcodeVersion = Std.parseFloat(getXcodeVersion()); + if (!Math.isNaN(xcodeVersion) && xcodeVersion >= 16) { + // ios-deploy doesn't work with newer iOS SDKs where it can't + // find DeveloperDiskImage.dmg. however, Xcode 16 adds new + // commands for installing and launching apps on connected + // devices, so we'll prefer those, if available. + var listDevicesOutput = System.runProcess("", "xcrun", ["devicectl", "list", "devices", "--hide-default-columns", "--columns", "Identifier", "--filter", "Platform == 'iOS' AND State == 'connected'"]); + var deviceUUID:String = null; + var ready = false; + for (line in listDevicesOutput.split("\n")) { + if (!ready) { + ready = StringTools.startsWith(line, "----"); + continue; + } + deviceUUID = line; + break; + } + if (deviceUUID == null || deviceUUID.length == 0) { + Log.error("No device connected"); + return; + } + System.runCommand("", "xcrun", ["devicectl", "device", "install", "app", "--device", deviceUUID, FileSystem.fullPath(applicationPath)]); + System.runCommand("", "xcrun", ["devicectl", "device", "process", "launch", "--console", "--device", deviceUUID, project.meta.packageName]); + } else { + var templatePaths = [ + Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end) + ].concat(project.templatePaths); + var launcher = System.findTemplate(templatePaths, "bin/ios-deploy"); + Sys.command("chmod", ["+x", launcher]); + + System.runCommand("", launcher, [ + "install", + "--noninteractive", + "--debug", + "--bundle", + FileSystem.fullPath(applicationPath) + ]); + } } } diff --git a/src/lime/tools/ProjectXMLParser.hx b/src/lime/tools/ProjectXMLParser.hx index 835d636933..687015c776 100644 --- a/src/lime/tools/ProjectXMLParser.hx +++ b/src/lime/tools/ProjectXMLParser.hx @@ -1738,6 +1738,9 @@ class ProjectXMLParser extends HXProject case "gradle-version": config.set("android.gradle-version", value); + + case "gradle-plugin": + config.set("android.gradle-plugin", value); default: name = formatAttributeName(attribute); diff --git a/src/lime/tools/XCodeHelper.hx b/src/lime/tools/XCodeHelper.hx index 1565d516ae..62109c5bee 100644 --- a/src/lime/tools/XCodeHelper.hx +++ b/src/lime/tools/XCodeHelper.hx @@ -60,7 +60,11 @@ class XCodeHelper { if (StringTools.startsWith(line, "--")) { - if (line.indexOf("iOS") > -1) + if (line.indexOf("Unavailable") > -1) + { + foundSection = false; + } + else if (line.indexOf("iOS") > -1) { foundSection = true; } diff --git a/svg.n b/svg.n index a1eac4b05f..e656b42dfe 100644 Binary files a/svg.n and b/svg.n differ diff --git a/templates/html5/output.js b/templates/html5/output.js index da522b6ca3..e04a257441 100644 --- a/templates/html5/output.js +++ b/templates/html5/output.js @@ -1,10 +1,17 @@ -var $lime_init = (function ($hx_exports, $global) { - "use strict"; +var $lime_init = (function ($hx_exports, $global) { "use strict"; var $hx_script = (function (exports, global) { ::SOURCE_FILE:: +});::if false:: +/* + Don't insert or remove any line breaks in the code above this line! - var $hx_script = (function (exports, global) { -::SOURCE_FILE:: - }); + ::SOURCE_FILE:: must start on the first line. + Breakpoints in debug builds won't work if this file's line numbers don't + match the .js.map file's expected line numbers exactly. + + Additionally, the }); after ::SOURCE_FILE:: must appear on the next line + to avoid it getting ignored in a // comment at the end of ::SOURCE_FILE::. +*/ +::end:: if (typeof self !== "undefined" && self.constructor.name.includes("Worker")) { // No need for exports in a worker context, just initialize statics. $hx_script({}, $global); diff --git a/tools/RunScript.hx b/tools/RunScript.hx index 1cc522ab0c..03a9912b36 100644 --- a/tools/RunScript.hx +++ b/tools/RunScript.hx @@ -7,16 +7,8 @@ import sys.FileSystem; class RunScript { - private static function rebuildTools(rebuildBinaries = true):Void + private static function rebuildTools(limeDirectory:String, toolsDirectory:String, rebuildBinaries = true):Void { - var limeDirectory = Haxelib.getPath(new Haxelib("lime"), true); - var toolsDirectory = Path.combine(limeDirectory, "tools"); - - if (!FileSystem.exists(toolsDirectory)) - { - toolsDirectory = Path.combine(limeDirectory, "../tools"); - } - /*var extendedToolsDirectory = Haxelib.getPath (new Haxelib ("lime-extended"), false); if (extendedToolsDirectory != null && extendedToolsDirectory != "") { @@ -135,6 +127,15 @@ class RunScript { var args = Sys.args(); + var limeDirectory = Haxelib.getPath(new Haxelib("lime"), true); + var toolsDirectory = Path.combine(limeDirectory, "tools"); + + if (!FileSystem.exists(toolsDirectory)) + { + limeDirectory = Path.combine(limeDirectory, ".."); + toolsDirectory = Path.combine(limeDirectory, "tools"); + } + if (args.length > 2 && args[0] == "rebuild" && args[1] == "tools") { var lastArgument = new Path(args[args.length - 1]).toString(); @@ -187,7 +188,7 @@ class RunScript } } - rebuildTools(rebuildBinaries); + rebuildTools(limeDirectory, toolsDirectory, rebuildBinaries); if (args.indexOf("-openfl") > -1) { @@ -207,8 +208,8 @@ class RunScript var args = [ "-D", "lime", - "-cp", "tools", - "-cp", "tools/platforms", + "-cp", toolsDirectory, + "-cp", Path.combine(toolsDirectory, "platforms"), "-cp", "src", "-lib", "format", "-lib", "hxp", @@ -216,12 +217,13 @@ class RunScript Sys.exit(runCommand("", "haxe", args)); } - if (!FileSystem.exists("tools/tools.n") || args.indexOf("-rebuild") > -1) + var tools_n = Path.combine(toolsDirectory, "tools.n"); + if (!FileSystem.exists(tools_n) || args.indexOf("-rebuild") > -1) { - rebuildTools(); + rebuildTools(limeDirectory, toolsDirectory); } - var args = ["tools/tools.n"].concat(args); + var args = [tools_n].concat(args); Sys.exit(runCommand("", "neko", args)); } } diff --git a/tools/platforms/MacPlatform.hx b/tools/platforms/MacPlatform.hx index 3737419d4d..6c540b4303 100644 --- a/tools/platforms/MacPlatform.hx +++ b/tools/platforms/MacPlatform.hx @@ -203,6 +203,9 @@ class MacPlatform extends PlatformTarget if (noOutput) return; + // ensure that the shell script is replaced by the template executable + System.deleteFile(executablePath); + HashlinkHelper.copyHashlink(project, targetDirectory, executableDirectory, executablePath, true); if (project.targetFlags.exists("hlc")) @@ -214,7 +217,7 @@ class MacPlatform extends PlatformTarget // compiler command with the `arch -x86_64` command. // if we ever support ARM or Universal binaries, this will // need to be handled differently. - var command = ["arch", "-x86_64", compiler, "-O3", "-o", executablePath, "-std=c11", "-I", Path.combine(targetDirectory, "obj"), Path.combine(targetDirectory, "obj/ApplicationMain.c")]; + var command = ["arch", "-x86_64", compiler, "-O3", "-o", executablePath, "-std=c11", "-Wl,-rpath,@executable_path", "-I", Path.combine(targetDirectory, "obj"), Path.combine(targetDirectory, "obj/ApplicationMain.c")]; for (file in System.readDirectory(executableDirectory)) { switch Path.extension(file) diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index 9cf73d685f..a3019c0aed 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -580,7 +580,7 @@ class WindowsPlatform extends PlatformTarget System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : "") + ".exe", executablePath); - if (project.targetFlags.exists("mingw")) + if (project.defines.exists("mingw")) { var libraries = ["libwinpthread-1.dll", "libstdc++-6.dll"]; if (is64) diff --git a/tools/utils/PlatformSetup.hx b/tools/utils/PlatformSetup.hx index a9342e4ccd..9dee297a59 100644 --- a/tools/utils/PlatformSetup.hx +++ b/tools/utils/PlatformSetup.hx @@ -578,7 +578,7 @@ class PlatformSetup Log.println("download and extract the Adobe AIR SDK."); Log.println(""); - getDefineValue("AIR_SDK", "Path to AIR SDK"); + getDefineValue("AIR_SDK", "Absolute path to AIR SDK"); Log.println(""); Log.println("Setup complete."); @@ -593,12 +593,12 @@ class PlatformSetup Log.println("the SDK manager from Android Studio.\x1b[0m"); Log.println(""); - getDefineValue("ANDROID_SDK", "Path to Android SDK"); - getDefineValue("ANDROID_NDK_ROOT", "Path to Android NDK"); + getDefineValue("ANDROID_SDK", "Absolute path to Android SDK"); + getDefineValue("ANDROID_NDK_ROOT", "Absolute path to Android NDK"); if (System.hostPlatform != MAC) { - getDefineValue("JAVA_HOME", "Path to Java JDK"); + getDefineValue("JAVA_HOME", "Absolute path to Java JDK"); } if (ConfigHelper.getConfigValue("ANDROID_SETUP") == null) @@ -616,7 +616,7 @@ class PlatformSetup Log.println("and extract the Electron runtime on your system."); Log.println(""); - getDefineValue("ELECTRON_PATH", "Path to Electron runtime"); + getDefineValue("ELECTRON_PATH", "Absolute path to Electron runtime"); Log.println(""); Haxelib.runCommand("", ["install", "electron"], true, true); @@ -1213,7 +1213,7 @@ class PlatformSetup Log.println("After install, the SDK path may be at \"emsdk/upstream/emscripten\""); Log.println(""); - getDefineValue("EMSCRIPTEN_SDK", "Path to Emscripten SDK"); + getDefineValue("EMSCRIPTEN_SDK", "Absolute path to Emscripten SDK"); Log.println(""); Log.println("Setup complete."); @@ -1239,13 +1239,17 @@ class PlatformSetup public static function setupHL():Void { - getDefineValue("HL_PATH", "Path to a custom version of Hashlink. Leave empty to use lime's default version."); + var message = "Absolute path to a custom version of HashLink."; + if (ConfigHelper.getConfigValue("HL_PATH") == null) { + message += " Leave empty to use Lime's default bundled version."; + } + getDefineValue("HL_PATH", message); if (System.hostPlatform == MAC) { - Log.println("To use the hashlink debugger on macOS, the hl executable needs to be signed."); + Log.println("To use the HashLink debugger on macOS, the hl executable needs to be signed."); if (ConfigHelper.getConfigValue("HL_PATH") != null) { - Log.println("When building HL from source, make sure to have run `make codesign_osx` before installing."); + Log.println("When building HashLink from source, you must run `make codesign_osx` before installing."); } else {