aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/nativedeps
Commit message (Collapse)AuthorAge
* C++: Refactor WrapCcHelper.Gravatar plf2018-06-26
| | | | | | | Makes it non-instantiable so that it's easier to migrate SWIG rules to Skylark. RELNOTES:none PiperOrigin-RevId: 202136054
* Rename LinkStaticness to LinkingMode and unify with the other LinkingMode.Gravatar hlopko2018-05-07
| | | | | RELNOTES: None. PiperOrigin-RevId: 195777400
* Extract CcCommon.configureFeaturesOrThrowEvalExceptionGravatar hlopko2018-04-20
| | | | | | | | | This method will be available to Skylark. Native rules will use the wrapped version in CcCommon.configureFeaturesOrReportRuleError. The error message shown in case of conflicting features was modified slightly. RELNOTES: None. PiperOrigin-RevId: 193639182
* Push using ruleContext.getFeatures() outside of creating FeatureConfigurationGravatar hlopko2018-04-17
| | | | | | | | The goal is to enable creation of feature configuration without the rule context. This will enable us to have cleaner API for this in Skylark. RELNOTES: None PiperOrigin-RevId: 193195986
* Push using ruleContext.getDisabledFeatures() outside of creating ↵Gravatar hlopko2018-04-16
| | | | | | | | | | FeatureConfiguration The goal is to enable creation of feature configuration without the rule context. This will enable us to have cleaner API for this in Skylark. RELNOTES: None PiperOrigin-RevId: 193017868
* Make statically linking cpp-runtimes as a crosstool feature.Gravatar Googler2018-04-12
| | | | | | | | | This cl should result in no user-visible change. It simply sets the feature based on the field in the crosstool proto. A subsequent cl will expose this feature for people to actually use. PiperOrigin-RevId: 192641438
* Automated rollback of commit 77c5582fa0f5c829df576d9f8d66f4975fe415a6.Gravatar hlopko2018-04-06
| | | | PiperOrigin-RevId: 191880445
* Make statically linking cpp-runtimes as a crosstool feature.Gravatar Googler2018-04-05
| | | | | | | | | | | This cl should result in no user-visible change. It simply sets the feature based on the field in the crosstool proto. A subsequent cl will expose this feature for people to actually use. DELTA_BY_EXTENSION=java=100,py=15 RELNOTES: None PiperOrigin-RevId: 191761838
* C++: Fixes Blaze crashing on CLIF in toolchains that don't need PICGravatar plf2018-03-27
| | | | | | | | | | | | | | | | | | | | For CLIF it doesn't matter whether we use PIC or no-PIC, the important thing is we get an output protobuf. Before https://github.com/bazelbuild/bazel/commit/35773928532c132e3229b490ad98f4ebfd3e5770, using no-PIC was hardcoded. In this CL it was decided to generate PIC instead because the toolchains used by CLIF targets appeared to all have needsPic. In b/73955395 it has been shown not to be the case. In this CL I'm changing the logic again to use no-PIC for CLIF and to circumvent the logic that checks what the configuration and the toolchain say. At the same time, SWIG also used the method setGenerateNoPic() after the variable onlySingleOutput was removed in https://github.com/bazelbuild/bazel/commit/4e9c9f93b15dd2594097644c6b9ca5a579c712fb. In this CL I use the enum to apply PIC and no-PIC in the same cases as before for SWIG. This CL also refactors the methods and boolean variables used to determine whether to use PIC or not, hopefully making it clearer. RELNOTES:none PiperOrigin-RevId: 190615548
* Enable static_linking_mode or dynamic_linking_mode features from cc_binaryGravatar hlopko2018-03-09
| | | | | RELNOTES: CppRules: cc_binary/cc_test now enable 'static_linking_mode' or 'dynamic_linking_mode'. PiperOrigin-RevId: 188482267
* Replace path implementation.Gravatar tomlu2018-02-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Path and PathFragment have been replaced with String-based implementations. They are pretty similar, but each method is dissimilar enough that I did not feel sharing code was appropriate. A summary of changes: PATH ==== * Subsumes LocalPath (deleted, its tests repurposed) * Use a simple string to back Path * Path instances are no longer interned; Reference equality will no longer work * Always normalized (same as before) * Some operations will now be slower, like instance compares (which were previously just a reference check) * Multiple identical paths will now consume more memory since they are not interned PATH FRAGMENT ============= * Use a simple string to back PathFragment * No more segment arrays with interned strings * Always normalized * Remove isNormalized * Replace some isNormalizied uses with containsUpLevelReferences() to check if path fragments try to escape their scope * To check if user input is normalized, supply static methods on PathFragment to validate the string before constructing a PathFragment * Because PathFragments are always normalized, we have to replace checks for literal "." from PathFragment#getPathString to PathFragment#getSafePathString. The latter returns "." for the empty string. * The previous implementation supported efficient segment semantics (segment count, iterating over segments). This is now expensive since we do longer have a segment array. ARTIFACT ======== * Remove Path instance. It is instead dynamically constructed on request. This is necessary to avoid this CL becoming a memory regression. RELNOTES: None PiperOrigin-RevId: 185062932
* Rename Root to ArtifactRoot.Gravatar tomlu2018-01-16
| | | | | | This is slightly more descriptive, and we will potentially want to use the name Root for a broader concept shared between ArtifactRoot and RootedPath. PiperOrigin-RevId: 182082367
* Use more robust check for bitcode inputs to linkGravatar Googler2017-12-21
| | | | | | | | | | | | The current checks used in several places for whether an LTO indexing step is needed only looked for direct LTO bitcode inputs. Instead we should use the existing hasLtoBitcodeInputs() method to look both at the direct inputs as well as inputs on all LibraryToLink. This was already used in similar checking on the CppBinary. With this change, all places that test for needing an LTO indexing step use the correct interface. RELNOTES: None PiperOrigin-RevId: 179812972
* Automated rollback of commit 367f704e71f352b404df38161f4c367b9ff506c9.Gravatar hlopko2017-12-12
| | | | | | | | | | | | | | *** Reason for rollback *** Rollforward of https://github.com/bazelbuild/bazel/commit/c861c0afd9a4df283936218b9e5b33c452b07c95 after fixing fake link actions. *** Original change description *** Rollback of 178106899. RELNOTES: Linkstamping is now a separate and full-blown CppCompileAction, it's no longer a part of linking command. PiperOrigin-RevId: 178760072
* Rollback of 178106899.Gravatar cpeyser2017-12-08
| | | | PiperOrigin-RevId: 178384991
* Register separate linkstamp compile actionGravatar hlopko2017-12-06
| | | | | | | | | | | | | | | | | This cl replaces entire hardcoded linkstamping command line generation with a separate action. Instead of generating bash command to compile linkstamp and prepending it to the standard link command line, this cl creates a special action that link action depends on. I kept linkstamp action registration in the CppLinkActionBuilder (and GoCompilationHelper internally) to keep the cl shorter and change more localized. I also didn't remove linkstamps and buildInfoHeaderArtifacts from CppLinkAction to stay compatible with extra actions api. Both issues and corresponding cleanups will be addressed in separate cls. RELNOTES: Linkstamping is now a separate and full-blown CppCompileAction, it's no longer a part of linking command. PiperOrigin-RevId: 178106899
* Suppress ThinLTO indexing for linkstatic testsGravatar Googler2017-11-30
| | | | | | | | | | | | | ThinLTO and static linking of test suites is a bad combination since it results in a combinatorial explosion of the ThinLTO backends - each object file needs a separate LTO backend action per target. If you are static linking O(N) objects, and have O(M) targets, with ThinLTO you will get O(N*M) LTO backend jobs. This is because the whole program optimization step is per-target, and may make different decisions affecting the object files. With dynamic linking it isn't a problem, since the ThinLTO optimization happens at the .so level, which are shared across tests. And for statically-linked cc_binary it hasn't been an issue since typically only a single target is built at a time, unlike tests. In general it isn't incredibly useful to run tests with ThinLTO, although most projects are in the habit of running their tests with the same options that they use to optimize their main binary (and most blueprints seem to be set up to share options between them). With ThinLTO since it is doing whole-program optimization, you are getting different whole-program optimizations for the main binary and each test binary, so it isn't the case that this will optimize the tests in the same exact way as the main binary anyway. Therefore, when creating LTO backends for statically-linked *_test targets, skip the LTO indexing stage, and create (or use if already created) shared dummy LTO backend actions for each library. These LTO backends are fed an empty index, so they don't do any whole program optimization and are safe to share. Enable this under a new feature so that we can enable it by default via blazerc but provide a facility to disable if needed. RELNOTES: None PiperOrigin-RevId: 177495858
* Move CppConfiguration's treatment of pic, --start-lib/--end-lib, and fission toGravatar cpeyser2017-11-22
| | | | | | | | | | | CppHelper. In CppHelper, CcToolchainProvider and CppConfiguration are used sepereately, allowing toolchain information to be removed from CppConfiguration. This is necessary to introduce hermetic toolchains, which require that toolchain information be seperated from the configuration, into the c++ rules. PiperOrigin-RevId: 176694160
* Replace all usages of Blaze's Preconditions class with guava.Gravatar tomlu2017-11-09
| | | | | | | | Blaze had its own class to avoid GC from varargs array creation for the precondition happy path. Guava now (mostly) implements these, making it unnecessary to maintain our own. This change was almost entirely automated by search-and-replace. A few BUILD files needed fixing up since I removed an export of preconditions from lib:util, which was all done by add_deps. There was one incorrect usage of Preconditions that was caught by error prone (which checks Guava's version of Preconditions) that I had to change manually. PiperOrigin-RevId: 175033526
* Add support for linker scripts in auto-linked Android native depsGravatar Googler2017-10-23
| | | | | | | Android's mechanism for automatically linking native deps does not currently support linker scripts. A dependency cc_library can specify the linker script in the linkopts and include it in its deps, but since the artifact is not provided as an input to the generated link action, this results in an error. This change provides the missing inputs and makes this work. RELNOTES: Support for linker scripts in NativeDepsHelper (e.g., android_binary) PiperOrigin-RevId: 172963605
* Pass CppSemantics down to the CppLinkActionBuilderGravatar hlopko2017-09-29
| | | | | | | | | Currently CppLinkActionBuilder is not using CppSemantics, but it will when we use full CppCompileAction for linkstamp compiles. This cl is a preparation for that. RELNOTES: None. PiperOrigin-RevId: 170467826
* Ensure ThinLTO backend actions always generate debug info when fission enabledGravatar Googler2017-08-29
| | | | | | | | | While we don't generate .dwp files for shared libraries, the link still expects the object files to contain split debug info. Enhanced tests to ensure the cc_library LTO backend actions always have the expected outputs/build variable, regardless of linking static or not. RELNOTES: NONE PiperOrigin-RevId: 166853630
* Use camel case in names that included "LTO".Gravatar Googler2017-08-02
| | | | | | As suggested in readability review for https://github.com/bazelbuild/bazel/commit/2789c97149a1f253b659aa0f2401f44705a3258f. Ended up being a fair number of changes, but I think I got them all. PiperOrigin-RevId: 163975846
* Enable ThinLTO for nativedeps linksGravatar Googler2017-08-01
| | | | | | | | | | | Add support for setting up the LTO indexing step when the inputs contain bitcode. Added a python BuildViewTestCase that provokes this, as well as a ThinLTO GoogleBuildIntegrationTestCase to the existing NativeDeps testing. PiperOrigin-RevId: 163827441
* Do not NPE crash when C++ actions are not configured in crosstoolGravatar hlopko2017-07-07
| | | | | | | Show meaningful message instead. RELNOTES: None. PiperOrigin-RevId: 161196096
* 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
* Refactor all ctor callsites of PathFragment to instead call a static ↵Gravatar nharmata2017-04-05
| | | | | | | | | | | | 'create' method. This paves the way for changing PathFragment to e.g. an abstract class with multiple subclasses. This way we can split out the windows-specific stuff into one of these concrete classes, making the code more readable and also saving memory (since the shallow heap size of the NonWindowsPathFragment subclass will hopefully be smaller than that of the current PathFragment). This also lets us pursue gc churn optimizations. We can now do interning in PathFragment#create and can also get rid of unnecessary intermediate PathFragment allocations. RELNOTES: None PiperOrigin-RevId: 152145768
* Refactor scheduling of LTO Backend actions into CppLinkActionBuilderGravatar Googler2017-03-14
| | | | | | | | | | | | This was suggested in the review for unknown commit, which adds ThinLTO support to another client of CppLinkActionBuilder. The change required changing the constructor to take a FdoSupportProvider object instead of a FdoSupport object, so required changes to all callers. -- PiperOrigin-RevId: 150060046 MOS_MIGRATED_REVID=150060046
* 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
* Remove varargs Fingerprint#addStringsGravatar Michajlo Matijkiw2016-12-07
| | | | | | | | Doesn't add much on top of the Iterable version in the current state of things, and it is too easy to confuse with addString. -- PiperOrigin-RevId: 141300940 MOS_MIGRATED_REVID=141300940
* Rollback of commit b5ac354867c4d8deb543285e87e636504078fb69.Gravatar Michael Staib2016-08-25
| | | | | | | | | *** Reason for rollback *** Roll forward with fixes. -- MOS_MIGRATED_REVID=131224077
* Make native deps with embedded runtimes work again. commit ↵Gravatar Lukacs Berki2016-08-17
| | | | | | | 0978a8ea1593ef204ea97155014f76baba2508c5 broke it. -- MOS_MIGRATED_REVID=130496094
* Allow Skyframe graph lookups and value retrievals to throw InterruptedException.Gravatar Janak Ramakrishnan2016-08-16
| | | | | | | The only place we now don't handle InterruptedException is in the action graph created after analysis, since I'm not sure that will be around for that much longer. -- MOS_MIGRATED_REVID=130327770
* Record the category of the artifact to be linked in LinkerInput.Gravatar Lukacs Berki2016-08-12
| | | | | | | | | It's currently only used for sanity checks, but the idea is that we'll use this field to decide what to do with a given linker input instead of inferring things from its file name. Also make artifact name creation a bit simpler by using the same set of variables for compiler and linker outputs. -- MOS_MIGRATED_REVID=129990944
* Add the repository name as a parameter to the output path functionsGravatar Kristina Chodorow2016-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't do anything yet, it's in preparation for the execroot rearranging change. The execroot will have one bazel-out per repo, so it'll look like: execroot/ repo1/ bazel-out/ local-fastbuild/ bin/ repo2/ bazel-out/ local-fastbuild/ bin/ genfiles/ repo3/ bazel-out/ local-fastbuild/ testlogs/ and so on. Thus, any output path (getBinDirectory() & friends) needs to know what the repo name is. This changes so many places in the code I thought it would be good to do separately, then just flip the functionality in the execroot-rearranging commit. While I was poking around, I changed all of the refs I could from getPackageRelativeArtifact() to getBin/GenfilesArtifact(), so that 1) rule implementation don't have to know as much about roots and 2) they'll be more isolated from other output dir changes. `bazel info` and similar just return roots for the main repository. The only "change" is passing around a target label in the Java rules. Continues work on #1262. -- MOS_MIGRATED_REVID=129985336
* 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
* Extract CppLinkAction.Builder to its own top level class.Gravatar Cal Peyser2016-07-13
| | | | | -- MOS_MIGRATED_REVID=127221256
* Rollback of commit 588a6a04c748a02f583d552660434d74190bb3ba.Gravatar Florian Weikert2016-07-04
| | | | | | | | | *** Reason for rollback *** Broke some targets -- MOS_MIGRATED_REVID=126574275
* RELNOTES: Use the correct build configuration for shared native deps during ↵Gravatar Googler2016-07-01
| | | | | | | Android split transitions. -- MOS_MIGRATED_REVID=126378169
* Support copy-only native code in modern native support for android_binary.Gravatar Michael Staib2016-06-30
| | | | | | | | | | | | | | | | | | | | | | | legacy_native_support makes it so that Bazel copies .so's instead of linking. This allows Bazel to include third-party native code without running an NDK. Turning it off allows Bazel to actually compile native code, but at the cost of this copy case no longer working without an NDK, and creating an unnecessary shared library which will most likely never be used. This CL makes it so that if no actual source code or static libraries are in the transitive closure, the linker is not run at the android_binary level. This means that legacy_native_support as a separate concept can be removed, and it is - the attribute remains, but is a no-op. This will be removed in a future change. The matching flag (--legacy_android_native_support) has already been removed. RELNOTES: The link mode for Android native code is now automatically determined based on the transitive closure of cc_libraries, and legacy_native_support is now a no-op. --legacy_android_native_support has been removed. -- MOS_MIGRATED_REVID=126244755
* Make linkstamp info use NestedSet.Gravatar Manuel Klimek2016-05-25
| | | | | | | | Before this patch we would store expanded transitive include files in CcLinkParams. -- MOS_MIGRATED_REVID=123103815
* --Gravatar Luis Fernando Pino Duque2016-05-03
| | | | MOS_MIGRATED_REVID=121353990
* Use Bazel Preconditions variant which avoids varargs array creationGravatar Mark Schaller2015-12-10
| | | | | | | Reduces garbage. -- MOS_MIGRATED_REVID=109914243
* 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
* Inline the native deps suffix constant in one location.Gravatar Ulf Adams2015-09-08
| | | | | | | Only one for now, as we need to migrate internally. -- MOS_MIGRATED_REVID=102477370
* Fix some warnings.Gravatar Ulf Adams2015-09-04
| | | | | -- MOS_MIGRATED_REVID=102332437
* Link Android native code with libstdc++, statically.Gravatar Ulf Adams2015-09-03
| | | | | | | | | | | | | | | | | | | | | | - Refactor the ndk toolchain generation to properly set the dynamic and static runtime lib filegroups. - Enable the runtime filegroups. - Change the NativeDepsHelper to work as documented - mostly static means statically linking the runtime filegroups; but only for Android to remain backwards compatible with other users of NativeDepsHelper. - This is safe as we don't use runtime filegroups internally for Android... yet. - Clean up the NativeDepsHelper a bit. Fixes #392. Next steps are to make this configurable at the android_binary level. We should also disable whole-archive in this case. -- Change-Id: I95b0ce45d8b3adcf5424544c92ec30102b7fac6b Reviewed-on: https://bazel-review.googlesource.com/1879 MOS_MIGRATED_REVID=102239337
* Remove an AnalysisEnvironment.getDerivedArtifact() call from nativedeps.Gravatar Lukacs Berki2015-08-24
| | | | | -- MOS_MIGRATED_REVID=101344826
* Remove an AnalysisEnvironment.getDerivedArtifact() call from nativedeps.Gravatar Lukacs Berki2015-08-24
| | | | | -- MOS_MIGRATED_REVID=101218538
* 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