From 4d95df4606288026dc66ad4cec12a962fa56b5ae Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Thu, 11 Jan 2018 19:21:09 -0500 Subject: [PATCH] Factor pkg_config_repository calls into bzl helpers --- WORKSPACE | 114 ++++++++++-------------- tools/workspace/blas/BUILD.bazel | 8 ++ tools/workspace/blas/package.bzl | 9 ++ tools/workspace/dreal/BUILD.bazel | 8 ++ tools/workspace/dreal/package.bzl | 9 ++ tools/workspace/glew/BUILD.bazel | 8 ++ tools/workspace/glew/package.bzl | 9 ++ tools/workspace/glib/BUILD.bazel | 8 ++ tools/workspace/glib/package.bzl | 9 ++ tools/workspace/gthread/BUILD.bazel | 8 ++ tools/workspace/gthread/package.bzl | 9 ++ tools/workspace/ibex/BUILD.bazel | 8 ++ tools/workspace/ibex/package.bzl | 9 ++ tools/workspace/ipopt/BUILD.bazel | 8 ++ tools/workspace/ipopt/package.bzl | 9 ++ tools/workspace/lapack/BUILD.bazel | 8 ++ tools/workspace/lapack/package.bzl | 9 ++ tools/workspace/liblz4/BUILD.bazel | 8 ++ tools/workspace/liblz4/package.bzl | 9 ++ tools/workspace/libpng/BUILD.bazel | 8 ++ tools/workspace/libpng/package.bzl | 9 ++ tools/workspace/libprotobuf/BUILD.bazel | 8 ++ tools/workspace/libprotobuf/package.bzl | 9 ++ tools/workspace/nlopt/BUILD.bazel | 8 ++ tools/workspace/nlopt/package.bzl | 9 ++ tools/workspace/tinyxml/BUILD.bazel | 8 ++ tools/workspace/tinyxml/package.bzl | 9 ++ tools/workspace/tinyxml2/BUILD.bazel | 8 ++ tools/workspace/tinyxml2/package.bzl | 9 ++ tools/workspace/yaml_cpp/package.bzl | 19 ++++ 30 files changed, 305 insertions(+), 66 deletions(-) create mode 100644 tools/workspace/blas/BUILD.bazel create mode 100644 tools/workspace/blas/package.bzl create mode 100644 tools/workspace/dreal/BUILD.bazel create mode 100644 tools/workspace/dreal/package.bzl create mode 100644 tools/workspace/glew/BUILD.bazel create mode 100644 tools/workspace/glew/package.bzl create mode 100644 tools/workspace/glib/BUILD.bazel create mode 100644 tools/workspace/glib/package.bzl create mode 100644 tools/workspace/gthread/BUILD.bazel create mode 100644 tools/workspace/gthread/package.bzl create mode 100644 tools/workspace/ibex/BUILD.bazel create mode 100644 tools/workspace/ibex/package.bzl create mode 100644 tools/workspace/ipopt/BUILD.bazel create mode 100644 tools/workspace/ipopt/package.bzl create mode 100644 tools/workspace/lapack/BUILD.bazel create mode 100644 tools/workspace/lapack/package.bzl create mode 100644 tools/workspace/liblz4/BUILD.bazel create mode 100644 tools/workspace/liblz4/package.bzl create mode 100644 tools/workspace/libpng/BUILD.bazel create mode 100644 tools/workspace/libpng/package.bzl create mode 100644 tools/workspace/libprotobuf/BUILD.bazel create mode 100644 tools/workspace/libprotobuf/package.bzl create mode 100644 tools/workspace/nlopt/BUILD.bazel create mode 100644 tools/workspace/nlopt/package.bzl create mode 100644 tools/workspace/tinyxml/BUILD.bazel create mode 100644 tools/workspace/tinyxml/package.bzl create mode 100644 tools/workspace/tinyxml2/BUILD.bazel create mode 100644 tools/workspace/tinyxml2/package.bzl create mode 100644 tools/workspace/yaml_cpp/package.bzl diff --git a/WORKSPACE b/WORKSPACE index d1bb60fd19e8..f19ee7cc5ba9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -18,7 +18,6 @@ workspace(name = "drake") load("//tools/workspace:bitbucket.bzl", "bitbucket_archive") load("//tools/workspace:github.bzl", "github_archive") -load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") load("//tools/workspace:which.bzl", "which") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") @@ -45,8 +44,8 @@ github_archive( ) # This local repository imports the protobuf build rules for Bazel (based on -# the upstream protobuf.bzl build rules). The protobuf runtime is loaded -# into "libprotobuf" via pkg-config below. +# the upstream protobuf.bzl build rules); in constrast, the protobuf runtime is +# loaded as @libprotobuf. local_repository( name = "com_google_protobuf", # TODO(clalancette) Per https://github.com/RobotLocomotion/drake/pull/7361 @@ -62,32 +61,27 @@ new_local_repository( path = __workspace_dir__ + "/third_party/com_kitware_gitlab_cmake_cmake", ) -pkg_config_repository( - name = "ibex", - modname = "ibex", -) +load("//tools/workspace/ibex:package.bzl", "ibex_repository") -pkg_config_repository( - name = "dreal", - modname = "dreal", -) +ibex_repository(name = "ibex") -pkg_config_repository( - name = "glib", - modname = "glib-2.0", -) +load("//tools/workspace/dreal:package.bzl", "dreal_repository") -pkg_config_repository( - name = "gthread", - modname = "gthread-2.0", -) +dreal_repository(name = "dreal") + +load("//tools/workspace/glib:package.bzl", "glib_repository") + +glib_repository(name = "glib") + +load("//tools/workspace/gthread:package.bzl", "gthread_repository") + +gthread_repository(name = "gthread") + +load("//tools/workspace/libprotobuf:package.bzl", "libprotobuf_repository") # Load in the paths and flags to the system version of the protobuf runtime; -# the Bazel build rules are loaded into "protobuf" via local_repository above. -pkg_config_repository( - name = "libprotobuf", - modname = "protobuf", -) +# in contrast, the Bazel build rules are loaded as @com_google_protobuf. +libprotobuf_repository(name = "libprotobuf") # Find the protoc binary on $PATH. which( @@ -237,15 +231,13 @@ github_archive( build_file = "@drake//tools/workspace/fcl:package.BUILD.bazel", ) -pkg_config_repository( - name = "ipopt", - modname = "ipopt", -) +load("//tools/workspace/ipopt:package.bzl", "ipopt_repository") -pkg_config_repository( - name = "nlopt", - modname = "nlopt", -) +ipopt_repository(name = "ipopt") + +load("//tools/workspace/nlopt:package.bzl", "nlopt_repository") + +nlopt_repository(name = "nlopt") github_archive( name = "optitrack_driver", @@ -278,15 +270,13 @@ github_archive( build_file = "@drake//tools/workspace/lcmtypes_robotlocomotion:package.BUILD.bazel", # noqa ) -pkg_config_repository( - name = "blas", - modname = "blas", -) +load("//tools/workspace/blas:package.bzl", "blas_repository") -pkg_config_repository( - name = "lapack", - modname = "lapack", -) +blas_repository(name = "blas") + +load("//tools/workspace/lapack:package.bzl", "lapack_repository") + +lapack_repository(name = "lapack") github_archive( name = "scs", @@ -304,12 +294,9 @@ github_archive( build_file = "@drake//tools/workspace/tinyobjloader:package.BUILD.bazel", ) -pkg_config_repository( - name = "yaml_cpp", - modname = "yaml-cpp", - atleast_version = "0.5.2", - extra_deps = ["@boost//:boost_headers"], -) +load("//tools/workspace/yaml_cpp:package.bzl", "yaml_cpp_repository") + +yaml_cpp_repository(name = "yaml_cpp") load("//tools/workspace/buildifier:package.bzl", "buildifier_repository") @@ -414,30 +401,25 @@ load("//tools/workspace/expat:package.bzl", "expat_repository") expat_repository(name = "expat") -pkg_config_repository( - name = "glew", - modname = "glew", -) +load("//tools/workspace/glew:package.bzl", "glew_repository") -pkg_config_repository( - name = "liblz4", - modname = "liblz4", -) +glew_repository(name = "glew") -pkg_config_repository( - name = "libpng", - modname = "libpng", -) +load("//tools/workspace/liblz4:package.bzl", "liblz4_repository") -pkg_config_repository( - name = "tinyxml", - modname = "tinyxml", -) +liblz4_repository(name = "liblz4") -pkg_config_repository( - name = "tinyxml2", - modname = "tinyxml2", -) +load("//tools/workspace/libpng:package.bzl", "libpng_repository") + +libpng_repository(name = "libpng") + +load("//tools/workspace/tinyxml:package.bzl", "tinyxml_repository") + +tinyxml_repository(name = "tinyxml") + +load("//tools/workspace/tinyxml2:package.bzl", "tinyxml2_repository") + +tinyxml2_repository(name = "tinyxml2") load("//tools/workspace/zlib:package.bzl", "zlib_repository") diff --git a/tools/workspace/blas/BUILD.bazel b/tools/workspace/blas/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/blas/BUILD.bazel @@ -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() diff --git a/tools/workspace/blas/package.bzl b/tools/workspace/blas/package.bzl new file mode 100644 index 000000000000..dc3c0bd85c1a --- /dev/null +++ b/tools/workspace/blas/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def blas_repository(name, modname = "blas", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/dreal/BUILD.bazel b/tools/workspace/dreal/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/dreal/BUILD.bazel @@ -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() diff --git a/tools/workspace/dreal/package.bzl b/tools/workspace/dreal/package.bzl new file mode 100644 index 000000000000..36c98ba77392 --- /dev/null +++ b/tools/workspace/dreal/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def dreal_repository(name, modname = "dreal", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/glew/BUILD.bazel b/tools/workspace/glew/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/glew/BUILD.bazel @@ -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() diff --git a/tools/workspace/glew/package.bzl b/tools/workspace/glew/package.bzl new file mode 100644 index 000000000000..f3e876daaede --- /dev/null +++ b/tools/workspace/glew/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def glew_repository(name, modname = "glew", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/glib/BUILD.bazel b/tools/workspace/glib/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/glib/BUILD.bazel @@ -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() diff --git a/tools/workspace/glib/package.bzl b/tools/workspace/glib/package.bzl new file mode 100644 index 000000000000..aea2c4a95955 --- /dev/null +++ b/tools/workspace/glib/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def glib_repository(name, modname = "glib-2.0", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/gthread/BUILD.bazel b/tools/workspace/gthread/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/gthread/BUILD.bazel @@ -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() diff --git a/tools/workspace/gthread/package.bzl b/tools/workspace/gthread/package.bzl new file mode 100644 index 000000000000..3050d901861e --- /dev/null +++ b/tools/workspace/gthread/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def gthread_repository(name, modname = "gthread-2.0", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/ibex/BUILD.bazel b/tools/workspace/ibex/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/ibex/BUILD.bazel @@ -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() diff --git a/tools/workspace/ibex/package.bzl b/tools/workspace/ibex/package.bzl new file mode 100644 index 000000000000..2cc4c4f45dbd --- /dev/null +++ b/tools/workspace/ibex/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def ibex_repository(name, modname = "ibex", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/ipopt/BUILD.bazel b/tools/workspace/ipopt/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/ipopt/BUILD.bazel @@ -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() diff --git a/tools/workspace/ipopt/package.bzl b/tools/workspace/ipopt/package.bzl new file mode 100644 index 000000000000..c48df30613e8 --- /dev/null +++ b/tools/workspace/ipopt/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def ipopt_repository(name, modname = "ipopt", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/lapack/BUILD.bazel b/tools/workspace/lapack/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/lapack/BUILD.bazel @@ -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() diff --git a/tools/workspace/lapack/package.bzl b/tools/workspace/lapack/package.bzl new file mode 100644 index 000000000000..583faf09506d --- /dev/null +++ b/tools/workspace/lapack/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def lapack_repository(name, modname = "lapack", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/liblz4/BUILD.bazel b/tools/workspace/liblz4/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/liblz4/BUILD.bazel @@ -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() diff --git a/tools/workspace/liblz4/package.bzl b/tools/workspace/liblz4/package.bzl new file mode 100644 index 000000000000..80fab1a04603 --- /dev/null +++ b/tools/workspace/liblz4/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def liblz4_repository(name, modname = "liblz4", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/libpng/BUILD.bazel b/tools/workspace/libpng/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/libpng/BUILD.bazel @@ -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() diff --git a/tools/workspace/libpng/package.bzl b/tools/workspace/libpng/package.bzl new file mode 100644 index 000000000000..3295f3ab9f85 --- /dev/null +++ b/tools/workspace/libpng/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def libpng_repository(name, modname = "libpng", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/libprotobuf/BUILD.bazel b/tools/workspace/libprotobuf/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/libprotobuf/BUILD.bazel @@ -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() diff --git a/tools/workspace/libprotobuf/package.bzl b/tools/workspace/libprotobuf/package.bzl new file mode 100644 index 000000000000..9564a1882fe7 --- /dev/null +++ b/tools/workspace/libprotobuf/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def libprotobuf_repository(name, modname = "protobuf", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/nlopt/BUILD.bazel b/tools/workspace/nlopt/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/nlopt/BUILD.bazel @@ -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() diff --git a/tools/workspace/nlopt/package.bzl b/tools/workspace/nlopt/package.bzl new file mode 100644 index 000000000000..14c54ed3f399 --- /dev/null +++ b/tools/workspace/nlopt/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def nlopt_repository(name, modname = "nlopt", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/tinyxml/BUILD.bazel b/tools/workspace/tinyxml/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/tinyxml/BUILD.bazel @@ -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() diff --git a/tools/workspace/tinyxml/package.bzl b/tools/workspace/tinyxml/package.bzl new file mode 100644 index 000000000000..a4396cf6d961 --- /dev/null +++ b/tools/workspace/tinyxml/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def tinyxml_repository(name, modname = "tinyxml", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/tinyxml2/BUILD.bazel b/tools/workspace/tinyxml2/BUILD.bazel new file mode 100644 index 000000000000..2e5301dc6578 --- /dev/null +++ b/tools/workspace/tinyxml2/BUILD.bazel @@ -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() diff --git a/tools/workspace/tinyxml2/package.bzl b/tools/workspace/tinyxml2/package.bzl new file mode 100644 index 000000000000..f8a3fc51f1b0 --- /dev/null +++ b/tools/workspace/tinyxml2/package.bzl @@ -0,0 +1,9 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def tinyxml2_repository(name, modname = "tinyxml2", **kwargs): + pkg_config_repository(name = name, modname = modname, **kwargs) diff --git a/tools/workspace/yaml_cpp/package.bzl b/tools/workspace/yaml_cpp/package.bzl new file mode 100644 index 000000000000..e0069306318a --- /dev/null +++ b/tools/workspace/yaml_cpp/package.bzl @@ -0,0 +1,19 @@ +# -*- mode: python -*- + +load( + "@drake//tools/workspace:pkg_config.bzl", + "pkg_config_repository", +) + +def yaml_cpp_repository( + name, + modname = "yaml-cpp", + atleast_version = "0.5.2", + extra_deps = ["@boost//:boost_headers"], + **kwargs): + pkg_config_repository( + name = name, + modname = modname, + atleast_version = atleast_version, + extra_deps = extra_deps, + **kwargs)