Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
sudo apt-get install libvlc-dev libvlccore-dev
- name: Installing/Updating libraries
run: |
haxe -cp commandline -D analyzer-optimize --run Main setup -s
haxe -cp commandline -D analyzer-optimize --run Main setup -si
- name: Building the game
run: |
haxelib run lime build linux -DCOMPILE_EXPERIMENTAL
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
sudo apt-get install libvlc-dev libvlccore-dev
- name: Installing/Updating libraries
run: |
haxe -cp commandline -D analyzer-optimize --run Main setup -s
haxe -cp commandline -D analyzer-optimize --run Main setup -si
- name: Building the game
run: |
haxelib run lime build linux -debug
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
export/release/macos/obj/
- name: Installing/Updating libraries
run: |
haxe -cp commandline -D analyzer-optimize --run Main setup -s
haxe -cp commandline -D analyzer-optimize --run Main setup -si
- name: Building the game
run: |
arch -x86_64 haxelib run lime build mac -DCOMPILE_EXPERIMENTAL
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
export/debug/macos/obj/
- name: Installing/Updating libraries
run: |
haxe -cp commandline -D analyzer-optimize --run Main setup -s
haxe -cp commandline -D analyzer-optimize --run Main setup -si
- name: Building the game
run: |
arch -x86_64 haxelib run lime build mac -debug
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
export/release/windows/obj/
- name: Installing/Updating libraries
run: |
haxe -cp commandline -D analyzer-optimize --run Main setup -s --no-vscheck
haxe -cp commandline -D analyzer-optimize --run Main setup -si --no-vscheck
- name: Building the game
run: |
haxelib run lime build windows -DCOMPILE_EXPERIMENTAL
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
export/debug/windows/obj/
- name: Installing/Updating libraries
run: |
haxe -cp commandline -D analyzer-optimize --run Main setup -s --no-vscheck
haxe -cp commandline -D analyzer-optimize --run Main setup -si --no-vscheck
- name: Building the game
run: |
haxelib run lime build windows -debug
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ addons/*
addons/*
!addons/readme.txt
dev-libs/
.vs/
*.sum
.vs/
2 changes: 1 addition & 1 deletion building/setup-unix.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh
cd "$(dirname "$0")/.."
haxe -cp commandline -D analyzer-optimize --run Main setup
haxe -cp commandline -D analyzer-optimize --run Main setup $@
2 changes: 1 addition & 1 deletion building/setup-windows.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cd /d "%~dp0.."
@haxe -cp commandline -D analyzer-optimize --run Main setup
@haxe -cp commandline -D analyzer-optimize --run Main setup %*
10 changes: 6 additions & 4 deletions commandline/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ class Main {
dDoc: [
"Usage: setup",
"",
"This command runs through all libraries in building/libs.xml, and install them.",
"If they're already installed, they will be updated.",
"This command runs through all libraries in building/libs.xml, and installs them.",
"This will generate a sum file; if the building/libs.xml file has remained unchanged,",
"then the setup process will not start. This may be avoided by using --ignore-sum.",
"",
"--all : Reinstall all libraries.",
"--all | --reinstall : Reinstall all libraries. This enforces --ignore-sum.",
"--no-vscheck : Don't check if Visual Studio is installed.",
"-s | --silent | --silent-progress : Don't show download progress."
"-s | --silent | --silent-progress : Don't show download progress.",
"-i | --ignore-sum : Ignore the library sum file, proceeding with the setup process anyway."
].join("\n")
},
{
Expand Down
32 changes: 29 additions & 3 deletions commandline/commands/Setup.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package commands;

import haxe.crypto.Sha256;
import haxe.xml.Access;
import haxe.Json;
import sys.io.File;
Expand Down Expand Up @@ -36,12 +37,15 @@ class Setup {
var args = ArgParser.parse(args, [
"s" => "silent-progress",
"S" => "silent-progress",
"all" => "reinstall",
"silent" => "silent-progress",
"f" => "fast",
"F" => "fast"
"F" => "fast",
"i" => "ignore-sum"
]);
var CHECK_VSTUDIO = !args.existsOption("no-vscheck");
var REINSTALL_ALL = args.existsOption("reinstall");
var IGNORE_SUM = REINSTALL_ALL || args.existsOption("ignore-sum");
var SILENT = args.existsOption("silent-progress");
var FAST = args.existsOption("fast");
// TODO: add only install missing libs
Expand All @@ -68,8 +72,28 @@ class Setup {
return;
}

var libFileContents = File.getContent(libFile);
var libSum = Sha256.encode(libFileContents);

var libSumFile = libFile + ".sum";
var libSumToCompare = "";
try {
var libSumFileContents = File.getContent(libSumFile);
if (!IGNORE_SUM && libSum == libSumFileContents) {
// Multiline strings are already awkward as-is in Haxe, so this just uses a buffer to emulate them.
var multiline = new StringBuf();
multiline.add('libs.xml has remained unchanged since the last time the setup subcommand was run.\n');
multiline.add('If you want to force a reinstall of the currently installed libraries, then please pass the --ignore-sum flag,\n');
multiline.add('or delete the generated ');
multiline.add(libSumFile);
multiline.add(' file.');
Sys.println(multiline);
return;
}
} catch (_) {}

final events:Array<Event> = [];
final libsXML:Access = new Access(Xml.parse(File.getContent(libFile)).firstElement());
final libsXML:Access = new Access(Xml.parse(libFileContents).firstElement());

function handleLib(libNode:Access) {
switch(libNode.name) {
Expand Down Expand Up @@ -267,6 +291,8 @@ class Setup {
}
}
}

try File.saveContent(libSumFile, libSum) catch (_) {}

// vswhere.exe is 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" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -requires Microsoft.VisualStudio.Component.Windows10SDK.19041 -property installationPath').exitCode(true) != 0) {
Expand Down Expand Up @@ -347,4 +373,4 @@ enum abstract EventType(Int) {
var INSTALL = 0;
var CMD = 1;
var PRINT = 2;
}
}