2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-29 12:33:51 +00:00
Commit graph

261 commits

Author SHA1 Message Date
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
irengrig 96856c9d89
Generation of API-dependent part should depend on involved files (#173) 2018-12-06 13:20:52 +01:00
irengrig eb5f16592f
Fix compatibility with Bazel HEAD for a cc_common.create_XXX_variables (#172) 2018-12-05 17:34:00 +01:00
irengrig 8e2cc0f83c
Use shell function for copying directory contents to be multi-platform (#171) 2018-12-05 15:13:03 +01:00
irengrig f31530ab3d
Fix test (replace cmkae command to actually used in expected) on Mac (#170) 2018-12-05 14:37:44 +01:00
irengrig d39887d3d6
Do not run configure-make test on mac ci machines for now (#169)
Do not run configure-make test on mac ci machines for now
2018-12-04 18:54:21 +01:00
irengrig 87f42c4a5b
Support in-the-middle state of C++ API in Bazel 0.20.0 (#168) 2018-12-04 18:39:08 +01:00
irengrig 348628d18b
Add test for #163 (do not strip quotes when merging flag values) (#167) 2018-12-04 16:08:30 +01:00
bbarnes52 6caaa8a26b removes strip calls from string concatenation to fix bug where compiler invocation failed due to invalid syntax (#163) 2018-12-04 16:02:00 +01:00
irengrig 7fdfc7cade
When cmake_external script fails, do not delete build directory. (#166)
* When cmake_external script fails, do not delete build directory.

Fixes #162.
2018-12-04 14:32:59 +01:00
irengrig c82068dd2d
Correct the reference in Android example (#164) 2018-12-03 11:19:46 +01:00
irengrig 59bd073a22
In the generated repository, refer to the "parent" as @rules_foreign_cc (#161)
Fixes #160
2018-11-29 21:55:27 +01:00
irengrig d6d2f0761a
Adapt to the new Starlark API. (#157)
The rule supports both old and new API;
however, for switching the implementations, I had to use code generation - copying the actual implementations for different API variants into a generated repository.
I did not invent any other mechanics to deal with non existing top level symbols like CcInfo or CcCompilationInfo.

Design document about the new API: https://github.com/bazelbuild/proposals, Partial C++ Starlark API
Introduced in the commit: eb139371c9
2018-11-27 10:06:23 +01:00
bbarnes52 bf2cb0112c adds *.cmake as regex to be searched by replace_in_files (#156) 2018-11-16 22:30:04 +01:00
irengrig 13419882d6
Put each of binary files into OutputGroupInfo under its name. (#148)
Add CMake test for building a binary and using that binary in a test.
2018-10-25 16:28:43 +02:00
irengrig c28320b89d
rename hello world examples (#146) 2018-10-25 12:56:42 +02:00
irengrig d9318f13d3
framework: extract environment variable declaration into separate part (#145) 2018-10-25 12:37:15 +02:00