aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
Commit message (Collapse)AuthorAge
* Fix missing print statements in output functionsGravatar vladmos2017-12-02
| | | | PiperOrigin-RevId: 177708823
* Refactor the representation of a collection of package specificationsGravatar cushon2017-11-15
| | | | PiperOrigin-RevId: 175832159
* 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
* Automated rollback of commit 8cb1d2fb460a9caf47df58d7ff051d31080a77cb.Gravatar ulfjack2017-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Roll forward again without the changes to expand_location, but with the trimming fix from https://github.com/bazelbuild/bazel/commit/19617360121635a77ffec99b84d825e7d9b260b1. *** Original change description *** Automated rollback of commit ca77f608e486bf7aa762565d25bf7b9e30f2268c. This also rolls back unknown commit. *** Reason for rollback *** Affected expand_location Skylark API semantics - it no longer accepts ${abc} or plain dollar signs, but complains. *** Original change description *** Extend TemplateExpander to handle $(func param) expansion Rewrite the Expander to use the new functionality; also rewrite the Skylark expand_location function to use it. PiperOrigin-RevId: 174384095
* Add platform_common.MakeVariableInfo so that Skylark code has access to the ↵Gravatar lberki2017-10-27
| | | | | | | Make variables provider. RELNOTES: None. PiperOrigin-RevId: 173527191
* Automated rollback of commit ca77f608e486bf7aa762565d25bf7b9e30f2268c.Gravatar ulfjack2017-10-26
| | | | | | | | | | | | | | | | | This also rolls back unknown commit. *** Reason for rollback *** Affected expand_location Skylark API semantics - it no longer accepts ${abc} or plain dollar signs, but complains. *** Original change description *** Extend TemplateExpander to handle $(func param) expansion Rewrite the Expander to use the new functionality; also rewrite the Skylark expand_location function to use it. PiperOrigin-RevId: 173508888
* Extend TemplateExpander to handle $(func param) expansionGravatar ulfjack2017-10-25
| | | | | | | Rewrite the Expander to use the new functionality; also rewrite the Skylark expand_location function to use it. PiperOrigin-RevId: 173280839
* Extend from an abstract base class to avoid duplication of utility methods ↵Gravatar ruperts2017-10-18
| | | | | | | in RuleErrorConsumers RELNOTES: None. PiperOrigin-RevId: 172387755
* Extract more RuleContext error-related methods into RuleErrorConsumerGravatar cparsons2017-10-16
| | | | | | | This will make it easier to pass only error-handling functionality into support classes. RELNOTES: None. PiperOrigin-RevId: 172148072
* SplitTransitionProvider no longer requires the attributes it uses are "Non ↵Gravatar cparsons2017-10-11
| | | | | | | Configurable" RELNOTES: None. PiperOrigin-RevId: 171751391
* Refactor ConfiguredAttributeMapper to lib/packages from lib/analysis.Gravatar cparsons2017-10-11
| | | | | | | | | This requires moving the convenience constructor using RuleConfiguredTarget to be owned by RuleConfiguredTarget. This refactoring is required by later work to allow SplitTransitionProvider to use configurable attributes. This would require packages/Attribute.java -> analysis/ConfiguredAttributeMapper.java, where in general, the 'analysis' package depends on the 'packages' package. This is the easiest way to prevent a circular dependency. RELNOTES: None. PiperOrigin-RevId: 171741620
* Move expansion functionality to a new classGravatar ulfjack2017-09-29
| | | | | | Progress on #2475. PiperOrigin-RevId: 170473111
* Make the state in RuleContext explicitGravatar ulfjack2017-09-28
| | | | | | | | | | | | | | | | | | | | | This isn't ideal - RuleContext should not have state, but this ended up happening between adding a cache and refactoring how make variables are discovered. I have carefully traced back all callers that provide custom make variable suppliers and added an init call to their rule initialization. Note that the ConfigurationMakeVariableContext is _cached_, so callers that call in without any make variable suppliers and then call again with them would get the context from the previous call. We now enforce that the ConfigurationMakeVariableContext is only initialized once, and that this happens before any usage, which is slightly better than the previous state, where initialization was silently ignored on any subsequent call. Progress on #2475. PiperOrigin-RevId: 170312285
* Simplify make variable expansion call sitesGravatar ulfjack2017-09-28
| | | | | | Progress on #2475. PiperOrigin-RevId: 170197341
* Simplify RuleContext APIGravatar ulfjack2017-09-27
| | | | | | | | | Use ConfigurationMakeVariableContext instead of passing in lists of MakeVariableSuppliers. Progress on #2475. PiperOrigin-RevId: 170182945
* Introduce --enabled_toolchain_types, which when set to the cpp toolchain ↵Gravatar cpeyser2017-09-20
| | | | | | causes the cc_toolchain dependency of cc targets to be selected using the platforms/toolchains constraint solving system. PiperOrigin-RevId: 169250621
* Automated rollback of commit 743dc14f9f30b80d6d821612f77186afb025477d.Gravatar dslomov2017-09-19
| | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Rollforward with a fix *** Original change description *** Automated rollback of commit 0ee3aa622fc13b8a5072ebddf5cd65823413b4ff. *** Reason for rollback *** Likely causing artifact conflicts for middleman artifacts in some cases due to accidental change of getMiddlemanDir() to getBinDir() in RunfilesSupport.createManifestMiddleman. *** Original change description *** Cleanup ActionConstructionContext. Do not expose the underlying Rule. RELNOTES: None. PiperOrigin-RevId: 169241011
* Automated rollback of commit 0ee3aa622fc13b8a5072ebddf5cd65823413b4ff.Gravatar ulfjack2017-09-19
| | | | | | | | | | | | | | | *** Reason for rollback *** Likely causing artifact conflicts for middleman artifacts in some cases due to accidental change of getMiddlemanDir() to getBinDir() in RunfilesSupport.createManifestMiddleman. *** Original change description *** Cleanup ActionConstructionContext. Do not expose the underlying Rule. RELNOTES: None. PiperOrigin-RevId: 169230095
* Move RuleConfiguredTarget to lib.analysis.configuredtargets.Gravatar gregce2017-09-19
| | | | | | This is a trivial change with a large file footprint. PiperOrigin-RevId: 169169864
* Cleanup ActionConstructionContext.Gravatar dslomov2017-09-19
| | | | | | | Do not expose the underlying Rule. RELNOTES: None. PiperOrigin-RevId: 169109552
* Remove outdated Attribute.Configurator interface.Gravatar gregce2017-09-13
| | | | | | | | With dynamic configurations we no longer need a special class to apply transitions: a simple patch transition bound to an attribute works just as well. PiperOrigin-RevId: 168442602
* Automated rollback of commit fc41c430e4de4594a1d699f573d191cbad52a2fb.Gravatar plf2017-09-01
| | | | PiperOrigin-RevId: 167154793
* Move ObjcProvider FLAG into a new provider type (TransitiveSourcesProvider) ↵Gravatar cpeyser2017-08-30
| | | | | | that is accessible to the c++ rules. PiperOrigin-RevId: 166934390
* Add a --build_runfile_manifests flag which controls production ofGravatar Googler2017-08-22
| | | | | | | | foo_test.runfiles_manifest files. These are the largest local outputs in many builds, and unnecessary for remote test execution. RELNOTES: New --build_runfile_manifests flag controls production of runfiles manifests. PiperOrigin-RevId: 166001477
* Rename some of native declared providers according to the new naming scheme.Gravatar dslomov2017-08-21
| | | | | RELNOTES: None PiperOrigin-RevId: 165910455
* Fetch the Java-specific Make variables from the :host_jdk dependency instead ↵Gravatar lberki2017-08-18
| | | | | | | | | of the configuration in genrules. This is necessary because if one uses a java_runtime rule that has java_home="$(VAR") and VAR is set to an absolute path, BuildConfiguration won't be able to resolve VAR (since it's a Make variable and thus can't affect other Make variables), Blaze won't be able to tell that it's an absolute value and thus will prepend the package name of the java_runtime rule to it, e.g. resulting in a//foo/bar instead of /foo/bar if the java_runtime rule is in package a. RELNOTES: None. PiperOrigin-RevId: 165555251
* Honor --nobuild_runfile_links for non-tests, and propagate it to theGravatar Googler2017-08-17
| | | | | | | | | | | | | host configuration. I think the comment I'm deleting is misleading. PAR file construction already has special handling of the input manifest, and host tools do get their runfiles when executed remotely. They don't get them for local execution, but users who care about that don't need to pass the non-default --nobuild_runfile_links option. RELNOTES: None. PiperOrigin-RevId: 165535870
* Move FilesetProvider to lib.analysis.filesetGravatar ulfjack2017-08-09
| | | | | | | This is part of splitting up the build-base library into separate libraries for analysis, exec, and rules. PiperOrigin-RevId: 164701931
* Move MakeVariableProvider to lib.analysisGravatar ulfjack2017-08-08
| | | | | | | This is part of splitting up the build-base library into separate libraries for analysis, exec, and rules. PiperOrigin-RevId: 164456961
* Move RuleConfiguredTargetFactory to lib.analysisGravatar ulfjack2017-08-07
| | | | | | | This is part of splitting up the build-base library into separate libraries for analysis, exec, and rules. PiperOrigin-RevId: 164446955
* Move AliasProvider to lib.analysisGravatar ulfjack2017-08-07
| | | | | | | This is part of splitting up the build-base library into separate libraries for analysis, exec, and rules. PiperOrigin-RevId: 164438390
* Use RequiredProviders to validate rule prerequisites in RuleContext.Gravatar dslomov2017-08-03
| | | | | | | | | We now use a unified way to check provider requirements everywhere. Reland of https://github.com/bazelbuild/bazel/commit/c32e1b1efcd703b3780de47fba62974123593d71. RELNOTES: None. PiperOrigin-RevId: 164038621
* Automated rollback of commit c32e1b1efcd703b3780de47fba62974123593d71.Gravatar dslomov2017-08-02
| | | | | | | | | | | | | | | *** Reason for rollback *** Breaks depot b/64250728 *** Original change description *** Use RequiredProviders to validate rule prerequisites in RuleContext. We now use a unified way to check provider requirements everywhere. RELNOTES: None. PiperOrigin-RevId: 163862067
* Better names for declared providers-related classes.Gravatar dslomov2017-08-01
| | | | | | | | Follows https://docs.google.com/document/d/1aAIVWvHPERDz2cv_PCFGwr8dvh5FcAkENFoRsNS4clk/. RELNOTES: None. PiperOrigin-RevId: 163728291
* Use RequiredProviders to validate rule prerequisites in RuleContext.Gravatar dslomov2017-07-31
| | | | | | | We now use a unified way to check provider requirements everywhere. RELNOTES: None. PiperOrigin-RevId: 163710961
* Fix confusing semantics for Attribute.Builder.allowedRuleClasses.Gravatar gregce2017-07-28
| | | | | | | | | | 1) Update the javadocs. 2) Clarify that allowedRuleClases and allowedRuleClassesWithWarning must be disjoint sets. 3) Enforce 2). 4) Fix error messaging when only "with warnings" is set. PiperOrigin-RevId: 163379567
* Make all WithLegacySkylarkName providers declared providers.Gravatar dslomov2017-07-28
| | | | | RELNOTES: None. PiperOrigin-RevId: 163343931
* Automated rollback of commit 6d884afa8da1b08288cb0108e8bbf6c22ec63393.Gravatar dslomov2017-07-25
| | | | | | | | | | | | | *** Reason for rollback *** Broke bazel_apple_rules *** Original change description *** Make all WithLegacySkylarkName providers declared providers. RELNOTES: None PiperOrigin-RevId: 163054821
* Make all WithLegacySkylarkName providers declared providers.Gravatar dslomov2017-07-25
| | | | | RELNOTES: None PiperOrigin-RevId: 163042362
* BEP: Report configuration for all actionsGravatar Klaus Aehlig2017-07-14
| | | | | | | | | | Whenever we report an action in the build event protocol that has a configuration associated with it, report the configuration as well in the protocol (and not only the checksum, if the configuration is not that of one of the top-level configured targets). Change-Id: I9b085d5381b3c3509b4f3b99c8a77bc8fba6abfe PiperOrigin-RevId: 161789745
* Add a toolchains= attribute to *_binary, *_test, cc_library and extra_action ↵Gravatar lberki2017-07-14
| | | | | | | | | rules to declare which Make variables they need. The idea is that they would depend on the future java_runtime_alias / cc_toolchain_alias and similar rules and thus Bazel will know which Make variables they actually need instead of pulling in the whole BuildConfiguration and also making it possible to compute these Make variables during analysis instead of configuration creation. RELNOTES: None. PiperOrigin-RevId: 161785868
* Make native declared providers not implement TransitiveInfoCollection.Gravatar dslomov2017-07-12
| | | | | | | | | | | | (Almost) all native declared providers are accessed as such and not as native non-declared providers (inheritors of TransitiveInfoCollaction). There are still three providers that use TransitiveInfoCollection.WithLegacySkylarkName mechanism, I'll address them in the follow-up CL. RELNOTES: None. PiperOrigin-RevId: 161655315
* MakeVariableProvider should be declared provider only.Gravatar dslomov2017-07-11
| | | | | RELNOTES: None. PiperOrigin-RevId: 161527470
* Make native declared providers type-safe.Gravatar dslomov2017-07-10
| | | | | RELNOTES: None. PiperOrigin-RevId: 161395570
* Make jvm_runtime.java_home expand Make variables.Gravatar lberki2017-07-10
| | | | | RELNOTES: None. PiperOrigin-RevId: 161383469
* Plumb some information about the location of the JVM through ↵Gravatar lberki2017-07-07
| | | | | | | | | | | | | | | JavaRuntimeProvider instead of Jvm if a java_runtime rule is used. There are a few things standing in the way of removing package loading from JvmConfigurationLoader: - The JAVABASE/JAVA Make variables, which are a function of the contents of the package with the JVM. The plan is to make JavaRuntime a MakeVariableProvider and add an attribute to rules that do Make variable evaluation to tell which Make variables they need - The path to the Java binary is exported to Skylark through the configuration fragment. We'll need to export an attribute to Skylark that can be used to depend on the JVM, then do the three-step dance to use that instead of the configuration and figure out what to do if --javabase is not a label. - Jvm#getJavaExecutable() has a bunch of call sites. They need to be adjusted individually. RELNOTES: None. PiperOrigin-RevId: 161176462
* Use the same data structure for native and Skylark providers.Gravatar dslomov2017-07-05
| | | | | | | | | The memory cost of adding Skylark provider is now the same as native. Skylark providers (declared and legacy) benefit from the same shape-sharing optimization as native providers. RELNOTES: None. PiperOrigin-RevId: 160944263
* Fix RuleContext documentation typo.Gravatar gregce2017-06-27
| | | | PiperOrigin-RevId: 160191135
* Revamp JavaToolchain:Gravatar lberki2017-06-16
| | | | | | | | | | | | - Rely on existing infrastructure to verify that attributes only contain a single artifact and that mandatory attributes are specified - Add single artifact modifiers to attributes that need them - Remove "final" modifiers from method variables (we don't use them in Blaze) - Replace deprecated #add() with #addProvider() Since this relies on existing infrastructure, I thought adding tests is redundant. I did test it manually, though, to be extra safe by testing what happens if these attributes contain an empty filegroup or a filegroup with multiple artifacts in it. RELNOTES: None. PiperOrigin-RevId: 158975017
* BEP: report visibility errorsGravatar Klaus Aehlig2017-06-01
| | | | | | | | On finding a visibility error, report it directly for that target, instead of relying on the implict "abort" message for targets that have not been built. Change-Id: I5e45722a1117afca3bc8eeebd05179425b995172 PiperOrigin-RevId: 157592518