From 14e020e67abc8e1729db7a410eb13716bb5b24b2 Mon Sep 17 00:00:00 2001 From: stfwi Date: Wed, 27 Feb 2019 21:43:47 +0100 Subject: [PATCH] Auxiliary build/release scripts ported. --- 1.12/Makefile | 13 +++---------- 1.12/tasks.js | 1 + 1.13/Makefile | 13 +++---------- 1.13/tasks.js | 1 + Makefile | 13 +++---------- tasks.js | 48 +++++++++++++++++++++++++++++++++++------------- 6 files changed, 46 insertions(+), 43 deletions(-) diff --git a/1.12/Makefile b/1.12/Makefile index 54355cb..afbe832 100644 --- a/1.12/Makefile +++ b/1.12/Makefile @@ -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)) diff --git a/1.12/tasks.js b/1.12/tasks.js index 40669ff..aad3211 100644 --- a/1.12/tasks.js +++ b/1.12/tasks.js @@ -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."); diff --git a/1.13/Makefile b/1.13/Makefile index 1d2c95e..ef6783d 100644 --- a/1.13/Makefile +++ b/1.13/Makefile @@ -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)) diff --git a/1.13/tasks.js b/1.13/tasks.js index 2d1953a..539dfda 100644 --- a/1.13/tasks.js +++ b/1.13/tasks.js @@ -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."); diff --git a/Makefile b/Makefile index cec0991..4c420a9 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/tasks.js b/tasks.js index 95bd238..19c866d 100644 --- a/tasks.js +++ b/tasks.js @@ -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"); - 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")) + 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."); + 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];