aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/constraints
Commit message (Collapse)AuthorAge
* Rephrase AbstractAttributeMapper#visitLabels such that we can avoid creating ↵Gravatar nharmata2017-04-05
| | | | | | | | a temporary Type.LabelVisitor instance per Attribute being visited. Instead, we can now create one temporary object per visitation. Getting rid of this dimension of scaling reduces the amount of garbage created. RELNOTES: None PiperOrigin-RevId: 152161836
* 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
* 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
* 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
* Fix an obscure crash scenario with static configs and BuildConfiguration.equals.Gravatar Greg Estren2017-01-04
| | | | | | | | | | See OutputFileConfiguredTargetTest for deep details. Also more strongly enforce the expectation that all output files have generating rules. -- PiperOrigin-RevId: 143570028 MOS_MIGRATED_REVID=143570028
* Skip constraint checking on generated sources with null generating rules.Gravatar Greg Estren2016-12-07
| | | | | | | | | | Null generating rules shouldn't actually happen. That's its own bug that needs its own attention. This change is just a workaround to prevent NullPointerExceptions when the bug hits. -- PiperOrigin-RevId: 141329624 MOS_MIGRATED_REVID=141329624
* 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
* Provide clearer messaging when a build fails because a rule'sGravatar Greg Estren2016-06-27
| | | | | | | | | | | | | | | | | | supported environments get refined away by incompatible select paths. This is a fix of TODO: https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/analysis/constraints/ConstraintSemantics.java#L597 Old message: ERROR: /workspace/foo/BUILD:3:1: in cc_binary rule //foo:main: all environments have been refined out of the following groups: //buildenv:environment_group New message: ERROR: /workspace/foo/BUILD:3:1: in cc_binary rule //foo:main: the current command-line flags disqualify all supported environments because of incompatible select() paths: environment: //buildenv:gce removed by: //util/lib:some_dep_with_select (/workspace/util/lib/BUILD:12:1) -- MOS_MIGRATED_REVID=125788804
* Allow use of Exceptions to exit early out of configured-target creation, ↵Gravatar Chris Parsons2016-05-24
| | | | | | | | | | instead of passing and checking null in all helpers. Demonstrates this pattern usage in a few select rules (e.g. AndroidBinary) where this was particularly egregious. There are many places which can benefit from this pattern -- this change doesn't try to fix them all at once. -- MOS_MIGRATED_REVID=123012378
* Remove LABEL_LIST_DICT type. This was only used for abi_deps,Gravatar Greg Estren2016-05-11
| | | | | | | which was removed in c231574. -- MOS_MIGRATED_REVID=121974686
* Use ConstraintSemantics.getSupportedEnvironments() in ↵Gravatar Liam Miller-Cushon2016-05-02
| | | | | | | supportsJava7TargetEnvironment -- MOS_MIGRATED_REVID=121150741
* Make ConstraintSemantics.java compile again with all supported JDKs.Gravatar Lukacs Berki2016-04-22
| | | | | -- MOS_MIGRATED_REVID=120540937
* Remove FileProvider.label.Gravatar Ulf Adams2016-04-22
| | | | | -- MOS_MIGRATED_REVID=120539626
* Make constraints and select() work well with each other.Gravatar Greg Estren2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements most of a design proposal that splits constraint checking into two pieces: *static* checks, which apply the standard constraint checking done today, and *refined* checks, which selectively prune environments based on select paths and check that not every environment gets pruned out. As a result of this change, dependencies like: java_library( name = "lib", restricted_to = [":A", ":B"], deps = select({ ":config_a": [":depA"], ":config_b": [":depB"], })) java_library( name = "depA", restricted_to = [":A"]) java_library( name = "depB", restricted_to = [":B"]) are allowed. Specifically, even though neither "depA" nor "depB" supports [":A", ":B"], the combination of the two does. So the select as a whole supports all environments declared in lib, even though only one of those environments actually gets chosen for a given build. Refinement makes lib "match" the chosen path. So for "config_a" builds, lib's environment set is "refined" down to [":A"], meaning [":B"]-restricted rules cannot depend on it. Likewise, for "config_b" builds, lib's environment set is "refined" down to [":B"], meaning [":A"]-restricted rules cannot depend on it. This guarantees that the restrictions imposed by the chosen select path propagate faithfully up the dependency chain. See new documentation in ConstraintSemantics.java for more details. -- MOS_MIGRATED_REVID=120464241
* Remove FilesToRunProvider.label.Gravatar Ulf Adams2016-04-22
| | | | | | | The TransitiveInfoProvider already contains a label, use that instead. -- MOS_MIGRATED_REVID=120443298
* Remove unused ${SYNOPSIS} variable from Bazel native rule inline documentation.Gravatar David Chen2016-01-28
| | | | | | | | | | This variable is no longer used because the docgen template directly calls RuleDocumentationAttribte.getSynopsis() instead of using the SYNOPSIS variable, and RuleDocumentationAttribute.getHtmlDocumentation() resolves the SYNOPSIS variable to the empty string. -- MOS_MIGRATED_REVID=113249993
* Refactor dependency filtering out of Rule class.Gravatar Dmitry Lomov2016-01-22
| | | | | -- MOS_MIGRATED_REVID=112717648
* Use Bazel Preconditions variant which avoids varargs array creationGravatar Mark Schaller2015-12-10
| | | | | | | Reduces garbage. -- MOS_MIGRATED_REVID=109914243
* Provide a way to explicitly constraint-enforceGravatar Greg Estren2015-10-29
| | | | | | | | | | | attributes that would otherwise be skipped by default policy. This is the simplistic start to a user-controllable enforcement policy API. -- MOS_MIGRATED_REVID=106530210
* 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
* Better syncing of Google vs. external constraint enforcement.Gravatar Greg Estren2015-09-24
| | | | | -- MOS_MIGRATED_REVID=103768073
* 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
* Have constraints' definition of implicit deps exactly match query's.Gravatar Greg Estren2015-06-12
| | | | | | | | | Before this change, constraints considered implicit deps anything from an attribute beginning with "$" or ":" (e.g. attributes that are completely hidden from BUILD files). Query agrees with this, but it also counts default values for *normal* attributes that aren't explicitly set in rules. By syncing the two up, depot migrations can figure out which rules need to be constraint-annotated by simply running a bazel query --no_host_deps --no_implicit_deps. -- MOS_MIGRATED_REVID=95766777
* Remove compatible_with / restricted_to attributes from ruleGravatar Greg Estren2015-06-03
| | | | | | | classes that are exempt from constraint checking. -- MOS_MIGRATED_REVID=95033646
* Keep host dependencies exempt from constraint checkingGravatar Greg Estren2015-06-03
| | | | | | | even with --nodistinct_host_configuration. -- MOS_MIGRATED_REVID=95009095
* Constraints: don't check constraints on implicit or lateboundGravatar Greg Estren2015-04-23
| | | | | | | dependencies. -- MOS_MIGRATED_REVID=91801043
* 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
* Constraints: implement "fulfills". Details are describedGravatar Greg Estren2015-03-18
| | | | | | | in -- MOS_MIGRATED_REVID=88869446
* Some constraint enforcement tweaks:Gravatar Greg Estren2015-03-10
| | | | | | | | | | | 1) Exclude host dependencies from constraint checking. 2) Check output files with the environment specs of their generating rules. 3) Provide a more generalized way to opt certain rule classes out of constraint checking (this fixes accidental checking on config_setting rules, which didn't really make sense). -- MOS_MIGRATED_REVID=87963638
* Add --target_environment flag. This declares the environment (or set of ↵Gravatar Greg Estren2015-03-06
| | | | | | | | | | | | | | | | | | environments) the build is being done for. In other words: blaze build //foo:all --target_environment=//buildenv/target:gce declares that this build targets GCE, so all top-level targets must also support GCE. This essentially allows constraint enforcement to apply to top-level targets, too. So users can protect against accidentally building targets in configurations they're not meant to work with. -- MOS_MIGRATED_REVID=87862252
* Update from Google.Gravatar Han-Wen Nienhuys2015-02-25
-- MOE_MIGRATED_REVID=85702957