Skip to content

Windows,Skylark: write rule migration guide #3889

Closed

Description

@laszlocsomor

Write a guide on how to write portable Skylark rules.

Activity

  1. laszlocsomor commented on Dec 14, 2017

    @laszlocsomor
    ContributorAuthor

    Bumping to P1 -- we committed to doing this work in Q4'2017.

  2. added
    P1
    and removed
    P2
    on Dec 14, 2017
  3. laszlocsomor commented on Dec 14, 2017

    @laszlocsomor
    ContributorAuthor

    I plan to work on this next week.

  4. j3parker commented on Dec 14, 2017

    @j3parker
    Contributor

    Some things I've hit:

    Something that would be interesting is any advice for making the best of unsandboxed execution. For example, we're able to vendor the C# compiler via an external package, but we rely on the system-wide .NET framework installation. My assumption (we haven't got to the point of cache sharing yet) is that these unsandboxed/unvendored resources won't contribute to the digests used in caching. This could lead (naturally) to non-repeatable builds in a way that could be dangerous with cache-sharing.

    My guess at what I'll have to do is find some proxy to include as an input from outside the sandbox (e.g. there are files/registry keys that indicate the specific .NET framework release number) and "hope for the best". Any kind of insight here would be really helpful. If there's specific things we should document as rule authors on this topic that'd be good to know.

  5. alexeagle commented on Dec 14, 2017

    @alexeagle
    Contributor
  6. laszlocsomor commented on Dec 18, 2017

    @laszlocsomor
    ContributorAuthor

    Thank you @j3parker and @alexeagle , these are insightful and valuable ideas and questions. I'll incorporate them / their answers in the doc.

    @j3parker :

    Something that would be interesting is any advice for making the best of unsandboxed execution. For example, we're able to vendor the C# compiler via an external package, but we rely on the system-wide .NET framework installation. My assumption (we haven't got to the point of cache sharing yet) is that these unsandboxed/unvendored resources won't contribute to the digests used in caching. This could lead (naturally) to non-repeatable builds in a way that could be dangerous with cache-sharing.

    Frankly I have no good answer at the moment. (For the record, we don't know about the feasibility of sandboxing on Windows.)

    My guess at what I'll have to do is find some proxy to include as an input from outside the sandbox (e.g. there are files/registry keys that indicate the specific .NET framework release number) and "hope for the best".

    That'd be one option. Another is to create a local repository for the .NET framework and write the .NET rules such that their actions depend on that local repository.

    @alexeagle :

    Thanks for mentioning runfiles, I'll write a section on that. There's also #4279.

  7. laszlocsomor commented on May 16, 2018

    @laszlocsomor
    ContributorAuthor

    Update: sorry for having dropped the ball on this issue. I never submitted any docs. @j3parker and @alexeagle , do you think it's still worthwhile to publish best practices for writing platform-aware Skylark rules?

  8. alexeagle commented on May 17, 2018

    @alexeagle
    Contributor
  9. 13 remaining items

  10. rongjiecomputer commented on Mar 22, 2019

    @rongjiecomputer
    Contributor

    Bazel works in any Windows shell (cmd, powershell and bash). It is just that Bazel will internally call bash for genrule, sh_test, sh_binary etc.

  11. njlr commented on Mar 22, 2019

    @njlr

    OK, that sounds like what I was hoping for! 🙂

    Just to clarify, if I run Bazel in PowerShell, and then build a genrule, Bazel will automatically find my Git Bash (or similar) installation and run that to build the target?

  12. rongjiecomputer commented on Mar 22, 2019

    @rongjiecomputer
    Contributor

    It is better to set BAZEL_SH env var to absolute path of bash.exe that you want to use (regardless of what shell you use).

  13. laszlocsomor commented on Mar 25, 2019

    @laszlocsomor
    ContributorAuthor

    @njlr :

    Just to clarify, if I run Bazel in PowerShell, and then build a genrule, Bazel will automatically find my Git Bash (or similar) installation and run that to build the target?

    Correct. As @rongjiecomputer says, better to set BAZEL_SH.

    I advise against using Git Bash as BAZEL_SH. See #5751

  14. meteorcloudy commented on May 12, 2020

    @meteorcloudy
    Member

    I'm closing this one because @laszlocsomor has done an excellent job in https://docs.bazel.build/versions/master/skylark/windows_tips.html

    Please file new issue or PR if you think anything else should be added in that guide.

  15. added
    team-OSS
    on Jun 15, 2020
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

    P2area-Windowsplatform: windowsteam-OSStype: documentation (cleanup)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions