Added in version numbers/hashes pulled from git - captain.sh generates at build time compiler_version.krak to be imported by kraken.main
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,3 +24,4 @@ kraken_bac
|
||||
kraken_deprecated
|
||||
bootstrap_kalypso
|
||||
kraken_bootstrap
|
||||
compiler_version.krak
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
kraken="kraken"
|
||||
bootstrap_commits=(cf46fb13afe66ba475db9725e9269c9c1cd3bbc3 2cd43e5a217318c70097334b3598d2924f64b362)
|
||||
|
||||
# Echo version string to a file included by kraken.krak
|
||||
# There is a default version string in the file in case kraken is not built with captain
|
||||
echo "var version_string = \"Self-hosted Kraken compiler \\\"Kalypso\\\" - revision $(git rev-list HEAD | wc -l), commit: $(git rev-parse HEAD)\";" > compiler_version.krak
|
||||
|
||||
if [[ $1 == "clean" ]]
|
||||
then
|
||||
rm ${kraken}
|
||||
@@ -73,6 +77,7 @@ else
|
||||
echo "commit hash: ${bootstrap_commits[$i]}"
|
||||
mv ./krakenGrammer.kgm krakenGrammer.kgm_old
|
||||
git checkout ${bootstrap_commits[$i]}
|
||||
echo "var version_string = \"Self-hosted Kraken compiler \\\"Kalypso\\\" - revision $(git rev-list HEAD | wc -l), commit: $(git rev-parse HEAD)\";" > compiler_version.krak
|
||||
mv ./krakenGrammer.kgm krakenGrammer.kgm_new
|
||||
mv ./krakenGrammer.kgm_old krakenGrammer.kgm
|
||||
./${kraken}_bootstrap kraken.krak ${kraken}_bootstrap
|
||||
|
||||
12
kraken.krak
12
kraken.krak
@@ -9,9 +9,16 @@ import tree:*
|
||||
import serialize:*
|
||||
import c_generator:*
|
||||
import os:*
|
||||
import compiler_version
|
||||
|
||||
|
||||
fun main(argc: int, argv: **char):int {
|
||||
|
||||
if (argc <= 1) {
|
||||
error("No input file!\n Call with one argument (the input file), or two arguments (input file and output name)")
|
||||
} else if (string(argv[1]) == "-v" || string(argv[1]) == "--version") {
|
||||
println(compiler_version::version_string)
|
||||
exit(0)
|
||||
}
|
||||
/*var gram.construct(): grammer*/
|
||||
// delay construction until we either load it or copy construct it
|
||||
var gram: grammer
|
||||
@@ -61,9 +68,6 @@ fun main(argc: int, argv: **char):int {
|
||||
println("done writing")
|
||||
}
|
||||
|
||||
if (argc <= 1) {
|
||||
error("No input file!\n Call with one argument (the input file), or two arguments (input file and output name)")
|
||||
}
|
||||
var kraken_file_name = string(argv[1])
|
||||
var parse.construct(gram): parser
|
||||
var ast_pass.construct(): ast_transformation
|
||||
|
||||
Reference in New Issue
Block a user