Coder Social home page Coder Social logo

s3w3nofficial / rules_dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bazelbuild/rules_dotnet

0.0 1.0 0.0 1.55 MB

.NET rules for Bazel

License: Apache License 2.0

Shell 0.15% C 2.08% C# 12.44% F# 0.10% PowerShell 0.03% XSLT 0.15% Batchfile 0.14% Dockerfile 0.17% Starlark 84.74%

rules_dotnet's Introduction

.Net Rules for Bazel

Gitpod ready-to-code

Build status

Bazel CI
Build status

Documentation

The full documentation is here.

Overview

This is a minimal viable set of C#/F# bindings for building C#/F# code with Core

Caveats

Bazel creates long paths. Therefore it is recommended to increase the length limit using newer version of Windows. Please see here.

However, some Windows programs do not handle long path names. Most notably - Microsoft C compiler (cl.exe). Therefore TMP env variable should be set to something short (like X:\ or c:\TEMP).

Bazel and dotnet_rules rely on symbolic linking. On Windows it, typically, requires elevated permissions. However, newer versions of Windows have a workaround.

Setup

  • The rules take full advantage of Bazel platforms and toolchains

  • When building any project the platform has to be specified. For example:

        bazel build --host_platform=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101 --platforms=@io_bazel_rules_dotnet//dotnet/toolchain:linux_amd64_6.0.101 //...
  • The platform specification has the form of //dotnet/toolchain:. The available values are listed in dotnet/platform/list.bzl in variables DOTNET_OS_ARCH and DOTNET_CORE_FRAMEWORKS. Typically the --host_platform and --platforms values are set in .bazelrc file.

  • Add the following to your WORKSPACE file to add the external repositories:

    # A newer version should be fine
    load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
    git_repository(
        name = "io_bazel_rules_dotnet",
        remote = "https://github.com/bazelbuild/rules_dotnet",
        branch = "master",
    )
    
    load("@io_bazel_rules_dotnet//dotnet:deps.bzl", "dotnet_repositories")
    dotnet_repositories()
    
    load(
        "@io_bazel_rules_dotnet//dotnet:defs.bzl",
        "dotnet_register_toolchains",
        "dotnet_repositories_nugets",
    )
    
    dotnet_register_toolchains()
    dotnet_repositories_nugets()

    The dotnet_repositories rule fetches external dependencies which have to be defined before loading any other file of rules_dotnet. dotnet_repositories_nugets loads nuget packages required by test rules.

    The dotnet_register_toolchains configures toolchains.

  • Add a file named BUILD.bazel in the root directory of your project. In general, you need one of these files in every directory with dotnet code.

    At the top of the file used rules should be imported:

      load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "csharp_library", "csharp_binary")
  • See nuget2bazel for using nuget dependencies.

  • See examples folder for examples.

rules_dotnet's People

Contributors

damienmg avatar damirdev avatar davidzchen avatar dependabot[bot] avatar hsyed-dojo avatar iainmerrick avatar ilya-klyuchnikov avatar j-swift avatar j3parker avatar jagobagascon avatar jart avatar jimevans avatar joey9801 avatar katre avatar kchodorow avatar laurentlb avatar mtsgrd avatar nmalsang avatar pcj avatar philwo avatar plule-ansys avatar purkhusid avatar renovate-bot avatar samhowes avatar strejczek avatar thelgevold avatar tomaszstrejczek avatar tomdegoede avatar vladmos avatar zaphar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.