reformat bazel files to use Google coding standards
Change-Id: I320f0ca7ccb1b2247ccdd9fa58fefca7dad8a16f
diff --git a/BUILD b/BUILD
index 9416716..31383aa 100644
--- a/BUILD
+++ b/BUILD
@@ -1,21 +1,20 @@
filegroup(
name = "onos",
srcs = [
- "//utils/junit:onlab-junit-osgi",
- "//utils/misc:onlab-misc-osgi",
- "//utils/osgi:onlab-osgi-osgi",
- "//utils/rest:onlab-rest-osgi",
- "//utils/osgiwrap:osgi-jar",
- "//core/api:onos-api-osgi",
- "//core/common:onos-core-common-osgi",
- "//incubator/api:onos-incubator-api-osgi",
- "//core/store/serializers:onos-core-serializers-osgi",
- "//core/store/dist:onos-core-dist-osgi",
- "//incubator/store:onos-incubator-store",
- "//incubator/net:onos-incubator-net",
- "//protocols/openflow/api:onos-protocols-openflow-api-osgi",
- "//drivers/default:onos-drivers-default-osgi",
- #"//core/net:onos-core-net-osgi",
- ],
+ "//utils/junit:onlab-junit-osgi",
+ "//utils/misc:onlab-misc-osgi",
+ "//utils/osgi:onlab-osgi-osgi",
+ "//utils/rest:onlab-rest-osgi",
+ "//utils/osgiwrap:osgi-jar",
+ "//core/api:onos-api-osgi",
+ "//core/common:onos-core-common-osgi",
+ "//incubator/api:onos-incubator-api-osgi",
+ "//core/store/serializers:onos-core-serializers-osgi",
+ "//core/store/dist:onos-core-dist-osgi",
+ "//incubator/store:onos-incubator-store",
+ "//incubator/net:onos-incubator-net",
+ "//protocols/openflow/api:onos-protocols-openflow-api-osgi",
+ "//drivers/default:onos-drivers-default-osgi",
+ #"//core/net:onos-core-net-osgi",
+ ],
)
-
diff --git a/core/api/BUILD b/core/api/BUILD
index be731ad..48ba6ae 100644
--- a/core/api/BUILD
+++ b/core/api/BUILD
@@ -1,27 +1,27 @@
COMPILE_DEPS = COMPILE + NETTY + JACKSON + METRICS + KRYO + [
- '//utils/misc:onlab-misc',
- '//utils/osgi:onlab-osgi',
- '//utils/rest:onlab-rest',
- '@joda_time//jar',
- '@netty//jar',
+ "//utils/misc:onlab-misc",
+ "//utils/osgi:onlab-osgi",
+ "//utils/rest:onlab-rest",
+ "@joda_time//jar",
+ "@netty//jar",
]
-osgi_jar_with_tests (
- name = 'onos-api',
- deps = COMPILE_DEPS,
+osgi_jar_with_tests(
+ name = "onos-api",
exclude_tests = [
- 'org.onosproject.net.config.basics.AbstractConfigTest',
- 'org.onosproject.net.driver.AbstractDriverLoaderTest',
- 'org.onosproject.net.intent.AbstractIntentTest',
- 'org.onosproject.net.intent.ConnectivityIntentTest',
- 'org.onosproject.net.intent.IntentTest',
- 'org.onosproject.net.pi.runtime.PiConstantsTest',
- 'org.onosproject.security.SecurityUtilTest',
- 'org.onosproject.ui.AbstractUiTest',
- 'org.onosproject.ui.model.AbstractUiModelTest',
- 'org.onosproject.net.behaviour.QosIdTest',
+ "org.onosproject.net.config.basics.AbstractConfigTest",
+ "org.onosproject.net.driver.AbstractDriverLoaderTest",
+ "org.onosproject.net.intent.AbstractIntentTest",
+ "org.onosproject.net.intent.ConnectivityIntentTest",
+ "org.onosproject.net.intent.IntentTest",
+ "org.onosproject.net.pi.runtime.PiConstantsTest",
+ "org.onosproject.security.SecurityUtilTest",
+ "org.onosproject.ui.AbstractUiTest",
+ "org.onosproject.ui.model.AbstractUiModelTest",
+ "org.onosproject.net.behaviour.QosIdTest",
],
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
#javadoc_files = glob(['src/main/javadoc/**/*']),
#javadoc_files_root = 'src/main/javadoc',
)
diff --git a/core/common/BUILD b/core/common/BUILD
index 7e4e557..be7fd44 100644
--- a/core/common/BUILD
+++ b/core/common/BUILD
@@ -1,11 +1,11 @@
COMPILE_DEPS = CORE_DEPS + JACKSON + METRICS + [
- '//incubator/api:onos-incubator-api',
+ "//incubator/api:onos-incubator-api",
]
-TEST_DEPS = TEST + ['//core/api:onos-api-tests']
+TEST_DEPS = TEST + ["//core/api:onos-api-tests"]
-osgi_jar_with_tests (
- deps = COMPILE_DEPS,
+osgi_jar_with_tests(
test_deps = TEST_DEPS,
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/core/store/dist/BUILD b/core/store/dist/BUILD
index 0608650..c48acda 100644
--- a/core/store/dist/BUILD
+++ b/core/store/dist/BUILD
@@ -1,28 +1,28 @@
COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + KRYO + [
- '//core/common:onos-core-common',
- '//utils/rest:onlab-rest',
- '//core/store/serializers:onos-core-serializers',
- '@netty_transport//jar',
- '@netty_codec//jar',
- '@netty_handler//jar',
- '@netty_transport_native_epoll//jar',
- '@netty_resolver//jar',
- '@commons_math3//jar',
- '//incubator/api:onos-incubator-api',
+ "//core/common:onos-core-common",
+ "//utils/rest:onlab-rest",
+ "//core/store/serializers:onos-core-serializers",
+ "@netty_transport//jar",
+ "@netty_codec//jar",
+ "@netty_handler//jar",
+ "@netty_transport_native_epoll//jar",
+ "@netty_resolver//jar",
+ "@commons_math3//jar",
+ "//incubator/api:onos-incubator-api",
]
TEST_DEPS = TEST + [
- '//core/api:onos-api-tests',
- '//core/common:onos-core-common-tests',
+ "//core/api:onos-api-tests",
+ "//core/common:onos-core-common-tests",
]
-osgi_jar_with_tests (
- name = 'onos-core-dist',
- deps = COMPILE_DEPS,
- test_deps = TEST_DEPS,
+osgi_jar_with_tests(
+ name = "onos-core-dist",
exclude_tests = [
- 'org.onosproject.store.link.impl.ECLinkStoreTest',
- 'org.onosproject.store.flow.impl.DistributedFlowRuleStoreTest',
+ "org.onosproject.store.link.impl.ECLinkStoreTest",
+ "org.onosproject.store.flow.impl.DistributedFlowRuleStoreTest",
],
+ test_deps = TEST_DEPS,
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/core/store/serializers/BUILD b/core/store/serializers/BUILD
index 83c05e3..6b51c34 100644
--- a/core/store/serializers/BUILD
+++ b/core/store/serializers/BUILD
@@ -1,12 +1,12 @@
COMPILE_DEPS = CORE_DEPS + KRYO + [
- '//incubator/api:onos-incubator-api',
+ "//incubator/api:onos-incubator-api",
]
TEST_DEPS = TEST
-osgi_jar_with_tests (
- name = 'onos-core-serializers',
- deps = COMPILE_DEPS,
+osgi_jar_with_tests(
+ name = "onos-core-serializers",
test_deps = TEST_DEPS,
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/drivers/default/BUILD b/drivers/default/BUILD
index faf4933..b609975 100644
--- a/drivers/default/BUILD
+++ b/drivers/default/BUILD
@@ -1,17 +1,17 @@
COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + [
- '@openflowj//jar',
- '//protocols/openflow/api:onos-protocols-openflow-api',
- '//core/store/serializers:onos-core-serializers',
+ "@openflowj//jar",
+ "//protocols/openflow/api:onos-protocols-openflow-api",
+ "//core/store/serializers:onos-core-serializers",
]
TEST_DEPS = TEST_ADAPTERS + [
- '//core/api:onos-api-tests',
+ "//core/api:onos-api-tests",
]
-osgi_jar_with_tests (
- deps = COMPILE_DEPS,
- test_deps = TEST_DEPS,
+osgi_jar_with_tests(
#resources_root = 'src/main/resources',
- resources = glob(['src/main/resources/**']),
+ resources = glob(["src/main/resources/**"]),
+ test_deps = TEST_DEPS,
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/incubator/api/BUILD b/incubator/api/BUILD
index c0beb98..c6ca52a 100644
--- a/incubator/api/BUILD
+++ b/incubator/api/BUILD
@@ -2,8 +2,8 @@
TEST_DEPS = TEST_ADAPTERS
-osgi_jar_with_tests (
- deps = COMPILE_DEPS,
+osgi_jar_with_tests(
test_deps = TEST_DEPS,
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/incubator/net/BUILD b/incubator/net/BUILD
index d6ed989..059f656 100644
--- a/incubator/net/BUILD
+++ b/incubator/net/BUILD
@@ -1,18 +1,18 @@
COMPILE_DEPS = CORE_DEPS + JACKSON + METRICS + KRYO + [
- '//incubator/store:onos-incubator-store',
- '//incubator/api:onos-incubator-api',
- '//core/common:onos-core-common',
+ "//incubator/store:onos-incubator-store",
+ "//incubator/api:onos-incubator-api",
+ "//core/common:onos-core-common",
]
TEST_DEPS = TEST_REST + [
- '//incubator/api:onos-incubator-api-tests',
+ "//incubator/api:onos-incubator-api-tests",
]
-osgi_jar_with_tests (
- deps = COMPILE_DEPS,
- test_deps = TEST_DEPS,
+osgi_jar_with_tests(
exclude_tests = [
- 'org.onosproject.incubator.net.virtual.impl.VirtualNetworkIntentManagerTest',
+ "org.onosproject.incubator.net.virtual.impl.VirtualNetworkIntentManagerTest",
],
+ test_deps = TEST_DEPS,
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/incubator/store/BUILD b/incubator/store/BUILD
index 37ce25a..9fd3b5f 100644
--- a/incubator/store/BUILD
+++ b/incubator/store/BUILD
@@ -1,15 +1,15 @@
COMPILE_DEPS = CORE_DEPS + KRYO + [
- '//core/common:onos-core-common',
- '//utils/rest:onlab-rest',
- '//core/store/serializers:onos-core-serializers',
- '@concurrent_trees//jar',
- '//incubator/api:onos-incubator-api',
+ "//core/common:onos-core-common",
+ "//utils/rest:onlab-rest",
+ "//core/store/serializers:onos-core-serializers",
+ "@concurrent_trees//jar",
+ "//incubator/api:onos-incubator-api",
]
TEST_DEPS = TEST_ADAPTERS
-osgi_jar_with_tests (
- deps = COMPILE_DEPS,
+osgi_jar_with_tests(
test_deps = TEST_DEPS,
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/protocols/openflow/api/BUILD b/protocols/openflow/api/BUILD
index 35abad3..a7df405 100644
--- a/protocols/openflow/api/BUILD
+++ b/protocols/openflow/api/BUILD
@@ -1,17 +1,17 @@
COMPILE_DEPS = CORE_DEPS + NETTY + [
- '//incubator/store:onos-incubator-store',
- '//incubator/api:onos-incubator-api',
- '//core/common:onos-core-common',
- '@openflowj//jar',
- '@netty_transport//jar',
+ "//incubator/store:onos-incubator-store",
+ "//incubator/api:onos-incubator-api",
+ "//core/common:onos-core-common",
+ "@openflowj//jar",
+ "@netty_transport//jar",
]
TEST_DEPS = TEST + [
- '//core/api:onos-api-tests',
+ "//core/api:onos-api-tests",
]
-osgi_jar_with_tests (
- deps = COMPILE_DEPS,
+osgi_jar_with_tests(
test_deps = TEST_DEPS,
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/protocols/p4runtime/api/BUILD b/protocols/p4runtime/api/BUILD
index 2936d86..50a0624 100644
--- a/protocols/p4runtime/api/BUILD
+++ b/protocols/p4runtime/api/BUILD
@@ -1,11 +1,11 @@
-GRPC_VER = '1.3.1'
+GRPC_VER = "1.3.1"
COMPILE_DEPS = CORE_DEPS + [
-# '@grpc//jar',
+ # '@grpc//jar',
]
TEST_DEPS = TEST + [
- '//core/api:onos-api-tests',
+ "//core/api:onos-api-tests",
]
#osgi_jar_with_tests (
diff --git a/protocols/p4runtime/model/BUILD b/protocols/p4runtime/model/BUILD
index 490ea94..39c314e 100644
--- a/protocols/p4runtime/model/BUILD
+++ b/protocols/p4runtime/model/BUILD
@@ -1,4 +1,4 @@
-PROTOBUF_VER = '3_2_0'
+PROTOBUF_VER = "3_2_0"
COMPILE_DEPS = CORE_DEPS + [
#'//protocols/p4runtime/proto:onos-protocols-p4runtime-proto',
diff --git a/tools/build/bazel/BUILD b/tools/build/bazel/BUILD
index 8b13789..e69de29 100644
--- a/tools/build/bazel/BUILD
+++ b/tools/build/bazel/BUILD
@@ -1 +0,0 @@
-
diff --git a/tools/build/bazel/generate_test_rules.bzl b/tools/build/bazel/generate_test_rules.bzl
index c8c3976..03f5073 100644
--- a/tools/build/bazel/generate_test_rules.bzl
+++ b/tools/build/bazel/generate_test_rules.bzl
@@ -21,93 +21,93 @@
"""
def testIsExcluded(exclude_tests, test):
- for excluded_test in exclude_tests:
- normalized_excluded_test = excluded_test.replace('.', '/')
- if test.endswith(normalized_excluded_test):
- return True;
- return False
+ for excluded_test in exclude_tests:
+ normalized_excluded_test = excluded_test.replace(".", "/")
+ if test.endswith(normalized_excluded_test):
+ return True
+ return False
-def generate_test_rules(name,
- test_files,
- deps,
- exclude_tests=[],
- default_test_size="small",
- small_tests=[],
- medium_tests=[],
- large_tests=[],
- enormous_tests=[],
- resources=[],
- flaky_tests=[],
- tags=[],
- prefix="",
- jvm_flags=["-XX:MaxPermSize=128m"],
- args=[],
- visibility=None,
- shard_count=1):
- for test in _get_test_names(test_files):
- if testIsExcluded(exclude_tests, test):
- continue
- test_size = default_test_size
- if test in small_tests:
- test_size = "small"
- if test in medium_tests:
- test_size = "medium"
- if test in large_tests:
- test_size = "large"
- if test in enormous_tests:
- test_size = "enormous"
- flaky = 0
- if (test in flaky_tests) or ("flaky" in tags):
- flaky = 1
- java_class = _package_from_path(
- PACKAGE_NAME + "/" + _strip_right(test, ".java"))
- package = java_class[:java_class.rfind(".")]
- native.java_test(name = prefix + test,
- runtime_deps = deps,
- resources = resources,
- size = test_size,
- jvm_flags = jvm_flags,
- args = args,
- flaky = flaky,
- tags = tags,
- test_class = java_class,
- visibility = visibility,
- shard_count = shard_count)
-
+def generate_test_rules(
+ name,
+ test_files,
+ deps,
+ exclude_tests = [],
+ default_test_size = "small",
+ small_tests = [],
+ medium_tests = [],
+ large_tests = [],
+ enormous_tests = [],
+ resources = [],
+ flaky_tests = [],
+ tags = [],
+ prefix = "",
+ jvm_flags = ["-XX:MaxPermSize=128m"],
+ args = [],
+ visibility = None,
+ shard_count = 1):
+ for test in _get_test_names(test_files):
+ if testIsExcluded(exclude_tests, test):
+ continue
+ test_size = default_test_size
+ if test in small_tests:
+ test_size = "small"
+ if test in medium_tests:
+ test_size = "medium"
+ if test in large_tests:
+ test_size = "large"
+ if test in enormous_tests:
+ test_size = "enormous"
+ flaky = 0
+ if (test in flaky_tests) or ("flaky" in tags):
+ flaky = 1
+ java_class = _package_from_path(
+ PACKAGE_NAME + "/" + _strip_right(test, ".java"),
+ )
+ package = java_class[:java_class.rfind(".")]
+ native.java_test(
+ name = prefix + test,
+ runtime_deps = deps,
+ resources = resources,
+ size = test_size,
+ jvm_flags = jvm_flags,
+ args = args,
+ flaky = flaky,
+ tags = tags,
+ test_class = java_class,
+ visibility = visibility,
+ shard_count = shard_count,
+ )
def _get_test_names(test_files):
- test_names = []
- for test_file in test_files:
- if not test_file.endswith("Test.java"):
- continue
- test_names += [test_file[:-5]]
- return test_names
+ test_names = []
+ for test_file in test_files:
+ if not test_file.endswith("Test.java"):
+ continue
+ test_names += [test_file[:-5]]
+ return test_names
-
-def _package_from_path(package_path, src_impls=None):
- src_impls = src_impls or ['javatests/', 'java/']
- for src_impl in src_impls:
- if not src_impl.endswith('/'):
- src_impl += '/'
- index = _index_of_end(package_path, src_impl)
- if index >= 0:
- package_path = package_path[index:]
- break
- return package_path.replace('/', '.')
-
+def _package_from_path(package_path, src_impls = None):
+ src_impls = src_impls or ["javatests/", "java/"]
+ for src_impl in src_impls:
+ if not src_impl.endswith("/"):
+ src_impl += "/"
+ index = _index_of_end(package_path, src_impl)
+ if index >= 0:
+ package_path = package_path[index:]
+ break
+ return package_path.replace("/", ".")
def _strip_right(str, suffix):
- """Returns str without the suffix if it ends with suffix."""
- if str.endswith(suffix):
- return str[0: len(str) - len(suffix)]
- else:
- return str
-
+ """Returns str without the suffix if it ends with suffix."""
+ if str.endswith(suffix):
+ return str[0:len(str) - len(suffix)]
+ else:
+ return str
def _index_of_end(str, part):
- """If part is in str, return the index of the first character after part.
- Return -1 if part is not in str."""
- index = str.find(part)
- if index >= 0:
- return index + len(part)
- return -1
+ """If part is in str, return the index of the first character after part.
+ Return -1 if part is not in str."""
+ index = str.find(part)
+ if index >= 0:
+ return index + len(part)
+ return -1
diff --git a/tools/build/bazel/osgi-java-library.bzl b/tools/build/bazel/osgi-java-library.bzl
index 680ecc9..e47c3d7 100644
--- a/tools/build/bazel/osgi-java-library.bzl
+++ b/tools/build/bazel/osgi-java-library.bzl
@@ -3,82 +3,81 @@
load("//tools/build/bazel:generate_test_rules.bzl", "generate_test_rules")
def all_java_sources():
- return native.glob(["src/main/java/**/*.java"])
+ return native.glob(["src/main/java/**/*.java"])
def all_java_test_sources():
- return native.glob(["src/test/java/**/*.java"])
+ return native.glob(["src/test/java/**/*.java"])
def all_test_resources():
- return native.glob(["src/test/resources/**"])
+ return native.glob(["src/test/resources/**"])
def all_resources(resources_root):
- if resources_root == None:
- return native.glob(["src/main/resources/**"])
- else:
- return native.glob([resources_root + '**'])
+ if resources_root == None:
+ return native.glob(["src/main/resources/**"])
+ else:
+ return native.glob([resources_root + "**"])
# Implementation of the rule to call bnd to make an OSGI jar file
def _bnd_impl(ctx):
+ jar = ctx.file.source.path
+ output = ctx.outputs.osgi_jar.path
+ cp = ""
+ name = ctx.attr.source.label.name
+ group = ctx.attr.package_name_root
+ version = ctx.attr.version
+ license = ""
+ importPackages = "*"
+ exportPackages = "*"
+ includeResources = ""
+ webContext = "NONE"
+ dynamicimportPackages = ""
- jar = ctx.file.source.path
- output = ctx.outputs.osgi_jar.path
- cp = ""
- name = ctx.attr.source.label.name
- group = ctx.attr.package_name_root
- version = ctx.attr.version
- license = ""
- importPackages = "*"
- exportPackages = "*"
- includeResources = ""
- webContext = "NONE"
- dynamicimportPackages = ""
+ inputDependencies = [ctx.file.source]
- inputDependencies = [ctx.file.source]
+ # determine the dependencies and build the class path
+ for dep in ctx.attr.deps:
+ file = dep.java.outputs.jars[0].class_jar
- # determine the dependencies and build the class path
- for dep in ctx.attr.deps:
- file = dep.java.outputs.jars[0].class_jar
+ if cp:
+ cp += ":"
+ cp += file.path
+ inputDependencies = inputDependencies + [file]
- if cp:
- cp += ":"
- cp += file.path
- inputDependencies = inputDependencies + [file]
+ # extract the class files for use by bnd
+ classes = ctx.actions.declare_file("classes")
+ classesPath = classes.path
+ jarCommand = "mkdir -p %s && cp %s %s && cd %s && jar xf *.jar" % (classesPath, jar, classesPath, classesPath)
+ ctx.actions.run_shell(
+ inputs = inputDependencies,
+ outputs = [classes],
+ command = jarCommand,
+ progress_message = "Expanding jar file: %s" % jar,
+ )
+ inputDependencies += [classes]
- # extract the class files for use by bnd
- classes = ctx.actions.declare_file("classes")
- classesPath = classes.path
- jarCommand = "mkdir -p %s && cp %s %s && cd %s && jar xf *.jar" % (classesPath, jar, classesPath, classesPath)
- ctx.actions.run_shell(
- inputs=inputDependencies,
- outputs=[classes],
- command=jarCommand,
- progress_message="Expanding jar file: %s" % jar,
- )
- inputDependencies += [classes]
-
- # call bnd to make the OSGI jar file
- arguments=[
- jar,
- output,
- cp,
- name,
- group,
- version,
- license,
- importPackages,
- exportPackages,
- includeResources,
- webContext,
- dynamicimportPackages,
- classesPath,
- ]
- ctx.actions.run(
- inputs=inputDependencies,
- outputs=[ctx.outputs.osgi_jar],
- arguments=arguments,
- progress_message="Running bnd wrapper on: %s" % ctx.attr.name,
- executable=ctx.executable._bnd_exe,
- )
+ # call bnd to make the OSGI jar file
+ arguments = [
+ jar,
+ output,
+ cp,
+ name,
+ group,
+ version,
+ license,
+ importPackages,
+ exportPackages,
+ includeResources,
+ webContext,
+ dynamicimportPackages,
+ classesPath,
+ ]
+ ctx.actions.run(
+ inputs = inputDependencies,
+ outputs = [ctx.outputs.osgi_jar],
+ arguments = arguments,
+ progress_message = "Running bnd wrapper on: %s" % ctx.attr.name,
+ executable = ctx.executable._bnd_exe,
+ )
bnd = rule(
attrs = {
@@ -101,82 +100,87 @@
)
def _fwd_bnd(name, source, deps, version, package_name_root, visibility):
- bnd(name = name, source = source, deps = deps, version = version, package_name_root = package_name_root, visibility = visibility)
+ bnd(name = name, source = source, deps = deps, version = version, package_name_root = package_name_root, visibility = visibility)
-def wrapped_osgi_library(name, jar, deps, version = ONOS_VERSION, package_name_root = "org.onosproject", visibility = [ "//visibility:private" ]):
- _fwd_bnd(name, jar, deps, version, package_name_root, visibility)
+def wrapped_osgi_library(name, jar, deps, version = ONOS_VERSION, package_name_root = "org.onosproject", visibility = ["//visibility:private"]):
+ _fwd_bnd(name, jar, deps, version, package_name_root, visibility)
-def osgi_jar_with_tests(name = None,
- deps = None,
- test_deps = None,
- package_name_root = "org.onosproject",
- srcs = None,
- resources_root = None,
- resources = None,
- test_srcs = None,
- exclude_tests = None,
- test_resources = None,
- visibility = [ "//visibility:public" ],
- version = ONOS_VERSION):
- if name == None:
- name = "onos-" + native.package_name().replace("/", "-")
- if srcs == None:
- srcs = all_java_sources()
- if resources == None:
- resources = all_resources(resources_root)
- if test_srcs == None:
- test_srcs = all_java_test_sources()
- if test_resources == None:
- test_resources = all_test_resources()
- if exclude_tests == None:
- exclude_tests = []
- if deps == None:
- deps = COMPILE
- if test_deps == None:
- test_deps = TEST
- tests_name = name + '-tests'
- tests_jar_deps = list(depset(deps + test_deps)) + [ name ]
- all_test_deps = tests_jar_deps + [ tests_name ]
-
- native.java_library(name = name, srcs = srcs, resources = resources, deps = deps, visibility = visibility)
- _fwd_bnd(name + '-osgi', name, deps, version, package_name_root, visibility)
- if test_srcs != []:
- native.java_library(name = tests_name,
- srcs = test_srcs,
- resources = test_resources,
- deps = tests_jar_deps,
- visibility = visibility)
-
- generate_test_rules(
- name = name + "-tests-gen",
- test_files = test_srcs,
- exclude_tests = exclude_tests,
- deps = all_test_deps
- )
-
-def osgi_jar(name = None,
- deps = None,
- package_name_root = "org.onosproject",
- srcs = None,
- resources_root = None,
- resources = None,
- visibility = [ "//visibility:public" ],
- version = ONOS_VERSION):
+def osgi_jar_with_tests(
+ name = None,
+ deps = None,
+ test_deps = None,
+ package_name_root = "org.onosproject",
+ srcs = None,
+ resources_root = None,
+ resources = None,
+ test_srcs = None,
+ exclude_tests = None,
+ test_resources = None,
+ visibility = ["//visibility:public"],
+ version = ONOS_VERSION):
+ if name == None:
+ name = "onos-" + native.package_name().replace("/", "-")
if srcs == None:
- srcs = all_java_sources()
+ srcs = all_java_sources()
+ if resources == None:
+ resources = all_resources(resources_root)
+ if test_srcs == None:
+ test_srcs = all_java_test_sources()
+ if test_resources == None:
+ test_resources = all_test_resources()
+ if exclude_tests == None:
+ exclude_tests = []
if deps == None:
- deps = COMPILE
+ deps = COMPILE
+ if test_deps == None:
+ test_deps = TEST
+ tests_name = name + "-tests"
+ tests_jar_deps = list(depset(deps + test_deps)) + [name]
+ all_test_deps = tests_jar_deps + [tests_name]
- osgi_jar_with_tests(name = name,
- deps = deps,
- test_deps = [],
- package_name_root = package_name_root,
- srcs = srcs,
- resources = resources,
- resources_root = resources_root,
- test_srcs = [],
- exclude_tests = [],
- test_resources = [],
- visibility = visibility,
- version = version)
+ native.java_library(name = name, srcs = srcs, resources = resources, deps = deps, visibility = visibility)
+ _fwd_bnd(name + "-osgi", name, deps, version, package_name_root, visibility)
+ if test_srcs != []:
+ native.java_library(
+ name = tests_name,
+ srcs = test_srcs,
+ resources = test_resources,
+ deps = tests_jar_deps,
+ visibility = visibility,
+ )
+ generate_test_rules(
+ name = name + "-tests-gen",
+ test_files = test_srcs,
+ exclude_tests = exclude_tests,
+ deps = all_test_deps,
+ )
+
+def osgi_jar(
+ name = None,
+ deps = None,
+ package_name_root = "org.onosproject",
+ srcs = None,
+ resources_root = None,
+ resources = None,
+ visibility = ["//visibility:public"],
+ version = ONOS_VERSION):
+ if srcs == None:
+ srcs = all_java_sources()
+ if deps == None:
+ deps = COMPILE
+
+ osgi_jar_with_tests(
+ name = name,
+ deps = deps,
+ test_deps = [],
+ package_name_root = package_name_root,
+ srcs = srcs,
+ resources = resources,
+ resources_root = resources_root,
+ test_srcs = [],
+ exclude_tests = [],
+ test_resources = [],
+ visibility = visibility,
+ version = version,
+ )
diff --git a/tools/build/bazel/rules.bzl b/tools/build/bazel/rules.bzl
deleted file mode 100644
index 3dd5922..0000000
--- a/tools/build/bazel/rules.bzl
+++ /dev/null
@@ -1,9 +0,0 @@
-load("//tools/build/bazel:generate_workspace.bzl",
- "generated_java_libraries", "COMPILE", "CORE_DEPS", "JACKSON",
- "TEST_ADAPTERS", "TEST", "TEST_REST", "METRICS", "KRYO", "NETTY")
-
-def onos_bazel_rules() :
- return
-
-def g() :
- generated_java_libraries()
\ No newline at end of file
diff --git a/tools/build/bazel/variables.bzl b/tools/build/bazel/variables.bzl
index 1ef7121..cad0944 100644
--- a/tools/build/bazel/variables.bzl
+++ b/tools/build/bazel/variables.bzl
@@ -1,2 +1 @@
ONOS_VERSION = "1.13.0-SNAPSHOT"
-
diff --git a/utils/junit/BUILD b/utils/junit/BUILD
index 13a2068..2c74051 100644
--- a/utils/junit/BUILD
+++ b/utils/junit/BUILD
@@ -1,11 +1,12 @@
-SRC = 'src/main/java/org/onlab/**/'
-TEST_SRC = 'src/test/java/org/onlab/**/'
+SRC = "src/main/java/org/onlab/**/"
+
+TEST_SRC = "src/test/java/org/onlab/**/"
COMPILE_DEPS = [
- "@guava//jar",
- "@slf4j_api//jar",
- "@hamcrest_all//jar",
- "@junit//jar",
+ "@guava//jar",
+ "@slf4j_api//jar",
+ "@hamcrest_all//jar",
+ "@junit//jar",
]
TEST_DEPS = [
@@ -13,13 +14,11 @@
]
osgi_jar_with_tests(
- name = 'onlab-junit',
- srcs = glob([SRC + '*.java']),
- deps = COMPILE_DEPS,
- test_srcs = glob([TEST_SRC + '*.java']),
+ name = "onlab-junit",
+ srcs = glob([SRC + "*.java"]),
+ package_name_root = "org.onlab",
test_deps = TEST_DEPS,
- package_name_root = 'org.onlab',
+ test_srcs = glob([TEST_SRC + "*.java"]),
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
-
-
diff --git a/utils/misc/BUILD b/utils/misc/BUILD
index 3635a41..cfb787f 100644
--- a/utils/misc/BUILD
+++ b/utils/misc/BUILD
@@ -1,17 +1,19 @@
COMPILE_DEPS = COMPILE + JACKSON + [
- "@kryo//jar",
- "@metrics_core//jar",
- "@netty//jar",
- "@netty_common//jar",
- "@objenesis//jar",
+ "@kryo//jar",
+ "@metrics_core//jar",
+ "@netty//jar",
+ "@netty_common//jar",
+ "@objenesis//jar",
]
osgi_jar_with_tests(
- name = 'onlab-misc',
- deps = COMPILE_DEPS,
- package_name_root = 'org.onlab',
- exclude_tests = ['org.onlab.graph.AbstractGraphPathSearchTest',
- 'org.onlab.graph.GraphTest',
- 'org.onlab.util.SlidingWindowCounterTest'],
+ name = "onlab-misc",
+ exclude_tests = [
+ "org.onlab.graph.AbstractGraphPathSearchTest",
+ "org.onlab.graph.GraphTest",
+ "org.onlab.util.SlidingWindowCounterTest",
+ ],
+ package_name_root = "org.onlab",
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/utils/osgi/BUILD b/utils/osgi/BUILD
index 91dd172..688e4c2 100644
--- a/utils/osgi/BUILD
+++ b/utils/osgi/BUILD
@@ -1,8 +1,8 @@
COMPILE_DEPS = COMPILE
osgi_jar_with_tests(
- name = 'onlab-osgi',
- deps = COMPILE_DEPS,
- package_name_root = 'org.onlab',
+ name = "onlab-osgi",
+ package_name_root = "org.onlab",
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)
diff --git a/utils/osgiwrap/BUILD b/utils/osgiwrap/BUILD
index 8e1e872..389cc8d 100644
--- a/utils/osgiwrap/BUILD
+++ b/utils/osgiwrap/BUILD
@@ -1,15 +1,15 @@
-OSGIWRAP_EXECUTABLE = 'osgi-jar'
+OSGIWRAP_EXECUTABLE = "osgi-jar"
COMPILE_DEPS = [
- '@guava//jar',
- '@bndlib//jar',
- '@org_apache_felix_scr_bnd//jar'
+ "@guava//jar",
+ "@bndlib//jar",
+ "@org_apache_felix_scr_bnd//jar",
]
java_binary(
name = OSGIWRAP_EXECUTABLE,
- srcs = glob(['src/main/java/**/*.java']),
+ srcs = glob(["src/main/java/**/*.java"]),
+ main_class = "org.onlab.osgiwrap.OSGiWrapper",
+ visibility = ["//visibility:public"],
deps = COMPILE_DEPS,
- main_class = 'org.onlab.osgiwrap.OSGiWrapper',
- visibility = ["//visibility:public"]
)
diff --git a/utils/rest/BUILD b/utils/rest/BUILD
index 0538ba6..27a221f 100644
--- a/utils/rest/BUILD
+++ b/utils/rest/BUILD
@@ -1,13 +1,13 @@
COMPILE_DEPS = COMPILE + JACKSON + [
- "//utils/osgi:onlab-osgi",
- "//utils/misc:onlab-misc",
- "@javax_ws_rs_api//jar",
- "@jersey_server//jar",
+ "//utils/osgi:onlab-osgi",
+ "//utils/misc:onlab-misc",
+ "@javax_ws_rs_api//jar",
+ "@jersey_server//jar",
]
osgi_jar(
- name = 'onlab-rest',
- deps = COMPILE_DEPS,
- package_name_root = 'org.onlab',
+ name = "onlab-rest",
+ package_name_root = "org.onlab",
visibility = ["//visibility:public"],
+ deps = COMPILE_DEPS,
)