40
40
// hashes of already-released versions. Then just hardcode it here.
41
41
_tagHashes = map [string ]string {
42
42
"v2.0.0-rc2" : "40dff82816735e631e8bd51ede3af1c4ed1ad4646928ffb6a0e53e228e55738c" ,
43
- "v2.0.0" : "57f03a6c29793e8add7bd64186fc8066d23b5ffd06fe9cc6b0b8c499914d3a65" ,
43
+ "v2.0.0" : "57f03a6c29793e8add7bd64186fc8066d23b5ffd06fe9cc6b0b8c499914d3a65" ,
44
44
}
45
45
46
46
_boilerplateFiles = []string {
@@ -465,7 +465,7 @@ func checkZigMirrored(repoRoot string) error {
465
465
// - so we'd rather pick a single platform and test it.
466
466
// - because windows coverage is smallest, let's take the windows platform.
467
467
url := strings .Replace (upstream .urlTemplate , "{host_platform}" , "windows-x86_64" , 1 )
468
- url = strings .Replace (url , "{version}" , upstream .version , 1 )
468
+ url = strings .ReplaceAll (url , "{version}" , upstream .version )
469
469
url = strings .Replace (url , "{_ext}" , "zip" , 1 )
470
470
471
471
log ("checking if zig is mirorred in %q" , url )
@@ -495,6 +495,7 @@ func parseZigUpstream(defsPath string) (zigUpstream, error) {
495
495
return zigUpstream {}, err
496
496
}
497
497
498
+ var nightlyFormat , releaseFormat string
498
499
for _ , expr := range parsed .Stmt {
499
500
def , ok := expr .(* bzl.AssignExpr )
500
501
if ! ok {
@@ -507,8 +508,10 @@ func parseZigUpstream(defsPath string) (zigUpstream, error) {
507
508
switch key .Name {
508
509
case "_VERSION" :
509
510
to = & ret .version
510
- case "URL_FORMAT_BAZELMIRROR" :
511
- to = & ret .urlTemplate
511
+ case "URL_FORMAT_RELEASE" :
512
+ to = & releaseFormat
513
+ case "URL_FORMAT_NIGHTLY" :
514
+ to = & nightlyFormat
512
515
default :
513
516
continue
514
517
}
@@ -521,9 +524,22 @@ func parseZigUpstream(defsPath string) (zigUpstream, error) {
521
524
* to = value .Value
522
525
}
523
526
524
- if ret .version == "" || ret . urlTemplate == "" {
525
- return zigUpstream {}, errors .New ("_VERSION and/or URL_FORMAT_BAZELMIRROR not found" )
527
+ if ret .version == "" {
528
+ return zigUpstream {}, errors .New ("_VERSION not found" )
526
529
}
530
+ if strings .Contains (ret .version , "dev" ) {
531
+ ret .urlTemplate = nightlyFormat
532
+ } else {
533
+ ret .urlTemplate = releaseFormat
534
+ }
535
+ if ret .urlTemplate == "" {
536
+ return zigUpstream {}, fmt .Errorf ("url format for %q not found" , ret .version )
537
+ }
538
+ ret .urlTemplate = strings .Replace (ret .urlTemplate ,
539
+ "https://ziglang.org/" ,
540
+ "https://mirror.bazel.build/ziglang.org/" ,
541
+ 1 ,
542
+ )
527
543
528
544
return ret , nil
529
545
}
0 commit comments