Skip to content
Snippets Groups Projects
Commit cf190b84 authored by ezsh's avatar ezsh
Browse files

Add Git commit hash to the App.Version object

parent b39d4781
No related branches found
No related tags found
No related merge requests found
......@@ -135,3 +135,4 @@ fc-pregmod
TODO.txt
temp.*
*.temp
src/002-config/fc-version.js.commitHash.js
......@@ -30,7 +30,7 @@ bin/resources: resources
test -L "$@" || ln -s "../$<" bin/
bin/%.html: bin/tmp
git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw
rm src/002-config/fc-version.js.commitHash.js
mv $< $@
bin/fc.js: bin/
......@@ -41,7 +41,7 @@ bin/tmp: bin/fc.js injectGitCommitHash
rm -f bin/fc.js
injectGitCommitHash:
sed -Ei "s/build: .releaseID/\0, commit $(COMMIT)/" src/gui/mainMenu/AlphaDisclaimer.tw
printf "App.Version.commitHash = '%s';\n" $(COMMIT) > src/002-config/fc-version.js.commitHash.js
bin/:
mkdir -p $@
......
......@@ -64,16 +64,13 @@ function compile() {
esac
fi
file="bin/FC_pregmod.html"
if [[ -d .git ]]; then
COMMIT=$(git rev-parse --short HEAD) # Find and insert current commit
printf "App.Version.commitHash = '%s';\n" $(COMMIT) > src/002-config/fc-version.js.commitHash.js
if [[ "$usehash" ]]; then
file="bin/FC_pregmod_${COMMIT}.html"
else
sed -Ei "s/build: .releaseID/\0, commit: $COMMIT/" src/gui/mainMenu/AlphaDisclaimer.tw
file="bin/FC_pregmod.html"
fi
else
file="bin/FC_pregmod.html"
fi
devTools/concatFiles.sh js/ '*.js' bin/fc.js
......@@ -84,10 +81,8 @@ function compile() {
exit 1
fi
#Make the output prettier, replacing \t with a tab and \n with a newline
sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g' $file
if [[ -d .git ]]; then
git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw # Revert AlphaDisclaimer for next compilation
rm src/002-config/fc-version.js.commitHash.js
fi
echoMessage "Saved to $file."
}
......
App.Version = {
base: "0.10.7.1", // The vanilla version the mod is based off of, this should never be changed.
pmod: "3.5.2",
release: 1072,
commitHash: null,
release: 1072
};
/* Use release as save version */
......
......@@ -30,7 +30,7 @@
Pregmod is a modification of the original <i>Free Cities</i> created by FCdev, which can be seen at https://freecitiesblog.blogspot.com/.
</div>
<div class="note">
version: $ver, mod version: $pmodVer, build: $releaseID
version: $ver, mod version: $pmodVer, build: $releaseID <<if App.Version.commitHash>>commit: <<= App.Version.commitHash>><</if>>
</div>
<div id="version">
<<link "More version info">>
......@@ -59,4 +59,4 @@
<p>
[[I am 18 or more years of age, I understand, and I wish to continue|Economy Intro]]
</p>
\ No newline at end of file
</p>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment