diff --git a/.plzconfig b/.plzconfig index 3793798..8ed3a36 100644 --- a/.plzconfig +++ b/.plzconfig @@ -1,8 +1,13 @@ [please] -version = >=16.12.1 +version = >=17.0.0 + +[Plugin "python"] +Target = //plugins:python +ModuleDir = third_party.python +WheelRepo = https://get.please.build/third_party/python/py3 +WheelNameScheme = {url_base}/{package_name}-{version}-${{OS}}_${{ARCH}}.whl +WheelNameScheme = "{url_base}/{package_name}-{version}.whl" -[parse] -preloadbuilddefs = build_defs/cc.build_defs [PluginDefinition] name = cc @@ -12,7 +17,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 @@ -42,7 +47,7 @@ Hel- = The path or build label for the archiver 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 @@ -54,7 +59,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 @@ -66,19 +71,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 @@ -90,9 +95,10 @@ 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 DefaultValue = Help = The default namespace to compile c++ code in + diff --git a/.plzconfig.gcc b/.plzconfig.gcc index 54fbf57..995c68a 100644 --- a/.plzconfig.gcc +++ b/.plzconfig.gcc @@ -1,6 +1,6 @@ [plugin "cc"] -cctool = gcc-10 -cpptool = g++-10 +cctool = gcc-11 +cpptool = g++-11 ldtool = gold defaultdbgcppflags = --std=c++1z -g3 -DDEBUG -Wall -Wextra -Werror -Wno-unused-parameter defaultoptcppflags = --std=c++1z -O2 -DNDEBUG -Wall -Wextra -Werror -Wno-unused-parameter diff --git a/ChangeLog b/ChangeLog index 0eecb10..e8f4c21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version 0.3.3 +------------- + * Add subincludes so we don't rely on them being globally subincluded to use + Version 0.3.2 ------------- * Fix dsymutil to have no default value (as plz was with its builtin rules) diff --git a/VERSION b/VERSION index d15723f..1c09c74 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.2 +0.3.3 diff --git a/build_defs/c.build_defs b/build_defs/c.build_defs index 97da033..32bdbb9 100644 --- a/build_defs/c.build_defs +++ b/build_defs/c.build_defs @@ -6,7 +6,7 @@ other than using different config settings. Both C and C++ can be mixed and matched arbitrarily, but of course to do so you must pay attention to interoperability when needed (e.g. 'extern "C"' and so forth). """ -subinclude("///cc//build_defs:cc") +subinclude("//build_defs:cc") def c_library(name:str, srcs:list=[], hdrs:list=[], private_hdrs:list=[], deps:list=[], out:str='', optional_outs:list=[], visibility:list=None, test_only:bool&testonly=False, compiler_flags:list&cflags&copts=[], diff --git a/compdb/BUILD b/compdb/BUILD index 06017a8..ce24ece 100644 --- a/compdb/BUILD +++ b/compdb/BUILD @@ -1,3 +1,5 @@ +subinclude("//build_defs:cc") + cc_binary( name = "compdb", srcs = ["compdb.cc"], diff --git a/gtest/BUILD b/gtest/BUILD deleted file mode 100644 index dd029bf..0000000 --- a/gtest/BUILD +++ /dev/null @@ -1,14 +0,0 @@ -github_repo( - name = "gtest", - bazel_compat = True, - repo = "google/googletest", - revision = "release-1.8.1", -) - -cc_library( - name = "main", - deps = [ - "///gtest/gtest//:gtest_main", - ], - visibility = ["PUBLIC"], -) diff --git a/plugins/BUILD b/plugins/BUILD new file mode 100644 index 0000000..f3047c9 --- /dev/null +++ b/plugins/BUILD @@ -0,0 +1,6 @@ +plugin_repo( + name = "python", + revision = "v1.3.0", + plugin = "python-rules", + owner = "please-build", +) diff --git a/test/BUILD b/test/BUILD index cda4b14..abecaca 100644 --- a/test/BUILD +++ b/test/BUILD @@ -1,6 +1,8 @@ # 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. +subinclude("//build_defs:cc") + cc_library( name = "lib1", srcs = ["lib1.cc"], diff --git a/test/binary/BUILD b/test/binary/BUILD index a6228a4..2c9dfd7 100644 --- a/test/binary/BUILD +++ b/test/binary/BUILD @@ -1,3 +1,5 @@ +subinclude("//build_defs:cc") + cc_binary( name = "test_binary", srcs = ["test_binary.cc"], diff --git a/test/c/BUILD b/test/c/BUILD index 8390b87..1694c72 100644 --- a/test/c/BUILD +++ b/test/c/BUILD @@ -1,3 +1,5 @@ +subinclude("//build_defs:c") + c_test( name = "c_test", srcs = ["test.c"], diff --git a/test/deps/BUILD b/test/deps/BUILD index 7336ae9..27e9b51 100644 --- a/test/deps/BUILD +++ b/test/deps/BUILD @@ -1,3 +1,5 @@ +subinclude("//build_defs:cc") + # Tests that a sequence of dependencies works as expected. cc_library( name = "lib1", diff --git a/test/embed/BUILD b/test/embed/BUILD index 3e7fe4c..8829d6d 100644 --- a/test/embed/BUILD +++ b/test/embed/BUILD @@ -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", diff --git a/test/gtest/BUILD b/test/gtest/BUILD deleted file mode 100644 index a467790..0000000 --- a/test/gtest/BUILD +++ /dev/null @@ -1,11 +0,0 @@ -package(cc = { - "test_main": "//gtest:main", -}) - -cc_test( - name = "gtest_test", - srcs = ["gtest_test.cc"], - deps = [ - "//test:lib2", - ], -) diff --git a/test/gtest/gtest_test.cc b/test/gtest/gtest_test.cc deleted file mode 100644 index 9b81c23..0000000 --- a/test/gtest/gtest_test.cc +++ /dev/null @@ -1,18 +0,0 @@ -// Trivial test to illustrate gtest working. - -#include "gtest/gtest.h" - -#include "test/lib1.h" -#include "test/lib2.h" - -namespace plz { - -TEST(GTest, Number1) { - EXPECT_EQ(107, get_number_1()); -} - -TEST(GTest, Number2) { - EXPECT_EQ(215, get_number_2()); -} - -} diff --git a/test/labels/BUILD b/test/labels/BUILD index 5c97be0..65ab5ed 100644 --- a/test/labels/BUILD +++ b/test/labels/BUILD @@ -1,3 +1,5 @@ +subinclude("//build_defs:cc") + cc_library( name = "lib1", hdrs = ["lib1/include/lib.hpp"], diff --git a/test/modules/BUILD b/test/modules/BUILD index 3c9d323..09c0a36 100644 --- a/test/modules/BUILD +++ b/test/modules/BUILD @@ -1,3 +1,5 @@ +subinclude("//build_defs:cc") + # Currently only supported for Clang. if "clang" in CONFIG.CC.CPP_TOOL: cc_module( diff --git a/test/so/BUILD b/test/so/BUILD index 8bbdc87..5e5355a 100644 --- a/test/so/BUILD +++ b/test/so/BUILD @@ -1,3 +1,5 @@ +subinclude("//build_defs:cc", "///python//build_defs:python") + # TODO(peterebden): now Python is becoming a plugin, we should choose something else to test with. cc_shared_object( name = "so_test", @@ -30,5 +32,6 @@ python_test( zip_safe = False, deps = [ ":so_test", + "//third_party/python:six", ], ) diff --git a/third_party/python/BUILD b/third_party/python/BUILD new file mode 100644 index 0000000..7b421e3 --- /dev/null +++ b/third_party/python/BUILD @@ -0,0 +1,9 @@ +subinclude("///python//build_defs:python") + +python_wheel( + name = "six", + outs = ["six.py"], + hashes = ["8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c"], + version = "1.14.0", + visibility = ["PUBLIC"], +) \ No newline at end of file diff --git a/unittest-pp/BUILD b/unittest-pp/BUILD index 187ca83..9e81092 100644 --- a/unittest-pp/BUILD +++ b/unittest-pp/BUILD @@ -1,3 +1,5 @@ +subinclude("///cc//build_defs:cc") + github_repo( name = "unittest_cpp", repo = "unittest-cpp/unittest-cpp", @@ -7,9 +9,21 @@ github_repo( strip_prefix = "unittest-cpp-2.0.0", ) + +filegroup( + name = "srcs", + srcs = ["unittest_main.cc", "///unittest-pp/unittest_cpp//:unittest_cpp_srcs"], +) + +filegroup( + name = "hdrs", + srcs = ["///unittest-pp/unittest_cpp//:unittest_cpp_hdrs"], +) + cc_library( name = "main", - srcs = ["unittest_main.cc"], + srcs = [":srcs"], + hdrs = [":hdrs"], visibility = ["PUBLIC"], - deps = ["///unittest-pp/unittest_cpp//:unittest_cpp"], + includes = ["."], ) diff --git a/unittest-pp/unittest.build b/unittest-pp/unittest.build index fb9693d..cddca26 100644 --- a/unittest-pp/unittest.build +++ b/unittest-pp/unittest.build @@ -2,9 +2,15 @@ os = "Win32" if CONFIG.OS == "windows" else "Posix" -cc_library( - name = "unittest_cpp", +filegroup( + name = "unittest_cpp_srcs", srcs = glob(["UnitTest++/*.cpp", f"UnitTest++/{os}/*.cpp"]), - hdrs = glob(["UnitTest++/*.h", f"UnitTest++/{os}/*.h"]), visibility = ["PUBLIC"], ) + + +filegroup( + name = "unittest_cpp_hdrs", + srcs = glob(["UnitTest++/*.h", f"UnitTest++/{os}/*.h"]), + visibility = ["PUBLIC"], +) \ No newline at end of file