summary refs log tree commit diff stats
path: root/ci
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-04-30 22:24:41 -0700
committerGitHub <noreply@github.com>2021-05-01 07:24:41 +0200
commit1f1d85bb9c614d93ce38becdcc421dda00264a75 (patch)
tree1e012ea3f6bb45383451fc79bfe369702a33bf5d /ci
parentabb8a73134597297b2c14567f7f8d72f6b723d24 (diff)
downloadNim-1f1d85bb9c614d93ce38becdcc421dda00264a75.tar.gz
reuse config/build_config.txt for all bootstrap scripts (posix + windows + ci); use build_all.bat in 1 CI, fix bug in build_all.bat (#17899)
* reuse config/build_config.txt for all bootstrap scripts (posix + windows + ci)
* ci_docs: use build_all.bat in CI (just in that pipeline) to ensure it keeps working
* fixup
* fix pre-existing bug in build_all.bat
* fixup
* cp => copy /y
* auto-generate build_all.bat, build_all.sh
* fixup
Diffstat (limited to 'ci')
-rw-r--r--ci/build_autogen.bat26
-rw-r--r--ci/funs.sh8
2 files changed, 30 insertions, 4 deletions
diff --git a/ci/build_autogen.bat b/ci/build_autogen.bat
new file mode 100644
index 000000000..8b1113175
--- /dev/null
+++ b/ci/build_autogen.bat
@@ -0,0 +1,26 @@
+@echo off
+rem DO NO EDIT DIRECTLY! auto-generated by `nim r tools/ci_generate.nim`
+rem Build development version of the compiler; can be rerun safely
+rem bare bones version of ci/funs.sh adapted for windows.
+
+rem Read in some common shared variables (shared with other tools),
+rem see https://stackoverflow.com/questions/3068929/how-to-read-file-contents-into-a-variable-in-a-batch-file
+for /f "delims== tokens=1,2" %%G in (config/build_config.txt) do set %%G=%%H
+SET nim_csources=bin\nim_csources_%nim_csourcesHash%.exe
+echo "building from csources: %nim_csources%"
+
+if not exist %nim_csourcesDir% (
+  git clone -q --depth 1 %nim_csourcesUrl% %nim_csourcesDir%
+)
+
+if not exist %nim_csources% (
+  cd %nim_csourcesDir%
+  git checkout %nim_csourcesHash%
+  echo "%PROCESSOR_ARCHITECTURE%"
+  if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
+    SET ARCH=64
+  )
+  CALL build.bat
+  cd ..
+  copy /y bin\nim.exe  %nim_csources%
+)
diff --git a/ci/funs.sh b/ci/funs.sh
index 7a6c66722..5158f38d5 100644
--- a/ci/funs.sh
+++ b/ci/funs.sh
@@ -32,9 +32,7 @@ nimIsCiSkip(){
 }
 
 nimDefineVars(){
-  nim_csourcesDir=csources_v1 # where we clone
-  nim_csourcesUrl=https://github.com/nim-lang/csources_v1.git
-  nim_csourcesHash=a8a5241f9475099c823cfe1a5e0ca4022ac201ff
+  . config/build_config.txt
   nim_csources=bin/nim_csources_$nim_csourcesHash
 }
 
@@ -88,9 +86,11 @@ nimBuildCsourcesIfNeeded(){
       if test -d "$nim_csourcesDir"; then
         echo "$nim_csourcesDir exists."
       else
-        # depth 1: adjust as needed in case useful for `git bisect`
+        # Note: using git tags would allow fetching just what's needed, unlike git hashes, e.g.
+        # via `git clone -q --depth 1 --branch $tag $nim_csourcesUrl`.
         echo_run git clone -q --depth 1 $nim_csourcesUrl "$nim_csourcesDir"
         echo_run git -C "$nim_csourcesDir" checkout $nim_csourcesHash
+        # if needed we could also add: `git reset --hard $nim_csourcesHash`
       fi
       _nimBuildCsourcesIfNeeded "$@"
     fi