aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages
Commit message (Collapse)AuthorAge
* Automated g4 rollback of commit 1d9e1ac90197b1d3d7b137ba3c1ada67bb9ba31b.Gravatar hlopko2017-04-04
| | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks //src/test/shell/integration:force_delete_output_test *** Original change description *** Symlink output directories to the correct directory name If the workspace directory is /path/to/my/proj and the name in the WORKSPACE file is "floop", this will symlink the output directories to output_base/execroot/floop instead of output_base/execroot/proj. More prep for #1262, fixes #1681. PiperOrigin-RevId: 152126545
* Add isConfigMatcher property to rule classes.Gravatar mstaib2017-04-03
| | | | | | | | | | | | | | BuildConfiguration currently depends directly on the name of a rule class to see if it is config_setting. This creates a circular dependency between ConfigSetting and BuildConfiguration. As ConfigSetting is being moved to rules/config, this circular dependency will no longer work. This replaces the name special case for a special property of the rule class, which only config_setting should set. RELNOTES: None. PiperOrigin-RevId: 151871084
* Use ImmutableList.Builder and ImmutableListMultimap.Builder to create the ↵Gravatar shreyax2017-03-31
| | | | | | | | outputFiles and outputFileMap objects in Rule. RELNOTES: None. PiperOrigin-RevId: 151764143
* Improve glob prefetching performance by providing a more realistic environment.Gravatar laurentlb2017-03-31
| | | | | | | | | | | | That means the prefetching execution is more similar to the real execution, it will fetch more globs and throw less exceptions. In the code path, one exception was thrown for almost each statement. With this change, many BUILD files can be evaluated without an exception. RELNOTES: None. PiperOrigin-RevId: 151740684
* Delete STRING_DICT_UNARYGravatar michajlo2017-03-31
| | | | | | | This isn't used anymore, it's the same as STRING_DICT, deleting so no one tries to use it. PiperOrigin-RevId: 151738915
* Symlink output directories to the correct directory nameGravatar kchodorow2017-03-31
| | | | | | | | | | If the workspace directory is /path/to/my/proj and the name in the WORKSPACE file is "floop", this will symlink the output directories to output_base/execroot/floop instead of output_base/execroot/proj. More prep for #1262, fixes #1681. PiperOrigin-RevId: 151712384
* introduce hidden flag to configure bytecode optimizersGravatar Kevin Bierhoff2017-03-27
| | | | | | -- PiperOrigin-RevId: 151170448 MOS_MIGRATED_REVID=151170448
* Show more sensible error messages for invalid placeholders Gravatar Pranjal Agrawal2017-03-23
| | | | | | | | | | | | | | | | (like %{invalid}) in implicit outputs. SkylarkImplicitOutputsFunctionWithMap.calculateOutputs now throws an EvalException in case of invalid placeholders in com.google. \ devtools.build.lib.packages.ImplicitOutputsFucntion. Fix #2467 on Github -- Change-Id: I5460388d0b3f83390aed4c45c967c633c2574e3b Reviewed-on: https://cr.bazel.build/9490 PiperOrigin-RevId: 150907001 MOS_MIGRATED_REVID=150907001
* Clarifies some javadoc in Rule and AttributeContainer.Gravatar Alex Humesky2017-03-21
| | | | | | -- PiperOrigin-RevId: 150675067 MOS_MIGRATED_REVID=150675067
* Enable rules to transition based on their Rule objects.Gravatar Michael Staib2017-03-21
| | | | | | | | | | | | This begins to allow for cases where a rule sets configuration based on its attributes, such as where a rule attribute names flags and their values - sort of a reverse select. There are no such cases yet, but they're coming! -- PiperOrigin-RevId: 150648357 MOS_MIGRATED_REVID=150648357
* Simplify Attribute.Configurator, add dynamic configs support.Gravatar Greg Estren2017-03-14
| | | | | | | | | | | | | | Specifically: 1) Read BuildOptions instead of BuildConfiguration 2) Remove unused extra parameters 1) is especially useful for dynamic configs. Before this change, dynamic configs just didn't support attribute configurators. This is because support would require Skyframe-instantiating temporary intermediate configurations, which is horribly awkward and would massively complicate Bazel's dependency evaluation logic. Using BuildOptions instead of BuildConfiguration completely eliminates the problem. As a bonus, dynamic configs can compose attribute configurators with any other transitions (including splits). This actually makes them more powerful than static configs. Whether anyone wants to use that composition is a different story, but that's now a policy decision vs. a technical limitation. This should also come in handy for RuleClass configurators, which will likely also leverage this. -- PiperOrigin-RevId: 150080977 MOS_MIGRATED_REVID=150080977
* Global cleanup change.Gravatar Googler2017-03-14
| | | | | | -- PiperOrigin-RevId: 150051360 MOS_MIGRATED_REVID=150051360
* Allow declared providers in attribute and aspect defintions.Gravatar Dmitry Lomov2017-03-06
| | | | | | -- PiperOrigin-RevId: 149169656 MOS_MIGRATED_REVID=149169656
* Support declared providers in AdvertisedProviderSet.Gravatar Dmitry Lomov2017-03-06
| | | | | | -- PiperOrigin-RevId: 149165836 MOS_MIGRATED_REVID=149165836
* Refactor implementation of native and Skylark declared providers.Gravatar Dmitry Lomov2017-03-03
| | | | | | | | | | | | 1) Instead of having a single class for both, split them into {Skylark,Native}ClassObjectConstructors 2) Allow NativeClassObjectConstructors to customize their instantiation logic. 3) Prepare ClassObjectConstructor.Key to be serializable. -- PiperOrigin-RevId: 148997553 MOS_MIGRATED_REVID=148997553
* Handle TriState type in `bazel query --output=build`Gravatar Laurent Le Brun2017-02-27
| | | | | | -- PiperOrigin-RevId: 148643993 MOS_MIGRATED_REVID=148643993
* Provide more reporting options to SkyFunctions Gravatar Klaus Aehlig2017-02-27
| | | | | | | | | | | | | With more specific information to be reported by Skyfunctions, e.g., to inform the build-event protocol on missing files, the EventHandler interface is no longer enough. Therefore, provide an enriched context for reporting events. -- Change-Id: I2d06166fe4d5b9054e24ad8c752fafc039e3f9f8 Reviewed-on: https://cr.bazel.build/8794 PiperOrigin-RevId: 148463437 MOS_MIGRATED_REVID=148463437
* Fix Cpp action cachingGravatar Ulf Adams2017-02-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This combines both previous changes and extends them to work both with and without kchodorow@'s rollout of the exec root rearrangement. Unfortunately, each of these changes individually breaks something somewhere, so they must all go into a single commit. Change 1: CppCompileAction must return false from inputsKnown for .d pruning This is necessary (but not sufficient) for the action cache to work correctly. Consider the following sequence of events: 1. action is executed 2. .d pruning is performed 3. action cache writes entry with post-pruning inputs list 4. action gets regenerated (e.g., due to server restart) 5. the action cache calls inputsKnown(), which returns true 6. action cache checks entry from step 3 against pre-pruning inputs list, which results in a cache miss The action cache needs to know that the current list is not the final list, so inputsKnown() in step 5 must return false if .d pruning is enabled. Change 2: Fix artifact root discovery for external artifacts The SkyframeExecutor was assuming that all exec paths were coming from the main repository. Instead, rely on external exec paths to start with "../". Additional change 3: In addition, update the PackageRootResolverWithEnvironment and the HeaderDiscovery to use the single unified repository name guessing implementation. Previously, the PackageRootResolverWithEnvironment was poisoning the source artifact cache, which then caused subsequent lookups to return a bad artifact. Add a precondition to double-check that artifacts looked up by exec path have the correct source root. For compatibility with kchodorow@'s upcoming exec root refactor, if the exec path starts with "external", then assume it's coming from an external repository. This must be removed when that change is successfully rolled out, or it will break if anyone creates a package called 'external'. Additional change 4: On top of all of that, PackageRootResolverWithEnvironment and SkyframeExecutor must use the same source root computation as the Package class itself. I extracted the corresponding code to Root, and added comments both there and in Package to clearly indicate that these methods have to always be modified in sync. Fixes #2490. -- PiperOrigin-RevId: 148439309 MOS_MIGRATED_REVID=148439309
* Add the LABEL_KEYED_STRING_DICT type for attributes.Gravatar Michael Staib2017-02-24
| | | | | | | | | This enables both native and Skylark rules to declare attributes which have labels/Targets as keys, and have string values. -- PiperOrigin-RevId: 148365033 MOS_MIGRATED_REVID=148365033
* Add detailed rule class/label info when report attribute checking error Gravatar Liangliang He2017-02-22
| | | | | | | | | | | This PR addresses comment by @gregestren in https://github.com/bazelbuild/bazel/pull/2531 Closes #2546. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/2546 PiperOrigin-RevId: 148201730 MOS_MIGRATED_REVID=148201730
* Remove Skylark documentation text from Target.class.Gravatar Florian Weikert2017-02-22
| | | | | | | | In Skylark, "Target" refers to TransitiveInfoCollection.class, which contains the real documentation string. -- PiperOrigin-RevId: 148132811 MOS_MIGRATED_REVID=148132811
* 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
* Fix NPE in NonconfigurableAttributeMapper Gravatar Liangliang He2017-02-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR fixes: https://github.com/bazelbuild/bazel/issues/2036 to provide more error message Explanation why this works: see PR comment thread starting here: https://github.com/bazelbuild/bazel/pull/2531#issuecomment-280573712 without the fix: ``` java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURED_TARGET:@grpc//:grpc++_config_proto 05cc524e2c4b9309660fb7daa4e35db9 (1333167441 455593757)' (requested by nodes 'CONFIGURED_TARGET:@grpc//:grpc_plugin_support 05cc524e2c4b9309660fb7daa4e35db9 (136418248 455593757)') at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:429) at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:501) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper.get(NonconfigurableAttributeMapper.java:45) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.isTestOnlyRule(BazelRuleClassProvider.java:268) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validateDirectPrerequisiteForTestOnly(BazelRuleClassProvider.java:254) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validate(BazelRuleClassProvider.java:190) at com.google.devtools.build.lib.analysis.RuleContext$Builder.validateDirectPrerequisite(RuleContext.java:1937) at com.google.devtools.build.lib.analysis.RuleContext$Builder.createTargetMap(RuleContext.java:1610) at com.google.devtools.build.lib.analysis.RuleContext$Builder.build(RuleContext.java:1449) at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:241) at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:171) at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:491) at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:1024) at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:249) at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:370) ... 4 more java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURED_TARGET:@grpc//:grpc++_config_proto 05cc524e2c4b9309660fb7daa4e35db9 (1333167441 455593757)' (requested by nodes 'CONFIGURED_TARGET:@grpc//:grpc_plugin_support 05cc524e2c4b9309660fb7daa4e35db9 (136418248 455593757)') at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:429) at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:501) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper.get(NonconfigurableAttributeMapper.java:45) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.isTestOnlyRule(BazelRuleClassProvider.java:268) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validateDirectPrerequisiteForTestOnly(BazelRuleClassProvider.java:254) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validate(BazelRuleClassProvider.java:190) at com.google.devtools.build.lib.analysis.RuleContext$Builder.validateDirectPrerequisite(RuleContext.java:1937) at com.google.devtools.build.lib.analysis.RuleContext$Builder.createTargetMap(RuleContext.java:1610) at com.google.devtools.build.lib.analysis.RuleContext$Builder.build(RuleContext.java:1449) at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:241) at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:171) at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:491) at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:1024) at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:249) at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:370) ... 4 more ``` with this fix: ``` java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURED_TARGET:@grpc//:grpc++_config_proto 26809c5247f58eb7a6314bd0e13655a1 (1551360347 275342100)' (requested by nodes 'CONFIGURED_TARGET:@grpc//:grpc_plugin_support 26809c5247f58eb7a6314bd0e13655a1 (859246773 275342100)') at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:438) at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:501) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalArgumentException: No such attribute testonly in rule protobuf_archive at com.google.devtools.build.lib.packages.AbstractAttributeMapper.getIndexWithTypeCheck(AbstractAttributeMapper.java:228) at com.google.devtools.build.lib.packages.AbstractAttributeMapper.get(AbstractAttributeMapper.java:57) at com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper.get(NonconfigurableAttributeMapper.java:45) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.isTestOnlyRule(BazelRuleClassProvider.java:266) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validateDirectPrerequisiteForTestOnly(BazelRuleClassProvider.java:252) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validate(BazelRuleClassProvider.java:196) at com.google.devtools.build.lib.analysis.RuleContext$Builder.validateDirectPrerequisite(RuleContext.java:1954) at com.google.devtools.build.lib.analysis.RuleContext$Builder.createTargetMap(RuleContext.java:1626) at com.google.devtools.build.lib.analysis.RuleContext$Builder.build(RuleContext.java:1465) at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:245) at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:176) at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:491) at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:1094) at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:251) at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:373) ... 4 more java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURED_TARGET:@grpc//:grpc++_config_proto 26809c5247f58eb7a6314bd0e13655a1 (1551360347 275342100)' (requested by nodes 'CONFIGURED_TARGET:@grpc//:grpc_plugin_support 26809c5247f58eb7a6314bd0e13655a1 (859246773 275342100)') at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:438) at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:501) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalArgumentException: No such attribute testonly in rule protobuf_archive at com.google.devtools.build.lib.packages.AbstractAttributeMapper.getIndexWithTypeCheck(AbstractAttributeMapper.java:228) at com.google.devtools.build.lib.packages.AbstractAttributeMapper.get(AbstractAttributeMapper.java:57) at com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper.get(NonconfigurableAttributeMapper.java:45) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.isTestOnlyRule(BazelRuleClassProvider.java:266) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validateDirectPrerequisiteForTestOnly(BazelRuleClassProvider.java:252) at com.google.devtools.build.lib.bazel.rules.BazelRuleClassProvider$BazelPrerequisiteValidator.validate(BazelRuleClassProvider.java:196) at com.google.devtools.build.lib.analysis.RuleContext$Builder.validateDirectPrerequisite(RuleContext.java:1954) at com.google.devtools.build.lib.analysis.RuleContext$Builder.createTargetMap(RuleContext.java:1626) at com.google.devtools.build.lib.analysis.RuleContext$Builder.build(RuleContext.java:1465) at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:245) at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:176) at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:491) at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:1094) at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:251) at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:373) ... 4 more ``` Closes #2531. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/2531 PiperOrigin-RevId: 147814996 MOS_MIGRATED_REVID=147814996
* 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
* Make RuleClass non-final for testing.Gravatar Janak Ramakrishnan2017-02-16
| | | | | | -- PiperOrigin-RevId: 147656856 MOS_MIGRATED_REVID=147656856
* Remove special-casing of the 'native' module.Gravatar Laurent Le Brun2017-02-15
| | | | | | | | | It should show up in the documentation in the same way as 'attr', another builtin module. -- PiperOrigin-RevId: 147589912 MOS_MIGRATED_REVID=147589912
* Restrict aspects visible to other aspects according to their advertised ↵Gravatar Dmitry Lomov2017-02-15
| | | | | | | | providers. -- PiperOrigin-RevId: 147526961 MOS_MIGRATED_REVID=147526961
* Remove type checking requirement from AttributeMap.has.Gravatar Greg Estren2017-02-15
| | | | | | | | | | | | | | This overrides the traditional has(String name, Type<>T> type) with has(String name) and removes the type check outright from isConfigurable. Ideally we'd remove the old version in this same change. But there are enough uses of it that that's not a risk-free change and is safer as followup changes. -- PiperOrigin-RevId: 147513593 MOS_MIGRATED_REVID=147513593
* Refactoring: Types report what class of labels they contain.Gravatar Michael Staib2017-02-14
| | | | | | | | | | | | | | | | | | | | | Currently label-type attributes are detected in many places across the codebase by simply reference-comparing against each of the label types. This CL aims to generalize most of these cases, moving the encoding of this logic into a single place (Type/BuildType itself). Not all of these cases can be made general without further refactoring, and some perhaps shouldn't be - serialization and Skylark rule context, for example, need to do exotic things based on the type. But most sites can avoid having to enumerate all the types they work with explicitly. This causes LABEL_DICT_UNARY to start being treated like the other label types, which means that CcToolchainSuiteRule and JavaRuntimeSuiteRule need to include a set of allowed file types (none, in their case). Skylark will continue treating it as a dictionary from String to Label in its rule context, however, to avoid visible behavior changes. -- PiperOrigin-RevId: 147471542 MOS_MIGRATED_REVID=147471542
* Remove special handling of name attribute. Fixes #278Gravatar Googler2017-02-14
| | | | | | | | | | | | | | | | | | | | | | | | | The name attribute gets special treatment in the codebase, in that it's not simply yet another attribute but stored in it's own field. Thus, every callside dealing with attributes needs to be aware of this special case and explicitly handle the name attribute. It's easy to see that this can lead to bugs. For example, querying for the name attribute is currently broken due the querying code not being aware of the special case [1]. Discussions with experienced bazel developers came to the conclusion that there is no need (anymore) to treat the name attribute specially and thus we decided it's best to remove the special treatment and handle the name attribute as any other attribute. This change removes the handling of name attributes and also adds a test case to verify that bug [1] is fixed. [1] https://github.com/bazelbuild/bazel/issues/278 -- PiperOrigin-RevId: 147446345 MOS_MIGRATED_REVID=147446345
* Rollback of commit cdbad585187dfe7bbb4d69ad68a1baf852beb691.Gravatar Michael Staib2017-02-14
| | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks Skylark aspects running over rules with LABEL_DICT_UNARY attributes. *** Original change description *** Refactoring: Types report what class of labels they contain. Currently label-type attributes are detected in many places across the codebase by simply reference-comparing against each of the label types. This CL aims to generalize most of these cases, moving the encoding of this logic into a single place (Type/BuildType itself). Not all of these cases can be made general without further refactoring, and some perhaps shouldn't be - serialization and Skylark rule context, for example, need to do... -- PiperOrigin-RevId: 147385072 MOS_MIGRATED_REVID=147385072
* Add an algorithm to reduce aspect paths according to aspects' visibility to ↵Gravatar Dmitry Lomov2017-02-14
| | | | | | | | | | | | each other. Aspects negotiate their visibility by advertizing and requiring providers. The algorithm is not used yet (that is future work). -- PiperOrigin-RevId: 147354682 MOS_MIGRATED_REVID=147354682
* Allow Skylark aspects to advertise providers.Gravatar Dmitry Lomov2017-02-14
| | | | | | -- PiperOrigin-RevId: 147350507 MOS_MIGRATED_REVID=147350507
* Refactoring: Types report what class of labels they contain.Gravatar Michael Staib2017-02-13
| | | | | | | | | | | | | | | | | | | Currently label-type attributes are detected in many places across the codebase by simply reference-comparing against each of the label types. This CL aims to generalize most of these cases, moving the encoding of this logic into a single place (Type/BuildType itself). Not all of these cases can be made general without further refactoring, and some perhaps shouldn't be - serialization and Skylark rule context, for example, need to do exotic things based on the type. But most sites can avoid having to enumerate all the types they work with explicitly. This causes LABEL_DICT_UNARY to start being treated like the other label types, which means that CcToolchainSuiteRule and JavaRuntimeSuiteRule need to include a set of allowed file types (none, in their case). -- PiperOrigin-RevId: 147175424 MOS_MIGRATED_REVID=147175424
* Introduce a new SkyValue that merely contains the workspace name. The ↵Gravatar Nathan Harmata2017-02-09
| | | | | | | | | | | | workspace name is needed for package loading, and so splitting out this computation into a separate skyframe node that can be change-pruned gives us better incrementality; previously we'd need to reload all packages on a WORKSPACE file change. N.B. (i) This CL doesn't solve all the other performance issues with //external in Bazel/Blaze since it's still inefficiently used for resolving labels like @foo//bar:baz. (ii) This CL doesn't address the wasteful invalidation + change pruning of all the packages. -- PiperOrigin-RevId: 146925369 MOS_MIGRATED_REVID=146925369
* Allow aspects to adveritise providers they provide.Gravatar Dmitry Lomov2017-02-07
| | | | | | -- PiperOrigin-RevId: 146794883 MOS_MIGRATED_REVID=146794883
* allow skylark implicit output callbacks to use the rule name Gravatar Benjamin Peterson2017-02-01
| | | | | | | | | | | | | | | | | Skylark implicit output callbacks could use any nonconfigurable attribute of the rule except for "name". (As an implementation detail, "name" is easy to overlook because it's a special case in rule attribute map.) In practice, this isn't too much of a problem because the return value of a skylark implicit output callback has %{} substitutions applied to it, which do allow the rule name. However, it is weird and inconsistent to prevent implicit output callbacks from using the name. -- Change-Id: I13149b2e9689ef8b8056c612a29df9da32e39bf3 Reviewed-on: https://cr.bazel.build/8251 PiperOrigin-RevId: 146178693 MOS_MIGRATED_REVID=146178693
* Fix the translation of names of implicit or latebound attributes to their ↵Gravatar Florian Weikert2017-01-30
| | | | | | | | | | Skylark equivalent (from '$attr' and ':attr' to '_attr'). This CL eliminates duplicate code and makes sure that attribute names in SkylarkClassObjects are properly translated. -- PiperOrigin-RevId: 145986380 MOS_MIGRATED_REVID=145986380
* Global cleanup change.Gravatar Googler2017-01-25
| | | | | | -- PiperOrigin-RevId: 145473478 MOS_MIGRATED_REVID=145473478
* Remove the ability for an aspect to propagate a different aspect.Gravatar Dmitry Lomov2017-01-20
| | | | | | | | | This functionality is never used, have never been exposed to Skylark and is a continuous pain to maintain and test. -- PiperOrigin-RevId: 145079832 MOS_MIGRATED_REVID=145079832
* Add ability to specify required aspect providers for aspects.Gravatar Dmitry Lomov2017-01-17
| | | | | | | | It is just a specification yet, it does nothing. -- PiperOrigin-RevId: 144687428 MOS_MIGRATED_REVID=144687428
* Roll forward of commit 5c071429e83b5c6d872c755d3da21ad934638111Gravatar Kristina Chodorow2017-01-13
| | | | | | | | Fixes #1248. -- PiperOrigin-RevId: 144333530 MOS_MIGRATED_REVID=144333530
* Allows a rule class to specify a configuration transtion that will apply to allGravatar Cal Peyser2017-01-12
| | | | | | | | | | incoming edges if dynamic configurations are turned on. This CL does not cover top-level nodes. -- PiperOrigin-RevId: 144258789 MOS_MIGRATED_REVID=144258789
* Add new flag to specify if output_licenses attribute should be checked for ↵Gravatar Irina Iancu2017-01-10
| | | | | | | | | | licenses. Also flipped :jvm attribute from HOST to TARGET and set the new flag on it. -- PiperOrigin-RevId: 144084000 MOS_MIGRATED_REVID=144084000
* Deprecated and removed HOST_CFG and DATA_CFG global variables.Gravatar Vladimir Moskva2017-01-10
| | | | | | | | RELNOTES[INC]: Deprecated globals HOST_CFG and DATA_CFG are removed. Use strings "host" and "data" instead. -- PiperOrigin-RevId: 144069794 MOS_MIGRATED_REVID=144069794
* Encapsulate the required provider logic in RequiredProviders class.Gravatar Dmitry Lomov2017-01-10
| | | | | | | | | For now, only for aspects, but eventually expand to Attribute's mandatory providers as well. -- PiperOrigin-RevId: 144063369 MOS_MIGRATED_REVID=144063369
* Extract a set of advertised providers into a separate class.Gravatar Dmitry Lomov2017-01-10
| | | | | | -- PiperOrigin-RevId: 143991903 MOS_MIGRATED_REVID=143991903
* Minor improvements to error messages.Gravatar Laurent Le Brun2017-01-04
| | | | | | | | In case of conflict, show the location of the original rule. -- PiperOrigin-RevId: 143541281 MOS_MIGRATED_REVID=143541281
* Manually add periods to documentation strings where needed.Gravatar John Cater2017-01-03
| | | | | | | | -- Change-Id: I9ec3209a69ba5a51943b334f278ba93d67d4f9f4 Reviewed-on: https://cr.bazel.build/8090 PiperOrigin-RevId: 143470915 MOS_MIGRATED_REVID=143470915
* Add 'did you mean' suggestion when accessing a struct fieldGravatar Laurent Le Brun2017-01-03
| | | | | | -- PiperOrigin-RevId: 143380643 MOS_MIGRATED_REVID=143380643