summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--WORKSPACE2
-rw-r--r--build_defs.bzl65
2 files changed, 12 insertions, 55 deletions
diff --git a/WORKSPACE b/WORKSPACE
index 58922bb..d49b894 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -20,6 +20,7 @@ git_repository(
commit = "25feb59620627b673df76813dfd66e3f565765e7",
#sha256 = "d7a221b3d4fb4f05b7473795ccea9e05dab3b8721f6286a95fffbffc2d926f8b",
remote = "https://github.com/haberman/protobuf.git",
+ shallow_since = "1541281400 -0700"
#tag = "conformance-build-tag",
)
@@ -27,6 +28,7 @@ git_repository(
name = "absl",
commit = "070f6e47b33a2909d039e620c873204f78809492",
remote = "https://github.com/abseil/abseil-cpp.git",
+ shallow_since = "1541627663 -0500"
)
http_archive(
diff --git a/build_defs.bzl b/build_defs.bzl
index 56e07c0..667db8a 100644
--- a/build_defs.bzl
+++ b/build_defs.bzl
@@ -337,67 +337,21 @@ def cc_library_func(ctx, hdrs, srcs, deps):
hdrs = hdrs,
compilation_contexts = compilation_contexts,
)
- output_file = ctx.new_file(ctx.bin_dir, "lib" + ctx.rule.attr.name + ".a")
- library_to_link = cc_common.create_library_to_link(
- actions = ctx.actions,
- feature_configuration = feature_configuration,
- cc_toolchain = toolchain,
- static_library = output_file,
- )
- archiver_path = cc_common.get_tool_for_action(
- feature_configuration = feature_configuration,
- action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
- )
- archiver_variables = cc_common.create_link_variables(
- feature_configuration = feature_configuration,
- cc_toolchain = toolchain,
- output_file = output_file.path,
- is_using_linker = False,
- )
- command_line = cc_common.get_memory_inefficient_command_line(
- feature_configuration = feature_configuration,
- action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
- variables = archiver_variables,
- )
+ # create link action
+ linking_contexts = [provider.linking_context for provider in cc_infos]
- # Non-PIC objects only get emitted in opt builds.
- use_pic = True
- if ctx.var.get("COMPILATION_MODE") == "opt":
- use_pic = False
-
- object_files = compilation_info.cc_compilation_outputs.object_files(use_pic = use_pic)
- args = ctx.actions.args()
- args.add_all(command_line)
- args.add_all(object_files)
-
- env = cc_common.get_environment_variables(
+ linking_info = cc_common.link(
+ ctx = ctx,
feature_configuration = feature_configuration,
- action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
- variables = archiver_variables,
+ cc_toolchain = toolchain,
+ cc_compilation_outputs = compilation_info.cc_compilation_outputs,
+ linking_contexts = linking_contexts,
)
- ctx.actions.run(
- executable = archiver_path,
- arguments = [args],
- env = env,
- inputs = depset(
- direct = object_files,
- transitive = [
- # TODO: Use CcToolchainInfo getters when available
- # See https://github.com/bazelbuild/bazel/issues/7427.
- ctx.attr._cc_toolchain.files,
- ],
- ),
- outputs = [output_file],
- )
- linking_context = cc_common.create_linking_context(
- libraries_to_link = [library_to_link],
- )
- info = CcInfo(
+ return CcInfo(
compilation_context = compilation_info.compilation_context,
- linking_context = linking_context,
+ linking_context = linking_info.linking_context,
)
- return cc_common.merge_cc_infos(cc_infos = [info] + cc_infos)
def _upb_proto_library_aspect_impl(target, ctx):
proto_sources = target[ProtoInfo].direct_sources
@@ -449,6 +403,7 @@ _upb_proto_library_aspect = aspect(
},
implementation = _upb_proto_library_aspect_impl,
attr_aspects = ["deps"],
+ fragments = ["cpp"],
)
def _upb_proto_library_impl(ctx):
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback