-
-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
always produce .a files at the beginning of a build #3385
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
d6cb38c
always produce .a files at the beginning of a build
matloob 784c1c0
fix a bad cleanup in stdlib.bzl
matloob dc93dfb
redefine transition in terms of what's kept
matloob 36c5314
Merge branch 'bazelbuild:master' into go
matloob 04c752c
use go_reset_target for the builder
matloob b81c415
remove previosly deleted code that came back in a merge`
matloob 8421750
fix buildifier issue
matloob c45ec9c
try to use tmpdir on WINDOWS
matloob 106e275
try another way of getting gocache dirs for windows
matloob c3b34ad
add output
matloob 7a79e59
debug
matloob de594a0
debug2
matloob 78a8e2e
debug 3
matloob 2b05009
debug 4
matloob 0d37f96
debug 5
matloob f0e29ba
debug 6
matloob 3a35f5b
only compile stdlib .a files for Go 1.20+
matloob f757ef4
set version to 1.20rc1 for CI testing purposes
matloob 24e601f
fix libs attribute of Go sdk to allow zero libs files
matloob b252e0e
fix coverage test
matloob 3b8dab0
get only digits of the part before the next dot
matloob 490ec4b
allow empty
matloob 0d3250c
Merge branch 'master' of github.com:matloob/rules_go into go
matloob 25e52fd
set GOEXPERIMENT=nocoverageredesign
matloob 06fd767
conditionally turn off goexperiment based on versioun
matloob 1b41059
rename variable
matloob 1c8389c
fix flag
matloob bb7eed4
add lcov fix
matloob 6f3008a
address comments, and remove one config of builder
matloob 06ee92d
decide to compile .a files based on whether they exist
matloob b3dfe4b
Merge branch 'master' of https://github.com/bazelbuild/rules_go into go
matloob de75424
Merge branch 'master' of https://github.com/bazelbuild/rules_go into go
matloob 80235ea
fix add call
matloob 929b55c
add nocoverageredesign to experiments earlier
matloob 87f47ef
another small fix
matloob c12a10b
fix double
matloob 108915e
Update go/private/sdk.bzl
matloob bc8eb25
add a simple test doing a build on 1.20rc1
matloob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test") | ||
|
||
go_bazel_test( | ||
name = "build_stdlib_test", | ||
srcs = ["build_stdlib_test.go"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Building with standard libraries with missing .a files | ||
=========== | ||
|
||
Tests to ensure that building with Go 1.20 and later versions of Go, which no longer | ||
include precompiled standard library .a files, continues to work | ||
|
||
build_stdlib_test | ||
-------------- | ||
|
||
Test that a simple binary depending on a simple library can build when the WORKSPACE's | ||
go version is set to 1.20rc1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Copyright 2022 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package build_stdlib_test | ||
|
||
import ( | ||
"bytes" | ||
"os" | ||
"testing" | ||
|
||
"github.com/bazelbuild/rules_go/go/tools/bazel_testing" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
bazel_testing.TestMain(m, bazel_testing.Args{ | ||
Main: ` | ||
-- BUILD.bazel -- | ||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") | ||
|
||
go_binary( | ||
name = "program", | ||
srcs = ["main.go"], | ||
deps = [":library"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
go_library( | ||
name = "library", | ||
srcs = ["library.go"], | ||
importpath = "example.com/library" | ||
) | ||
-- main.go -- | ||
package main | ||
|
||
import "example.com/library" | ||
|
||
func main() { | ||
library.F() | ||
} | ||
-- library.go -- | ||
package library | ||
|
||
func F() {} | ||
`, | ||
}) | ||
} | ||
|
||
const origWrapSDK = `go_wrap_sdk( | ||
name = "go_sdk", | ||
root_file = "@local_go_sdk//:ROOT", | ||
) | ||
|
||
go_register_toolchains()` | ||
|
||
const toolchain120 = `go_register_toolchains(version = "1.20rc1")` | ||
|
||
func TestBoringcryptoExperimentPresent(t *testing.T) { | ||
mustReplaceInFile(t, "WORKSPACE", origWrapSDK, toolchain120) | ||
defer mustReplaceInFile(t, "WORKSPACE", toolchain120, origWrapSDK) | ||
|
||
cmd := bazel_testing.BazelCmd("build", "//:program") | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stdout | ||
if err := cmd.Run(); err != nil { | ||
t.Fatal("failed to run bazel build: ", err) | ||
} | ||
|
||
} | ||
|
||
func mustReplaceInFile(t *testing.T, path, old, new string) { | ||
t.Helper() | ||
if old == new { | ||
return | ||
} | ||
data, err := os.ReadFile(path) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if !bytes.Contains(data, []byte(old)) { | ||
t.Fatalf("bytes to replace %q not found in file %q with contents, %q", old, path, data) | ||
} | ||
data = bytes.ReplaceAll(data, []byte(old), []byte(new)) | ||
if err := os.WriteFile(path, data, 0666); err != nil { | ||
t.Fatal(err) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is back to 1.19.4. Given that 1.20 isn't out yet, maybe we should test it in
go_bazel_test
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a simple test doing a build in 1.20.