commit | 5824d24d0ce9615224225b7f88d6fbaa927c0536 | [log] [tgz] |
---|---|---|
author | Andreas Herrmann <andreas.herrmann@tweag.io> | Tue Dec 17 09:18:52 2019 -0800 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Dec 17 09:19:47 2019 -0800 |
tree | a0d28b2d1fe51f0a47e08b61f76b97a216996666 | |
parent | a104a56fcb2e7e2ad52f9f781cf7d6bec335d2c8 [diff] |
create_library_to_link: add mangle_name and unique_name arguments Closes #8180 - Adds `mangle_name` and `unique_name` arguments to `create_library_to_link` - `mangle_name` allows users replicate the behavior of `cc_library` in their custom rules. The link placed under the solib directory will be mangled and no intermediate directory will be generated. - `unique_name` allows users to specify that the given library name is unique and no intermediate directory is required. - Adds the `prefixLibraryPath` argument to the internal `CcCommon` API to facilitate the above changes to `create_library_to_link`. - Adds shell tests for the `mangle_name` and `unique_name` arguments to `create_library_to_link`. ### Motivation See https://github.com/bazelbuild/bazel/issues/8180 https://github.com/tweag/rules_haskell/issues/958 Before this PR the new Starlark Cc API's `create_library_to_link` would always preserve the given library name and link it into the solib directory underneath an intermediate directory based on the library label and consumer label. These intermediate directories can grow very long, in particular if external workspaces are involved. In rules_haskell this causes issues on Windows and MacOS. On Windows the linker cannot look for libraries underneath search paths which exceed a certain path length. On MacOS the header size of a MACH-O binary/library is limited and the required runpaths/load commands would quickly exceed this limit due to the long paths generated by Bazel. In rules_haskell in particular these intermediate directories are unnecessary, as rules_haskell already mangles the library names itself to ensure their uniqueness. Furthermore, the Haskell compiler GHC expects library names of a particular shape, such that Bazel's builtin mangling cannot be used. This motivates the combination `mangle_name = False`, `unique_name = True` enabled by this PR. cc @oquenchil @mboes @cocreature Closes #8888. PiperOrigin-RevId: 285993823
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.
One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.
Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.
Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.
Follow our tutorials:
See CONTRIBUTING.md