-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## What? The `out` attribute was broken after we started generating deps.json and runtimeconfig.json files. The internals visible to handling was also not correct when using the `out` attribute Fixes #341
- Loading branch information
Showing
10 changed files
with
136 additions
and
10 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"Test that the `out` attribute works as expected" | ||
|
||
load( | ||
"@rules_dotnet//dotnet:defs.bzl", | ||
"csharp_library", | ||
"csharp_nunit_test", | ||
) | ||
|
||
csharp_nunit_test( | ||
name = "lib_test", | ||
srcs = ["libtest.cs"], | ||
out = "OtherLibTest", | ||
private_deps = [ | ||
"@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.ref", | ||
], | ||
target_frameworks = ["net6.0"], | ||
deps = [ | ||
":lib", | ||
], | ||
) | ||
|
||
csharp_library( | ||
name = "lib", | ||
srcs = ["lib.cs"], | ||
out = "OtherLib", | ||
# Note that the we use the name that is used in the `out` attribute of the `lib_test` target. | ||
internals_visible_to = [ | ||
"OtherLibTest", | ||
], | ||
private_deps = [ | ||
"@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.ref", | ||
], | ||
target_frameworks = ["net6.0"], | ||
deps = [], | ||
) |
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,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Lib | ||
{ | ||
public static class Stuff | ||
{ | ||
public static bool IsTrue() | ||
{ | ||
return true; | ||
} | ||
internal static bool IsTrueInternal() | ||
{ | ||
return true; | ||
} | ||
} | ||
} |
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,20 @@ | ||
using Lib; | ||
using NUnit.Framework; | ||
using System.Linq; | ||
|
||
[TestFixture] | ||
public sealed class LibTests | ||
{ | ||
[Test] | ||
public void SomeTest() | ||
{ | ||
Assert.AreEqual(true, Stuff.IsTrue()); | ||
} | ||
|
||
[Test] | ||
public void SomeTestInternal() | ||
{ | ||
Assert.AreEqual(true, Stuff.IsTrueInternal()); | ||
} | ||
} | ||
|
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,38 @@ | ||
"Test that the `out` attribute works as expected" | ||
|
||
load( | ||
"@rules_dotnet//dotnet:defs.bzl", | ||
"fsharp_library", | ||
"fsharp_nunit_test", | ||
) | ||
|
||
fsharp_nunit_test( | ||
name = "lib_test", | ||
srcs = ["libtest.fs"], | ||
out = "OtherLibTest", | ||
private_deps = [ | ||
"@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.ref", | ||
], | ||
target_frameworks = ["net6.0"], | ||
deps = [ | ||
":lib", | ||
"@rules_dotnet_dev_nuget_packages//fsharp.core", | ||
], | ||
) | ||
|
||
fsharp_library( | ||
name = "lib", | ||
srcs = ["lib.fs"], | ||
out = "OtherLib", | ||
# Note that the we use the name that is used in the `out` attribute of the `lib_test` target. | ||
internals_visible_to = [ | ||
"OtherLibTest", | ||
], | ||
private_deps = [ | ||
"@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.ref", | ||
], | ||
target_frameworks = ["net6.0"], | ||
deps = [ | ||
"@rules_dotnet_dev_nuget_packages//fsharp.core", | ||
], | ||
) |
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,5 @@ | ||
namespace Lib | ||
|
||
module Stuff = | ||
let isTrue () = true | ||
let internal isTrueInternal () = true |
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,14 @@ | ||
module Tests | ||
|
||
open Lib | ||
open NUnit.Framework | ||
open System.Linq | ||
|
||
[<TestFixture>] | ||
type LibTests() = | ||
[<Test>] | ||
member this.SomeTest() = Assert.AreEqual(true, Stuff.isTrue ()) | ||
|
||
[<Test>] | ||
member this.SomeTestInternal() = | ||
Assert.AreEqual(true, Stuff.isTrueInternal ()) |
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