Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
purkhusid committed Apr 3, 2024
1 parent e00e8a2 commit a7f4e4e
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 48 deletions.
4 changes: 0 additions & 4 deletions docs/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 25 additions & 23 deletions docs/defs.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions dotnet/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,7 @@ def fsharp_nunit_test(
**kwargs
)

def publish_binary(name, binary, target_framework, self_contained = False, runtime_identifier = None, **kwargs):
_publish_binary(
name = "{}".format(name),
binary = binary,
target_framework = target_framework,
self_contained = self_contained,
runtime_identifier = runtime_identifier,
**kwargs
)

publish_binary = _publish_binary
import_library = _import_library
import_dll = _import_dll
nuget_repo = _nuget_repo
Expand Down
2 changes: 0 additions & 2 deletions dotnet/private/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ DotnetAssemblyCompileInfo = provider(
"internals_visible_to": "list[string]: A list of assemblies that can use the assemblies listed in iref for compilation. See docs/ReferenceAssemblies.md for more info.",
"compile_data": "list[File]: Compile data files",
"exports": "list[File]",

# TODO: Maybe this should just be deps?
"transitive_refs": "depset[File]: Transitive reference-only assemblies containing only public symbols. Only used when strict deps are off.",
"transitive_compile_data": "depset[File]: Transitive compile data files. Only used when strict deps are off.",
"transitive_analyzers": "depset[File]: Transitive analyzer dlls. Only used when strict deps are off.",
Expand Down
5 changes: 1 addition & 4 deletions dotnet/private/rules/publish_binary/publish_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ def _generate_depsjson(
)

def _publish_binary_impl(ctx):
# repo_mapping_manifest is only available in Bazel 7.0+
repo_mapping_manifest = None
if ctx.attr.binary[0][DefaultInfo].files_to_run and hasattr(ctx.attr.binary[0][DefaultInfo].files_to_run, "repo_mapping_manifest"):
repo_mapping_manifest = ctx.attr.binary[0][DefaultInfo].files_to_run.repo_mapping_manifest
repo_mapping_manifest = ctx.attr.binary[0][DefaultInfo].files_to_run.repo_mapping_manifest

assembly_compile_info = ctx.attr.binary[0][DotnetAssemblyCompileInfo]
assembly_runtime_info = ctx.attr.binary[0][DotnetAssemblyRuntimeInfo]
Expand Down
15 changes: 14 additions & 1 deletion dotnet/private/sdk/gen/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
TODO: Document how to update the SDK versions
# SDK Generation
This program generates the Bazel targets required for rules_dotnet to work with the upstream .Net SDK.

It does the following:

1. Updates the available .Net SDK versions so that the end user of rules_dotnet can choose the SDK version they want to use.
2. Updates the avilable runtime identifiers (RIDs) so that the end user of rules_dotnet can choose the RID they want to when publishing.
3. Updates and creates the Bazel targest for the targeting/runtime/apphost packs that are fetched by rules_dotnet when building.

## Usage

To run the program simply run the `update-sdk.sh` script


1 change: 0 additions & 1 deletion dotnet/private/sdk/gen/TargetingPacks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ let generateTargetingPacksNugetRepo (targetingPacksFile: string) (outputFolder:
sha512 = packageInfo.sha512sri
sources = [ NugetHelpers.nugetV3Feed ]
netrc = None
// TODO: Look into if the dependencies are needed for targeting packs like NETStandard.Library
dependencies = Dictionary<string, string seq>()
targeting_pack_overrides = packageInfo.overrides
framework_list = packageInfo.frameworkList })
Expand Down
2 changes: 1 addition & 1 deletion dotnet/private/transitions/tfm_transition.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _impl(settings, attr):
if hasattr(attr, "runtime_identifier") and attr.runtime_identifier != "":
runtime_identifier = attr.runtime_identifier
elif runtime_identifier == "base":
# If the runtime_identifier attribute is not set and the incoming value is "base", we will use the platform to determine the rid since upstream target has set the runtime identifier
# If the runtime_identifier attribute is not set and the incoming value is "base", we will use the platform to determine the rid since no upstream target has set the runtime identifier
runtime_identifier = _platform_to_rid()

return dicts.add({"//dotnet:target_framework": transitioned_tfm}, {"//dotnet:rid": runtime_identifier}, FRAMEWORK_COMPATABILITY_TRANSITION_OUTPUTS[transitioned_tfm], RID_COMPATABILITY_TRANSITION_OUTPUTS[runtime_identifier])
Expand Down
1 change: 1 addition & 0 deletions examples/aspnetcore/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ csharp_binary(
publish_binary(
name = "publish",
binary = ":aspnetcore",
project_sdk = "web"
self_contained = True,
target_framework = "net6.0",
)
2 changes: 0 additions & 2 deletions tools/runfiles/Runfiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ public override IDictionary<string, string> GetEnvVars()
result.Add("RUNFILES_MANIFEST_FILE", manifestPath);
var runfilesDir = findRunfilesDir(manifestPath);
result.Add("RUNFILES_DIR", runfilesDir);
// TODO(laszlocsomor): remove JAVA_RUNFILES once the Java launcher can pick up RUNFILES_DIR.
result.Add("JAVA_RUNFILES", runfilesDir);
return result;
}
Expand Down Expand Up @@ -556,7 +555,6 @@ public override IDictionary<string, string> GetEnvVars()
{
var result = new Dictionary<string, string>(2);
result.Add("RUNFILES_DIR", runfilesRoot);
// TODO(laszlocsomor): remove JAVA_RUNFILES once the Java launcher can pick up RUNFILES_DIR.
result.Add("JAVA_RUNFILES", runfilesRoot);
return result;
}
Expand Down

0 comments on commit a7f4e4e

Please sign in to comment.