aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp
Commit message (Collapse)AuthorAge
* Disable include scanning for assembler-without-preprocessor source.Gravatar Googler2015-09-28
| | | | | | | | The scanner only looks for C preprocessor directives, but most assemblers allow '.include' assembly directives, and those aren't found by the scanner. So skip the include scanner for assembly files that don't want C preprocessing, because correctly declared inclusions are to be preferred anyway. -- MOS_MIGRATED_REVID=103944189
* Also ship the linker for LTO backend actions.Gravatar Han-Wen Nienhuys2015-09-28
| | | | | -- MOS_MIGRATED_REVID=103942611
* Rationalize copyright headersGravatar Damien Martin-Guillerez2015-09-25
| | | | | | | | | | | The headers were modified with `find . -type f -exec 'sed' '-Ei' 's|Copyright 201([45]) Google|Copyright 201\1 The Bazel Authors|' '{}' ';'` And manual edit for not Google owned copyright. Because of the nature of ijar, I did not modified the header of file owned by Alan Donovan. The list of authors were extracted from the git log. It is missing older Google contributors that can be added on-demand. -- MOS_MIGRATED_REVID=103938715
* Move Label from the lib.syntax to the lib.cmdline package so that:Gravatar Lukacs Berki2015-09-21
| | | | | | | | | | - Label parsing can be simplified - lib.syntax is only contains the code for Skylark and is reasonably independent from the problem domain of building things This change is mostly only changes to imports declarations. The rest is reversing the dependency between :cmdline and :syntax and moving a tiny amount of code between Printer and FilesetEntry and the addition of SkylarkPrintableValue that I couldn't be bothered to separate out into its own change. -- MOS_MIGRATED_REVID=103527877
* Make sure disabled FDO features are filtered out.Gravatar Googler2015-09-21
| | | | | | | Without this, the FDO features enabled under --fdo* blaze options are not removed when BUILD files contain "features = ['-fdo_instrument', '-fdo_optimize']". -- MOS_MIGRATED_REVID=103431508
* Also change C++ to use the new split attribute lists.Gravatar Ulf Adams2015-09-21
| | | | | -- MOS_MIGRATED_REVID=103384782
* Separate build-specific types and types inherent to Skylark.Gravatar Lukacs Berki2015-09-21
| | | | | -- MOS_MIGRATED_REVID=103374106
* Teach Bazel to accept assembler-without-preprocessor source files.Gravatar Googler2015-09-16
| | | | | | | | | | | Adding the accepted file extensions was a minor issue. The bulk of this change was to weaken the assertion that all cxx compiler actions produce a '.d' file. RELNOTES[NEW]: a cc_binary rule may list '.s' and '.asm' files in the srcs -- MOS_MIGRATED_REVID=103196242
* Parse the label syntax "@//a:b" so that eventually we can make that the ↵Gravatar Lukacs Berki2015-09-15
| | | | | | | | | syntax that means "refer to the main repository". There isn't an overarching plan for what we are going to do with the cmdline package, which seems to be separated from the .syntax one in all sorts of awkward ways. -- MOS_MIGRATED_REVID=103088960
* Prevented catching/wrapping of InterruptedExceptions, especially in ↵Gravatar Florian Weikert2015-09-14
| | | | | | | BaseFunction. -- MOS_MIGRATED_REVID=102988766
* Rollback of commit a708acd02baf3821c975801ae0e5cad6867a6735.Gravatar Mark Schaller2015-09-08
| | | | | | | *** Reason for rollback *** -- MOS_MIGRATED_REVID=102590114
* Teach Bazel to accept assembler-without-preprocessor source files.Gravatar Googler2015-09-04
| | | | | | | | | | | Adding the accepted file extensions was a minor issue. The bulk of this change was to weaken the assertion that all cxx compiler actions produce a '.d' file. RELNOTES[NEW]: a cc_binary rule may list '.s' and '.asm' files in the srcs -- MOS_MIGRATED_REVID=102346882
* Fix some warnings.Gravatar Ulf Adams2015-09-04
| | | | | -- MOS_MIGRATED_REVID=102332437
* Code cleanupGravatar Laurent Le Brun2015-09-03
| | | | | -- MOS_MIGRATED_REVID=102239051
* Allow .dylib libraries in srcsGravatar Kristina Chodorow2015-09-02
| | | | | | | Fixes some of #407. -- MOS_MIGRATED_REVID=102148776
* Drop the baseline artifact output group.Gravatar Ulf Adams2015-08-31
| | | | | | | | | | The baseline artifacts are part of the instrumented files provider now, and are strongly tied to the collect_code_coverage flag. It seems to be simpler to collect them explicitly in the BuildView (which already collects them for post-processing), than to rely on the output group selection. -- MOS_MIGRATED_REVID=101926341
* Merge the baseline coverage code path into the coverage codepath.Gravatar Ulf Adams2015-08-31
| | | | | | | | | | | | | | | | | We're currently doing too much work for baseline coverage - every rule creates an action for its entire transitive closure; these actions are added to the output group for baseline coverage, but not transitively accumulated. It would be better for every rule to create an action for local baseline coverage, and to aggregate the baseline coverage artifacts down the dependency tree. By merging the code paths, the InstrumentedFilesCollector can perform the aggregation, because it can distinguish local and transitive files; I'm planning to implement that in a subsequent change. -- MOS_MIGRATED_REVID=101914334
* Remove the deprecated unused addTransitiveLangTargets method.Gravatar Ulf Adams2015-08-31
| | | | | -- MOS_MIGRATED_REVID=101913201
* Add a convenience method to InstrumentedFilesCollector.Gravatar Ulf Adams2015-08-31
| | | | | | | This simplifies the users a bit, and makes it easier to refactor the code. -- MOS_MIGRATED_REVID=101802767
* Fix a typo.Gravatar Ulf Adams2015-08-28
| | | | | -- MOS_MIGRATED_REVID=101762412
* Clean up the link command action code a bit.Gravatar Ulf Adams2015-08-27
| | | | | -- MOS_MIGRATED_REVID=101568873
* Implement the core structure for dynamic configurations.Gravatar Greg Estren2015-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a big change, so let me walk you through the key pieces: 1) This cl provides an alternative mechanism for creating configurations and doing configuration transitions that's "dynamic" in that the configurations can be created on the fly and the transitions are arbitrary mappings from BuildOptions --> BuildOptions that can also be created on the fly. It also integrates this with ConfiguredTargetFunction, so the configured target graph automatically uses this framework. 2) It does *not* replace old-style (which we'll call "static") configurations. For a number of important reasons: It's not yet at feature parity (particularly: no LIPO). It's not remotely tested across real projects enough to have confidence that it's battle-ready. It doesn't yet handle certain "special" functions like BuildConfiguration.prepareToBuild() and BuildConfiguration.getRoots(). It still relies on the old static transition logic to determine what transitions to apply (eventually we'll distribute that logic out, but that's too much for a single cl). We need the option to toggle it on and off until we have enough confidence in it. So with this cl, builds can be done in either mode. 3) The new flag --experimental_dynamic_configs toggles use of dynamic configurations. 4) Dynamic configurations are created with the Skyframe function BuildConfigurationFunction (this was already created in an earlier change). This consumes a BuildOptions and a set of configuration fragments to produce a BuildConfiguration. 5) Dynamic transitions are instances of the new class PatchTransition, which simply maps an input BuildOptions to an output BuildOptions. 6) Since static and dynamic configurations have to co-exist (for now), this cl tries hard to keep today's transition logic defined in a single place (vs. forking a dedicated copy for each configuration style). This is done via the new interface BuildConfiguration.TransitionApplier. BuildConfiguration.evaluateTransition is modified to feed its transition logic into TransitionApplier's common API. Both dynamic and static configurations have their own implementations that "do the right thing" with the results. 7) The transition applier for dynamic configurations basically stores the Transition, then allows DependencyResolver (which calls BuildConfiguration.evaluateTransition) to return Dependency instances containing that Transition (vs. a BuildConfiguration, which they traditionally contain). 7.5) An earlier variation of the dynamic transition applier retained BuildOptions (e.g. when it got a Transition it immediately applied it to get its output BuildOptions, then stored that). This had the advantage of making composing of transitions easier, especially within BuildConfiguration.evaluateTransition (which can theoretically apply multiple transitions to the input configuration). But it turns out that applying transitions has a cost, and it's simply more performant to pass them through until they're really needed. 8) In dynamic configuration mode, after ConfiguredTargetFunction gets its deps (e.g. an <Attribute, Dependency> multimap), it "trims" the configurations for its dependencies by a) only including config fragments required by the deps' subtrees and b) applying the transitions that came from 7). This all happens in the new method ConfiguredTargetFunction.trimConfigurations. 9) trimConfigurations is heavily performance-optimized based on a lot of experience running this through a large project within Google. As it turns out, the cost of host transitions can be atrocious (because there are a lot of them). Also, BuildOptions.clone() is expensive. And just creating BuildConfiguration SkyKeys also has a cost (largely because of BuildOptions cloning), so that shouldn't be done except when really necessary. My experience with this convinced me it's worth making this method complicated for the sake of making it fast. Since it basically visits every edge in the configured target graph (at least), it really needs to be slick. 10) Since host transitions in particular are problematic w.r.t. speed, I compute the host *once* in ConfigurationCollectionFunction.getHostConfiguration() and expose that reference to ConfiguredTargetFunction and other Skyframe functions. This limits recomputation to just when the fragments are trimmed. 11) Since options cloning is expensive, I'm doing something scary: exposing a BuildConfiguration.getOptions() method that returns a direct reference. Since BuildOptions is mutable, this is dangerous in the wrong hands. I can experiment with going back to cloning (with the caching of host transitions it may not matter as much), but we may ultimately have to put up with this risk for the sake of performant analysis time. What would be *really* awesome would be to make BuildOptions immutable. But that's not going to happen in this cl. So in short, the key abstractions in this cl are: - PatchTransition - BuildConfiguration.TransitionApplier - ConfiguredTargetFunction.trimConfigurations The current implementation imposes no analysis time penalty -- MOS_MIGRATED_REVID=101474620
* Add '.ldscript' as a possible linker script file extension.Gravatar Googler2015-08-24
| | | | | | | | | | This is an easy way to deal with other code that names scripts as such, rather than requiring that scripts be renamed to end in ".lds" RELNOTES[NEW]: deps of a cc_binary may contain linker script files ending in ".ldscript" -- MOS_MIGRATED_REVID=101346375
* Remove the some calls to AnalysisEnvironment.getDerivedArtifact() and add a ↵Gravatar Lukacs Berki2015-08-24
| | | | | | | | | | | big fat warning that that method shouldn't be used anymore. Ideally, I'd mark it as deprecated, but it's legitimately used by RuleContext. I could just forbid access to AnalysisEnvironment to rule implementations, but, sadly, almost every method on it is called at a few oddball places in implementations of various rules, so we can't do it just yet. -- MOS_MIGRATED_REVID=101345484
* Add the implicit output of unstripped binary for Launcher-enabled java_binary.Gravatar Googler2015-08-24
| | | | | | | Use stripped launcher when Fission is enabled. -- MOS_MIGRATED_REVID=101244628
* Abstract away artifact creation in CppLinkAction so that we can create most ↵Gravatar Lukacs Berki2015-08-24
| | | | | | | | | of the artifacts in a way that checks that they are under the package directory. The exception is nativedeps, whose link actions are shared, and thus they cannot be at a package-specific location. -- MOS_MIGRATED_REVID=101216949
* Prefer RuleContext.getFragment over BuildConfiguration.getFragment.Gravatar Ulf Adams2015-08-24
| | | | | | | This improves the coverage of the legality check in RuleContext.getFragment. -- MOS_MIGRATED_REVID=101208822
* Add an empty RunfilesProvider to cc_toolchain_suite to fulfill the contract ↵Gravatar Alex Humesky2015-08-21
| | | | | | | in RuleConfiguredTarget. -- MOS_MIGRATED_REVID=101166333
* Rollback of commit 50adddf01b8d7f46fba6bee12ebbb41c31c87165.Gravatar Ulf Adams2015-08-20
| | | | | | | | | | | | | | | | | *** Reason for rollback *** Makes some tests fail, oddly enough. *** Original change description *** Fixes to use dylib on MacOS X. The change in LinkCommandLine.java fixes the error "ld: library not found for -ltbb.dylib". The change in osx_gcc_wrapper.sh fixes the error "dyld: Library not loaded: @rpath/libtbb.dylib". See https://groups.google.com/forum/#!topic/bazel-discuss/bs8BnXYRjzY -- MOS_MIGRATED_REVID=101012689
* Fixes to use dylib on MacOS X.Gravatar Topher2015-08-20
| | | | | | | | | | | The change in LinkCommandLine.java fixes the error "ld: library not found for -ltbb.dylib". The change in osx_gcc_wrapper.sh fixes the error "dyld: Library not loaded: @rpath/libtbb.dylib". See https://groups.google.com/forum/#!topic/bazel-discuss/bs8BnXYRjzY -- Change-Id: I7feb02eee7d059d86a6d29af391dc2fc71e1d0cc Reviewed-on: https://bazel-review.googlesource.com/#/c/1831/ MOS_MIGRATED_REVID=101007071
* Remove errant paths from crosstool test files.Gravatar Alex Humesky2015-08-20
| | | | | | | | | | | | | | | | | | | Also includes the following changes: Introduce a helper class for low-boilerplate time measurements and logging. -- Removed attribute "args" from java_test. -- Adds the arm64, mips, mips64, x86, and x86_64 toolchains in the Android NDK This adds the precited targets to the crosstools file generated by the android_ndk_repository rule. The crosstools support NDK revision r10e-rc4. RELNOTES: arm64, mips, mips64, x86, and x86_64 NDK toolchains added to android_ndk_repository in Bazel -- MOS_MIGRATED_REVID=100953441
* Fail more verbosely in LinkerInputs.java.Gravatar Han-Wen Nienhuys2015-08-18
| | | | | -- MOS_MIGRATED_REVID=100913716
* Set the workspace suffix for runfilesGravatar Kristina Chodorow2015-08-13
| | | | | | | This CL covers the "easy" cases. Followup CLs will take care of couple dozen remaining gnarly ones. -- MOS_MIGRATED_REVID=100479410
* Resolve TODO now that the feature configuration supports conditional expansionGravatar Manuel Klimek2015-08-12
| | | | | | | of flag sets. -- MOS_MIGRATED_REVID=100400672
* Patch the PATH for linker on Windows, in the same way as for compiler.Gravatar Dmitry Lomov2015-08-12
| | | | | -- MOS_MIGRATED_REVID=100368051
* Convert the coverage flags to use the feature configuration.Gravatar Manuel Klimek2015-08-11
| | | | | -- MOS_MIGRATED_REVID=100281959
* Add a feature to control whether we provide transitive header modules to aGravatar Manuel Klimek2015-08-11
| | | | | | | modules enabled build. -- MOS_MIGRATED_REVID=100272810
* Experimental support LLVM ThinLTO.Gravatar Han-Wen Nienhuys2015-08-11
| | | | | | | | | | | | | | | | | | | | | | ThinLTO is a Link Time Opimization strategy, where the inlining step operates on LLVM intermediate code, and is sharded across multiple compiler invocations, so they can be parallelized. For more information, see http://llvm.org/devmtg/2015-04/slides/ThinLTO_EuroLLVM2015.pdf Using this features requires an experimental LLVM toolchain, with the following stanza in CROSSTOOL feature { name: "thin_lto" flag_set { action: "c-compile" action: "c++-compile" flag_group { flag: "-Xclang-only=-Wno-inconsistent-missing-override" flag: "-flto" flag: "-O2" } } } -- MOS_MIGRATED_REVID=100269776
* Feature configuration: add a field required_variables on flag_sets.Gravatar Manuel Klimek2015-08-06
| | | | | | | | | | | | | This allows to prevent expansion of flag sets based on whether build variables are available. If required_variables is not set, and a variable that is referenced in the flag_set's flags is not available, the build will fail. We need the new behavior when some input files (for example profile data in FDO enabled builds) are only available for a subset of the translation units of a given target. -- MOS_MIGRATED_REVID=100028996
* Allow the feature configuration to support structured build variables of nestedGravatar Manuel Klimek2015-08-06
| | | | | | | list type. -- MOS_MIGRATED_REVID=100024899
* Removed BuildConfiguration.Fragment#getName() and #isSkylarkVisible().Gravatar Florian Weikert2015-08-05
| | | | | | | Instead, the SkylarkModule annotation is being used to identify fragments that are visible in Skylark. -- MOS_MIGRATED_REVID=99930512
* Hard disable C++ include scanning in Bazel (which wasn't supported anyway, ↵Gravatar Philipp Wollermann2015-08-05
| | | | | | | but due to the flag default value being true, some code behaved as if it was). -- MOS_MIGRATED_REVID=99913146
* Use pic mode for cc_fake_binary if pic actions are used for binaries.Gravatar Manuel Klimek2015-08-05
| | | | | | | | | | | | | | | | | | | | | To allow the commands in the cc_fake_binary to work with modules (which is a precondition to writing nocompile tests for modules), we need to create header modules in the same pic/nopic mode as the rest of the commandline indicates. There are two ways to resolve this problem: a) Make cc_fake_binary use the same pic mode as other binaries. b) Make sure fake compile actions get all their inputs in non-pic mode. This patch proposes solution a), as that makes sure cc_fake_binary is as close to the actual compilation going on as possible; for example, if we decide to always use pic in the future, this will simply work; additionally, we will currently get more test coverage through different compilation modes. RELNOTES: 'cc_fake_binary' uses the same pic/nopic mode as other binaries. -- MOS_MIGRATED_REVID=99902738
* Add dylib as a C++ file typeGravatar Kristina Chodorow2015-08-04
| | | | | -- MOS_MIGRATED_REVID=99823918
* Add more configuration fragment annotations, and a runtime check.Gravatar Ulf Adams2015-08-04
| | | | | -- MOS_MIGRATED_REVID=99819719
* Lazy evaluation of C & C++ sources in CcCommon.Gravatar Ulf Adams2015-08-04
| | | | | -- MOS_MIGRATED_REVID=99718820
* Refactor CcBinary / CcCommon a bit.Gravatar Ulf Adams2015-08-04
| | | | | | | | | | Don't compute the linkopts in CcCommon unconditionally, only on demand. In order to only do this once, I had to pull out all calls to getLinkopts and move them up in the call hierarchy. This in turn resulted in some simplification and dead code removal in CcBinary. -- MOS_MIGRATED_REVID=99716999
* Split CcCommon handling of srcs filtering into a new class.Gravatar Ulf Adams2015-08-04
| | | | | -- MOS_MIGRATED_REVID=99715964
* Remove all calls to AnalysisEnvironment.getDerivedArtifact() from the C++ ↵Gravatar Lukacs Berki2015-08-04
| | | | | | | | | | | | rules that can be removed. What is left: - The outputs of ExtractInclusionsAction. I think this action is shared between multiple rules that have the same generated file in srcs, so this call site is legitimate. - Creating the solib symlinks. This is not a shared action, but these need to be in the same directory so that the RPATH is not too long, so we must live with this for the time being. - FDO, which is beyond salvation. The artifacts under the FDO root don't really conform to the usual "only under the package directory" convention. -- MOS_MIGRATED_REVID=99551394
* Skylark: In addition to using ctx.configuration.fragment(CONF), the build ↵Gravatar Florian Weikert2015-07-30
| | | | | | | configuration can now be accessed via ctx.configuration.CONF where CONF is in {cpp, jvm, java}. -- MOS_MIGRATED_REVID=99470271