Auxiliary build/release scripts ported.

This commit is contained in:
stfwi 2019-02-27 21:43:47 +01:00
parent 82cdcf61a0
commit 14e020e67a
6 changed files with 46 additions and 43 deletions

View file

@ -2,16 +2,9 @@
# @author Stefan Wilhelm (wile)
# @license MIT
#
# GNU Make makefile for, well, speeding
# up the development a bit.
# You very likely need some tools installed
# to use all build targets, so this file is
# not "official". If you work on windows and
# install GIT with complete shell PATH (the
# red marked option in the GIT installer) you
# should have the needed unix tools available.
# For image stripping install imagemagick and
# also put the "magick" executable in the PATH.
# GNU Make makefile based build relay.
# Note for reviewers/clones: This file is a auxiliary script for my setup.
# It's not needed to build the mod.
#
MOD_JAR_PREFIX=engineersdecor-
MOD_JAR=$(filter-out %-sources.jar,$(wildcard build/libs/${MOD_JAR_PREFIX}*.jar))

View file

@ -1,4 +1,5 @@
#!/usr/bin/djs
// Note for reviewers/clones: This file is a auxiliary script for my setup. It's not needed to build the mod.
"use strict";
if(!fs.chdir(fs.dirname(fs.realpath(sys.script)))) throw new Error("Failed to switch to mod source directory.");
if(!fs.isdir("../.git")) throw new Error("Missing git repository in parent directory of mod source.");

View file

@ -2,16 +2,9 @@
# @author Stefan Wilhelm (wile)
# @license MIT
#
# GNU Make makefile for, well, speeding
# up the development a bit.
# You very likely need some tools installed
# to use all build targets, so this file is
# not "official". If you work on windows and
# install GIT with complete shell PATH (the
# red marked option in the GIT installer) you
# should have the needed unix tools available.
# For image stripping install imagemagick and
# also put the "magick" executable in the PATH.
# GNU Make makefile based build relay.
# Note for reviewers/clones: This file is a auxiliary script for my setup.
# It's not needed to build the mod.
#
MOD_JAR_PREFIX=engineersdecor-
MOD_JAR=$(filter-out %-sources.jar,$(wildcard build/libs/${MOD_JAR_PREFIX}*.jar))

View file

@ -1,4 +1,5 @@
#!/usr/bin/djs
// Note for reviewers/clones: This file is a auxiliary script for my setup. It's not needed to build the mod.
"use strict";
if(!fs.chdir(fs.dirname(fs.realpath(sys.script)))) throw new Error("Failed to switch to mod source directory.");
if(!fs.isdir("../.git")) throw new Error("Missing git repository in parent directory of mod source.");

View file

@ -2,16 +2,9 @@
# @author Stefan Wilhelm (wile)
# @license MIT
#
# GNU Make makefile for, well, speeding
# up the development a bit.
# You very likely need some tools installed
# to use all build targets, so this file is
# not "official". If you work on windows and
# install GIT with complete shell PATH (the
# red marked option in the GIT installer) you
# should have the needed unix tools available.
# For image stripping install imagemagick and
# also put the "magick" executable in the PATH.
# GNU Make makefile based build relay.
# Note for reviewers/clones: This file is a auxiliary script for my setup.
# It's not needed to build the mod.
#
.PHONY: default init clean clean-all dist sync-main-repo sanatize update-json
.PHONY: init-1.12 clean-1.12 clean-all-1.12 dist-1.12 sanatize-1.12

View file

