Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix //dotnet:defs target to allow users to create stardoc docs using it #403

Merged

Conversation

michaelboyd2
Copy link
Contributor

No description provided.

Copy link

google-cla bot commented Dec 6, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@michaelboyd2
Copy link
Contributor Author

With only the changes to the test directory the build fails:

michaelboyd rules_dotnet $ bazel build dotnet/private/tests/bzl_library/...
INFO: Analyzed target //dotnet/private/tests/bzl_library:docs (2 packages loaded, 18 targets configured).
ERROR: /Users/michaelboyd/Workspaces/rules_dotnet/dotnet/private/tests/bzl_library/BUILD.bazel:3:23: Generating proto for Starlark doc for docs failed: (Exit 1): docs_stardoc failed: error executing Stardoc command (from target //dotnet/private/tests/bzl_library:docs) bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/dotnet/private/tests/bzl_library/docs_stardoc '--input=@@//dotnet:defs.bzl' '--workspace_name=_main' ... (remaining 1 argument skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
com.google.devtools.build.skydoc.SkydocMain$StarlarkEvaluationException: File /private/var/tmp/_bazel_michaelboyd/68eb91361dee7d3d13348599fdf5171e/sandbox/darwin-sandbox/385/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/dotnet/private/tests/bzl_library/docs_stardoc.runfiles/_main/dotnet/defs.bzl imported '//dotnet/private/rules/csharp:nunit_test.bzl', yet /private/var/tmp/_bazel_michaelboyd/68eb91361dee7d3d13348599fdf5171e/sandbox/darwin-sandbox/385/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/dotnet/private/tests/bzl_library/docs_stardoc.runfiles/_main/dotnet/private/rules/csharp/nunit_test.bzl was not found.
        at com.google.devtools.build.skydoc.SkydocMain.recursiveEval(SkydocMain.java:454)
        at com.google.devtools.build.skydoc.SkydocMain.eval(SkydocMain.java:289)
        at com.google.devtools.build.skydoc.SkydocMain.main(SkydocMain.java:151)
Caused by: java.nio.file.NoSuchFileException: /private/var/tmp/_bazel_michaelboyd/68eb91361dee7d3d13348599fdf5171e/sandbox/darwin-sandbox/385/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/dotnet/private/tests/bzl_library/docs_stardoc.runfiles/_main/dotnet/private/rules/csharp/nunit_test.bzl
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:422)
        at java.base/java.nio.file.Files.readAllBytes(Files.java:3206)
        at com.google.devtools.build.skydoc.SkydocMain.recursiveEval(SkydocMain.java:429)
        at com.google.devtools.build.skydoc.SkydocMain.recursiveEval(SkydocMain.java:450)
        ... 2 more
Stardoc documentation generation failed: File /private/var/tmp/_bazel_michaelboyd/68eb91361dee7d3d13348599fdf5171e/sandbox/darwin-sandbox/385/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/dotnet/private/tests/bzl_library/docs_stardoc.runfiles/_main/dotnet/defs.bzl imported '//dotnet/private/rules/csharp:nunit_test.bzl', yet /private/var/tmp/_bazel_michaelboyd/68eb91361dee7d3d13348599fdf5171e/sandbox/darwin-sandbox/385/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/dotnet/private/tests/bzl_library/docs_stardoc.runfiles/_main/dotnet/private/rules/csharp/nunit_test.bzl was not found.
INFO: Found 1 target...
Target //dotnet/private/tests/bzl_library:docs failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.903s, Critical Path: 1.04s
INFO: 5 processes: 5 internal.
ERROR: Build did NOT complete successfully

@michaelboyd2 michaelboyd2 force-pushed the fix_defs_bzl_library_target branch from d2e6318 to 120d318 Compare January 25, 2024 09:45
@michaelboyd2 michaelboyd2 marked this pull request as ready for review February 1, 2024 09:14
@purkhusid
Copy link
Collaborator

Could you explain to me what it is that you are trying to achieve?

@michaelboyd2
Copy link
Contributor Author

Sorry, I am trying to create stardoc documentation from a file loading @rules_dotnet//dotnet:defs.bzl. I think the defs bzl_library is missing some functionality to support this?

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")

bzl_library(
    name = "defs",
    srcs = ["defs.bzl"],  # Loads "@rules_dotnet//dotnet:defs.bzl"
    visibility = ["//visibility:public"],
    deps = [
        "//prelude/dotnet/framework:defs",
        "//prelude/utils:defs",
        "@rules_dotnet//dotnet:defs",
    ],
)

stardoc(
    name = "defs_docs",
    out = "defs.bzl.md",
    input = "defs.bzl",
    deps = ["defs"],
)
ERROR: /Users/michaelboyd/Workspaces/bpbuild/prelude/dotnet/csharp/BUILD.bazel:20:8: in deps attribute of starlark_doc_extract rule //prelude/dotnet/csharp:defs_docs.extract: missing bzl_library targets for Starlark module(s) @rules_dotnet//dotnet/private/rules/csharp:nunit_test.bzl, @rules_dotnet//dotnet/private/rules/fsharp:nunit_test.bzl. Since this rule was created by the macro 'stardoc', the error might have been caused by the macro implementation

@purkhusid purkhusid merged commit 38bf1c6 into bazel-contrib:master Feb 2, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants