Skip to content

Commit

Permalink
Use load() to add external repositories for Skylark rules.
Browse files Browse the repository at this point in the history
--
MOS_MIGRATED_REVID=109405753
  • Loading branch information
davidzchen authored and kchodorow committed Dec 4, 2015
1 parent b4d482b commit 7019ff9
Show file tree
Hide file tree
Showing 25 changed files with 287 additions and 270 deletions.
71 changes: 10 additions & 61 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
load("/tools/build_defs/d/d", "d_repositories")
load("/tools/build_defs/dotnet/csharp", "csharp_repositories")
load("/tools/build_defs/jsonnet/jsonnet", "jsonnet_repositories")
load("/tools/build_defs/sass/sass", "sass_repositories")
load("/tools/build_rules/go/def", "go_repositories")
load("/tools/build_rules/rust/rust", "rust_repositories")

csharp_repositories()
d_repositories()
go_repositories()
jsonnet_repositories()
rust_repositories()
sass_repositories()

# In order to run the Android integration tests, uncomment these rules, point
# them to the Android NDK and the SDK, and point the bind rules under them
Expand Down Expand Up @@ -33,64 +43,3 @@ bind(
# actual = "@androidndk//:files",
actual = "//:dummy",
)

new_http_archive(
name = "dmd-linux-x86_64",
build_file = "tools/build_defs/d/dmd.BUILD",
sha256 = "a5014886773853b4a42df19ee9591774cf281d33fbc511b265df30ba832926cd",
url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.linux.zip",
)

new_http_archive(
name = "dmd-darwin-x86_64",
build_file = "tools/build_defs/d/dmd.BUILD",
sha256 = "aa76bb83c38b3f7495516eb08977fc9700c664d7a945ba3ac3c0004a6a8509f2",
url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.osx.zip",
)

git_repository(
name = "jsonnet",
remote = "https://github.com/google/jsonnet.git",
tag = "v0.8.1",
)

new_http_archive(
name = "libsass",
build_file = "tools/build_defs/sass/libsass.BUILD",
sha256 = "6a4da39cc0b585f7a6ee660dc522916f0f417c890c3c0ac7ebbf6a85a16d220f",
url = "https://github.com/sass/libsass/archive/3.3.0-beta1.tar.gz",
)

new_http_archive(
name = "sassc",
build_file = "tools/build_defs/sass/sassc.BUILD",
sha256 = "87494218eea2441a7a24b40f227330877dbba75c5fa9014ac6188711baed53f6",
url = "https://github.com/sass/sassc/archive/3.3.0-beta1.tar.gz",
)

bind(
name = "go_prefix",
actual = "//:go_prefix",
)

new_http_archive(
name = "golang-darwin-amd64",
build_file = "tools/build_rules/go/toolchain/BUILD.go-toolchain",
sha256 = "e94487b8cd2e0239f27dc51e6c6464383b10acb491f753584605e9b28abf48fb",
url = "https://storage.googleapis.com/golang/go1.5.1.darwin-amd64.tar.gz",
)

new_http_archive(
name = "golang-linux-amd64",
build_file = "tools/build_rules/go/toolchain/BUILD.go-toolchain",
sha256 = "2593132ca490b9ee17509d65ee2cd078441ff544899f6afb97a03d08c25524e7",
url = "https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz",
)

new_http_archive(
name = "nunit",
build_file = "tools/build_defs/dotnet/nunit.BUILD",
sha256 = "1bd925514f31e7729ccde40a38a512c2accd86895f93465f3dfe6d0b593d7170",
type = "zip",
url = "https://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.zip",
)
10 changes: 8 additions & 2 deletions tools/build_defs/d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@

## Setup

To use the D rules, simply copy the contents of `d.WORKSPACE` into your
`WORKSPACE` file.
To use the D rules, add the following to your `WORKSPACE` file to add the
external repositories for the D toolchain:

```python
load("/tools/build_defs/d/d", "d_repositories")

d_repositories()
```

## Roadmap

Expand Down
13 changes: 0 additions & 13 deletions tools/build_defs/d/d.WORKSPACE

This file was deleted.

15 changes: 15 additions & 0 deletions tools/build_defs/d/d.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,18 @@ d_docs = rule(
"d_docs": "%{name}-docs.zip",
},
)

def d_repositories():
native.new_http_archive(
name = "dmd-linux-x86_64",
url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.linux.zip",
sha256 = "a5014886773853b4a42df19ee9591774cf281d33fbc511b265df30ba832926cd",
build_file = "tools/build_defs/d/dmd.BUILD",
)

native.new_http_archive(
name = "dmd-darwin-x86_64",
url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.linux.zip",
sha256 = "aa76bb83c38b3f7495516eb08977fc9700c664d7a945ba3ac3c0004a6a8509f2",
build_file = "tools/build_defs/d/dmd.BUILD",
)
52 changes: 32 additions & 20 deletions tools/build_defs/dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,46 @@ might become especially valuable.

## Setup

Copy the contents of the dotnet.WORKSPACE file into your WORKSPACE file.
Add the following to your `WORKSPACE` file to add the external repositories:

```python
load("/tools/build_defs/dotnet/csharp", "csharp_repositories")

csharp_repositories()
```

## Examples

* `csharp_library`
### csharp_library

csharp_library(
name="MyLib",
srcs=["MyLib.cs"],
deps=["//my/dependency:SomeLib"],
)
```python
csharp_library(
name = "MyLib",
srcs = ["MyLib.cs"],
deps = ["//my/dependency:SomeLib"],
)
```

* `csharp_binary`
### csharp_binary

