Giter Site home page Giter Site logo

rules_ocaml's Introduction

OCaml rules for Bazel

Rules

Overview

Build OCaml with Bazel. Very experimental. API is expected to change.

Setup

This is a wrapper around ocamlbuild. Ensure that the OCaml toolchain (ocamlbuild, ocamlfind, etc) is reachable in your PATH. TODO: have ocaml_repositories download the toolchain.

Add the following to your WORKSPACE file.

git_repository(
    name = "io_bazel_rules_ocaml",
    remote = "https://github.com/jin/rules_ocaml.git",
    commit = "de567d0e6653f9e8208a42bfe26b30d58e6beeaa",
)

load("@io_bazel_rules_ocaml//ocaml:ocaml.bzl", "ocaml_repositories")
ocaml_repositories() 
# this downloads the OPAM precompiled binaries into your bazel cache, but doesn't use them directly yet.

and this to your BUILD files.

load("@io_bazel_rules_ocaml//ocaml:ocaml.bzl", "ocaml_native_binary", "ocaml_bytecode_binary")

Examples

ocaml_native_binary

Generates a native binary.

ocaml_native_binary(
    name = "hello_world",
    srcs = glob(["examples/*.ml"]),
    opam_packages = ["pkg_foo", "pkg_bar"],
    src_root = "examples/hello_world.ml", # Optional, defaults to the first main.ml found while loading the sources.
)

ocaml_bytecode_binary

Generates a bytecode binary.

ocaml_bytecode_binary(
    name = "hello_world",
    srcs = glob(["examples/*.ml"]),
    opam_packages = ["pkg_foo", "pkg_bar"],
    src_root = "examples/hello_world.ml", # Optional, defaults to the first main.ml found while loading the sources.
)

ocaml_interface

Generates a .mli file of the source.

ocaml_interface(
    name = "hello_world_interface",
    src = "examples/hello_world.ml",
)

Projects using rules_ocaml

rules_ocaml's People

Contributors

jin avatar liyistc avatar

Watchers

James Cloos avatar  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.