@ -1,5 +1,7 @@
#!/usr/bin/djs
"use strict";
const main_repo_local = fs.realpath("../engineersdecor-github");
// Note for reviewers/clones: This file is a auxiliary script for my setup. It's not needed to build the mod.
const config_main_repo = fs.realpath("../engineersdecor-github");
if(!fs.chdir(fs.dirname(fs.realpath(sys.script)))) throw new Error("Failed to switch to mod repository base directory.");
if(!fs.isdir(".git")) throw new Error("Missing git repository in mod repository base directory.");
var tasks = {};
@ -26,19 +28,39 @@ tasks["update-json"] = function() {
};
tasks["sync-main-repository"] = function() {
if((!fs.chdir(fs.dirname(fs.realpath(sys.script))+"/..")) || (!fs.isdir(".git"))) throw new Error("Failed to switch to mod source directory.");
const test_repo_local = fs.cwd();
// step-by-step-verbose operations, as the code bases and copy data are different.
if((!fs.chdir(fs.dirname(fs.realpath(sys.script)))) || (!fs.isdir(".git"))) throw new Error("Failed to switch to mod source directory.");
if(sys.shell("git remote -v") != "") throw new Error("Dev repository has a remote set.");
if(main_repo_local == "") throw new Error("Main repository (real) path not found.");
if(fs.realpath(main_repo_local) == fs.realpath(test_repo_local)) throw new Error("This is already the main repository");
const test_repo_local = fs.cwd();
const main_repo_local = fs.realpath(config_main_repo);
if(main_repo_local == fs.realpath(test_repo_local)) throw new Error("This is already the main repository");
const cd_dev = function(subdir) {
if((!fs.chdir(test_repo_local)) || (!fs.isdir(".git"))) throw new Error("Failed to switch to mod source directory.");
if((subdir!==undefined) && (!fs.chdir(subdir))) throw new Error("Failed to change to '" + subdir + "' of the test repository.");
}
const cd_main = function(subdir) {
if((!fs.chdir(main_repo_local)) || (!fs.isdir(".git"))) throw new Error("Failed to switch to main repository directory.");
if(fs.cwd().search("-github") < 0) throw new Error("Main repository is missing the '*-github' tag in the path name.");
// sys.shell("rm -rf build documentation gradle meta scripts src")
// sys.shell("rm -f .gitignore build.gradle gradle.properties gradlew gradlew.bat license Makefile readme.md")
// if((!fs.chdir(test_repo_local)) || (!fs.isdir(".git"))) throw new Error("Failed to switch to local dev directory.");
// sys.shell("cp -r documentation gradle meta scripts src " + main_repo_local + "/")
// sys.shell("cp .gitignore build.gradle gradle.properties gradlew gradlew.bat license Makefile readme.md " + main_repo_local + "/")
// if((!fs.chdir(main_repo_local)) || (!fs.isdir(".git"))) throw new Error("Failed to switch to main repository directory.");
// print(sys.shell("git status -s"))
if((subdir!==undefined) && (!fs.chdir(subdir))) throw new Error("Failed to change to '" + subdir + "' of the main repository.");
};
cd_main();
sys.shell("rm -rf documentation meta");
sys.shell("rm -f .gitignore credits.md license Makefile readme.md tasks.js");
cd_main("1.12"); sys.shell("rm -rf meta src gradle");
cd_main("1.13"); sys.shell("rm -rf meta src gradle");
cd_dev();
sys.shell("cp -f .gitignore credits.md license Makefile readme.md tasks.js \"" + main_repo_local + "/\"")
sys.shell("cp -r documentation meta \"" + main_repo_local + "/\"")
cd_dev("1.12");
sys.shell("cp -f build.gradle gradle.properties gradlew gradlew.bat Makefile readme.md tasks.js signing.* \"" + main_repo_local + "/1.12/\"")
sys.shell("cp -r src gradle meta \"" + main_repo_local + "/1.12/\"")
cd_dev("1.13");
sys.shell("cp -f build.gradle gradle.properties gradlew gradlew.bat Makefile readme.md tasks.js signing.* \"" + main_repo_local + "/1.13/\"")
sys.shell("cp -r src gradle meta \"" + main_repo_local + "/1.13/\"")
cd_main();
print("Main repository changes:");
print(sys.shell("git status -s"))
};
const task_name = sys.args[0];