aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
Commit message (Collapse)AuthorAge
* 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
* Factor out BuildConfigurationCollection.Transitions.getDynamicTransition.Gravatar gregce2017-07-07
| | | | | | | | | | | | This is a legacy dependency on the configuration transition table, which is only needed for static configurations. Dynamic configurations didn't actually use anything in that table: this was just a convenience interface that could have equally been defined somewhere else. So this cl defines it somewhere else. There's still one last dependency: Transitions.configurationHook. We'll tackle that in a followup cl. PiperOrigin-RevId: 161141650
* 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
* Add coverage support for java test.Gravatar Yue Gan2016-12-07
| | | | | | | | (series 4/4 of open-sourcing coverage command for java test) -- PiperOrigin-RevId: 141292977 MOS_MIGRATED_REVID=141292977
* Move constraint enforcement policy into attribute definitions.Gravatar Greg Estren2016-12-02
| | | | | | | | | This makes is easier to understand and change which attributes are checked. Also turn off checking for "data" and java_* "resources" attributes. -- MOS_MIGRATED_REVID=140771015
* Merge BazelBaseRuleClasses into BaseRuleClasses.Gravatar Ulf Adams2016-10-14
| | | | | | | There doesn't seem to be any reason to keep them separate. -- MOS_MIGRATED_REVID=136145734
* Proper error messages when built-in rule attributes are overridden #1811Gravatar Vladimir Moskva2016-10-05
| | | | | -- MOS_MIGRATED_REVID=135241715
* Rollback of commit 3c0d64886d2f7f6b2015780f1628b1391c320d0f.Gravatar Carmi Grushko2016-10-04
| | | | | | | | | | | | | *** Reason for rollback *** Blaze with this CL breaks ~all targets: "There is already a built-in attribute 'name' which cannot be overridden." *** Original change description *** Proper error messages when built-in rule attributes are overridden #1811 -- MOS_MIGRATED_REVID=134857179
* Proper error messages when built-in rule attributes are overridden #1811Gravatar Vladimir Moskva2016-10-04
| | | | | -- MOS_MIGRATED_REVID=134823021
* Make test "args" attribute configurable.Gravatar Greg Estren2016-08-19
| | | | | | | | A valid argument has been made for opening it up, and it's not clear it's helping anyone by locking it down. -- MOS_MIGRATED_REVID=130686109
* 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
* Make compatible_with / restricted_to nonconfigurable.Gravatar Greg Estren2016-05-03
| | | | | | | | | | | | | | | | As of 18c277f, we have special logic for mixing selects and constraints. With that logic, a multiplaform libray declares all environments it supports across all select paths, then each path supports some subset of those environments. With this approach, there's no need for compatible_with = select(). So we'd like to disallow that pattern (and all its downsides) in preference for what 18c277f allows. -- MOS_MIGRATED_REVID=121294433
* Rename LateBoundLabel#getDefault(Rule, AttributeMap, T) to #resolve().Gravatar Lukacs Berki2016-04-19
| | | | | | | Its old name was confusing because resolve() and getDefault() do radically different things: getDefault() returns a good enough lie for when BuildConfiguration is not available, and resolve() resolves the dependency when we do have a BuildConfiguration. -- MOS_MIGRATED_REVID=120212630
* Add placeholder documentation for Bazel's constraint system -Gravatar Greg Estren2016-03-08
| | | | | | | fully implemented but still being guinea pigged. -- MOS_MIGRATED_REVID=116694206
* Implement TODO from: ↵Gravatar Greg Estren2016-02-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/bazelbuild/bazel/blo[]fbbd6a32b95ba746f09dae1eaeaccf675cd5b3/src/main/java/com/google/devtools/build/lib/packages/Attribute.java#L1045 This allows the default value computation for latebound attributes to consider the values of configurable attributes. This is most directly useful for user-definable Skylark defaults, which have full access to the values of all non-latebound attributes. Without this change, this kind of scenario crashes Bazel. For example: ------------------ select_rules.bzl: ------------------ def _impl(ctx): ctx.file_action( output=ctx.outputs.out_file, content=ctx.attr.string_value, ) return struct() # Bug does not manifest without using this as a default. def _derived_value(attrs, _): return Label("//some:dep") selector_rule = rule( implementation=_impl, attrs={ "string_value": attr.string(default=""), "out_file": attr.output(), "_derived": attr.label(default=_derived_value), }, output_to_genfiles=True, ) def selector_macro(name, out_file="", string_value=""): # This will fail with selectors. selector_rule( name="%s_skylark" % name, string_value=string_value, out_file=out_file + ".skylark", ) # This does not. native.genrule( name="%s_genrule" % name, cmd="echo '" + string_value + "' > $@", outs=[out_file + ".genrule"], ) native.filegroup( name=name, srcs=[":%s_genrule" % name, "%s_skylark" % name], ) ------------------ BUILD.bzl: ------------------ config_setting( name = "selector", values = {"compilation_mode": "opt"}, ) selector_macro( name = "this_rule", string_value = """soup? """ + select({ ":selector": "no, thank you.", "//conditions:default": "yes, please!!", }), out_file = "this_rule.txt", ) -- MOS_MIGRATED_REVID=114326474
* Make generator_function, generator_name nonconfigurable -Gravatar Greg Estren2016-02-09
| | | | | | | they're part of the static structure of a rule. -- MOS_MIGRATED_REVID=114141259
* Replace getToolsRepository() with getToolsLabel(String labelValue) which ↵Gravatar Luis Fernando Pino Duque2016-02-09
| | | | | | | | | prepends the tools repository path to the given string and parses the result as a label. This is a cleaner way to access the tools repository label. -- MOS_MIGRATED_REVID=114105929
* Replace occurrences of Constants.TOOLS_REPOSITORY in places where it can be ↵Gravatar Luis Fernando Pino Duque2016-02-03
| | | | | | | | | referenced via the rule class provider (using the RuleDefinitionEnvironment). This is the second phase of the removal of the TOOLS_REPOSITORY constants. -- MOS_MIGRATED_REVID=113734334
* Emit extra-actions for actions registered by Aspects.Gravatar Carmi Grushko2015-11-17
| | | | | | | A prerequisite is to pass RuleContext to ConfiguredAspect, so we can read from it the registered actions when we build() the aspect. -- MOS_MIGRATED_REVID=107997593
* Rules created by Skylark Macros now store the workspace-relative path of the ↵Gravatar Florian Weikert2015-10-07
| | | | | | | respective macro in the attribute "generator_location". -- MOS_MIGRATED_REVID=104757928
* Partially revert []: move the tools/defaults package back to the main ↵Gravatar Lukacs Berki2015-10-07
| | | | | | | | | repository. This is necessary because we copy labels from the command line into tools/defaults/BUILD and currently there is no syntax to make a label in a remote repository refer to one in the main repository. -- MOS_MIGRATED_REVID=104755206
* Add a Constants.TOOLS_PREFIX constant that will serve to redirect the Bazel ↵Gravatar Lukacs Berki2015-10-05
| | | | | | | | | | | tools repository. This is a no-op refactoring CL. The actual switch will be made once everything passes with the new setup. As a side cleanup, change the awkward realAndroidSdk() / realAndroidCrosstoolTop() mechanism to a converter. -- MOS_MIGRATED_REVID=104649067
* 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
* Change Attribute.skipConstraintsCheck() (and similar methods)Gravatar Greg Estren2015-09-25
| | | | | | | | | | | | | to Attribute.skipPrereqValidatorCheck. This is to disambiguate the concept of "constraints" and keep the word consciously focused on Bazel's *new* constraint system. The changed methods refer to checks done by PrerequisiteValidator, which is basically an adhoc version of the "old" system (e.g. checking visibility) -- MOS_MIGRATED_REVID=103872412
* 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
* Separate build-specific types and types inherent to Skylark.Gravatar Lukacs Berki2015-09-21
| | | | | -- MOS_MIGRATED_REVID=103374106
* Removed attribute 'generator_location' from rules created by Skylark macros.Gravatar Florian Weikert2015-09-15
| | | | | -- MOS_MIGRATED_REVID=103090380
* Skip the constraints check for :run_under.Gravatar Ulf Adams2015-09-14
| | | | | | | | It's an implementation artifact that we declare this as a late bound dependency, and having checks here doesn't make a lot of sense. -- MOS_MIGRATED_REVID=102976439
* Rules created by Skylark macros now have values for the attributes ↵Gravatar Florian Weikert2015-08-26
| | | | | | | | | generator_name and generator_function. Additionally, both Skylark macros and build extensions set the attribute generator_location in order to store the name of the file where generator_function was defined. -- MOS_MIGRATED_REVID=101458757
* Support coverage in experimental_ios_test.Gravatar Peter Schmitt2015-07-29
| | | | | | | | | | | Coverage depends on quite a few moving parts, several of which were changed for this test: - BuildConfiguration.getCoverageLabels() used to include gcov support, this is now replaced by the dedicated getGcovLabels() and a separate implicit attribute on TestBaseRule. This new attribute is then overridden in ExperimentalIosTest to use an xcode-compatible gcov. - Objc's TestSupport now correctly registers instrumented files and sets the necessary runfiles for collecting coverage. - ios_test's template exports gcda files for coverage computation after the test's execution. -- MOS_MIGRATED_REVID=99374435
* Define ":action_listener" attribute for Skylark rules.Gravatar Laurent Le Brun2015-07-13
| | | | | | | The enables the use of extra actions with Skylark rules. -- MOS_MIGRATED_REVID=98115878
* Implements an attribute 'features' that allows overriding package levelGravatar Manuel Klimek2015-04-30
| | | | | | | | | | | | | | | | | | | | | | | | features. Features on the rule level modify features that are enabled at the package level. Note that this behavior is different from how the current command line / package level interaction is, but we probably want to change the command line behavior. Alternative implementations considered: a) using package-level features as default value for the rule attribute; this would make it hard for future transitions; adding a completely new feature to a package should not require updating all rules that have overrides b) putting all positive features and all negative features from command-line, package, and rule attribute into a positive and negative set, and subtract the negative from the positive set; this is how the command-line features worked previously, but it makes it impossible to enable a features that is disabled at the package level just for one rule. RELNOTES: Add 'features' attribute on the rule level. -- MOS_MIGRATED_REVID=92448449
* Replace @BlazeRule with a getMetadata() method. This lets us avoid Java ↵Gravatar Googler2015-03-20
| | | | | | | | | | | | | | | | | Reflection, and saves ~15% of initialization time in []RuleClassProvider.create(). Before change: Over 14 samples, average = 976 median = 969.9 After change: Over 14 samples, average = 811.5 median = 813.9 -- MOS_MIGRATED_REVID=89036261
* Remove "obsolete" and "default_obsolete" from the BUILD language.Gravatar Greg Estren2015-03-18
| | | | | | | | Anyone who needs this kind of functionality in the future can redefine it through user-defined constraints. -- MOS_MIGRATED_REVID=88871811
* Update from Google.Gravatar Han-Wen Nienhuys2015-02-25
-- MOE_MIGRATED_REVID=85702957