The API should expose to Skylark from Java the logic for the creation of compilation and linking actions.
The main problem to solve is inter-operability between different rules/languages that have dependencies on C++ code.
Design doc:https://docs.google.com/document/d/1cRRdHOPTTUXBbq9Cj9hk_WLnPqsGtAoQynYd7TKBQI8/edit?disco=AAAACkgMw7E
Bazel@HEAD now accepts --experimental_enable_cc_skylark_api that will enable the current WIP version of the API. It's only for experimenting at this point, we break it daily, and we will not support users using it yet. But feedback is more than welcomed.
Is there a better way to traverse the API than print(dir(ctx.attr.cc_lib.cc))?
Would like to see if it better fits https://github.com/bazelbuild/rules_rust/pull/108
Sandwich is ready:
https://docs.bazel.build/versions/master/skylark/lib/cc_common.html#compile
Hey @oquenchil . How to pass data to LinkBuildVariables of cc_common.link? For example, interface_library name?
CcModule.java:290
/* interfaceLibraryBuilder= */ null,
/* interfaceLibraryOutput= */ null,
Currently it is being calculated to "ignored", producing command line like (Windows):
/IMPLIB:ignored
Repro case is here:
https://groups.google.com/forum/#!topic/bazel-discuss/I-yvg7xbbG0
Also, dynamic libraries in create_linking_context_from_compilation_outputs are not being generated on Windows:
CcModule.java:1435
.setShouldCreateDynamicLibrary(
!disallowDynamicLibraries
&& !featureConfiguration
.getFeatureConfiguration()
.isEnabled(CppRuleClasses.TARGETS_WINDOWS))
Most helpful comment
Sandwich is ready:
https://docs.bazel.build/versions/master/skylark/lib/cc_common.html#compile