bring back std/ prefix within compiler and ensure it works in bootstrap + bsd (#17902)

* [WIP] bring back std/ prefix within compiler and ensure it works in bootstrap + bsd

* refs https://github.com/nim-lang/Nim/pull/16282#discussion_r616846863
* sounds very similar to https://github.com/nim-lang/Nim/pull/14291
* more: vmops
* update tools/ci_generate.nim
* auto-generate freebsd.yml as well, to avoid duplication with openbsd.yml
* cleanup
* undo temporary CI removal
This commit is contained in:
Timothee Cour 2021-04-30 13:27:53 -07:00 • committed by GitHub
commit d0485e326a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 65 additions and 33 deletions

View file

@ -1,6 +1,6 @@
##[
avoid code duplication in CI pipelines.
For now, this is only used for openbsd, but there is a lot of other code
For now, this is only used for openbsd + freebsd, but there is a lot of other code
duplication that could be removed.
## usage
@ -10,22 +10,14 @@ nim r tools/ci_generate.nim
```
]##
import std/strformat
import std/[strformat, os]
proc genCIopenbsd(batch: int, num: int): string =
proc genCiBsd(header: string, batch: int, num: int): string =
result = fmt"""
## do not edit directly; auto-generated by `nim r tools/ci_generate.nim`
## DO NO EDIT DIRECTLY! auto-generated by `nim r tools/ci_generate.nim`
{header}
image: openbsd/latest
packages:
- gmake
- sqlite3
- node
- boehm-gc
- pcre
- sfml
- sdl2
- libffi
sources:
- https://github.com/nim-lang/Nim
environment:
@ -36,9 +28,10 @@ tasks:
set -e
cd Nim
. ci/funs.sh && nimBuildCsourcesIfNeeded
$nim_csources c koch
$nim_csources c --skipUserCfg --skipParentCfg koch
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
- test: |
set -e
cd Nim
if ! ./koch runCI; then
nim r tools/ci_testresults.nim
@ -51,14 +44,39 @@ triggers:
"""
proc main()=
let dir = ".builds"
# not too large to be resource friendly, refs bug #17107
let num = 2
# if you reduce this, make sure to remove files that shouldn't be generated,
# or better, do the cleanup logic here e.g.: `rm .builds/openbsd_*`
let headerFreebsd = """
# see https://man.sr.ht/builds.sr.ht/compatibility.md#freebsd
image: freebsd/latest
packages:
- databases/sqlite3
- devel/boehm-gc-threaded
- devel/pcre
- devel/sdl20
- devel/sfml
- www/node
- devel/gmake
"""
let headerOpenbsd = """
image: openbsd/latest
packages:
- gmake
- sqlite3
- node
- boehm-gc
- pcre
- sfml
- sdl2
- libffi
"""
for i in 0..<num:
let file = fmt".builds/openbsd_{i}.yml"
let code = genCIopenbsd(i, num)
writeFile(file, code)
writeFile(dir / fmt"openbsd_{i}.yml", genCiBsd(headerOpenbsd, i, num))
writeFile(dir / "freebsd.yml", genCiBsd(headerFreebsd, 0, 1))
when isMainModule:
main()