builder: use build ID as cache key

Instead of storing an increasing version number in relevant packages
(compiler.Version, interp.Version, cgo.Version, ...), read the build ID
from the currently running executable. This has several benefits:

  * All changes relevant to the compiled packages are caught.
  * No need to bump the version for each change to these packages.
    This avoids merge conflicts.
  * During development, `go install` is enough. No need to run
    `tinygo clean` all the time.

Of course, the drawback is that it might be updated a bit more often
than necessary but I think the overall benefit is big.

Regular release users shouldn't see any difference. Because the tinygo
binary stays the same, the cache works well.
This commit is contained in:
Ayke van Laethem
2021-12-09 19:37:13 +01:00
committed by Nia
parent 763a86cd8e
commit 3e109fca5f
5 changed files with 103 additions and 24 deletions
-5
View File
@@ -20,11 +20,6 @@ import (
"tinygo.org/x/go-llvm"
)
// Version of the compiler pacakge. Must be incremented each time the compiler
// package changes in a way that affects the generated LLVM module.
// This version is independent of the TinyGo version number.
const Version = 25 // last change: add "target-cpu" and "target-features" attributes
func init() {
llvm.InitializeAllTargets()
llvm.InitializeAllTargetMCs()