Brightspace / rules_csharp

Bazel rules for C#
Apache License 2.0
8 stars 5 forks source link

Add Diamond example, and fix a design bug #37

Closed j3parker closed 5 years ago

j3parker commented 5 years ago

Whew! I added examples/diamond/in excitement after #33 and when I did a build I got errors like:

ERROR: file 'examples/diamond/Bottom.dll' is generated by these conflicting actions:
Label: //examples/diamond:Bottom
RuleClass: csharp_library rule
Configuration: 9db7557022224156d4ba00ff45ffc062
Mnemonic: CSharpCompile
Action key: 9dc446100544dbedb8f7a06179803675, d9921dee1e6ce573097cfcfbbd35e621
Progress message: Compiling Bottom
PrimaryInput: File:[/Users/jparker/rules_csharp[source]]examples/diamond/Bottom.cs
PrimaryOutput: File:[[<execution_root>]bazel-out/darwin-fastbuild/bin]examples/diamond/Bottom.dll
Owner information: //examples/diamond:Bottom BuildConfigurationValue.Key[9db7557022224156d4ba00ff45ffc062] false
MandatoryInputs: are equal
Outputs: are equal

It turns out, kinda obviously, that only one action should generate a particular file. This PR also makes the outputs distinct by adding the TFM. My bad!

j3parker commented 5 years ago
$ bazel build //examples/diamond:Top
WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE.
INFO: Analyzed target //examples/diamond:Top (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //examples/diamond:Top up-to-date:
  bazel-bin/examples/diamond/bazelout/net48/Top.dll
  bazel-bin/examples/diamond/bazelout/net48/Top.ref.dll
  bazel-bin/examples/diamond/bazelout/net48/Top.pdb

This will probably be nicer when creating NuGet packages.