Convert lime.tools.Architecture to enum abstract. (#1754)

* Convert `lime.tools.Architecture` to `enum abstract`.

This improves compatibility with `hxp.HostArchitecture` and provides a more user-friendly API than `try { Type.createEnum() }`.

* Add category functions to `Architecture`.

* Fix errors related to `Architecture`'s new type.

* Standardize formatting.

* Re-implement `Architecture.match()` for backwards compatibility.

* Add `Architecture` constructor for clarity.
This commit is contained in:
player-03
2024-06-04 15:39:48 -04:00
committed by GitHub
parent ead4402d5f
commit ef7eef4bf3
4 changed files with 112 additions and 27 deletions

View File

@@ -2234,17 +2234,12 @@ class CommandLineTools
{
if (argument.substr(0, 4) == "-arm")
{
try
{
var name = argument.substr(1).toUpperCase();
var value = Type.createEnum(Architecture, name);
var value = new Architecture(argument.substr(1));
if (value != null)
{
overrides.architectures.push(value);
}
if (value != null)
{
overrides.architectures.push(value);
}
catch (e:Dynamic) {}
}
else if (argument == "-64")
{

View File

@@ -112,10 +112,10 @@ class MacPlatform extends PlatformTarget
project.architectures.remove(excludeArchitecture);
}
targetArchitecture = Type.createEnum(Architecture, Type.enumConstructor(System.hostArchitecture));
targetArchitecture = System.hostArchitecture;
for (architecture in project.architectures)
{
if (architecture.match(X86 | X64 | ARMV6 | ARMV7 | ARM64))
if (architecture.isARM() || architecture.isX())
{
targetArchitecture = architecture;
break;