-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only use cc_shared_library if it is enabled
- Loading branch information
Showing
1 changed file
with
4 additions
and
3 deletions.
There are no files selected for viewing
7 changes: 4 additions & 3 deletions
7
rules_haskell_tests/tests/repl-targets/hs_lib_repl_test/maybe_cc_shared_library.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
load("@bazel_features//:features.bzl", "bazel_features") | ||
load("@rules_cc//cc/common:cc_common.bzl", "cc_common") | ||
|
||
def maybe_cc_shared_library(name, **kwargs): | ||
if _has_cc_shared_library(): | ||
shared_name = "%s_shared" % name | ||
native.cc_shared_library( | ||
name = shared_name, | ||
deps = [name], | ||
**kwargs, | ||
**kwargs | ||
) | ||
return shared_name | ||
return name | ||
|
||
|
||
|
||
def _has_cc_shared_library(): | ||
if hasattr(cc_common, "check_experimental_cc_shared_library"): | ||
return cc_common.check_experimental_cc_shared_library() | ||
return bazel_features.globals.CcSharedLibraryInfo != None |