Skip to content

Windows, native launcher: sh_binary doesn't have rlocation #3865

Closed

Description

@laszlocsomor

When using the native launcher, the .exe launcher created from sh_binary rules doesn't define rlocation for the shell script.

Normally rlocation is defined for shell tests because they all run https://github.com/bazelbuild/bazel/blob/master/tools/test/test-setup.sh which defines and exports this function.

Activity

  1. laszlocsomor commented on Oct 5, 2017

    @laszlocsomor
    ContributorAuthor
  2. added
    P2
    on Oct 5, 2017
  3. laszlocsomor commented on Oct 9, 2017

    @laszlocsomor
    ContributorAuthor

    Fixing this bug makes fixing #3839 trivial.

  4. meteorcloudy commented on Oct 9, 2017

    @meteorcloudy
    Member

    Not actually, because when you run the binary alone, test-setup.sh won't be executed at all, right?

    I am thinking about adding a library under @bazel_tools, which provides rlocation function for Java/Python/Bash/C++, so that users can just depend on it and don't have to write their own. WDYT?

  5. laszlocsomor commented on Oct 9, 2017

    @laszlocsomor
    ContributorAuthor

    That's similar to what I did in my pending change that fixes this issue. I'll send it to you for review soon.

  6. meteorcloudy commented on Oct 9, 2017

    @meteorcloudy
    Member

    Great, thanks!

  7. laszlocsomor commented on Oct 9, 2017

    @laszlocsomor
    ContributorAuthor

    Actually, I like your idea more than my own! Let me accommodate that in my CL.

  8. laszlocsomor commented on Oct 9, 2017

    @laszlocsomor
    ContributorAuthor
  9. laszlocsomor commented on Dec 13, 2017

    @laszlocsomor
    ContributorAuthor

    I'm making this P3 with the same justification as I gave on #3839:

    This bug directly influences the usability of sh_* rules on Windows.

    I'd like Bazel to treat shell scripts as just another language like Python, and to require Bash only if the targets depend on sh_* rules.

    I'm making this P3 for now, because I believe other languages are more important on Windows and the practical limitation with a sub-par support for sh_* rules is that we can't use them to implement build-aiding tools as easily as we can on Linux.

  10. added
    P3
    and removed
    P2
    on Dec 13, 2017
  11. added
    P1
    and removed
    P3
    on Dec 18, 2017
  12. laszlocsomor commented on May 2, 2018

    @laszlocsomor
    ContributorAuthor

    I'm closing this bug as obsolete.

    The sh_binary on non-Windows uses no launcher, so there's nothing to load whatever defines rlocation. If users want to write platform-independent sh_* rules, they'll need to source the rlocation-defining library manually (copy-pasting the code to do so from the runfiles library itself).

    Automatically sourcing the file on Windows encourages writing non-portable Bash scripts, and is unnecessary if the scripts will have the copy-pasted initializer code anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1category: misc > miscplatform: windowstype: feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions