Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .plzconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[please]
version = >=16.12.1
version = >=17.0.0

[parse]
preloadbuilddefs = build_defs/cc.build_defs
preloadsubincludes = //build_defs:cc

[PluginDefinition]
name = cc
Expand All @@ -12,7 +12,7 @@ ConfigKey = Coverage
DefaultValue = true
Type = bool
Inherit = true
Help = Whether to build with coverage
Help = Whether to build with coverage

[PluginConfig "cc_tool"]
ConfigKey = CCTool
Expand All @@ -30,19 +30,19 @@ Help = The path or build label for the C++ compiler
ConfigKey = LDTool
DefaultValue = ld
Inherit = true
Hel- = The path or build label for the linker
Help = The path or build label for the linker

[PluginConfig "ar_tool"]
ConfigKey = ARTool
DefaultValue = ar
Inherit = true
Hel- = The path or build label for the archiver
Help = The path or build label for the archiver

[PluginConfig "default_opt_cflags"]
ConfigKey = DefaultOptCFlags
DefaultValue = --std=c99 -O3 -pipe -DNDEBUG -Wall -Werror
Inherit = true
Help = The default c compiler flags when compiling for release
Help = The default c compiler flags when compiling for release

[PluginConfig "default_dbg_cflags"]
ConfigKey = DefaultDbgCFlags
Expand All @@ -54,7 +54,7 @@ Help = The default c compiler flags when compiling for debug
ConfigKey = DefaultOptCppFlags
DefaultValue = --std=c++11 -O3 -pipe -DNDEBUG -Wall -Werror
Inherit = true
Help = The default c++ compiler flags when compiling for release
Help = The default c++ compiler flags when compiling for release

[PluginConfig "default_dbg_cppflags"]
ConfigKey = DefaultDbgCppFlags
Expand All @@ -66,19 +66,19 @@ Help = The default c++ compiler flags when compiling for debug
ConfigKey = DefaultLdFlags
DefaultValue = -lpthread -ldl
Inherit = true
Help = The default set of flags to apply when linking
Help = The default set of flags to apply when linking

[PluginConfig "pkg_config_path"]
ConfigKey = PkgConfigPath
DefaultValue =
Inherit = true
Help = A path to the systems package configs
Help = A path to the systems package configs

[PluginConfig "test_main"]
ConfigKey = TestMain
Inherit = true
DefaultValue = //unittest-pp:main
Help = A build label with c/c++ source code to use run tests.
Help = A build label with c/c++ source code to use run tests.

[PluginConfig "dsym_tool"]
ConfigKey = DsymTool
Expand All @@ -90,7 +90,7 @@ Help = Set this to dsymutil or equivalent on MacOS to use this tool to generate
ConfigKey = AsmTool
DefaultValue = nasm
Inherit = true
Help = The tool to use for assembling assembly code
Help = The tool to use for assembling assembly code

[PluginConfig "default_namespace"]
ConfigKey = DefaultNamespace
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 0.4.0
-------------
* Change to using build.arcat instead of the deprecated jarcat config option.

