mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-12-08 19:02:00 +01:00
Implement OSGI wrappers for proto jar files
Change-Id: Ic30d162093c383edc4abf5e9e9b96df669d804c8
This commit is contained in:
parent
2ee4585ea0
commit
3275ae800b
@ -2,7 +2,6 @@ PROTOBUF_VER = "3_2_0"
|
||||
|
||||
COMPILE_DEPS = CORE_DEPS + [
|
||||
"//protocols/p4runtime/proto:p4_runtime_java_proto",
|
||||
"//protocols/p4runtime/proto:p4_config_java_proto",
|
||||
"@com_google_protobuf//:protobuf_java",
|
||||
]
|
||||
|
||||
|
||||
@ -1,23 +1,22 @@
|
||||
java_proto_library(
|
||||
name = "p4_types_java_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@p4lang_pi//:p4types_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "p4_config_java_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@p4lang_pi//:p4config_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "p4_tmp_config_java_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@p4lang_pi//:p4_tmp_config_proto"],
|
||||
)
|
||||
|
||||
java_proto_library(
|
||||
name = "p4_runtime_java_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@p4lang_pi//:p4_runtime_proto"],
|
||||
)
|
||||
|
||||
wrapped_osgi_library(
|
||||
name = "rpc_java_proto-osgi",
|
||||
jar = "@google_rpc//:rpc_java_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = CORE_DEPS + ["@protobuf_java_3_2_0//jar"],
|
||||
)
|
||||
|
||||
wrapped_osgi_library(
|
||||
name = "p4_runtime_java_proto-osgi",
|
||||
jar = ":p4_runtime_java_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = CORE_DEPS + [
|
||||
"@protobuf_java_3_2_0//jar",
|
||||
"@google_rpc//:rpc_java_proto",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
proto_library(
|
||||
name = "status_proto",
|
||||
srcs = [ "//:google/rpc/status.proto" ],
|
||||
name = "rpc_proto",
|
||||
srcs = [ "//:google/rpc/code.proto", "//:google/rpc/status.proto" ],
|
||||
deps = [
|
||||
"@com_google_protobuf//:any_proto",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "code_proto",
|
||||
srcs = [ "//:google/rpc/code.proto" ],
|
||||
deps = [
|
||||
"@com_google_protobuf//:any_proto",
|
||||
],
|
||||
java_proto_library(
|
||||
name = "rpc_java_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":rpc_proto"],
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2018-present Open Networking Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
load("//tools/build/bazel:generate_workspace.bzl", "COMPILE", "TEST")
|
||||
load("//tools/build/bazel:variables.bzl", "ONOS_VERSION")
|
||||
load("//tools/build/bazel:generate_test_rules.bzl", "generate_test_rules")
|
||||
@ -19,9 +35,20 @@ def all_resources(resources_root):
|
||||
|
||||
# Implementation of the rule to call bnd to make an OSGI jar file
|
||||
def _bnd_impl(ctx):
|
||||
jar = ctx.file.source.path
|
||||
if (len(ctx.files.source) == 1):
|
||||
input_file = ctx.files.source[0]
|
||||
else:
|
||||
# this is a list of inputs. The one we want is the last one
|
||||
# in the list that isn't a source jar
|
||||
for file in reversed(ctx.files.source):
|
||||
if ("-src" in file.path):
|
||||
continue
|
||||
else:
|
||||
input_file = file
|
||||
break
|
||||
|
||||
jar = input_file.path
|
||||
output = ctx.outputs.osgi_jar.path
|
||||
cp = ""
|
||||
name = ctx.attr.source.label.name
|
||||
group = ctx.attr.package_name_root
|
||||
version = ctx.attr.version
|
||||
@ -31,8 +58,9 @@ def _bnd_impl(ctx):
|
||||
includeResources = ""
|
||||
webContext = "NONE"
|
||||
dynamicimportPackages = ""
|
||||
cp = ""
|
||||
|
||||
inputDependencies = [ctx.file.source]
|
||||
inputDependencies = [input_file]
|
||||
|
||||
# determine the dependencies and build the class path
|
||||
for dep in ctx.attr.deps:
|
||||
@ -47,7 +75,7 @@ def _bnd_impl(ctx):
|
||||
inputDependencies = inputDependencies + [file]
|
||||
|
||||
# extract the class files for use by bnd
|
||||
classes = ctx.actions.declare_file("classes")
|
||||
classes = ctx.actions.declare_file("classes" + ctx.label.name.replace("/", "-"))
|
||||
classesPath = classes.path
|
||||
jarCommand = "mkdir -p %s && cp %s %s && cd %s && jar xf *.jar" % (classesPath, jar, classesPath, classesPath)
|
||||
ctx.actions.run_shell(
|
||||
@ -87,7 +115,7 @@ bnd = rule(
|
||||
"deps": attr.label_list(),
|
||||
"version": attr.string(),
|
||||
"package_name_root": attr.string(),
|
||||
"source": attr.label(allow_single_file = True),
|
||||
"source": attr.label(),
|
||||
"_bnd_exe": attr.label(
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
|
||||
@ -1,40 +1,15 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
proto_library(
|
||||
name = "p4types_proto",
|
||||
srcs = [ "//:p4/p4types.proto" ],
|
||||
deps = [
|
||||
"@com_google_protobuf//:any_proto",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "p4config_proto",
|
||||
srcs = [ "//:p4/config/p4info.proto" ],
|
||||
deps = [
|
||||
"@com_google_protobuf//:any_proto",
|
||||
":p4types_proto",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "p4_tmp_config_proto",
|
||||
srcs = [ "//:p4/tmp/p4config.proto" ],
|
||||
deps = [
|
||||
"@com_google_protobuf//:any_proto",
|
||||
":p4types_proto",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "p4_runtime_proto",
|
||||
srcs = [ "//:p4/p4runtime.proto" ],
|
||||
srcs = [
|
||||
"//:p4/p4types.proto",
|
||||
"//:p4/config/p4info.proto",
|
||||
"//:p4/tmp/p4config.proto",
|
||||
"//:p4/p4runtime.proto",
|
||||
],
|
||||
deps = [
|
||||
"@com_google_protobuf//:any_proto",
|
||||
"@google_rpc//:status_proto",
|
||||
"@google_rpc//:code_proto",
|
||||
":p4types_proto",
|
||||
":p4config_proto",
|
||||
":p4_tmp_config_proto",
|
||||
"@google_rpc//:rpc_proto",
|
||||
],
|
||||
)
|
||||
Loading…
x
Reference in New Issue
Block a user