aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/constraints
Commit message (Collapse)AuthorAge
* Deprecate TransitiveInfoCollection#getConfiguration(), adding two new ↵Gravatar janakr2018-03-26
| | | | | | | | methods, TransitiveInfoCollection#getConfigurationKey() and ConfiguredTarget#getConfigurationChecksum(). These methods currently delegate to #getConfiguration(), but in the future they won't. I hope to get rid of #getConfigurationChecksum(), but I may have to fold the checksum into BuildConfigurationValue.Key or leave it as a separate field in ConfiguredTarget. Transform a representative (random?) selection of #getConfiguration calls, to show that it's pretty much possible everywhere. PiperOrigin-RevId: 190474978
* Expose an actions provider on RuleConfiguredTarget instances.Gravatar cparsons2018-03-06
| | | | | | | | | Given a target (for example from a skylark aspect), one will be able to access a list of actions that the target generated using "target.actions". This is without additional memory footprint. Actions themselves are not fully exposed to skylark (and thus there isn't much meaning to gather from them in skylark yet). Access methods will follow soon. RELNOTES: None. PiperOrigin-RevId: 188098079
* Add proper serialization constructor and equals/hashCode for EnvironmentLabels.Gravatar janakr2018-03-06
| | | | PiperOrigin-RevId: 188078054
* Automated rollback of commit 96145511b34a2d7be834e3eb05927674e875c813.Gravatar janakr2018-03-05
| | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Fixed issue that led to rollback. RELNOTES: None *** Original change description *** Automated rollback of commit eee53d3a33dde441f7e7adaecde81ef2d3db7c1b. *** Reason for rollback *** breaks Blaze_CorpTest *** Original change description *** @AutoCodec ConfiguredTargetValue. PiperOrigin-RevId: 187869560
* Automated rollback of commit eee53d3a33dde441f7e7adaecde81ef2d3db7c1b.Gravatar dannark2018-03-04
| | | | | | | | | | | | *** Reason for rollback *** breaks Blaze_CorpTest *** Original change description *** @AutoCodec ConfiguredTargetValue. PiperOrigin-RevId: 187783702
* @AutoCodec ConfiguredTargetValue.Gravatar cpeyser2018-03-02
| | | | PiperOrigin-RevId: 187635570
* Extract part of EnvironmentGroup that's necessary for constraint ↵Gravatar janakr2018-02-15
| | | | | | | | calculation, so we don't have to have the whole package. Memory increase should be minimal because there aren't that many environment groups, but it's further minimized by breaking an inner class UnpackagedEnvironmentGroup out of EnvironmentGroup. Previously, each EnvironmentGroup cost 40 bytes (24 bytes for first three fields, 8 for next two, 8 for last field because of alignment). Each UnpackagedEnvironmentGroup costs 32 bytes (4 fields), while the EnvironmentGroup now costs 24 bytes. So a loss of 16 bytes per EnvironmentGroup: shouldn't be noticeable. PiperOrigin-RevId: 185837140
* Get Target out of SupportedEnvironmentsProvider. Only a Label and Location ↵Gravatar janakr2018-02-14
| | | | | | are needed, so just use that. PiperOrigin-RevId: 185738140
* Remove ConfiguredTarget.getTarget() call in TopLevelConstraintSemantics.Gravatar mjhalupka2018-01-29
| | | | | | Replace it with PackageManager.getTarget(). PiperOrigin-RevId: 183736074
* Change cfg(HOST) to cfg(HostTransition.INSTANCE).Gravatar gregce2017-12-21
| | | | | | Preparatory step for removing ConfigurationTransition.HOST. PiperOrigin-RevId: 179838374
* Remove ConfigurationTransition.HOST references from lib.packages.Gravatar gregce2017-12-20
| | | | | | | | | | | | | | | | | | | | This removes the main barrier to making host transitions routine patch transitions. Today you signify a host transition by calling Attribute.Builder.cfg(ConfigurationTransition.HOST). Blaze's configuration machinery auto-converts this to HostTransition.INSTANCE, which is a patch transition. This change provides the groundwork for removing ConfigurationTransition.HOST and removing the special conversion logic. This also paves the way for better API support for multiple host configurations. Also change some cfg(HOST) rule references to cfg(HostTransition.INSTANCE). PiperOrigin-RevId: 179754619
* Correct typos found by the linter.Gravatar gregce2017-12-20
| | | | PiperOrigin-RevId: 179748374
* Upgrade --target_environment, --auto_cpu_environment_group.Gravatar gregce2017-12-05
| | | | | | | 1: Allow both in the same build (before, just one would trigger) 2: Don't check environment defaults from other groups, since neither flag asserts any expectations on those groups PiperOrigin-RevId: 178026699
* Fix TopLevelConstraintSemantics to ignore targets that explicitly ignore ↵Gravatar John Cater2017-11-10
| | | | | | | | | constraint checking. Fixes #4042. Change-Id: I9461c004ab1aab8ca7a0ad515e8a9f24c8a489a5 PiperOrigin-RevId: 175219823
* 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
* Start process of making auto_cpu_environment_group non-experimental.Gravatar jcater2017-10-18
| | | | | | | | Adds a legacy flag so clients can continue to use both experimental_auto_cpu_environment_group and auto_cpu_environment_group until uses can be cleaned up. PiperOrigin-RevId: 172470616
* Move RuleConfiguredTarget to lib.analysis.configuredtargets.Gravatar gregce2017-09-19
| | | | | | This is a trivial change with a large file footprint. PiperOrigin-RevId: 169169864
* Project reorg: move *ConfiguredTarget to new configuredtargets/ pathGravatar gregce2017-09-18
| | | | | | | Exempt RuleConfiguredTarget in this change because that's liable to touch a billion files. PiperOrigin-RevId: 168929827
* 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
* Skip tests that aren't CPU-compatible with the current build.Gravatar gregce2017-07-24
| | | | | | | | | | We don't yet have a SKIPPED test status. So for now we report "NO STATUS". Also moved top-level constraint checking to its own file, since its logic is getting more complicated. PiperOrigin-RevId: 162790879
* Make compatible_with = ["all", "foo"] the same as compatible_with = ["all"].Gravatar gregce2017-06-06
| | | | | | | | | | | | | Assuming "all" fulfills "foo", these should be exactly the same (and maybe we should trigger a redundant listing error). In practice, it's possible to make the first case succeed while the second fails because of environment refining and lack of static constraint checking for selects. See changes for details. Also refactor ConstraintSemantics.checkConstraints to divide and conquer more clearly. PiperOrigin-RevId: 158047217
* 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