Skip to content

Commit

Permalink
Update the Bazel build configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
renggli committed Jul 30, 2016
1 parent 15fe569 commit fabe02c
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 102 deletions.
19 changes: 0 additions & 19 deletions BUILD
@@ -1,22 +1,3 @@
package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # MIT

java_toolchain(
name = "java_toolchain",
encoding = "UTF-8",
source_version = "8",
target_version = "8",
misc = [
"-extra_checks:on",
],
)

java_library(
name="junit",
exports = [
"//external:hamcrest-core-jar",
"//external:hamcrest-library-jar",
"//external:junit-jar",
],
)
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -70,8 +70,8 @@ git checkout master
Then build with [Bazel](http://bazel.io/):

```bash
bazel build --java_toolchain=//:java_toolchain //petitparser-core:core
bazel test --java_toolchain=//:java_toolchain //petitparser-core:test
bazel build ...:all
bazel test ...:all
```


Expand Down
35 changes: 9 additions & 26 deletions WORKSPACE
@@ -1,39 +1,22 @@

# JUnit 4.12
maven_jar(
name = "junit",
group_id = "junit",
artifact_id = "junit",
version = "4.12",
name = "junit_maven",
artifact = "junit:junit:4.12",
)

bind(
name = "junit-jar",
actual = "@junit//jar"
)

# Hamcrest Library 1.3
maven_jar(
name = "hamcrest-library",
group_id = "org.hamcrest",
artifact_id = "hamcrest-library",
version = "1.3",
)

bind(
name = "hamcrest-library-jar",
actual = "@hamcrest-library//jar"
name = "junit",
actual = "@junit_maven//jar"
)

# Hamcrest Core 1.3
maven_jar(
name = "hamcrest-core",
group_id = "org.hamcrest",
artifact_id = "hamcrest-core",
version = "1.3",
name = "hamcrest_maven",
artifact = "org.hamcrest:hamcrest-core:1.3",
)

bind(
name = "hamcrest-core-jar",
actual = "@hamcrest-core//jar"
)
name = "hamcrest",
actual = "@hamcrest_maven//jar"
)
27 changes: 12 additions & 15 deletions petitparser-core/BUILD
Expand Up @@ -3,28 +3,25 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # MIT

java_library(
name = "core",
name = "main",
srcs = glob(["src/main/**/*.java"]),
)

java_library(
name = "test-support",
srcs = [
"src/test/java/org/petitparser/Assertions.java",
],
name = "test",
srcs = glob(["src/test/**/*.java"]),
deps = [
":core",
"//:junit",
":main",
"//external:junit",
"//external:hamcrest",
],
)

java_test(
name = "test",
size = "small",
srcs = glob(["src/test/**/*Test.java"]),
[java_test(
name = FILE[:-5],
srcs = [FILE],
deps = [
":core",
":test-support",
"//:junit",
":main",
":test",
],
)
) for FILE in glob(["src/test/**/*Test.java"])]
29 changes: 19 additions & 10 deletions petitparser-json/BUILD
Expand Up @@ -3,20 +3,29 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # MIT

java_library(
name = "json",
name = "main",
srcs = glob(["src/main/**/*.java"]),
deps = ["//petitparser-core:main"],
)

java_library(
name = "test",
srcs = glob(["src/test/**/*.java"]),
deps = [
"//petitparser-core:core",
":main",
"//external:junit",
"//external:hamcrest",
"//petitparser-core:main",
"//petitparser-core:test"
],
)

java_test(
name = "test",
size = "small",
srcs = glob(["src/test/**/*Test.java"]),
[java_test(
name = FILE[:-5],
srcs = [FILE],
deps = [
":json",
"//:junit",
"//petitparser-core:core",
":main",
":test",
"//petitparser-core:main",
],
)
) for FILE in glob(["src/test/**/*Test.java"])]
29 changes: 19 additions & 10 deletions petitparser-smalltalk/BUILD
Expand Up @@ -3,20 +3,29 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # MIT

java_library(
name = "smalltalk",
name = "main",
srcs = glob(["src/main/**/*.java"]),
deps = ["//petitparser-core:main"],
)

java_library(
name = "test",
srcs = glob(["src/test/**/*.java"]),
deps = [
"//petitparser-core:core",
":main",
"//external:junit",
"//external:hamcrest",
"//petitparser-core:main",
"//petitparser-core:test"
],
)

java_test(
name = "test",
size = "small",
srcs = glob(["src/test/**/*Test.java"]),
[java_test(
name = FILE[:-5],
srcs = [FILE],
deps = [
":smalltalk",
"//:junit",
"//petitparser-core:core",
":main",
":test",
"//petitparser-core:main",
],
)
) for FILE in glob(["src/test/**/*Test.java"])]
37 changes: 17 additions & 20 deletions petitparser-xml/BUILD
Expand Up @@ -3,32 +3,29 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"]) # MIT

java_library(
name = "xml",
name = "main",
srcs = glob(["src/main/**/*.java"]),
deps = [
"//petitparser-core:core",
],
deps = ["//petitparser-core:main"],
)

java_binary(
name = "benchmark",
main_class = "org.petitparser.grammar.xml.XmlBenchmark",
srcs = [
"src/test/java/org/petitparser/grammar/xml/XmlBenchmark.java",
],
java_library(
name = "test",
srcs = glob(["src/test/**/*.java"]),
deps = [
":xml",
"//petitparser-core:core",
":main",
"//external:junit",
"//external:hamcrest",
"//petitparser-core:main",
"//petitparser-core:test"
],
)

java_test(
name = "test",
size = "small",
srcs = glob(["src/test/**/*Test.java"]),
[java_test(
name = FILE[:-5],
srcs = [FILE],
deps = [
":xml",
"//third_party:junit4",
"//petitparser-core:core",
":main",
":test",
"//petitparser-core:main",
],
)
) for FILE in glob(["src/test/**/*Test.java"])]

0 comments on commit fabe02c

Please sign in to comment.