aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
Commit message (Collapse)AuthorAge
* Add FeatureSpecification.Gravatar hlopko2017-05-30
| | | | | RELNOTES: None. PiperOrigin-RevId: 157450873
* Use FeatureConfiguration to compute value of CC_FLAGS make variableGravatar hlopko2017-05-26
| | | | | | | | | | | | | | | | | | | | | | | | | This cl introduces new action_config type for Crosstool named 'generic'. This can be used to set the value of CC_FLAGS make variable using much more expressive mechanism (action_configs + features) than previous make_variable Crosstool messages. This has been requested by the C++ LPT. However, as FeatureConfiguration needs RuleContext, CC_FLAGS cannot be computed using configuration only anymore. Also, FeatureConfiguration is C++ rules specific class, and Bazel build-base cannot depend on it. Therefore we cannot use FeatureConfiguration for ExtraActions, for example. Because it cannot be made perfect, this cl is not updating all the possible places that expand make variables but limits the scope to: * genrule (the only widely used rule that often expands make variables) * *_test (CC_FLAGS is used by Tensorflow in the 'args' attribute) * cc_rules (people sometimes set 'copts' to something like: "-DCC_STRING=\\\"$(CC)\\\" -DCC_FLAGS_STRING=\"$(CC_FLAGS)\"" The long term plan is to use Skylark C++ API to get C++ command lines, so CC_FLAGS together with this inconsistent solution will be removed. RELNOTES: CC_FLAGS can be defined using 'generic' action_config in CROSSTOOL PiperOrigin-RevId: 157202883
* Extract :cc_toolchain as constantGravatar hlopko2017-05-22
| | | | | | | | And while at it cleanup all the calls of CppHelper.getToolchain and CppHelper.getFdoSupport. RELNOTES: None. PiperOrigin-RevId: 156716291
* Automated g4 rollback of commit 27a136b9bbb4d73b0a343d407b5da9f890175aea.Gravatar ajmichael2017-05-02
| | | | | | *** Reason for rollback *** PiperOrigin-RevId: 154776438
* Initialize FeatureConfiguration for hip toolchain when building hipGravatar hlopko2017-04-24
| | | | | | | | | | | | | | | | | | | | | | Before, we correctly replaced CppConfiguration with HipCppConfiguration for hip builds, but we didn't update FeatureConfiguration. As Blaze was not using action_configs for compile actions, compiler tool was taken from configuration at the action creation time, not from FeatureConfiguration, so the tool was correct. Command line flags (some of them) were computed by FeatureConfiguration, but luckily the toolchains were so similar that it worked. In https://github.com/bazelbuild/bazel/commit/e1d692e486a2f838c3c894fd9de693fabd6685ed I tried to use action_configs for compile actions. The result was that compiler tool was taken from configuration at the CppConfiguration creation time, that was put into FeatureConfiguration, and that was used in action creation time. Sadly, the tool in CppConfiguration was different that the tool in HipCppConfiguration, and b/37315875 was discovered. This cl also uppdates FeatureConfiguration when HipCppConfiguration is replaced. RELNOTES: None. PiperOrigin-RevId: 153710405
* Rollback of commit 4b73e972d909bcd533f2f9940f95a00b9b73bdde.Gravatar Dmitry Lomov2017-02-17
| | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Broke tests on CI: http://ci.bazel.io/job/bazel-tests/570/ *** Original change description *** Roll forward execroot change RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Cust... -- PiperOrigin-RevId: 147833177 MOS_MIGRATED_REVID=147833177
* Roll forward execroot changeGravatar Kristina Chodorow2017-02-16
| | | | | | | | | | | | | | | | | RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Custom crosstools that hardcode external/<repo> paths will have to be updated. Issue #1262. -- PiperOrigin-RevId: 147726370 MOS_MIGRATED_REVID=147726370
* Stop retrieving FdoSupport statically from hard-coded attribute ↵Gravatar Rumou Duan2017-02-14
| | | | | | | | | | ":cc_toolchain" in RuleContext, instead take the provider from users and pass it around to where it is used. This gives J2ObjcAspect the ability to specify the C++ toolchain attribute under a different name to avoid attribute conflicts with attached rules that have already declared attribute ":cc_toolchain". -- PiperOrigin-RevId: 147358325 MOS_MIGRATED_REVID=147358325
* Stop retrieving CcToolChainProvider statically from hard-coded attribute ↵Gravatar Rumou Duan2017-02-08
| | | | | | | | | | ":cc_toolchain" in RuleContext, instead take the provider from users and pass it around to where it is used. This gives J2ObjcAspect the ability to specify the C++ toolchain attribute under a different name to avoid attribute conflicts with attached rules that have already declared attribute ":cc_toolchain". -- PiperOrigin-RevId: 146920294 MOS_MIGRATED_REVID=146920294
* Add a boolean flag to a Feature to specify whether it is enabled by default.Gravatar Googler2017-02-08
| | | | | | | | | This enables us to configure default features for each toolchain without having to hard-code anything in class such as CcCommon. -- PiperOrigin-RevId: 146904287 MOS_MIGRATED_REVID=146904287
* Add a flag that alters the behavior of the parse_headers feature. With theGravatar Googler2017-01-27
| | | | | | | | | | | | | flag, the headers of a target are compiled into a C++ module instead of being parsed as their own translation unit. The module otherwise remains unused. This way, parse_headers can be used to get a codebase ready for C++ modules. parse_headers currently already gets close, but there are still ways in which a header can be modules-incompatible although it parses fine. -- PiperOrigin-RevId: 145729231 MOS_MIGRATED_REVID=145729231
* Description redacted.Gravatar Googler2017-01-23
| | | | | | -- PiperOrigin-RevId: 145091484 MOS_MIGRATED_REVID=145091484
* Compute module file compile command line flags right before executing theGravatar Googler2016-12-02
| | | | | | | | | | | | action. This removes flattening of nested sets (for the transitive/top-level header modules) in the analysis phase making it about 10% faster. Also remove the calculation of top-level modules entirely as it doesn't seem to be necessary and doing it might actually lead to unexpected results when actions are restored from cache and thus the module input flags are computed from the actually used inputs (determined from .d files). -- MOS_MIGRATED_REVID=140738461
* Description redacted.Gravatar Googler2016-12-01
| | | | | -- MOS_MIGRATED_REVID=140613176
* Rollback of commit 82d43279f93d95e4c41b4bc598a3cc05ddd1ae1a.Gravatar Laszlo Csomor2016-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks TensorFlow and other Bazel jobs on ci.bazel.io *** Original change description *** Change execution root for external repositories to be ../repo Some of the important aspect of this change: * Remote repos in the execution root are under output_base/execroot/repo_name, so the prefix is ../repo_name (to escape the local workspace name). * Package roots for external repos were previously "output_base/", they are now output_base/external/repo_name (which means source artifacts always have a relative path from their repository). * Outputs are under bazel-bin/external/repo_name/ (or similarly under genfiles). Note that this is a bit of a change from how this was implemented in the previous cl. Fixes #1262. RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Roll forward of bdfd58a. -- MOS_MIGRATED_REVID=133709658
* Change execution root for external repositories to be ../repoGravatar Kristina Chodorow2016-09-20
| | | | | | | | | | | | | | | | | | | | | | | Some of the important aspect of this change: * Remote repos in the execution root are under output_base/execroot/repo_name, so the prefix is ../repo_name (to escape the local workspace name). * Package roots for external repos were previously "output_base/", they are now output_base/external/repo_name (which means source artifacts always have a relative path from their repository). * Outputs are under bazel-bin/external/repo_name/ (or similarly under genfiles). Note that this is a bit of a change from how this was implemented in the previous cl. Fixes #1262. RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. Roll forward of bdfd58a. -- MOS_MIGRATED_REVID=133606309
* Make the code that is using execRoot paths use execRoot pathsGravatar Kristina Chodorow2016-09-09
| | | | | | | | | | | Chipping away at making the big CL for #1262 smaller. Only runfiles paths are different right now, so this makes getPathUnderExecRoot and getSourceRoot return the same thing. Also corrected a couple places where Label.EXTERNAL_PATH_PREFIX and Label.EXTERNAL_PACKAGE_NAME were being used incorrectly. -- MOS_MIGRATED_REVID=132671081
* Remove the "cc_*.includes attribute must refer to the third_party directory" ↵Gravatar Lukacs Berki2016-08-31
| | | | | | | | | | | warning from Bazel. This behavior doesn't really make sense except within Google. Fixes #1286. -- MOS_MIGRATED_REVID=131813322
* Prune .pcm files based on the results of include scanning.Gravatar Googler2016-08-23
| | | | | | | Basically, take the set of headers found by #include scanning and check what modules they are coming from. If a module provides at least one of the required headers, it is required as are all of its dependent modules (because of the way modules are implemented). Only use the actually required modules as compilation inputs and as flags handed in on the command line. Also move the logic to calculate top-level modules from the analysis phase into the execution phase. In the long run, we might be able to completely remove this logic now, but for now, we want to be able to quickly switch between the old and the new behavior. Thus, pruning of modules is now guarded on a feature prune_module_headers. -- MOS_MIGRATED_REVID=131058820
* Refactor C++ rules so that CcLinkingOutputs.libraryIdentifierOf() gets ↵Gravatar Lukacs Berki2016-08-09
| | | | | | | called at places where a CcToolchainProvider is near so that we can use information in it to infer how each input file is linked. -- MOS_MIGRATED_REVID=129729628
* Rename some PackageId and RepositoryName fields/methods in prep for deep ↵Gravatar Kristina Chodorow2016-07-28
| | | | | | | | | | | | | execroot change This is in prep for making the execution root path for external repositories ../repo_name (instead of external/repo_name). Right now, the getRunfilesPath() returns that path, so that is renamed getExecRoot() (since the runfiles are really just a reflection of the execRoot structure). getSourceRoot() replaces getPathFragment, which has always been a confusing name (it's not clear from the name what the difference is between it and getPackageFragment()). It returns the relative path to source files for external repositories (external/repo_name). Also renamed/moved to more sensible class a few static RepositoryName fields. -- MOS_MIGRATED_REVID=128594419
* Pass the coverage environment into tests using a nested set collected from ↵Gravatar Lukacs Berki2016-07-27
| | | | | | | the transitive closure instead of having a global environment in the configuration. -- MOS_MIGRATED_REVID=128559756
* Add host/target feature support for ThinLTOGravatar Googler2016-07-14
| | | | | | | | | | | ThinLTO isn't fully supported for host builds, in order to handle this add support for enabling either a 'host' or 'target' feature in the configuration. The thin_lto feature will require the new 'target' configuration. Companion crosstool change: unknown commit. -- MOS_MIGRATED_REVID=127350506
* Refactor how coverage support files get to test actions.Gravatar Lukacs Berki2016-06-29
| | | | | | | | | Previously we used labels in each configuration fragment that then got added to every test action. Instead, we now have a filegroup under //tools/test for coverage files that truly need to be on the inputs of every test action and collect language-specific support files in InstrumentedFilesProvider. This makes configuration creation simpler and makes it possible to turn --crosstool_top into something else other than a filegroup (previously, it was that filegroup that got added to every test action) -- MOS_MIGRATED_REVID=126170241
* Rollback of commit bdfd58a8ca2ed5735d6aaa5b238fb0f689515724.Gravatar Laurent Le Brun2016-06-20
| | | | | -- MOS_MIGRATED_REVID=125160288
* Make the execution root match the runfiles tree structure for external ↵Gravatar Kristina Chodorow2016-06-17
| | | | | | | | | | | | | | | | | | | | | repositories One interesting side effect of how this is implemented is that for external repositories, bin/ and genfiles/ are combined. External repo output is under bazel-out/local-fastbuild/repo_name for each repo. Fixes #1262. RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. -- MOS_MIGRATED_REVID=125095799
* Rollback of commit 0150e7fa5963fa569d9795c02fd3afe3c52ff30c.Gravatar Yun Peng2016-06-10
| | | | | | | *** Reason for rollback *** -- MOS_MIGRATED_REVID=124553522
* Rollback of commit 828a9e2f167db8c4debca6e00ee37dd030849c2f.Gravatar Yun Peng2016-06-10
| | | | | | | *** Reason for rollback *** -- MOS_MIGRATED_REVID=124549894
* Move -MD and -MF(for dotd file generation) into featureGravatar Yun Peng2016-06-08
| | | | | -- MOS_MIGRATED_REVID=124355936
* Move -c and -o options into action_configGravatar Yun Peng2016-06-08
| | | | | | | | | Also moved -S and -E options into the same action_config. Since whoever consume CppCompileInfo add -c and -o options by themselves, to keep compatible with this, the original code is still kept and used, until the corresponding flag sets are added into CROSSTOOL. -- MOS_MIGRATED_REVID=124350905
* Remove the --use_isystem_for_includes option.Gravatar Lukacs Berki2016-05-31
| | | | | | | RELNOTES: The --ues_isystem_for_includes command line option is not supported anymore. -- MOS_MIGRATED_REVID=123617061
* Create a feature for per-object-file debug info files and move -gsplit-dwarf ↵Gravatar Lukacs Berki2016-05-25
| | | | | | | | | to it. A side effect is that this made --save_temps (probably) work with --use_fission . Previously, the DWO file was also an output of the temps actions. -- MOS_MIGRATED_REVID=123117200
* Move -frandom-seed= into a feature.Gravatar Lukacs Berki2016-05-25
| | | | | | | | | One more thing that doesn't work on Windows is gone. As a drive-by fix, also remove usePic from CppCompileAction since it's not needed anymore. -- MOS_MIGRATED_REVID=123099120
* Move the command line arguments for C++ preprocessor defines to a feature.Gravatar Lukacs Berki2016-05-20
| | | | | | | | | | | | This required a few assorted changes: - The FDO build stamp is not special-cased anymore, it is treated as a preprocessor define like any other. - When compiling a .pcm file, use interfaceContext instead of the regular context when setting up the build variables. This is a bit more consistent and would be a good cause for a future bug. This is a retry of commit 7841a6ab100fc35a67600f1ce1a70d293c51350e, which made some bold changes to LIPO that didn't work out well. -- MOS_MIGRATED_REVID=122829825
* Rollback of commit 7841a6ab100fc35a67600f1ce1a70d293c51350e.Gravatar Lukacs Berki2016-05-20
| | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** breaks [] *** Original change description *** Move the command line arguments for C++ preprocessor defines to a feature. This required a few assorted changes: - The LIPO compilation context is not merged anymore. Include paths for auxiliary files are apparently taken from the profile files, so it is not necessary. - The FDO build stamp is not special-cased anymore, it is treated as a preprocessor define like any other. - When compiling a .pcm file, use interfaceContext instead of the regular context when setting up the build variables. Th... *** -- MOS_MIGRATED_REVID=122823591
* Move the command line arguments for C++ preprocessor defines to a feature.Gravatar Lukacs Berki2016-05-19
| | | | | | | | | | | This required a few assorted changes: - The LIPO compilation context is not merged anymore. Include paths for auxiliary files are apparently taken from the profile files, so it is not necessary. - The FDO build stamp is not special-cased anymore, it is treated as a preprocessor define like any other. - When compiling a .pcm file, use interfaceContext instead of the regular context when setting up the build variables. This is a bit more consistent and would be a good cause for a future bug. -- MOS_MIGRATED_REVID=122725179
* Turn the addition of -fPIC to the command line of PIC actions into a feature.Gravatar Lukacs Berki2016-05-19
| | | | | | | This is a resubmission of commit 45d48bf1fe7503acbbb0c095822b7f8f558881e8. It turns out that we also need -fPIC for *assembler* command line options, because some assembler sources are preprocessed and they can say "#ifdef __PIC__". -- MOS_MIGRATED_REVID=122626234
* Rollback of commit 45d48bf1fe7503acbbb0c095822b7f8f558881e8.Gravatar Lukacs Berki2016-05-17
| | | | | | | | | | | | | *** Reason for rollback *** Breaks //[]/go:all . *** Original change description *** Turn the addition of -fPIC to the command line of PIC actions into a feature. -- MOS_MIGRATED_REVID=122526799
* Turn the addition of -fPIC to the command line of PIC actions into a feature.Gravatar Lukacs Berki2016-05-17
| | | | | -- MOS_MIGRATED_REVID=122498464
* Action configs are activated like features (instead of being activated by ↵Gravatar Cal Peyser2016-05-11
| | | | | | | default). Action configs can imply features. -- MOS_MIGRATED_REVID=122032003
* Split ActionMetadata into ActionAnalysisMetadata and ActionExecutionMetadata.Gravatar Rumou Duan2016-04-26
| | | | | | | Except in action execution logic (ActionExecutionFunction, SkyframeActionExecutor, etc.), switch Action interface references to either ActionAnalysisMetadata if possible or ActionExecutionMetadata. -- MOS_MIGRATED_REVID=120723431
* Remove all internal calls to FileProvider.getLabel.Gravatar Ulf Adams2016-04-22
| | | | | | | | The method will be removed in a subsequent change to facilitate reverting the change in case it goes bad. -- MOS_MIGRATED_REVID=120526894
* Allow external repositories to have includes attributes that point to ↵Gravatar Janak Ramakrishnan2016-04-19
| | | | | | | | | packages not in third_party. We don't need to police users' external repositories. Fixes #1151 -- MOS_MIGRATED_REVID=120222222
* Allows CcLibraryHelper's acceptance of objc source to be paramaterized. For ↵Gravatar Cal Peyser2016-04-15
| | | | | | | | | cc_* targets, CcLibraryHelper will not process objc source files, which may have been provided accidentally though a filegroup. Note: This is note intended to prevent illegal sources for cc_* targets - that will be implemented in a different CL. This will involve making changes to filtering occuring in CcCommon, which for now will permit objc source. -- MOS_MIGRATED_REVID=119897621
* RELNOTES[INC]: Bazel warns if a cc rule's includes attribute points out of ↵Gravatar Janak Ramakrishnan2016-04-14
| | | | | | | | | third_party. I'm confused that Bazel has the concept of third_party, but as long as it does, let's exploit it. -- MOS_MIGRATED_REVID=119779306
* RELNOTES[INC]: It is now an error for a cc rule's includes attribute to ↵Gravatar Janak Ramakrishnan2016-04-12
| | | | | | | point to the workspace root. -- MOS_MIGRATED_REVID=119558172
* Move FDO support to the analysis phase by wrapping FdoSupport in its own ↵Gravatar Lukacs Berki2016-04-07
| | | | | | | | | | | SkyFunction. This removes one of the two reasons for the existence of BuildConfiguration#prepareToBuild() which makes implementing dynamic configurations impossible and also makes FDO support halfway sane; now FDO is exactly as ugly as remote repositories, that is to say, reasonably okay. Ideally, we'd implement the zip extraction as an Action and make it a TreeArtifact, but support for TreeArtifacts is not mature yet enough, so it's not possible at the moment. -- MOS_MIGRATED_REVID=119150223
* Do not put both pic and non-pic header modules into the inputs of a compile ↵Gravatar Manuel Klimek2016-03-23
| | | | | | | action. -- MOS_MIGRATED_REVID=117915931
* RELNOTES: Bazel warns if a cc rule's includes attribute contains up-level ↵Gravatar Janak Ramakrishnan2016-03-21
| | | | | | | references that escape its package. -- MOS_MIGRATED_REVID=117550535
* Small fix for coverage.Gravatar Googler2016-03-04
| | | | | -- MOS_MIGRATED_REVID=116255991