From 27dba453e8ad7dc5bbdb9fe023c3e71ea2bc80bb Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko Date: Wed, 6 Dec 2023 14:47:46 +0300 Subject: [PATCH 1/2] Fix nuget target framework --- dotnet/private/nuget_pack.bzl | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/dotnet/private/nuget_pack.bzl b/dotnet/private/nuget_pack.bzl index 6fc2e10a00c1c..1bf1b5e103a10 100644 --- a/dotnet/private/nuget_pack.bzl +++ b/dotnet/private/nuget_pack.bzl @@ -13,16 +13,7 @@ def _guess_dotnet_version(label, assembly_info): # The dirname will be something like `bazel-out/darwin_arm64-fastbuild-ST-5c013bc87029/bin/dotnet/src/webdriver/bazelout/net5.0` # Note that the last segment of the path is the framework we're # targeting. Happy days! - full_path = assembly_info.libs[0].dirname - - # And that framework is after the constant string `bazelout` - index = full_path.index(label.name) - - # The actual start is at the _end_ of the `bazelout` string - index += len(label.name) - - to_return = full_path[index:].replace("/", "") - return to_return.replace("/", "") + return assembly_info.libs[0].dirname.split('/')[::-1][0] def nuget_pack_impl(ctx): nuspec = ctx.actions.declare_file("%s-generated.nuspec" % ctx.label.name) From 1aaa11676385c4800731599bc1236a1b2e5bb290 Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko Date: Wed, 6 Dec 2023 14:59:22 +0300 Subject: [PATCH 2/2] Pedantant linter --- dotnet/private/nuget_pack.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/private/nuget_pack.bzl b/dotnet/private/nuget_pack.bzl index 1bf1b5e103a10..8ef0539ab7249 100644 --- a/dotnet/private/nuget_pack.bzl +++ b/dotnet/private/nuget_pack.bzl @@ -13,7 +13,7 @@ def _guess_dotnet_version(label, assembly_info): # The dirname will be something like `bazel-out/darwin_arm64-fastbuild-ST-5c013bc87029/bin/dotnet/src/webdriver/bazelout/net5.0` # Note that the last segment of the path is the framework we're # targeting. Happy days! - return assembly_info.libs[0].dirname.split('/')[::-1][0] + return assembly_info.libs[0].dirname.split("/")[::-1][0] def nuget_pack_impl(ctx): nuspec = ctx.actions.declare_file("%s-generated.nuspec" % ctx.label.name)