From cb39204af85533f1905b5715908c51adc46ca610 Mon Sep 17 00:00:00 2001 From: Pete Warden Date: Tue, 23 Feb 2016 10:18:32 -0800 Subject: Updated library generation with iOS options --- BUILD | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'BUILD') diff --git a/BUILD b/BUILD index c4de1c4c..8667cc48 100644 --- a/BUILD +++ b/BUILD @@ -26,6 +26,25 @@ load( "internal_protobuf_py_tests", ) +config_setting( + name = "ios_arm", + values = { + "ios_cpu": "armv7", + "ios_cpu": "armv7s", + "ios_cpu": "arm64", + }, +) + +IOS_ARM_COPTS = COPTS + [ + "-DOS_IOS", + "-miphoneos-version-min=7.0", + "-arch armv7", + "-arch armv7s", + "-arch arm64", + "-D__thread=", + "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/", +] + cc_library( name = "protobuf_lite", srcs = [ @@ -55,7 +74,10 @@ cc_library( "src/google/protobuf/wire_format_lite.cc", ], hdrs = glob(["src/google/protobuf/**/*.h"]), - copts = COPTS, + copts = select({ + ":ios_arm": IOS_ARM_COPTS, + "//conditions:default": COPTS, + }), includes = ["src/"], linkopts = LINK_OPTS, visibility = ["//visibility:public"], @@ -120,7 +142,10 @@ cc_library( "src/google/protobuf/wrappers.pb.cc", ], hdrs = glob(["src/**/*.h"]), - copts = COPTS, + copts = select({ + ":ios_arm": IOS_ARM_COPTS, + "//conditions:default": COPTS, + }), includes = ["src/"], linkopts = LINK_OPTS, visibility = ["//visibility:public"], -- cgit v1.2.3 From f0c1a8637218a03a083901493c9b3acdb6e5db57 Mon Sep 17 00:00:00 2001 From: Pete Warden Date: Wed, 9 Mar 2016 13:03:52 -0800 Subject: Added iOS settings to Bazel build --- BUILD | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'BUILD') diff --git a/BUILD b/BUILD index 8667cc48..39ba0d94 100644 --- a/BUILD +++ b/BUILD @@ -27,10 +27,22 @@ load( ) config_setting( - name = "ios_arm", + name = "ios_armv7", values = { "ios_cpu": "armv7", + }, +) + +config_setting( + name = "ios_armv7s", + values = { "ios_cpu": "armv7s", + }, +) + +config_setting( + name = "ios_arm64", + values = { "ios_cpu": "arm64", }, ) @@ -75,7 +87,9 @@ cc_library( ], hdrs = glob(["src/google/protobuf/**/*.h"]), copts = select({ - ":ios_arm": IOS_ARM_COPTS, + ":ios_armv7": IOS_ARM_COPTS, + ":ios_armv7s": IOS_ARM_COPTS, + ":ios_arm64": IOS_ARM_COPTS, "//conditions:default": COPTS, }), includes = ["src/"], @@ -143,7 +157,9 @@ cc_library( ], hdrs = glob(["src/**/*.h"]), copts = select({ - ":ios_arm": IOS_ARM_COPTS, + ":ios_armv7": IOS_ARM_COPTS, + ":ios_armv7s": IOS_ARM_COPTS, + ":ios_arm64": IOS_ARM_COPTS, "//conditions:default": COPTS, }), includes = ["src/"], -- cgit v1.2.3 From ea1886661e1ad607e7cac03f0e720c9ab337686e Mon Sep 17 00:00:00 2001 From: Steven Parkes Date: Thu, 25 Feb 2016 07:53:19 -0800 Subject: pass correct args to protoc for java wellknown protos when used as an external repository --- BUILD | 11 ++--------- protobuf.bzl | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 9 deletions(-) (limited to 'BUILD') diff --git a/BUILD b/BUILD index 9cbddd5b..32fd669f 100644 --- a/BUILD +++ b/BUILD @@ -22,6 +22,7 @@ load( "protobuf", "cc_proto_library", "py_proto_library", + "internal_gen_well_known_protos_java", "internal_protobuf_py_tests", ) @@ -457,16 +458,8 @@ cc_test( ################################################################################ # Java support ################################################################################ -genrule( - name = "gen_well_known_protos_java", +internal_gen_well_known_protos_java( srcs = WELL_KNOWN_PROTOS, - outs = [ - "wellknown.srcjar", - ], - cmd = "$(location :protoc) --java_out=$(@D)/wellknown.jar" + - " -Isrc $(SRCS) " + - " && mv $(@D)/wellknown.jar $(@D)/wellknown.srcjar", - tools = [":protoc"], ) java_library( diff --git a/protobuf.bzl b/protobuf.bzl index 71eaba22..fbcae0b3 100644 --- a/protobuf.bzl +++ b/protobuf.bzl @@ -199,6 +199,31 @@ def cc_proto_library( includes=includes, **kargs) + +def internal_gen_well_known_protos_java(srcs): + """Bazel rule to generate the gen_well_known_protos_java genrule + + Args: + srcs: the well known protos + """ + root = Label("%s//protobuf_java" % (REPOSITORY_NAME)).workspace_root + if root == "": + include = " -Isrc " + else: + include = " -I%s/src " % root + native.genrule( + name = "gen_well_known_protos_java", + srcs = srcs, + outs = [ + "wellknown.srcjar", + ], + cmd = "$(location :protoc) --java_out=$(@D)/wellknown.jar" + + " %s $(SRCS) " % include + + " && mv $(@D)/wellknown.jar $(@D)/wellknown.srcjar", + tools = [":protoc"], + ) + + def py_proto_library( name, srcs=[], -- cgit v1.2.3 From a9244ca0dfea15b024df5a81b948d09907fa3970 Mon Sep 17 00:00:00 2001 From: Steven Parkes Date: Thu, 10 Mar 2016 17:50:25 -0800 Subject: add java/util support based on java/util/pom.xml --- BUILD | 13 +++++++++++++ WORKSPACE | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'BUILD') diff --git a/BUILD b/BUILD index 32fd669f..cc699c8b 100644 --- a/BUILD +++ b/BUILD @@ -472,6 +472,19 @@ java_library( visibility = ["//visibility:public"], ) +java_library( + name = "protobuf_java_util", + srcs = glob([ + "java/util/src/main/java/com/google/protobuf/util/*.java", + ]), + deps = [ + "protobuf_java", + "//external:gson", + "//external:guava", + ], + visibility = ["//visibility:public"], +) + ################################################################################ # Python support ################################################################################ diff --git a/WORKSPACE b/WORKSPACE index 1e8e0a7f..065dc819 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -31,3 +31,23 @@ bind( name = "six", actual = "@six_archive//:six", ) + +maven_jar( + name = "guava_maven", + artifact = "com.google.guava:guava:18.0", +) + +bind( + name = "guava", + actual = "@guava_maven//jar", +) + +maven_jar( + name = "gson_maven", + artifact = "com.google.code.gson:gson:2.3", +) + +bind( + name = "gson", + actual = "@gson_maven//jar", +) -- cgit v1.2.3 From d5a573274df4fabd2afd34b5d98bc7ccf5cb5229 Mon Sep 17 00:00:00 2001 From: Steven Parkes Date: Tue, 22 Mar 2016 17:56:07 -0700 Subject: export well known protos --- BUILD | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'BUILD') diff --git a/BUILD b/BUILD index 2cb96b20..e35a2e8e 100644 --- a/BUILD +++ b/BUILD @@ -194,6 +194,12 @@ RELATIVE_WELL_KNOWN_PROTOS = [ WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS] +filegroup( + name = "well_known_protos", + srcs = WELL_KNOWN_PROTOS, + visibility = ["//visibility:public"], +) + cc_proto_library( name = "cc_wkt_protos", srcs = WELL_KNOWN_PROTOS, -- cgit v1.2.3