From 9b7908fd601adbd742530368b78ac5dc57386837 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Tue, 26 Jul 2022 17:15:14 +0200 Subject: [PATCH] Added build-clients.d script. --- .gitignore | 1 + build-clients.d | 43 +++++++++++++++++++++++++++++++++++++++++++ client/pom.xml | 2 +- server/pom.xml | 2 +- 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 build-clients.d diff --git a/.gitignore b/.gitignore index d0bb1d9..b607676 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea/ target/ +client-builds/ # Ignore the ./config directory so that developers can put their config files # there for server and client apps. diff --git a/build-clients.d b/build-clients.d new file mode 100755 index 0000000..355c94c --- /dev/null +++ b/build-clients.d @@ -0,0 +1,43 @@ +#!/usr/bin/env dub +/+ dub.sdl: + dependency "dsh" version="~>1.6.1" ++/ + +/** + * Builds OS-dependent client application versions. + */ +module build_clients; + +import dsh; +import std.array; +import std.algorithm; +import std.string; +import std.regex; +import std.path; + +void main() { + string[] profiles = [ + "linux-aarch64", + "linux-amd64", + "linux-arm", + "linux-arm32", + "macos-aarch64", + "macos-x86_64", + "windows-aarch64", + "windows-amd64", + "windows-x86" + ]; + string outDir = "client-builds"; + removeIfExists(outDir); + mkdir(outDir); + foreach (profile; profiles) { + print("Building profile: %s", profile); + string cmd = format!"mvn -B -Plwjgl-natives-%s --projects client --also-make clean package"(profile); + new ProcessBuilder() + .outputTo(buildPath(outDir, "output-" ~ profile ~ ".txt")) + .run(cmd); + string jarFile = findFile("client/target", ".+-jar-with-dependencies\\.jar"); + string finalName = replaceFirst(baseName(jarFile), regex("jar-with-dependencies"), profile); + copy(jarFile, outDir ~ "/" ~ finalName); + } +} diff --git a/client/pom.xml b/client/pom.xml index 6fc7531..b0c3bb7 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -144,7 +144,7 @@ nl.andrewl aos2-core - ${parent.version} + ${project.parent.version} de.javagl diff --git a/server/pom.xml b/server/pom.xml index 8f1322e..dbb974e 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -20,7 +20,7 @@ nl.andrewl aos2-core - ${parent.version} + ${project.parent.version} info.picocli