diff --git a/.gitpod.yml b/.gitpod.yml index 554be24e..65a4a1e2 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -9,9 +9,9 @@ tasks: vscode: extensions: - - BazelBuild.vscode-bazel@0.4.1 - - Ionide.Ionide-fsharp@5.7.3 - - muhammad-sammy.csharp@1.23.16 + - BazelBuild.vscode-bazel@0.5.0 + - Ionide.Ionide-fsharp@5.11.1 + - muhammad-sammy.csharp@1.24.0 github: prebuilds: diff --git a/.gitpod/gitpod.Dockerfile b/.gitpod/gitpod.Dockerfile index 5b9ed296..28d9ee19 100644 --- a/.gitpod/gitpod.Dockerfile +++ b/.gitpod/gitpod.Dockerfile @@ -64,11 +64,11 @@ RUN curl -o ibazel_linux_amd64 -fsSL https://github.com/bazelbuild/bazel-watcher && chmod +x $HOME/bin/ibazel # Install buildifier -RUN curl -o buildifier-linux-amd64 -fsSL https://github.com/bazelbuild/buildtools/releases/download/4.2.2/buildifier-linux-amd64 \ +RUN curl -o buildifier-linux-amd64 -fsSL https://github.com/bazelbuild/buildtools/releases/download/5.0.1/buildifier-linux-amd64 \ && mv ./buildifier-linux-amd64 $HOME/bin/buildifier \ && chmod +x $HOME/bin/buildifier # Install buildozer -RUN curl -o buildozer-linux-amd64 -fsSL https://github.com/bazelbuild/buildtools/releases/download/4.2.2/buildozer-linux-amd64 \ +RUN curl -o buildozer-linux-amd64 -fsSL https://github.com/bazelbuild/buildtools/releases/download/5.0.1/buildozer-linux-amd64 \ && mv ./buildozer-linux-amd64 $HOME/bin/buildozer \ && chmod +x $HOME/bin/buildozer diff --git a/dotnet/private/actions/assembly_core.bzl b/dotnet/private/actions/assembly_core.bzl index c096647c..5f8f6c22 100644 --- a/dotnet/private/actions/assembly_core.bzl +++ b/dotnet/private/actions/assembly_core.bzl @@ -188,6 +188,11 @@ def emit_assembly_core_csharp( arguments = action_args, mnemonic = "Compile", tools = runner_tools, + env = { + # Set so that compilations work on remote execution workers that don't have ICU installed + # ICU should not be required during compliation but only at runtime + "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT": "1", + }, progress_message = ( "Compiling " + dotnet.label.package + ":" + dotnet.label.name ), @@ -217,6 +222,7 @@ def emit_assembly_core_csharp( return new_library +# buildifier: disable=unused-variable def emit_assembly_core_fsharp( dotnet, name, @@ -407,6 +413,9 @@ def emit_assembly_core_fsharp( # If the script is in a directory using a 'global.json' then ensure the relevant .NET SDK is installed. The output from '/path/to/dotnet --version' in the directory '/path' was: # 'The user's home directory could not be determined. Set the 'DOTNET_CLI_HOME' environment variable to specify the directory to use.' and the exit code was '1'. "DOTNET_CLI_HOME": runner.executable.dirname, + # Set so that compilations work on remote execution workers that don't have ICU installed + # ICU should not be required during compliation but only at runtime + "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT": "1", }, progress_message = ( "Compiling " + dotnet.label.package + ":" + dotnet.label.name diff --git a/dotnet/private/actions/resolve.bzl b/dotnet/private/actions/resolve.bzl index 308139ba..cfa9691b 100644 --- a/dotnet/private/actions/resolve.bzl +++ b/dotnet/private/actions/resolve.bzl @@ -257,6 +257,7 @@ def _ResolveTransitiveLevel9(arg, version): fail("Unknown argument %s" % arg) +# buildifier: disable=unused-variable def _ResolveTransitiveLevel10(arg, version): result = [] if (type(arg)) == "list": diff --git a/dotnet/private/actions/resx_core.bzl b/dotnet/private/actions/resx_core.bzl index 07c02ac3..5dce9574 100644 --- a/dotnet/private/actions/resx_core.bzl +++ b/dotnet/private/actions/resx_core.bzl @@ -5,7 +5,7 @@ load( "DotnetResourceInfo", ) -def _make_runner_arglist(dotnet, source, output, resgen): +def _make_runner_arglist(dotnet, source, output): args = dotnet.actions.args() if type(source) == "Target": @@ -46,7 +46,7 @@ def emit_resx_core( else: result = dotnet.actions.declare_file(out) - args = _make_runner_arglist(dotnet, src, result, customresgen.files_to_run.executable.path) + args = _make_runner_arglist(dotnet, src, result) # We use the command to extrace shell path and force runfiles creation resolve = dotnet._ctx.resolve_tools(tools = [customresgen]) diff --git a/dotnet/private/context.bzl b/dotnet/private/context.bzl index 74645724..f44a6c2e 100644 --- a/dotnet/private/context.bzl +++ b/dotnet/private/context.bzl @@ -42,12 +42,6 @@ DotnetContextInfo = provider( }, ) -def _declare_file(dotnet, path = None, ext = None, sibling = None): - result = path if path else dotnet._ctx.label.name - if ext: - result += ext - return dotnet.actions.declare_file(result, sibling = sibling) - def new_library( dotnet, name = None, @@ -137,8 +131,6 @@ def dotnet_context(ctx, lang): Returns: DotnetContextInfo: [DotnetContextInfo](api.md#dotnetcontextinfo) provider for ctx rule. """ - attr = ctx.attr - if lang == "csharp": toolchain = ctx.toolchains["@io_bazel_rules_dotnet//dotnet:toolchain_type_csharp_core"] elif lang == "fsharp": diff --git a/dotnet/private/rules/csharp/library.bzl b/dotnet/private/rules/csharp/library.bzl index 7bb36d94..791dcc14 100644 --- a/dotnet/private/rules/csharp/library.bzl +++ b/dotnet/private/rules/csharp/library.bzl @@ -35,8 +35,6 @@ def _library_impl(ctx): version = (0, 0, 0, 0, "") if ctx.attr.version == "" else parse_version(ctx.attr.version), ) - runfiles = ctx.runfiles(files = [], transitive_files = library.runfiles) - return [ library, DefaultInfo( diff --git a/dotnet/private/rules/fsharp/library.bzl b/dotnet/private/rules/fsharp/library.bzl index 4cddd8c0..fd4bc441 100644 --- a/dotnet/private/rules/fsharp/library.bzl +++ b/dotnet/private/rules/fsharp/library.bzl @@ -35,8 +35,6 @@ def _library_impl(ctx): version = (0, 0, 0, 0, "") if ctx.attr.version == "" else parse_version(ctx.attr.version), ) - runfiles = ctx.runfiles(files = [], transitive_files = library.runfiles) - return [ library, DefaultInfo( diff --git a/dotnet/private/rules/nuget.bzl b/dotnet/private/rules/nuget.bzl index 76eea34d..5ec8e124 100644 --- a/dotnet/private/rules/nuget.bzl +++ b/dotnet/private/rules/nuget.bzl @@ -9,7 +9,6 @@ def _dotnet_nuget_impl( build_file_content = None): """dotnet_nuget_impl emits actions for exposing nunit assmebly.""" - package = ctx.attr.package output_dir = ctx.path("") url = ctx.attr.source + "/" + ctx.attr.package + "/" + ctx.attr.version ctx.download_and_extract(url, output_dir, ctx.attr.sha256, type = "zip") @@ -123,24 +122,6 @@ _FUNC2 = """ """ -def _get_importlib(func, func2, name, lib, ref, deps, files, version): - depsstr = "" - for d in deps: - depsstr += " \"{}\",\n".format(d) - datastr = "" - for f in files: - datastr += " \"{}\",\n".format(f) - - if lib != "": - if ref != "" and ref != None: - result = _FUNC_WITH_REF.format(func, name, lib, ref, depsstr, datastr, version) - else: - result = _FUNC.format(func, name, lib, depsstr, datastr, version) - else: - result = _FUNC2.format(func2, name, depsstr, datastr) - - return result - def _get_importlib_withframework(func, func2, name, frameworks, lib, ref, deps, files, version): result = "" for framework in frameworks: @@ -197,7 +178,6 @@ def _nuget_package_impl(ctx): content = content + """"{}": "{}",""".format(key, val) content += """}, no_match_error = "framework not known"), visibility=["//visibility:public"])\n""" - package = ctx.attr.package output_dir = ctx.path("") urls = [s + "/" + ctx.attr.package + "/" + ctx.attr.version for s in ctx.attr.source] ctx.download_and_extract(urls, output_dir, ctx.attr.sha256, type = "zip") diff --git a/dotnet/private/rules/resource_core.bzl b/dotnet/private/rules/resource_core.bzl index 8895dda3..e2c4da55 100644 --- a/dotnet/private/rules/resource_core.bzl +++ b/dotnet/private/rules/resource_core.bzl @@ -1,9 +1,5 @@ ".resource rules" -load( - "@io_bazel_rules_dotnet//dotnet/private:context.bzl", - "dotnet_context", -) load( "@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetResourceInfo", @@ -13,7 +9,6 @@ load("@rules_dotnet_skylib//lib:paths.bzl", "paths") def _resource_impl(ctx): """core_resource_impl emits actions for embeding file as resource.""" - dotnet = dotnet_context(ctx, "csharp") name = ctx.label.name resource = DotnetResourceInfo( @@ -31,9 +26,6 @@ def _resource_impl(ctx): ] def _resource_multi_impl(ctx): - dotnet = dotnet_context(ctx, "csharp") - name = ctx.label.name - if ctx.attr.identifierBase != "" and ctx.attr.fixedIdentifierBase != "": fail("Both identifierBase and fixedIdentifierBase cannot be specified") diff --git a/dotnet/private/rules/resx.bzl b/dotnet/private/rules/resx.bzl index b3e22c92..4f9b8a06 100644 --- a/dotnet/private/rules/resx.bzl +++ b/dotnet/private/rules/resx.bzl @@ -33,7 +33,6 @@ def _resx_impl(ctx): def _resx_multi_impl(ctx): dotnet = dotnet_context(ctx, "csharp") - name = ctx.label.name if ctx.attr.identifierBase != "" and ctx.attr.fixedIdentifierBase != "": fail("Both identifierBase and fixedIdentifierBase cannot be specified") diff --git a/dotnet/toolchain/toolchains.bzl b/dotnet/toolchain/toolchains.bzl index bb08c3c4..cef3932b 100644 --- a/dotnet/toolchain/toolchains.bzl +++ b/dotnet/toolchain/toolchains.bzl @@ -173,6 +173,7 @@ _toolchains = _generate_toolchains() _label_prefix = "@io_bazel_rules_dotnet//dotnet/toolchain:" +# buildifier: disable=unused-variable def dotnet_register_toolchains(name = None): """The macro registers all toolchains.""" @@ -201,6 +202,7 @@ def declare_toolchains(): ) # buildifier: disable=function-docstring-args +# buildifier: disable=unused-variable def declare_constraints(name = None): """Generates constraint_values and platform targets for valid platforms. """