Skip to content

Commit

Permalink
Merge pull request #7739 from jwnimmer-tri/bazel-reuse-workspace-pr6
Browse files Browse the repository at this point in the history
Rewrite maven rules to use java_import_external
  • Loading branch information
jwnimmer-tri authored Jan 12, 2018
2 parents 968ca82 + c951567 commit 364a1a2
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 37 deletions.
38 changes: 11 additions & 27 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -159,37 +159,21 @@ github_archive(
build_file = "@drake//tools/workspace/fmt:package.BUILD.bazel",
)

MAVEN_REPOSITORY = "https://jcenter.bintray.com"
load("//tools/workspace/net_sf_jchart2d:package.bzl", "net_sf_jchart2d_repository") # noqa

# In the unlikely event that you update the version here, verify that the
# licenses in tools/third_party/jchart2d/LICENSE are still applicable.
maven_jar(
name = "net_sf_jchart2d_jchart2d",
artifact = "net.sf.jchart2d:jchart2d:3.3.2",
repository = MAVEN_REPOSITORY,
sha1 = "4950821eefe4c204903e68b4d45a558b5ebdd6fa",
)
net_sf_jchart2d_repository(name = "net_sf_jchart2d")

maven_jar(
name = "com_jidesoft_jide_oss",
artifact = "com.jidesoft:jide-oss:2.9.7",
repository = MAVEN_REPOSITORY,
sha1 = "a9bb0d8384012c25c1519f6dd9adc80dd720a050",
)
load("//tools/workspace/com_jidesoft_jide_oss:package.bzl", "com_jidesoft_jide_oss_repository") # noqa

maven_jar(
name = "commons_io_commons_io",
artifact = "commons-io:commons-io:1.3.1",
repository = MAVEN_REPOSITORY,
sha1 = "b90b6ac57cf27a2858eaa490d02ba7945d18ca7b",
)
com_jidesoft_jide_oss_repository(name = "com_jidesoft_jide_oss")

maven_jar(
name = "org_apache_xmlgraphics_xmlgraphics_commons",
artifact = "org.apache.xmlgraphics:xmlgraphics-commons:1.3.1",
repository = MAVEN_REPOSITORY,
sha1 = "f7d0fa54e2750acd82b1a241c043be6fce1bf0dc",
)
load("//tools/workspace/commons_io:package.bzl", "commons_io_repository")

commons_io_repository(name = "commons_io")

load("//tools/workspace/org_apache_xmlgraphics_commons:package.bzl", "org_apache_xmlgraphics_commons_repository") # noqa

org_apache_xmlgraphics_commons_repository(name = "org_apache_xmlgraphics_commons") # noqa

