Merge branch 'main' into translations-system

This commit is contained in:
Furo
2025-07-21 12:58:53 +02:00
592 changed files with 20908 additions and 4426 deletions
+5 -5
View File
@@ -17,18 +17,18 @@ class ArgParser {
this.args = args;
this.options = new Map();
var copy = args.copy();
final copy = args.copy();
var i = 0;
while(copy.length > 0) {
var arg = copy.shift();
// this parses the -NAME=VALUE
if (arg.startsWith("-")) {
var key = arg.substr(1);
var isLongKey = key.startsWith("-");
final isLongKey = key.startsWith("-");
if (isLongKey) {
key = key.substr(1);
}
var split = key.split("=");
final split = key.split("=");
var longName = split.shift();
if(!isLongKey) {
// Allow -ABC to be parsed as -A -B -C
@@ -43,8 +43,8 @@ class ArgParser {
// Parse the last option with value support
}
var name = rename(longName);
var value = (split.length > 0) ? split.join("=") : null;
final name = rename(longName);
final value = (split.length > 0) ? split.join("=") : null;
options.set(name, value);
args.splice(i, 1);
+23 -5
View File
@@ -49,7 +49,8 @@ class Main {
"If you want a full build which contains all assets, run \"cne release\" or \"cne test-release\"",
"Additional arguments will be sent to the lime compiler.",
"",
"-debug : Builds a debug build."
"-debug : Builds a debug build.",
"-clean : Compiled files will be deleted before compiling."
].join("\n")
},
{
@@ -67,7 +68,20 @@ class Main {
"If you want a full build which contains all assets, run \"cne release\" or \"cne test-release\"",
"Additional arguments will be sent to the lime compiler.",
"",
"-debug : Builds a debug build."
"-debug : Builds a debug build.",
"-clean : Compiled files will be deleted before compiling."
].join("\n")
},
{
names: ["run"],
doc: "Runs the last build that was created.",
func: Compiler.run,
dDoc: [
"Usage: run <optional arguments>",
"",
"This will run the last build that was created.",
"If the last build was a debug build, you need to pass the -debug argument to run it.",
"Additional arguments will be sent to the lime compiler."
].join("\n")
},
{
@@ -79,7 +93,9 @@ class Main {
"",
"This will create and run a final ready-for-release build,",
"which means this build will be able to be release on websites such as GameBanana without worrying about source-dependant stuff.",
"Additional arguments will be sent to the lime compiler."
"Additional arguments will be sent to the lime compiler.",
"",
"-clean : Compiled files will be deleted before compiling."
].join("\n")
},
{
@@ -91,7 +107,9 @@ class Main {
"",
"This will create and run a final ready-for-release build,",
"which means this build will be able to be release on websites such as GameBanana without worrying about source-dependant stuff.",
"Additional arguments will be sent to the lime compiler."
"Additional arguments will be sent to the lime compiler.",
"",
"-clean : Compiled files will be deleted before compiling."
].join("\n")
},
{
@@ -113,7 +131,7 @@ class Main {
public static function main() {
initCommands();
var args = Sys.args();
final args = Sys.args();
var commandName = args.shift();
if (commandName != null)
commandName = commandName.toLowerCase();
+5 -5
View File
@@ -17,11 +17,11 @@ class Utils {
condition = condition.replace('&&', '&').replace('||', '|').replace(" ", "");
var stack:Array<Dynamic> = [];
final stack:Array<Dynamic> = [];
var i = 0;
while (i < condition.length) {
var char = condition.charAt(i);
final char = condition.charAt(i);
switch (char) {
case '(':
@@ -32,7 +32,7 @@ class Utils {
if (condition.charAt(j) == '(') balance++;
if (condition.charAt(j) == ')') balance--;
}
var subExpr = condition.substr(i + 1, j - i - 1);
final subExpr = condition.substr(i + 1, j - i - 1);
stack.push(evaluateArgsCondition(subExpr, args));
i = j;
case '&', '|':
@@ -55,8 +55,8 @@ class Utils {
public static function evaluate(stack:Array<Dynamic>):Bool {
var result = stack.shift();
while (stack.length > 0) {
var op = stack.shift();
var next = stack.shift();
final op = stack.shift();
final next = stack.shift();
switch(op) {
case '&':
result = result && next;
+8 -5
View File
@@ -2,19 +2,22 @@ package commands;
class Compiler {
public static function test(args:Array<String>) {
__build(args, ["test", getBuildTarget(), "-DTEST_BUILD"]);
__runLime(args, ["test", getBuildTarget(), "-DTEST_BUILD"]);
}
public static function build(args:Array<String>) {
__build(args, ["build", getBuildTarget(), "-DTEST_BUILD"]);
__runLime(args, ["build", getBuildTarget(), "-DTEST_BUILD"]);
}
public static function release(args:Array<String>) {
__build(args, ["build", getBuildTarget()]);
__runLime(args, ["build", getBuildTarget()]);
}
public static function testRelease(args:Array<String>) {
__build(args, ["test", getBuildTarget()]);
__runLime(args, ["test", getBuildTarget()]);
}
public static function run(args:Array<String>) {
__runLime(args, ["run", getBuildTarget()]);
}
private static function __build(args:Array<String>, arg:Array<String>) {
private static function __runLime(args:Array<String>, arg:Array<String>) {
arg.insert(0, "lime");
arg.insert(0, "run");
for(a in args)
+4 -4
View File
@@ -4,17 +4,17 @@ import sys.io.File;
class Optimizer {
public static function main(args:Array<String>) {
var args = ArgParser.parse(args);
var saveOld = args.existsOption("no-old");
final args = ArgParser.parse(args);
final saveOld = !args.existsOption("no-old");
if(args.length == 0) {
Sys.println(Main.curCommand.dDoc);
return;
}
var filename = args.get(0);
final filename = args.get(0);
var data = File.getContent(filename);
final data = File.getContent(filename);
var json = null;
try {
json = haxe.Json.parse(data);
+36 -34
View File
@@ -44,6 +44,7 @@ class Setup {
var REINSTALL_ALL = args.existsOption("reinstall");
var SILENT = args.existsOption("silent-progress");
var FAST = args.existsOption("fast");
// TODO: add only install missing libs
// to prevent messing with currently installed libs
if (!FileSystem.exists('.haxelib'))
@@ -67,13 +68,13 @@ class Setup {
return;
}
var events:Array<Event> = [];
var libsXML:Access = new Access(Xml.parse(File.getContent(libFile)).firstElement());
final events:Array<Event> = [];
final libsXML:Access = new Access(Xml.parse(File.getContent(libFile)).firstElement());
function handleLib(libNode:Access) {
switch(libNode.name) {
case "lib" | "git" | "custom":
var lib:Library = {
final lib:Library = {
name: libNode.att.name,
type: libNode.name,
skipDeps: libNode.has.skipDeps ? libNode.att.skipDeps == "true" : false,
@@ -122,15 +123,16 @@ class Setup {
}
}
var platform = switch(Sys.systemName()) {
final platform = switch(Sys.systemName()) {
case "Windows": "windows";
case "Mac": "mac";
case "Linux": "linux";
case def: def.toLowerCase();
}
var defines = args.args.copy();
final defines = args.args.copy();
defines.push(platform);
defines.push("true");
if(args.args.length == 0) defines.push("all");
function parse(libNode:Access) {
@@ -148,6 +150,8 @@ class Setup {
}
}
final shouldCheckHaxeVersion = !libsXML.has.checkVersion || Utils.evaluateArgsCondition(libsXML.att.checkVersion, defines);
for (libNode in libsXML.elements) {
parse(libNode);
}
@@ -201,10 +205,10 @@ class Setup {
}
var oldCwd = Sys.getCwd();
if(lib != null) {
var libPrefix = '.haxelib/$lib';
final libPrefix = '.haxelib/$lib';
if(FileSystem.exists(libPrefix)) {
if(FileSystem.exists(libPrefix + '/.dev')) { // haxelib dev
var devPath = File.getContent(libPrefix + '/.dev');
final devPath = File.getContent(libPrefix + '/.dev');
if(!FileSystem.exists(devPath)) {
Sys.println('Cannot find dev path $devPath for $lib');
Sys.setCwd(oldCwd);
@@ -212,7 +216,7 @@ class Setup {
}
Sys.setCwd(devPath + dir);
} else if(FileSystem.exists(libPrefix + '/.current')) {
var version = StringTools.replace(File.getContent(libPrefix + '/.current'), ".", ",");
final version = StringTools.replace(File.getContent(libPrefix + '/.current'), ".", ",");
if(!FileSystem.exists(libPrefix + '/$version')) {
Sys.println('Cannot find version $version of $lib');
Sys.setCwd(oldCwd);
@@ -227,13 +231,13 @@ class Setup {
}
}
for(line in cmd.lines) {
var line = StringTools.replace(line, "$PLATFORM", platform);
final line = StringTools.replace(line, "$PLATFORM", platform);
//Sys.println(line);
command(line);
}
Sys.setCwd(oldCwd);
case PRINT:
var data:PrintData = event.data;
final data:PrintData = event.data;
if(data.pretty)
prettyPrint(data.text);
else
@@ -241,30 +245,28 @@ class Setup {
}
}
/*var proc = new Process('haxe --version');
proc.exitCode(true);
var haxeVer = proc.stdout.readLine();
if (haxeVer != "4.2.5") {
if(shouldCheckHaxeVersion) {
final proc = new Process('haxe --version');
proc.exitCode(true);
final haxeVer = proc.stdout.readLine();
// check for outdated haxe
var curHaxeVer = [for(v in haxeVer.split(".")) Std.parseInt(v)];
var requiredHaxeVer = [4, 2, 5];
for(i in 0...requiredHaxeVer.length) {
if (curHaxeVer[i] < requiredHaxeVer[i]) {
prettyPrint("!! WARNING !!");
Sys.println("Your current Haxe version is outdated.");
Sys.println('You\'re using ${haxeVer}, while the required version is 4.2.5.');
Sys.println('The engine may not compile with your current version of Haxe.');
Sys.println('We recommend upgrading to 4.2.5');
break;
} else if (curHaxeVer[i] > requiredHaxeVer[i]) {
prettyPrint("!! WARNING !!"
+ "\nUsing Haxe 4.3.0 and above is currently not recommended due to lack of testing.");
Sys.println('');
Sys.println('We recommend downgrading back to 4.2.5.');
final curHaxeVer = [for(v in haxeVer.split(".")) Std.parseInt(v)];
final minumumVersion = [4, 2, 5];
for(i in 0...minumumVersion.length) {
if (curHaxeVer[i] > minumumVersion[i]) break;
if (curHaxeVer[i] < minumumVersion[i]) {
prettyPrint([
"!! WARNING !!",
"Your current Haxe version is outdated.",
'You\'re using ${haxeVer}, whilst the required version is 4.2.5 or newer.',
'The engine may not compile with your current version of Haxe.',
'We recommend upgrading to 4.2.5 or newer'
].join("\n"));
break;
}
}
}*/
}
// vswhere.exe its used to find any visual studio related installations on the system, including full visual studio ide installations, visual studio build tools installations, and other related components - Nex
if (CHECK_VSTUDIO && Compiler.getBuildTarget().toLowerCase() == "windows" && new Process('"C:/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -property catalog_productDisplayVersion').exitCode(true) == 1) {
@@ -282,7 +284,7 @@ class Setup {
}
public static function prettyPrint(text:String) {
var lines = text.split("\n");
final lines = text.split("\n");
var length = -1;
for(line in lines)
if(line.length > length)
@@ -300,9 +302,9 @@ class Setup {
public static function centerText(text:String, width:Int):String {
var centerOffset = (width - text.length) / 2;
var left = repeat(' ', Math.floor(centerOffset));
var right = repeat(' ', Math.ceil(centerOffset));
final centerOffset = (width - text.length) / 2;
final left = repeat(' ', Math.floor(centerOffset));
final right = repeat(' ', Math.ceil(centerOffset));
return left + text + right;
}