gg_one_core 2.19.0
gg_one_core: ^2.19.0 copied to clipboard
Kernel, checks and publish configuration of the gg_one tool family - state caching, command bases, verification steps and gg-publish.json handling.
gg_one_core #
Kernel, checks and publish configuration of the gg_one tool family - state caching, command bases, verification steps and gg-publish.json handling.
Settings #
GgRc reads the settings of gg from two JSON files with the same structure:
the user's ~/.gg_rc ($GG_RC names another file) and a repository's
.gg/gg_rc. The keys follow the command path and end with the flag they
preset:
{
"do": {
"upgrade": { "deps": { "majorVersions": false } }
},
"can": {
"commit": { "checks": false }
}
}
- Precedence: a flag on the command line, then
.gg/gg_rc, then~/.gg_rc, then the built-in default do.upgrade.deps.majorVersionsandcan.commit.checksbelong to one repository (GgRc.repoDefaults, bothtrue): only.gg/gg_rcmay set them, a~/.gg_rcholding one is reported as brokenGgRc.load(ggLog:, repo:)reads~/.gg_rc— written withGgRc.builtInDefaultswhen missing — and, withrepo,.gg/gg_rcon topGgRc.builtInDefaultsleavesdo.add.transitiveoff. A~/.gg_rcthat still holds exactly what an older gg wrote (GgRc.formerBuiltInDefaults) gets the current defaults written into it; a file anyone edited stays as it isGgRc.loadRepo(repo, create:)reads.gg/gg_rconly;create: truewrites a missing file withGgRc.repoDefaultsand adds!.gg/gg_rcbelow a.gg/*rule of.gitignore, so it stays trackedflag(keys)answers a setting; invalid JSON or a non-boolean value throws with the file and how to fix itCommandCluster(checksSetting: GgRc.commitChecks)skips its commands and records success when the setting isfalse
Running tasks in parallel #
runInParallel(count:, task:, ggLog:, maxParallel:, cancelOnError:)runs tasks at the same time and logs them as if they had run in a loopGgParallelismholds one limit per kind of work:heavy(test runs, analyzers) a quarter of the processors, 1 to 4;lightthe processors, 2 to 16;network8,pushes4,pullRequests10,publishes4- The environment variable
GG_PARALLEL=<n>setsheavyand caps the others;GG_PARALLEL=1runs everything one after the other TaskSlots.heavy()are the slots for the heavy part of tasks; a test run in one of them shares the test files of the machine with the runs under way (GgParallelism.testFilesPerRun)
One gg run per repository #
RepoLock.use(directory:, ggLog:, body:)lets one run at a time work in a repository; a second run waits and learns that it waited- The lock is the file
.git/gg-run-lockwith its holder and an expiry date: renewed every 10 s, free again after 30 s without a renewal CommandClusterruns its commands inside of it and takes over the result of the run it waited for