github_archive(
name = "lcm",
Expand Down
4 changes: 2 additions & 2 deletions third_party/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ exports_files(
)

exports_files(
["net_sf_jchart2d_jchart2d/LICENSE"],
visibility = ["//tools/workspace/jchart2d:__pkg__"],
["net_sf_jchart2d/LICENSE"],
visibility = ["//tools/workspace/net_sf_jchart2d:__pkg__"],
)

exports_files(
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tools/workspace/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ _DRAKE_EXTERNAL_PACKAGE_INSTALLS = ["@%s//:install" % p for p in [
"tinyobjloader",
"vtk",
]] + ["//tools/workspace/%s:install" % p for p in [
"jchart2d",
"net_sf_jchart2d",
"optitrack_driver",
]] + select({
"//tools:with_gurobi": ["@gurobi//:install"],
Expand Down
8 changes: 8 additions & 0 deletions tools/workspace/com_jidesoft_jide_oss/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
15 changes: 15 additions & 0 deletions tools/workspace/com_jidesoft_jide_oss/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- mode: python -*-

load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
load("@drake//tools/workspace:maven.bzl", "MAVEN_BASE_URLS")

def com_jidesoft_jide_oss_repository(name):
java_import_external(
name = name,
licenses = [],
jar_urls = [
base + "com/jidesoft/jide-oss/2.9.7/jide-oss-2.9.7.jar"
for base in MAVEN_BASE_URLS
],
jar_sha256 = "a2edc2749cf482f6b2b1331f35f0383a1a11c19b1cf6d9a8cf7c69ce4cc8e04b", # noqa
)
8 changes: 8 additions & 0 deletions tools/workspace/commons_io/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
15 changes: 15 additions & 0 deletions tools/workspace/commons_io/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- mode: python -*-

load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
load("@drake//tools/workspace:maven.bzl", "MAVEN_BASE_URLS")

def commons_io_repository(name):
java_import_external(
name = name,
licenses = [],
jar_urls = [
base + "commons-io/commons-io/1.3.1/commons-io-1.3.1.jar"
for base in MAVEN_BASE_URLS
],
jar_sha256 = "3307319ddc221f1b23e8a1445aef10d2d2308e0ec46977b3f17cbb15c0ef335b", # noqa
)
6 changes: 3 additions & 3 deletions tools/workspace/lcm/package.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ java_library(
],
runtime_deps = [
"@com_jidesoft_jide_oss//jar",
"@commons_io_commons_io//jar",
"@org_apache_xmlgraphics_xmlgraphics_commons//jar",
"@commons_io//jar",
"@org_apache_xmlgraphics_commons//jar",
],
deps = ["@net_sf_jchart2d_jchart2d//jar"],
deps = ["@net_sf_jchart2d//jar"],
)

java_binary(
Expand Down
8 changes: 8 additions & 0 deletions tools/workspace/maven.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# URL prefixes (including the "/") where maven jars can be found.
MAVEN_BASE_URLS = [
"https://jcenter.bintray.com/",
"https://repo1.maven.org/maven2/",
"http://maven.ibiblio.org/maven2/", # N.B. ibiblio doesn't offer https.
]
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ cmake_config(

install_cmake_config(package = CMAKE_PACKAGE)

JCHART_LICENSE_DOCS = ["//third_party:net_sf_jchart2d_jchart2d/LICENSE"]
JCHART_LICENSE_DOCS = ["//third_party:net_sf_jchart2d/LICENSE"]

JCHART_TARGETS = [
"@com_jidesoft_jide_oss//jar",
"@commons_io_commons_io//jar",
"@net_sf_jchart2d_jchart2d//jar",
"@org_apache_xmlgraphics_xmlgraphics_commons//jar",
"@commons_io//jar",
"@net_sf_jchart2d//jar",
"@org_apache_xmlgraphics_commons//jar",
]

install(
Expand Down
17 changes: 17 additions & 0 deletions tools/workspace/net_sf_jchart2d/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- mode: python -*-

load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
load("@drake//tools/workspace:maven.bzl", "MAVEN_BASE_URLS")

def net_sf_jchart2d_repository(name):
# In the unlikely event that you update the version here, verify that the
# licenses in tools/third_party/jchart2d/LICENSE are still applicable.
java_import_external(
name = name,
licenses = [],
jar_urls = [
base + "net/sf/jchart2d/jchart2d/3.3.2/jchart2d-3.3.2.jar"
for base in MAVEN_BASE_URLS
],
jar_sha256 = "41af674b1bb00d8b89a0649ddaa569df5750911b4e33f89b211ae82e411d16cc", # noqa
)
File renamed without changes.
8 changes: 8 additions & 0 deletions tools/workspace/org_apache_xmlgraphics_commons/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
15 changes: 15 additions & 0 deletions tools/workspace/org_apache_xmlgraphics_commons/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- mode: python -*-

load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
load("@drake//tools/workspace:maven.bzl", "MAVEN_BASE_URLS")

def org_apache_xmlgraphics_commons_repository(name):
java_import_external(
name = name,
licenses = [],
jar_urls = [
base + "org/apache/xmlgraphics/xmlgraphics-commons/1.3.1/xmlgraphics-commons-1.3.1.jar" # noqa
for base in MAVEN_BASE_URLS
],
jar_sha256 = "7ce0c924c84e2710c162ae1c98f5047d64f528268792aba642d4bae5e1de7181", # noqa
)

0 comments on commit 364a1a2

Please sign in to comment.