aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages
Commit message (Collapse)AuthorAge
* Change execution root for external repositories to be ../repoGravatar Kristina Chodorow2016-09-20
| | | | | | | | | | | | | | | | | | | | | | | Some of the important aspect of this change: * Remote repos in the execution root are under output_base/execroot/repo_name, so the prefix is ../repo_name (to escape the local workspace name). * Package roots for external repos were previously "output_base/", they are now output_base/external/repo_name (which means source artifacts always have a relative path from their repository). * Outputs are under bazel-bin/external/repo_name/ (or similarly under genfiles). Note that this is a bit of a change from how this was implemented in the previous cl. Fixes #1262. 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. Roll forward of bdfd58a. -- MOS_MIGRATED_REVID=133606309
* Rollback of commit 4381a1d6e8f711957f430aac0c301acec6dfa0eb.Gravatar Damien Martin-Guillerez2016-09-14
| | | | | | | | | | | | | *** Reason for rollback *** Breaks all projects using Bazel, see https://ci.bazel.io *** Original change description *** Deprecated and removed HOST_CFG and DATA_CFG global variables. -- MOS_MIGRATED_REVID=133005398
* Global cleanup change.Gravatar Vladimir Moskva2016-09-13
| | | | | -- MOS_MIGRATED_REVID=132976702
* Allow list of lists of mandatory native providersGravatar Googler2016-09-08
| | | | | -- MOS_MIGRATED_REVID=132464865
* Skylark no longer crashes when the default value of an attribute is a label ↵Gravatar Florian Weikert2016-09-06
| | | | | | | | | string that points to a remote repository. Fixes #1442. -- MOS_MIGRATED_REVID=132320130
* Roll forward of commit 19db71413329da3f5d22b5fc7681471f3d971d88 (Skylark: ↵Gravatar Florian Weikert2016-09-06
| | | | | | | | | | | | | Replaced late bound attributes with computed default attributes) with two bug fixes: 1. Unlike SkylarkComputedDefault, SkylarkComputedDefaultTemplate did not sort the names of its attribute dependencies. Consequently, lookup operations failed when callback functions in bzl files specified the names of their required attributes in a non-alphabetical order since the order of the key tuples was different (e.g. [1, 2] vs [2, 1]). It would be less error prone to always sort the dependencies in createDependencyAssignmentTuple(), but this would impact performance. 2. SkylarkCallbackFunction ignores the legacy "cfg" parameter in callback functions. This special case should be deleted once all cfg parameters have been removed from the depot. -- MOS_MIGRATED_REVID=132235927
* Rollback of commit 19db71413329da3f5d22b5fc7681471f3d971d88.Gravatar Tobias Werth2016-09-06
| | | | | -- MOS_MIGRATED_REVID=132058819
* Skylark: Replaced late bound attributes with computed default attributesGravatar Mark Schaller2016-09-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: Compared to computed default attributes, late bound attributes are evaluated in a later phase (analysis instead of loading phase). While both mechanisms provide access to other attributes of a rule, only late bound attributes additionally provide access to the build configuration. However, late bound attributes could be used to return new labels that have not been loaded before. Since this happens in the analysis phase, it can break one of Blaze's underlying principles, thus introducing a serious correctness bug. We decided to replace late bound attributes in Skylark with computed default attributes since this moves the evaluation of values into the loading phase, thus fixing this bug. Moreover, none of the existing users of this mechanism required access to the build configuration, which means that the user impact of this change is minimal. Implementation details: Unlike attributes of non-Skylark rules, however, Skylark computed defaults need to be able to depend on more than two configurable attributes since all attributes of Skylark rules are configurable by default. This has two implications: 1. Unlike "normal" Skylark attributes, Skylark computed defaults need to know about the existence of other attributes in order to declare a dependency on them. This CL takes advantage of work previously done to require parameter names to be the names of attributes used by the computed default function. 2. Since Bazel computes the combinations of all possible attribute values, a Skylark rule with a computed default that depends on a lot of configurable attributes could crash Bazel. Consequently, this CL also introduces an upper bound (64) for the number of valid combinations. Caveats: 1. Getting the depended-on attributes' names from function paramters is mildly surprising. Alternatives: The best solution would be to keep SkylarkLateBound, but restrict it in a way that it can only return already loaded labels. This is not possible right now. -- MOS_MIGRATED_REVID=131967238
* First step towards allowing returning declared providers from rule ↵Gravatar Dmitry Lomov2016-09-01
| | | | | | | implementations. -- MOS_MIGRATED_REVID=131923497
* Make aspects attached to aliases work when their actual= attribute is a select.Gravatar Lukacs Berki2016-08-31
| | | | | | | Fixes https://github.com/bazelbuild/e4b/issues/6 . -- MOS_MIGRATED_REVID=131698950
* Some optimizations in Type#flatten (used under the covers by ↵Gravatar Nathan Harmata2016-08-25
| | | | | | | | | | | | | AggregatingAttributeMapper#visitLabels): -Rename Type#flatten to Type#extractLabels. -Change the return type of Type#extractLabels from Collection to Iterable. This way we don't need to create and concatenate large lists. -Add an internal-only Type#containsLabels so this way ListType and DictType can have efficient implementations of Type#extractLabels. Note that AggregatingAttributeMapper#visitLabels is called multiple times on the same in several different places during the lifetime of a non-incremental Blaze invocation (e.g. during Package loading, during transitive target visitation, etc) -- MOS_MIGRATED_REVID=131311698
* Automated [] rollback of commit 846a5ab98fc26d72024890fdb79a5d3bc6a5a1ba + ↵Gravatar Nathan Harmata2016-08-23
| | | | | | | | | | | | | | | manual rollback of [] *** Reason for rollback *** Depot has been fixed / is in the process of being fixed. See the work tracked on [] *** Original change description *** Automated [] rollback of commit bb5d5efb4b50710241b5b374eb67084f4bf08278. -- MOS_MIGRATED_REVID=131095905
* Rollback of commit bb5d5efb4b50710241b5b374eb67084f4bf08278.Gravatar Tobias Werth2016-08-23
| | | | | -- MOS_MIGRATED_REVID=130941264
* Fix NPE when aspect propagates over an alias.Gravatar Googler2016-08-18
| | | | | -- MOS_MIGRATED_REVID=130553300
* RELNOTES: The string list returned by the skylark 'glob' function is now ↵Gravatar Nathan Harmata2016-08-18
| | | | | | | | | | | | | | sorted. Previously, it would return a list formed by concatenating the sorted results of each pattern in the 'includes' list. A bunch of cleanups and one bug fix: -Remove the unused-except-for tests GlobCache#globsUpToDate. This code has been dead for a very very long time, ever since we switched to using Skyframe. -Change the semantics of the 'glob' function as described above. -Change UnixGlob to return unsorted results. Document this in UnixGlob and GlobCache. -Change LegacyGlobber to conditionally return sorted results. Have users other than PackageFunction get sorted results (as described above). Have PackageFunction's use case get completely unsorted results, and have PackageFunction do the sorting itself. -Have PackageFunction's HybridGlobber unconditionally sort the glob result list. This ensure deterministic glob results, fixing a bug where the order of the elements of the result depended on the contents of the Skyframe graph, which of course depends on the sequence of incremental Blaze commands. -- MOS_MIGRATED_REVID=130540152
* Allow Skyframe graph lookups and value retrievals to throw InterruptedException.Gravatar Janak Ramakrishnan2016-08-16
| | | | | | | The only place we now don't handle InterruptedException is in the action graph created after analysis, since I'm not sure that will be around for that much longer. -- MOS_MIGRATED_REVID=130327770
* Fix grammar in documentationGravatar Michajlo Matijkiw2016-08-16
| | | | | | | I must have been between "similar to" and "same as" and chose both. -- MOS_MIGRATED_REVID=130281024
* Clarify comments and function names in AggregatingAttributeMapperGravatar Mark Schaller2016-08-16
| | | | | | | | A small cleanup and refactoring in advance of heavier work to be done for Skylark computed defaults. -- MOS_MIGRATED_REVID=130140706
* Add the repository name as a parameter to the output path functionsGravatar Kristina Chodorow2016-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't do anything yet, it's in preparation for the execroot rearranging change. The execroot will have one bazel-out per repo, so it'll look like: execroot/ repo1/ bazel-out/ local-fastbuild/ bin/ repo2/ bazel-out/ local-fastbuild/ bin/ genfiles/ repo3/ bazel-out/ local-fastbuild/ testlogs/ and so on. Thus, any output path (getBinDirectory() & friends) needs to know what the repo name is. This changes so many places in the code I thought it would be good to do separately, then just flip the functionality in the execroot-rearranging commit. While I was poking around, I changed all of the refs I could from getPackageRelativeArtifact() to getBin/GenfilesArtifact(), so that 1) rule implementation don't have to know as much about roots and 2) they'll be more isolated from other output dir changes. `bazel info` and similar just return roots for the main repository. The only "change" is passing around a target label in the Java rules. Continues work on #1262. -- MOS_MIGRATED_REVID=129985336
* Add 'provider()' function.Gravatar Dmitry Lomov2016-08-11
| | | | | -- MOS_MIGRATED_REVID=129889793
* Substituted NoSuchVariableException with manual checks for performance purposesGravatar Vladimir Moskva2016-08-11
| | | | | -- MOS_MIGRATED_REVID=129869968
* Allow ImplicitOutputsFunctions to be overriden on Rule creation.Gravatar Michajlo Matijkiw2016-08-10
| | | | | -- MOS_MIGRATED_REVID=129787305
* Add SkylarkClassObjectConstructor - a future return value of "provider" ↵Gravatar Dmitry Lomov2016-08-09
| | | | | | | function. -- MOS_MIGRATED_REVID=129726780
* Implements dynamic split transitions (minus latebound attribute splits).Gravatar Greg Estren2016-08-08
| | | | | | | | | | With the prereq work behind this, this is surprisingly straightforward. The main change is to eliminate BuildConfiguration.SplittableTransitionApplier, make both DynamicTransitionApplier and StaticTransitionApplier split-aware, and add awareness of this to ConfiguredTargetFunction.trimConfigurations. Latebound splits will follow next. -- MOS_MIGRATED_REVID=129480309
* Make SkylarkClassObject "Bazel-specific".Gravatar Dmitry Lomov2016-08-05
| | | | | | | This in preparation to DeclaredProviders implementation. -- MOS_MIGRATED_REVID=129420617
* Emphasize that default_strict_deps_java_protos is subject to change at any ↵Gravatar Carmi Grushko2016-08-05
| | | | | | | time without prior notice. -- MOS_MIGRATED_REVID=129409727
* Delete unused RuleClass.createPlaceholderBuilderGravatar Michajlo Matijkiw2016-08-05
| | | | | -- MOS_MIGRATED_REVID=129360870
* Start removing the parsePython booleanGravatar Laurent Le Brun2016-08-03
| | | | | | | It's still used in one place and should be removed completely in October. -- MOS_MIGRATED_REVID=129207133
* Allow objc rule deps to include any rule that exports an "objc" provider.Gravatar Googler2016-08-01
| | | | | | | | | | | This change was motivated by a need to write pure Skylark rules that expose their own objc providers so they can be used as deps to other libraries/application targets (e.g., SceneKit/SpriteKit compiled resources, []) without having to whitelist them and wait for a Blaze release. This CL fixes what seems to be a bug in validateRuleDependency, where the behavior in the doc comment implies that it will accept a whitelisted rule name *or* a list of mandatory providers, but as implemented today it seems to require the rule to be whitelisted even if the mandatory native providers matched. RELNOTES: objc_* rules can now depend on any target that returns an "objc" provider. -- MOS_MIGRATED_REVID=128835096
* Rename some PackageId and RepositoryName fields/methods in prep for deep ↵Gravatar Kristina Chodorow2016-07-28
| | | | | | | | | | | | | execroot change This is in prep for making the execution root path for external repositories ../repo_name (instead of external/repo_name). Right now, the getRunfilesPath() returns that path, so that is renamed getExecRoot() (since the runfiles are really just a reflection of the execRoot structure). getSourceRoot() replaces getPathFragment, which has always been a confusing name (it's not clear from the name what the difference is between it and getPackageFragment()). It returns the relative path to source files for external repositories (external/repo_name). Also renamed/moved to more sensible class a few static RepositoryName fields. -- MOS_MIGRATED_REVID=128594419
* Clean up DependencyResolver's interface for the dynamic config migration and ↵Gravatar Greg Estren2016-07-28
| | | | | | | | | | | | | | | | | | | | for general readability. Major changes: - Remove the intermediate Attribute -> LabelAndConfiguration multimap (computed in resolveAttributes). Instead, feed discovered values directly into the final Attribute -> Dependency map via a new RuleResolver interface. - Remove all references to LabelAndConfiguration. The configuration is always the owning rule's configuration except for two special cases: late-bound attributes with splits and late-bound attributes with LateBoundDefault.useHostConfiguration. The original interface made this very unclear and required a lot of awkward and sometimes incorrect logic. The new interface only involves configurations for the cases that actually need them. - Remove an ugly hack caused by BuildConfiguration.evaluateTransition mixing poorly with LateBoundDefault.useHostConfiguration (https://github.com/bazelbuild/bazel/blo[]e172693c27f3efc95ed163e43a9f0a7a6fb4017/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java#L488). - Remove a hack that applies split transitions twice because of BuildConfiguration.evaluateTransition mixing poorly with late-bound split attributes (https://github.com/bazelbuild/bazel/blo[]e172693c27f3efc95ed163e43a9f0a7a6fb4017/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java#L319). This happens to be innocent now but won't be when nested splits are possible. - Solidifies the API contract for Attribute.LateBoundDefault.useHostConfiguration. - Applies clearer naming and more consistent ordering to method parameters. - Better documentation. This is all also prep work for dynamic split transitions. tl;dr: late-bound attributes are legitimately special. Treat them that way to make the rest of DependencyResolver cleaner and hack-free. -- MOS_MIGRATED_REVID=128582618
* java_proto_library strict deps: add attributes for gradual migrationGravatar Carmi Grushko2016-07-27
| | | | | | | | | Control strict-deps through a rule-level and a package-level attribute, allowing finer-grained migration in conjunction with a global flag. RELNOTES: java_proto_library: control strict-deps through a rule-level and a package-level attribute. -- MOS_MIGRATED_REVID=128542363
* Remove outdated commentGravatar Michajlo Matijkiw2016-07-27
| | | | | -- MOS_MIGRATED_REVID=128510907
* Adjust visibility of ComputedDefault dependenciesGravatar Mark Schaller2016-07-27
| | | | | | | Also clarify that the returned list is immutable. -- MOS_MIGRATED_REVID=128482720
* Slim down RuleClass#createUncheckedGravatar Michajlo Matijkiw2016-07-26
| | | | | -- MOS_MIGRATED_REVID=128391351
* Optimize Rule.getLabels(void) to avoid ImmutableSortedSet.construct().Gravatar Googler2016-07-26
| | | | | | | | | This is called only from Package$Builder.checkForInputOutputConflicts() which just wants the name of each input label; there's no need to sort or deduplicate. -- MOS_MIGRATED_REVID=128355375
* Bring PackageSpecification docs up-to-date, clean up its interfaceGravatar Mark Schaller2016-07-22
| | | | | | | | Focuses on documenting the Strings that PackageSpecifications can be translated from and to. -- MOS_MIGRATED_REVID=128195540
* JavaBuilder: for jars that are produced by aspects (e.g., JavaProtoAspect), ↵Gravatar Carmi Grushko2016-07-22
| | | | | | | | | pass the name of the injecting rule (e.g., java_proto_library), if the rule registered it. Registration is done using AspectParameters and a specially-named key. -- MOS_MIGRATED_REVID=128179548
* Remove Rule's dependence on a RawAttributeMapper instanceGravatar Michajlo Matijkiw2016-07-21
| | | | | | | | | The things Rule needs it for aren't terribly complex. Instead inline functionality where sensible, and refactor into static methods where not. This reduces each Rule's memory footprint by 38%. -- MOS_MIGRATED_REVID=128011760
* Remove unused AttributeContainer#getAttrGravatar Michajlo Matijkiw2016-07-20
| | | | | -- MOS_MIGRATED_REVID=127895738
* Prohibit duplicate addition of aspect to an attribute and improve diagnostics.Gravatar Dmitry Lomov2016-07-19
| | | | | -- MOS_MIGRATED_REVID=127808009
* Sort the results returned by the HybridGlobber if we are using results from ↵Gravatar Janak Ramakrishnan2016-07-19
| | | | | | | | | Skyframe globbing. This adds a log(n) factor to uses of globs, but getting globs to be returned in a reasonable order that can be emulated by legacy globbing is hard and bug-prone right now, and we must sort anyway if we are merging legacy and Skyframe globs. Note that this log(n) factor is already present on clean builds with legacy globbing. If we end up seeing performance issues on incremental loading, we can investigate making GlobFunction efficiently return elements in sorted order. (We would still need to sort if merging legacy and Skyframe globs, but that should be a relatively rare occurrence, and can be dealt with by a more efficient merge sort if necessary.) -- MOS_MIGRATED_REVID=127752554
* Don't store workspace name on ruleGravatar Michajlo Matijkiw2016-07-18
| | | | | | | Instead have callers get it via package. -- MOS_MIGRATED_REVID=127715494
* Remove GlobList formatting logicGravatar Michajlo Matijkiw2016-07-18
| | | | | | | Isn't strictly necessary, remove it before anyone decides they want to use it. -- MOS_MIGRATED_REVID=127585617
* Remove not-quite necessary serialization bitsGravatar Michajlo Matijkiw2016-07-15
| | | | | | | What we really are doing here is formatting. -- MOS_MIGRATED_REVID=127481183
* Memoize TestSize.name().toLowerCase() -> TestSize mappingsGravatar Michajlo Matijkiw2016-07-14
| | | | | | | | | | Saves some needless garbage generation. We expect TestSize#getTestSize(String) to always pass in a lowercase value, which we promptly change to uppercase for the enum lookup. Instead memoize the lowercase -> TestSize mapping to avoid this call. -- MOS_MIGRATED_REVID=127362499
* Fix native.existing_rule() when argument is an existing fileGravatar Laurent Le Brun2016-07-13
| | | | | -- MOS_MIGRATED_REVID=127218963
* Glob arguments 'exclude' and 'exclude_directories' must be namedGravatar Laurent Le Brun2016-07-13
| | | | | | | | | | | Unamed arguments are confusing, e.g. glob(["*.java"], ["testing/*.java"]) The second list is actually excluded. RELNOTES: Glob arguments 'exclude' and 'exclude_directories' must be named -- MOS_MIGRATED_REVID=127190991
* Add allow_single_file in attr.label, deprecate single_file.Gravatar Laurent Le Brun2016-07-05
| | | | | -- MOS_MIGRATED_REVID=126620866
* Ignore make variables undefined for requested platform.Gravatar Dmitry Lomov2016-07-01
| | | | | -- MOS_MIGRATED_REVID=126333303