csharp_binary(
name="MyApp",
main="MyApp", # optional name of the main class.
srcs=["MyApp.cs"],
deps=["//my/dependency:MyLib"],
)
```python
csharp_binary(
name = "MyApp",
main = "MyApp", # optional name of the main class.
srcs = ["MyApp.cs"],
deps = ["//my/dependency:MyLib"],
)
```

* `csharp_nunit_test`
### csharp\_nunit\_test

csharp_nunit_test(
name="MyApp",
srcs=["MyApp.cs"],
deps=["//my/dependency:MyLib"],
)
```python
csharp_nunit_test(
name = "MyApp",
srcs = ["MyApp.cs"],
deps = ["//my/dependency:MyLib"],
)
```

## Things still missing:

Expand Down
9 changes: 9 additions & 0 deletions tools/build_defs/dotnet/csharp.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,12 @@ csharp_nunit_test = rule(
outputs = _LIB_OUTPUTS,
test=True
)

def csharp_repositories():
native.new_http_archive(
name = "nunit",
build_file = "tools/build_defs/dotnet/BUILD.nunit",
sha256 = "1bd925514f31e7729ccde40a38a512c2accd86895f93465f3dfe6d0b593d7170",
type = "zip",
url = "https://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.zip",
)
7 changes: 0 additions & 7 deletions tools/build_defs/dotnet/dotnet.WORKSPACE

This file was deleted.

10 changes: 8 additions & 2 deletions tools/build_defs/groovy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ targets:
* `//external:junit`, pointing at JUnit (only required if using `groovy_test`)
* `//external:spock`, pointing at Spock (only required if using `spock_test`)

The easiest way to do so is by copying the content of `groovy.WORKSPACE` to your
workspace file and putting `groovy.BUILD` at the root of your workspace.
The easiest way to do so is to add the following to your `WORKSPACE` file and
putting `groovy.BUILD` at the root of your workspace:

```python
load("/tools/build_defs/groovy/groovy", "groovy_repositories")

groovy_repositories()
```

<a name="basic-example"></a>
## Basic Example
Expand Down
32 changes: 0 additions & 32 deletions tools/build_defs/groovy/groovy.WORKSPACE

This file was deleted.

34 changes: 34 additions & 0 deletions tools/build_defs/groovy/groovy.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,37 @@ def spock_test(
size = size,
tags = tags,
)

def groovy_repositories():
native.new_http_archive(
name = "groovy-sdk-artifact",
url = "http://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.4.zip",
sha256 = "a7cc1e5315a14ea38db1b2b9ce0792e35174161141a6a3e2ef49b7b2788c258c",
build_file = "groovy.BUILD",
)
native.bind(
name = "groovy-sdk",
actual = "@groovy-sdk-artifact//:sdk",
)
native.bind(
name = "groovy",
actual = "@groovy-sdk-artifact//:groovy",
)

native.maven_jar(
name = "junit-artifact",
artifact = "junit:junit:4.12",
)
native.bind(
name = "junit",
actual = "@junit-artifact//jar",
)

native.maven_jar(
name = "spock-artifact",
artifact = "org.spockframework:spock-core:0.7-groovy-2.0",
)
native.bind(
name = "spock",
actual = "@spock-artifact//jar",
)
10 changes: 8 additions & 2 deletions tools/build_defs/jsonnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ These are build rules for working with [Jsonnet][jsonnet] files with Bazel.

## Setup

To use the Jsonnet rules, simply copy the contents of `jsonnet.WORKSPACE` into
your `WORKSPACE` file.
To use the Jsonnet rules, add the following to your `WORKSPACE` file to add the
external repositories for Jsonnet:

```python
load("/tools/build_defs/jsonnet/jsonnet", "jsonnet_repositories")

jsonnet_repositories()
```

<a name="#jsonnet_library"></a>
## jsonnet_library
Expand Down
5 changes: 0 additions & 5 deletions tools/build_defs/jsonnet/jsonnet.WORKSPACE

This file was deleted.

7 changes: 7 additions & 0 deletions tools/build_defs/jsonnet/jsonnet.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,10 @@ jsonnet_to_json_test = rule(
executable = True,
test = True,
)

def jsonnet_repositories():
native.git_repository(
name = "jsonnet",
remote = "https://github.com/google/jsonnet.git",
tag = "v0.8.1",
)
9 changes: 8 additions & 1 deletion tools/build_defs/sass/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ These build rules are used for building [Sass][sass] projects with Bazel.

<a name="setup"></a>
## Setup
To use the Sass rules, simply copy the contents of `sass.WORKSPACE` to your own top level `WORKSPACE` file.
To use the Sass rules, add the following to your `WORKSPACE` file to add the
external repositories for Sass:

```python
load("/tools/build_defs/sass/sass", "sass_repositories")

sass_repositories()
```

<a name="basic-example"></a>
## Basic Example
Expand Down
13 changes: 0 additions & 13 deletions tools/build_defs/sass/sass.WORKSPACE

This file was deleted.

15 changes: 15 additions & 0 deletions tools/build_defs/sass/sass.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,18 @@ sass_binary = rule(
"css_map_file": "%{name}.css.map",
},
)

def sass_repositories():
native.new_http_archive(
name = "libsass",
url = "https://github.com/sass/libsass/archive/3.3.0-beta1.tar.gz",
sha256 = "6a4da39cc0b585f7a6ee660dc522916f0f417c890c3c0ac7ebbf6a85a16d220f",
build_file = "tools/build_defs/sass/libsass.BUILD",
)

native.new_http_archive(
name = "sassc",
url = "https://github.com/sass/sassc/archive/3.3.0-beta1.tar.gz",
sha256 = "87494218eea2441a7a24b40f227330877dbba75c5fa9014ac6188711baed53f6",
build_file = "tools/build_defs/sass/sassc.BUILD",
)
Loading

0 comments on commit 7019ff9

Please sign in to comment.