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 :)
* 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
* 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)
* 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
* 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
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
* correct shell utilities: params differ on mac, remove debug print,
+ correct a bug on windows
* Simplify the example, libz is also needed by libgd
* Framework function: simplify code gathering deps, collect_libs public
* Correct configure-make: get all lib files, also built with bazel
and pass them in LDFLAGS; correct the linking paths (add prefix)
* Make maximum line length for shell = 80
* Improve comments to the _InputFiles provider
* Allow execution on Windows, use utils_win.sh, copy instead of symlink
* Prepare for execution on Windows: set up environment, convert path
also rename TMPDIR since it can clash with widely used variable