Partial revert of 38f4d41424

This commit is contained in:
Adam Liddell 2023-10-18 15:20:45 +01:00
parent 38f4d41424
commit aa1786dd77
7 changed files with 40 additions and 13 deletions

View File

@ -6,6 +6,8 @@ tasks:
environment:
CC: clang
build_flags:
- "--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101"
- "--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101"
- "--cxxopt=-std=c++17"
- "--host_cxxopt=-std=c++17"
build_targets:
@ -26,6 +28,8 @@ tasks:
- "//scala/..."
test_flags:
- "--test_output=errors"
- "--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101"
- "--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101"
- "--cxxopt=-std=c++17"
- "--host_cxxopt=-std=c++17"
test_targets:
@ -105,6 +109,8 @@ tasks:
environment:
CC: clang
build_flags:
- "--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101"
- "--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101"
- "--cxxopt=-std=c++17"
- "--host_cxxopt=-std=c++17"
build_targets:
@ -126,6 +132,8 @@ tasks:
- "//swift/..."
test_flags:
- "--test_output=errors"
- "--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101"
- "--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101"
- "--cxxopt=-std=c++17"
- "--host_cxxopt=-std=c++17"
test_targets:
@ -287,6 +295,8 @@ tasks:
shell_commands:
- set -x
- export CC=clang
- export BAZEL_EXTRA_FLAGS="--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101 $BAZEL_EXTRA_FLAGS"
- export BAZEL_EXTRA_FLAGS="--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101 $BAZEL_EXTRA_FLAGS"
- make csharp_csharp_proto_compile_example
- make csharp_csharp_grpc_compile_example
- make csharp_csharp_proto_library_example
@ -298,6 +308,8 @@ tasks:
shell_commands:
- set -x
- export CC=clang
- export BAZEL_EXTRA_FLAGS="--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101 $BAZEL_EXTRA_FLAGS"
- export BAZEL_EXTRA_FLAGS="--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101 $BAZEL_EXTRA_FLAGS"
- make csharp_csharp_proto_compile_example
- make csharp_csharp_grpc_compile_example
- make csharp_csharp_proto_library_example
@ -342,6 +354,8 @@ tasks:
shell_commands:
- set -x
- export CC=clang
- export BAZEL_EXTRA_FLAGS="--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101 $BAZEL_EXTRA_FLAGS"
- export BAZEL_EXTRA_FLAGS="--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101 $BAZEL_EXTRA_FLAGS"
- make fsharp_fsharp_proto_compile_example
- make fsharp_fsharp_grpc_compile_example
- make fsharp_fsharp_proto_library_example
@ -353,6 +367,8 @@ tasks:
shell_commands:
- set -x
- export CC=clang
- export BAZEL_EXTRA_FLAGS="--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101 $BAZEL_EXTRA_FLAGS"
- export BAZEL_EXTRA_FLAGS="--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101 $BAZEL_EXTRA_FLAGS"
- make fsharp_fsharp_proto_compile_example
- make fsharp_fsharp_grpc_compile_example
- make fsharp_fsharp_proto_library_example

View File

@ -2,7 +2,7 @@
load("//csharp:csharp_grpc_compile.bzl", "csharp_grpc_compile")
load("//:defs.bzl", "bazel_build_rule_common_attrs", "proto_compile_attrs")
load("@rules_dotnet//dotnet:defs.bzl", "csharp_library")
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "csharp_library")
def csharp_grpc_library(name, **kwargs):
# Compile protos

View File

@ -2,7 +2,7 @@
load("//csharp:csharp_proto_compile.bzl", "csharp_proto_compile")
load("//:defs.bzl", "bazel_build_rule_common_attrs", "proto_compile_attrs")
load("@rules_dotnet//dotnet:defs.bzl", "csharp_library")
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "csharp_library")
def csharp_proto_library(name, **kwargs):
# Compile protos

View File

@ -1,5 +1,5 @@
load("//csharp:defs.bzl", "csharp_grpc_library")
load("@rules_dotnet//dotnet:defs.bzl", "csharp_binary", "csharp_library")
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "csharp_binary", "csharp_library")
csharp_grpc_library(
name = "routeguide.dll",

View File

@ -2,10 +2,10 @@
load(
"//:repositories.bzl",
"rules_dotnet",
"io_bazel_rules_dotnet",
"rules_proto_grpc_repos",
)
def csharp_repos(**kwargs): # buildifier: disable=function-docstring
rules_proto_grpc_repos(**kwargs)
rules_dotnet(**kwargs)
io_bazel_rules_dotnet(**kwargs)

View File

@ -49,7 +49,7 @@ nuget_rules_proto_grpc_packages()`)
var csharpLibraryRuleTemplateString = `load("//{{ .Lang.Dir }}:{{ .Lang.Name }}_{{ .Rule.Kind }}_compile.bzl", "{{ .Lang.Name }}_{{ .Rule.Kind }}_compile")
load("//:defs.bzl", "bazel_build_rule_common_attrs", "proto_compile_attrs")
load("@rules_dotnet//dotnet:defs.bzl", "csharp_library")
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "csharp_library")
def {{ .Rule.Name }}(name, **kwargs):
# Compile protos

View File

@ -22,10 +22,21 @@ var ciPlatformsMap = map[string][]string{
"macos": []string{"macos"},
}
var extraPlatformFlags = map[string][]string{
"ubuntu2204": []string{},
"windows": []string{},
"macos": []string{},
// https://github.com/bazelbuild/rules_dotnet/issues/225
// TODO: Remove if becomes unnecessary
var dotnetPlatformFlags = map[string][]string{
"ubuntu2204": []string{
"--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101",
"--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101",
},
"windows": []string{
"--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:windows_amd64_6.0.101",
"--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:windows_amd64_6.0.101",
},
"macos": []string{
"--host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101",
"--platforms=@io_bazel_rules_dotnet//dotnet/toolchain:darwin_amd64_6.0.101",
},
}
func main() {
@ -471,7 +482,7 @@ func mustWriteBazelCIPresubmitYml(dir string, languages []*Language, availableTe
out.w(" environment:")
out.w(` CC: clang`)
out.w(" build_flags:")
for _, flag := range extraPlatformFlags[ciPlatform] {
for _, flag := range dotnetPlatformFlags[ciPlatform] {
out.w(` - "%s"`, flag)
}
out.w(` - "--cxxopt=-std=c++17"`)
@ -485,7 +496,7 @@ func mustWriteBazelCIPresubmitYml(dir string, languages []*Language, availableTe
}
out.w(" test_flags:")
out.w(` - "--test_output=errors"`)
for _, flag := range extraPlatformFlags[ciPlatform] {
for _, flag := range dotnetPlatformFlags[ciPlatform] {
out.w(` - "%s"`, flag)
}
out.w(` - "--cxxopt=-std=c++17"`)
@ -534,7 +545,7 @@ func mustWriteBazelCIPresubmitYml(dir string, languages []*Language, availableTe
out.w(" - set -x")
out.w(" - export CC=clang")
if lang.Name == "csharp" || lang.Name == "fsharp" {
for _, flag := range extraPlatformFlags[ciPlatform] {
for _, flag := range dotnetPlatformFlags[ciPlatform] {
out.w(` - export BAZEL_EXTRA_FLAGS="%s $BAZEL_EXTRA_FLAGS"`, flag)
}
}