2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-27 02:43:28 +00:00
Commit graph

298 commits

Author SHA1 Message Date
Keith Smiley ec8400cbd0 Switch to rules_jvm_external (#287)
The previous gmaven_rules usage was broken, this is the new supported
way to download these dependencies.
2019-07-10 18:44:57 +02:00
irengrig 540253c265
Implement support for "pure" GNU Make in make.bzl (#285)
* Implement support for "pure" GNU Make in make.bzl

Usage: load("@rules_foreign_cc//tools/build_defs:make.bzl", "make")
make(name = <name>, lib_source = <source>), please see more arguments
in make.bzl

Add test in examples/simple_make (runs only on Linux because of Makefile contents)
2019-07-10 18:05:24 +02:00
Keith Smiley e8dece6e76 Add examples' bazel symlinks to gitignore (#288) 2019-07-10 17:55:36 +02:00
Michal Rostecki 8ccd83504b Minor fixes in example files (#264)
* examples: cmake_crosstool: Remove executable bit from BUILD

There is no reason for BUILD file to be an executable.

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>

* examples: Add shebang to the bash script

print_bazel_version.sh is a bash script, but it did not contain a
shebang.

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
2019-06-25 18:38:25 +02:00
irengrig 0b8356f199
Fix replace_in_files function in windows_commands.bzl (#280)
* Fix replace_in_files function in windows_commands.bzl

Filter files by types, where the absolute paths need to be replaced.

* Add one more hello world example

* Include test into windows list, remove from Mac OS list
2019-06-25 18:31:21 +02:00
Justin Buchanan d084070466 fix(cmake): Use "Debug" and "Release" instead of "DEBUG" and "RELEASE" (#277)
* fix(cmake): Use "Debug" and "Release" instead of "DEBUG" and "RELEASE"

These values are case-sensitive in cmake and give this error currently:

```
CMake Error at CMakeLists.txt:23 (message):
  CMAKE_BUILD_TYPE must be one of: Debug, Release (current value: 'RELEASE')
```

* update test data
2019-06-21 10:40:01 +02:00
irengrig dea1437d92
Fix #123 Improve code readability for collecting input dependencies (#257)
* Fix #123 Improve code readability for collecting input dependencies

* Fix line endings
2019-06-19 15:50:58 +02:00
Yun Peng 0f0c0da3a1 Fix patch file for nghttp2 (#275)
The line number doesn't match the exact location of the position of the content. This is tolerable with patch command line tool, but it won't work with a more strict patch implementation.
Context: https://github.com/bazelbuild/bazel/pulls
2019-06-06 13:25:46 +02:00
irengrig a0dc109915
Fix the code to work with Bazel HEAD: (#274)
Fix the code to work with Bazel HEAD:

- convert depset to list for iteration (libraries to link)
- _build_tools() are just creating the file, not contributing anything to the text of constructed BUILD file, so make a call to this method separately.
2019-06-04 11:11:46 +02:00
Marcel Hlopko 6b2f454a41 Use forward compatible version of _configure_features (#271)
This PR fixes the bug introduced in https://github.com/bazelbuild/rules_foreign_cc/pull/270.

hlopko@ should not be allowed to code undercaffeinated.
2019-05-28 10:55:13 +02:00
Laurent Le Brun 3990f265ee Migrate for --incompatible_depset_is_not_iterable (#267) 2019-05-28 10:47:28 +02:00
Marcel Hlopko 604f1e1c9f Guard cc_common.configure_features with a version check (#270)
This PR adds @bazel_version repository which contains single def.bzl
file which contains a BAZEL_VERSION constant that can be used to perform
conditional logic bazed on the Bazel version.

As a result, rules_foreing_cc are now compatible with Bazel 0.24 - 0.27
(at least regarding configure_features :)
2019-05-28 10:31:58 +02:00
László Csomor 9cfeff53b5 Windows: tests now work with native test wrapper (#263)
Windows: tests now work with native test wrapper

See https://github.com/bazelbuild/bazel/issues/6622
2019-05-17 11:52:28 +02:00
Marcel Hlopko 50e2679dee Migrate for --incompatible_enable_cc_toolchain_resolution (#262)
https://github.com/bazelbuild/bazel/issues/7260
2019-05-15 14:43:13 +02:00
Marcel Hlopko 9c6480858a Migrate for incompatible_require_ctx_in_configure_features (#260)
This PR migrates rules_foreign_cc for bazelbuild/bazel#7793
2019-05-10 15:51:44 +02:00
irengrig bf99a0bf00
Fix #254 (Linker flags passed to ar). (#256)
Fix #254 (Linker flags passed to ar).
2019-05-10 15:49:21 +02:00
irengrig 3831409fd5
For cmake_external and configure_make, do not prepend relative instal… (#258)
For cmake_external and configure_make, do not prepend relative install prefix path with "./", as it is recognized as relative and gets appended to the current build directory anyway, forming the path /tmp/something/./install_prefix - which does not make much sense.
2019-05-09 14:11:03 +02:00
Keith Smiley 2b40a0098d Allow ranlib to be overridden (#253)
This allows users to set this to an empty string if they want to disable
it. Related https://github.com/bazelbuild/rules_foreign_cc/issues/252
2019-05-09 10:56:11 +02:00
irengrig e36f3cee8c
Fix using Bazel-built libraries by cmake_external and configure_make (#249)
Fix #232 - enable usage of Bazel-built libraries as dependencies of cmake_external and configure_make.

- fix logic of reading library data described by C/C++ Bazel interface (as CcInfo.linking_context appeared)
- symlink transitive include directories under $EXT_BUILD_DEPS
- gather all possible transitive include directories to pass to CMake, pass transitive include directories to CMAKE_PREFIX_PATH so that the transitive include directories were scanned by CMake
- fix logic of passing transitive libraries into CPPFLAGS (configure_make)
- add test with the chain: Bazel lib -> CMake lib -> Bazel cc_test
- add synthetic configure-make test with the chain: Bazel lib -> configure_make lib -> Bazel cc_test
- also notice, that passed include directories from Bazel C/C++ Sandwich interface are not always existing; for now, make symlinking code resistant to that

see https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Preset-Output-Variables.html
2019-05-09 10:35:00 +02:00
irengrig 6b04da2262
Example with malloc attribute, currently not working (#250) 2019-05-07 18:19:16 +02:00
irengrig 4c59d4d0c5
Correct environment variable references to the platform-independent style (#248)
* working example for #241

* correct variables references
2019-05-06 16:30:21 +02:00
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