Commit Graph

277 Commits

Author SHA1 Message Date
irengrig 15aec187ff
working example for #241 (#247) 2019-05-06 16:04:47 +02:00
Dig-Doug e43f5f275a - Fixes a bug where bootstrap options weren't being passed (#245) 2019-05-06 10:30:14 +02:00
László Csomor 5f9879c7ec Windows, tests: fix for native test wrapper (#246)
* Windows, tests: fix for native test wrapper

In this PR:

- Update `@bazel_skylib` to 0.8.0, which has a
  Windows-compatible unittest.bzl

- Fix unittest-using tests. Correct usage of
  `unittest.end(env)` is to return its value.

Result: //test:all now passes with Bazel 0.25.0rc3
and --incompatible_windows_native_test_wrapper

* Register Skylib toolchains

* rules_foreign_cc_dep registers unittest toolchains

* Address review comments

* Add bazel_skylib_workspace to WORKSPACE files

* Remove stale toolchain init code
2019-04-30 16:50:26 +03:00
irengrig e3f4b5e0bc
remove unneeded -print option from find command (#242) 2019-04-04 13:39:40 +02:00
Keith Smiley 59a618db5f Remove rules_apple dependency (#233)
This appears to be unused
2019-03-19 18:35:05 +01:00
Jingwen d18d7bd35d Fix Buildkite breakage caused by gmaven_rules rename (#236)
* Fix buildkite breakage

* update examples WORKSPACE
2019-03-12 15:41:04 +01:00
irengrig f00cd27f06
Pass --copt, --cxxopt, --conlyopt, --linkopt to cmake_external/configure_make rules (#235)
- explicitly pass the values of these options to corresponding compilation/link flags lists; add them to the end of the lists of they are not already there
- please see the test in test/standard_cxx_flags_test
2019-03-11 16:50:39 +01:00
irengrig bcb7a345f7
Remove support for the versions of Bazel before 0.22 (#234)
- as 0.23 is already released
- to have only one variant of framework code
2019-03-11 16:34:56 +01:00
irengrig a3593905f7
Explicitly name the nested workspace for tests on Bazel CI (#230)
Explicitly name the nested workspace for tests on Bazel CI
2019-03-07 14:25:20 +01:00
irengrig bb9d86c1f2
Fix generated code to have load statements strictly in the beginning (#231)
make code compatible with --incompatible_bzl_disallow_load_after_statement
2019-03-07 13:35:13 +01:00
irengrig 8648b04460
Correct check for shared library requiring also interface library on win (#226)
originally suggested in #184
2019-02-14 11:18:47 +01:00
bbarnes52 514cb4e0a1 adds bootstrap_options to attribute to allow user to pass command line args to bootstrap.sh (#181) 2019-02-14 11:05:10 +01:00
bbarnes52 02e808a885 removes unused reference (#180) 2019-02-14 10:50:44 +01:00
irengrig 4d73887da8
Improve outputs handling: wrapper script in shell-abstract manner (#223)
* Improve outputs handling: wrapper script in shell-abstract manner

- extract wrapper script creation into a separate function,
- simplify the script and log names, also output the wrapper script text,
- introduce more shell primitives

related to #204

* Correct review comments
2019-02-14 10:00:19 +01:00
irengrig d8e78e4cf0
cmake_external: allow user to suppress computed cache entries (#224)
If the user passes empty string for some cache entry, for instance,
CMAKE_BUILD_TYPE, then the corresponding computed value
(computed from the Bazel's build type or Bazel C/C++ toolchain)
should not be used.
I.e., user passes "CMAKE_BUILD_TYPE": "", and there will be no
-DCMAKE_BUILD_TYPE in the cmake call.
2019-02-07 17:11:23 +01:00
irengrig d334e2eec6
For configure_make, allow to run configure in place (#221)
Some configure scripts rely on being called from their parent directory (they call other files as if they are in the same directory). For this case, we should copy/symlink the contents of the directory under our build root, and run configure from there.

New attribute in configure_make rule: "configure_in_place".

Also, add documentation for configure_make.
2019-02-04 20:10:40 +01:00
irengrig 4999ececdb
Fix shell script conversion bug + test (#220) 2019-02-04 19:53:44 +01:00
Dig-Doug fa183dcc1f Hide build output from console (#204)
* Implements redirecting the build command output to a log file and printing it when the build fails.

* - Removed gitignore
2019-02-01 17:39:07 +01:00
Dig-Doug d1e0fd4a5e Adds a gitignore. (#218) 2019-02-01 17:33:33 +01:00
irengrig b2ac19e790
Pass through the os_name() from a custom shell toolchain to CMake (#215) 2019-01-31 15:42:37 +01:00
irengrig 91ba4441d2
Register shell toolchain implementations in the correct order and allow customization (#214)
* Register shell toolchain implementations in the correct order

so that the default implementation is the last

* Refactor shell toolchain to allow users register custom shell toolchains.

- define your own shell toolchain file(s) by copying @rules_foreign_cc//tools/build_defs/shell_toolchain/toolchains/impl:linux_commands.bzl,
and modifying the methods.
- create a mapping: a list of ToolchainMapping with the mappings between created file(s) and execution or/and target platform constraints.
- in the BUILD file of some package, call "register_mappings" macro from "@rules_foreign_cc//tools/build_defs/shell_toolchain/toolchains:defs.bzl", passing the mappings and toolchain_type_ = "@rules_foreign_cc//tools/build_defs/shell_toolchain/toolchains:shell_commands"
- in the WORKSPACE file of your main repository, when you initialize rules_foreign_cc, pass the mappings and the package, in which BUILD file you called "register_mappings" macro

* Correct typo
2019-01-31 15:11:28 +01:00
irengrig 4a6fd7fd62
Add default shell toolchain implementation (#213)
assume Linux as a platform name for CMake
2019-01-31 08:27:34 +01:00
irengrig b0feddbcbb
Remove platform specific variables from generic windows toolchain (#211) 2019-01-30 17:49:37 +01:00
Dmitry Lomov f16bb6dae3 Create CODEOWNERS (#210) 2019-01-30 13:47:27 +01:00
irengrig 0984825255
Correct headers (#209)
* Update README.md because of Bazel 0.22.0 release

- with Bazel 0.22.0, no flags are required to use rules_foreign_cc
- improve Bazel versions related information
- add link to "rules_foreign_cc take-aways"

* Correct headers in README
2019-01-29 14:55:29 +01:00
irengrig 6f0005be09
Update README.md because of Bazel 0.22.0 release (#208)
- with Bazel 0.22.0, no flags are required to use rules_foreign_cc
- improve Bazel versions related information
- add link to "rules_foreign_cc take-aways"
2019-01-29 14:52:47 +01:00
irengrig b207809dba
Correction for what tests to run on CI on Windows with Bazel 0.22.0 (#207)
As Bazel 0.22.0 is broken for rules_foreign_cc on Windows, we do not want to run any tests with this version on CI. So we are selecting the list of tests to run according to recorded-in-workspace Bazel version.
But list of tests can not be empty! Instead, have a test that just prints the Bazel version.
2019-01-29 14:21:31 +01:00
irengrig 8c019a368f
Add bison/yacc example (configure & make) (#206)
For MAC/Linux
2019-01-28 22:10:31 +01:00
irengrig 3d4fe6d0c8
Add doc (#205)
* Add a note about broken with Bazel 0.22 on Windows

* Add a note about broken with Bazel 0.22 on Windows
2019-01-28 13:36:56 +01:00
irengrig 216ded8acb
Boost rule to use shell toolchain, fixes #202 (#203) 2019-01-19 17:37:57 +01:00
irengrig 5511d9e1fe
Launch at least some Windows tests on CI (#201)
All custom tools (MS Visual Studio) information goes into
windows_commands.bzl
2019-01-18 18:43:37 +01:00
irengrig c51480261c
Extract shell fragments into a toolchain (#196)
* Extract shell fragments into a toolchain

Construct script in framework.bzl using special notation for calling
shell fragments, defining and referencing environment variables;
have the script converted from this special notation into a real script
(see README.md notes.)
The special notation is used to keep script construction in code still readable.

Tools scripts (cmake, ninja) were also converted.

* Fix reference to environment variables in examples

.. and reference it correctly $$var_name$$ so it is replaced further

* Review comments: documentation, explicitly mark functions from toolchain

- mark functions from shell toolchain as ##funname##, so that they
can not be mixed with usual shell functions

* Fix operating system name for windows in toolchain file

* Additional env vars for windows

* Correct cmake tool build

* Do not build ninja on Windows

* When run on Windows under msys, find utility from Window could "leak"...

into the script. Use heuristics to use /usr/bin/find if it exists.
Also, use pwd -W to get Windows-styled paths (for cmake)
2019-01-18 18:06:10 +01:00
irengrig fcd01e4a23
Fix reference to environment variables in examples, (#199)
provide more hints for configure-make example
2019-01-10 15:51:27 +01:00
irengrig dff9d0a729
More changes because of incompatible flags (#198) 2019-01-10 13:47:45 +01:00
irengrig 7994b96ff6
Remove incorrect load symbol, this failed in incompatible flags build (#197) 2019-01-09 16:41:56 +01:00
Laurent Le Brun dfd1d815f5 Fixes for Bazel --all_incompatible_changes (#194)
Tested:
  `bazel test //... --nobuild --all_incompatible_changes`
2019-01-08 18:25:04 +01:00
irengrig 4dc369a845
Do not support Bazel before 0.20 (#195) 2019-01-08 18:21:22 +01:00
irengrig 99ea1b09fc
Extract cmake and ninja into a toolchain; provide defaults. (#192)
* Extract cmake and ninja into a toolchain; provide defaults.

In the workspace-level rule registration function, default toolchain
implementations are registered for all platforms, which are calling
the cmake and ninja just by name, assuming they are preinstalled.

Also, the user can pass the custom toolchains in the initialization
function, they will be registered before the defaults.

* Do not run ninja build test for now without nested workspaces support

* Corrections after merge

* Always build ninja from sources for tests, correct initialization order

* Add example of using prebuilt artefact in the native tools toolchain.

* Review comments, have native_tool_toolchain#target, not label

+ improve documentation

* Correct ninja toolchain label

* Correct documentation in native_tools_toolchain.bzl
2019-01-08 12:25:16 +01:00
irengrig 006d5f6f8b
Reorganize examples to be in a separate workspace (#188)
* Reorganize examples to be in a separate workspace

This will help to define native tools toolchains for examples

* Remove examples-related part from main WORKSPACE file

* Copy .bazelrc to the examples workspace.

* correction for Bazel HEAD compatibility

* Changes to run nested workspace tests from main workspace
2019-01-07 10:31:27 +01:00
irengrig ee779e7d9d
Fix create_compilation_context call to match changed Starlark API (#189)
... in Bazel HEAD
2019-01-03 10:21:08 +01:00
irengrig ac1cbb5e86
Put examples/crosstool into .bazelignore (#187)
Since it is a separate workspace
2019-01-02 15:47:38 +01:00
irengrig 370a8ff244
Remove unused call of an old Starlark API (#186) 2019-01-02 14:50:20 +01:00
irengrig 82ff0ce803
We need a separate variant for 0.21 and fix for HEAD was in wrong file (#183) 2018-12-20 13:27:52 +01:00
irengrig cec144aef4
Fix a call to cc_common.create_compilation_context for Bazel HEAD (#182) 2018-12-20 13:13:17 +01:00
irengrig 8ec19f3959
Fix build, remove configure-make failing on CI, ubuntu 16 (#179) 2018-12-16 20:57:23 +01:00
irengrig 888a8a67e8
Add example how to produce binaries with configure_make (#178) 2018-12-16 11:35:52 +01:00
irengrig b08610b154
Improve the boost rule including user_options attribute. (#177)
* Improve the boost rule including user_options attribute.

Then --with-<library> parameter can be passed to build only that library
Modify examples to demonstrate how to use it.
However, building examples takes too long time, so do not include them into the tests.
2018-12-07 14:30:41 +01:00
irengrig 4c426c839e
Add build status to README (#176) 2018-12-07 11:14:01 +01:00
irengrig 5d1cecfa08
Switch libevent example to configure_make implementation. (#175) 2018-12-06 20:11:13 +01:00
irengrig 9a261f7993
Crosstool example + fixes (#174)
* Add crosstool example; does not work with cmake rule yet

the code is taken from Bazel test data (bazel_toolchain_test_data)

* Make crosstool compilation of cmake_external + cc_binary work

To build example, cd examples/cmake_crosstool bazel build //:libhello_test

Changes:
1) Initially suggested in #124: put $EXT_BUILD_ROOT on path, so that relative paths can be resolved by CMake
2) Toolchain tools are references as relative paths, and they themselves refer to external repository with external/ prefix.
This will not work with CMake, as CMake also perform compiler tests and the build is performed in some temp directory.
We need to convert to absolute paths.
I did a trick with checking of $EXT_BUILD_ROOT is defined and then using it as a prefix.
3) I had to change the visibility of the cc-compiler-k8 toolchain to public
4) For CMake crosstool file, CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, CMAKE_AR need to be absolute, so in cases when they are relative and not under external directory, force paths conversion
2018-12-06 18:14:00 +01:00