Version 0.3.2
-------------
* Fix dsymutil to have no default value (as plz was with its builtin rules)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.2
0.4.0
12 changes: 6 additions & 6 deletions build_defs/cc.build_defs
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ def cc_library(name:str, srcs:list=[], hdrs:list=[], private_hdrs:list=[], deps:
tag = 'a',
srcs = {'srcs': a_rules},
outs = [out],
cmd = '"$TOOLS_JARCAT" ar --combine && "$TOOLS_AR" s "$OUT"',
cmd = '"$TOOLS_ARCAT" ar --combine && "$TOOLS_AR" s "$OUT"',
building_description = 'Archiving...',
test_only = test_only,
labels = labels,
output_is_complete = True,
tools = {
'jarcat': [CONFIG.JARCAT_TOOL],
'arcat': [CONFIG.ARCAT_TOOL],
'ar': [CONFIG.CC.AR_TOOL],
},
)
Expand Down Expand Up @@ -355,7 +355,7 @@ def cc_static_library(name:str, srcs:list=[], hdrs:list=[], compiler_flags:list&
name = name,
deps = deps,
outs = [out],
cmd = '"$TOOLS_JARCAT" ar --find && "$TOOLS_AR" s "$OUT"',
cmd = '"$TOOLS_ARCAT" ar --find && "$TOOLS_AR" s "$OUT"',
needs_transitive_deps = True,
output_is_complete = True,
visibility = visibility,
Expand All @@ -364,7 +364,7 @@ def cc_static_library(name:str, srcs:list=[], hdrs:list=[], compiler_flags:list&
provides = provides,
requires = ['cc'],
tools = {
'jarcat': [CONFIG.JARCAT_TOOL],
'arcat': [CONFIG.ARCAT_TOOL],
'ar': [CONFIG.CC.AR_TOOL],
},
labels = labels,
Expand Down Expand Up @@ -723,7 +723,7 @@ def _library_cmds(c, compiler_flags, pkg_config_libs, pkg_config_cflags, extra_f
opt_flags = _build_flags(compiler_flags, pkg_config_libs, pkg_config_cflags, c=c)
cmd_template = '$TOOLS_CC -c -I . ${SRCS_SRCS} %s %s'
if archive:
cmd_template += ' && "$TOOLS_JARCAT" ar -r && "$TOOLS_AR" s "$OUT"'
cmd_template += ' && "$TOOLS_ARCAT" ar -r && "$TOOLS_AR" s "$OUT"'
cmds = {
'dbg': cmd_template % (dbg_flags, extra_flags),
'opt': cmd_template % (opt_flags, extra_flags),
Expand All @@ -732,7 +732,7 @@ def _library_cmds(c, compiler_flags, pkg_config_libs, pkg_config_cflags, extra_f
cmds['cover'] = cmd_template % (dbg_flags + _COVERAGE_FLAGS, extra_flags)
return cmds, {
'cc': [CONFIG.CC.CC_TOOL if c else CONFIG.CC.CPP_TOOL],
'jarcat': [CONFIG.JARCAT_TOOL if archive else None],
'arcat': [CONFIG.ARCAT_TOOL if archive else None],
'ar': [CONFIG.CC.AR_TOOL if archive else None],
}

Expand Down
10 changes: 6 additions & 4 deletions compdb/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
subinclude("//build_defs:cc")

cc_binary(
name = "compdb",
srcs = ["compdb.cc"],
Expand All @@ -13,17 +15,17 @@ cc_binary(

github_repo(
name = "subprocess",
build_file = "subprocess.build",
hashes = ["4dd85ccdbf5c78dee8321dc3587c2c4970793abc394c4b9288debc8825b01571"],
repo = "arun11299/cpp-subprocess",
revision = "v2.0",
hashes = ["4dd85ccdbf5c78dee8321dc3587c2c4970793abc394c4b9288debc8825b01571"],
strip_prefix = "cpp-subprocess-2.0",
build_file = "subprocess.build",
)

github_repo(
name = "json",
build_file = "json.build",
hashes = ["83258a1aa68921b1d82ca3fcfeef04f27471d33cc0e51d516109d161916223f2"],
repo = "nlohmann/json",
revision = "v3.10.4",
hashes = ["83258a1aa68921b1d82ca3fcfeef04f27471d33cc0e51d516109d161916223f2"],
build_file = "json.build",
)
6 changes: 4 additions & 2 deletions gtest/BUILD
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
subinclude("//build_defs:cc")

github_repo(
name = "gtest",
bazel_compat = True,
build_file = "gtest.build",
repo = "google/googletest",
revision = "release-1.8.1",
)

cc_library(
name = "main",
visibility = ["PUBLIC"],
deps = [
"///gtest/gtest//:gtest_main",
],
visibility = ["PUBLIC"],
)
40 changes: 40 additions & 0 deletions gtest/gtest.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package(default_visibility = ["PUBLIC"])

# Google Test including Google Mock
cc_library(
name = "gtest",
srcs = glob(
include = [
"googletest/src/*.cc",
"googletest/src/*.h",
"googletest/include/gtest/**/*.h",
"googlemock/src/*.cc",
"googlemock/include/gmock/**/*.h",
],
exclude = [
"googletest/src/gtest-all.cc",
"googletest/src/gtest_main.cc",
"googlemock/src/gmock-all.cc",
"googlemock/src/gmock_main.cc",
],
),
hdrs = glob([
"googletest/include/gtest/*.h",
"googlemock/include/gmock/*.h",
]),
cflags = ["-pthread"],
includes = [
"googlemock",
"googlemock/include",
"googletest",
"googletest/include",
],
)

cc_library(
name = "gtest_main",
srcs = [
"googlemock/src/gmock_main.cc",
],
deps = [":gtest"],
)
2 changes: 2 additions & 0 deletions test/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
subinclude("//build_defs:cc")

# Test the way cc rules depend on one another; ideally we should be able to
# pick up all transitive dependencies correctly but compile the .o files independently.

Expand Down
2 changes: 2 additions & 0 deletions test/binary/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
subinclude("//build_defs:cc")

cc_binary(
name = "test_binary",
srcs = ["test_binary.cc"],
Expand Down
2 changes: 2 additions & 0 deletions test/c/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
subinclude("//build_defs:c")

c_test(
name = "c_test",
srcs = ["test.c"],
Expand Down
2 changes: 2 additions & 0 deletions test/deps/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
subinclude("//build_defs:cc")

# Tests that a sequence of dependencies works as expected.
cc_library(
name = "lib1",
Expand Down
4 changes: 2 additions & 2 deletions test/embed/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
subinclude("//build_defs:cc_embed_binary")
subinclude("//build_defs:cc", "//build_defs:cc_embed_binary")

cc_embed_binary(
name = "embedded_file_1",
Expand Down Expand Up @@ -32,9 +32,9 @@ cc_library(
name = "embedded_files",
srcs = ["embedded_files.cc"],
hdrs = ["embedded_files.h"],
visibility = ["//test/..."],
deps = [
":embedded_file_1",
":embedded_file_3",
],
visibility = ["//test/..."],
)
2 changes: 2 additions & 0 deletions test/gtest/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
subinclude("//build_defs:cc")

package(cc = {
"test_main": "//gtest:main",
})
Expand Down
2 changes: 2 additions & 0 deletions test/labels/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
subinclude("//build_defs:cc")

cc_library(
name = "lib1",
hdrs = ["lib1/include/lib.hpp"],
Expand Down
2 changes: 2 additions & 0 deletions test/modules/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
subinclude("//build_defs:cc")

# Currently only supported for Clang.
if "clang" in CONFIG.CC.CPP_TOOL:
cc_module(
Expand Down
34 changes: 0 additions & 34 deletions test/so/BUILD

This file was deleted.

Empty file removed test/so/__init__.py
Empty file.
20 changes: 0 additions & 20 deletions test/so/shared_object_test.py

This file was deleted.

Loading