last codename engine commit, its over

This commit is contained in:
Yoshman29
2023-05-14 17:04:37 +02:00
parent 465b0ec5cb
commit 367d2588b9
8 changed files with 163 additions and 24 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB

+1
View File
@@ -0,0 +1 @@
@haxe -cp commandline -D analyzer-optimize --run Main %*
+113
View File
@@ -0,0 +1,113 @@
package;
import commands.*;
class Main {
public static var commands:Array<Command> = [];
public static function initCommands() {
commands = [
{
names: ["setup"],
doc: "Setups (or updates) all libraries required for the engine.",
func: Update.main,
dDoc: "This command runs through all libraries in libs.xml, and install them.\nIf they're already installed, they will be updated."
},
{
names: ["help", null],
doc: "Shows help. Pass a command name to get additional help.",
func: help,
dDoc: "Usage: help <cmd>\n\nFor example, use \"cne help test\" to get additional help on the test command."
},
{
names: ["test"],
doc: "Creates a non final test build, then runs it.",
func: Compiler.test,
dDoc: "Usage: test <optional args>\n" +
"\nThis will create a quick debug build binded to the source then run it, which means:" +
"\n- The assets WON'T be copied over - Assets will be read from the game's source." +
"\n- This build WON'T be ready for release - Running anywhere else than in the bin folder will result in a crash from missing assets" +
"\n- This build will also use the mods folder from the source directory." +
"\n\nIf you want a full build which contains all assets, run \"cne release\" or \"cne test-release\"" +
"\nAdditional arguments will be sent to the lime compiler."
},
{
names: ["build"],
doc: "Creates a non final test build, without running it.",
func: Compiler.build,
dDoc: "Usage: build <optional arguments>\n" +
"\nThis will create a quick debug build binded to the source then run it, which means:" +
"\n- The assets WON'T be copied over - Assets will be read from the game's source." +
"\n- This build WON'T be ready for release - Running anywhere else than in the bin folder will result in a crash from missing assets" +
"\n- This build will also use the mods folder from the source directory." +
"\n\nIf you want a full build which contains all assets, run \"cne release\" or \"cne test-release\"" +
"\nAdditional arguments will be sent to the lime compiler."
},
{
names: ["release"],
doc: "Creates a final non debug build, containing all assets.",
func: Compiler.release,
dDoc: "Usage: release <optional arguments>\n" +
"\nThis will create 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."
},
{
names: ["test-release"],
doc: "Creates a final non debug build, containing all assets.",
func: Compiler.testRelease,
dDoc: "Usage: release <optional arguments>\n" +
"\nThis 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."
}
];
}
public static function main() {
initCommands();
var args = Sys.args();
var commandName = args.shift();
if (commandName != null)
commandName = commandName.toLowerCase();
for(c in commands) {
if (c.names.contains(commandName)) {
c.func(args);
return;
}
}
}
public static function help(args:Array<String>) {
var cmdName = args.shift();
if (cmdName != null) {
cmdName = cmdName.toLowerCase();
var matchingCommand = null;
for(c in commands) if (c.names.contains(cmdName)) {
matchingCommand = c;
break;
}
if (matchingCommand == null) {
Sys.println('help - Command named ${cmdName} not found.');
return;
}
Sys.println('${matchingCommand.names.join(", ")}');
Sys.println("---");
Sys.println(matchingCommand.dDoc);
return;
}
// shows help
Sys.println("Codename Engine Command Line utility");
Sys.println('Available commands (${commands.length}):\n');
for(line in commands) {
Sys.println('${line.names.join(", ")} - ${line.doc}');
}
}
}
typedef Command = {
var names:Array<String>;
var func:Array<String>->Void;
var ?doc:String;
var ?dDoc:String;
}
+35
View File
@@ -0,0 +1,35 @@
package commands;
class Compiler {
public static function test(args:Array<String>) {
__build(args, ["test", getBuildTarget(), "-D", "TEST_BUILD"]);
}
public static function build(args:Array<String>) {
__build(args, ["build", "windows", "-D", "TEST_BUILD"]);
}
public static function release(args:Array<String>) {
__build(args, ["build", "windows"]);
}
public static function testRelease(args:Array<String>) {
__build(args, ["test", "windows"]);
}
private static function __build(args:Array<String>, arg:Array<String>) {
for(a in args)
arg.push(a);
Sys.command("lime", arg);
}
private static function getBuildTarget() {
return switch(Sys.systemName()) {
case "Windows":
"windows";
case "Mac":
"macos";
case "Linux":
"linux";
case def:
def.toLowerCase();
}
}
}
@@ -1,10 +1,12 @@
package commands;
import haxe.Json;
import sys.io.File;
import sys.io.Process;
import sys.FileSystem;
class Update {
public static function main() {
public static function main(args:Array<String>) {
// to prevent messing with currently installed libs
if (!FileSystem.exists('.haxelib'))
FileSystem.createDirectory('.haxelib');
+5 -5
View File
@@ -57,11 +57,14 @@
<define name="PRELOAD_ALL" unless="web" />
<define name="NO_PRELOAD_ALL" unless="PRELOAD_ALL"/>
<library name="assets" preload="true" if="PRELOAD_ALL"/>
<library name="assets" preload="false" if="NO_PRELOAD_ALL" />
<assets path="assets/" rename="assets" exclude="*.ogg" if="web"/>
<assets path="assets/" rename="assets" exclude="*.mp3" unless="web"/>
<section unless="TEST_BUILD">
<assets path="assets/" rename="assets" exclude="*.ogg" if="web"/>
<assets path="assets/" rename="assets" exclude="*.mp3" unless="web"/>
</section>
<assets path='mods' rename='mods' embed='false'/>
<assets path='art/readme.txt' rename='do NOT readme.txt' />
@@ -132,9 +135,6 @@
<!-- Comment this out to disable softcoded states and state scripting !-->
<haxedef name="SOFTCODED_STATES" />
<!-- Comment this out to disable usage of source assets when using lime test windows !-->
<haxedef name="USE_SOURCE_ASSETS" />
<!-- Comment this out to use the default OpenFL assets system for the assets/ folder. !-->
<haxedef name="USE_ADAPTED_ASSETS" />
+5 -17
View File
@@ -83,7 +83,7 @@ class Main extends Sprite
#else
""
#end;
public static var startedFromSource:Bool = false;
public static var startedFromSource:Bool = #if TEST_BUILD true #else false #end;
private static var __threadCycle:Int = 0;
@@ -123,26 +123,14 @@ class Main extends Sprite
funkin.backend.scripting.GlobalScript.init();
#end
#if sys
if (startedFromSource = Sys.args().contains("-livereload")) {
#if USE_SOURCE_ASSETS
#if windows
trace("Used lime test windows. Switching into source assets.");
#elseif mac
trace("Used lime test mac. Switching into source assets.");
#elseif linux
trace("Used lime test linux. Switching into source assets.");
#end
#if (sys && TEST_BUILD)
trace("Used cne test / cne build. Switching into source assets.");
#if MOD_SUPPORT
ModsFolder.modsPath = './${pathBack}mods/';
ModsFolder.modsPath = './${pathBack}mods/';
#end
Paths.assetsTree.__defaultLibraries.push(ModsFolder.loadLibraryFromFolder('assets', './${pathBack}assets/', true));
#end
} else {
#if USE_ADAPTED_ASSETS
#elseif USE_ADAPTED_ASSETS
Paths.assetsTree.__defaultLibraries.push(ModsFolder.loadLibraryFromFolder('assets', './assets/', true));
#end
}
#end
+1 -1
View File
@@ -1 +1 @@
@haxe -cp update -D analyzer-optimize -main Update --interp
@haxe -cp commandline -D analyzer-optimize --run Main setup