aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/packages/BuildTypeTest.java
Commit message (Collapse)AuthorAge
* Automated refactor of Label.parseAbsolute() to always pass a repository mappingGravatar dannark2018-06-27
| | | | | RELNOTES: None PiperOrigin-RevId: 202360925
* Take into account repository mapping when processing labels inside BUILD ↵Gravatar dannark2018-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | files within external repositories. For example: a/BUILD genrule( name = "a", srcs = ["@x//:x.txt"], outs = ["result.txt"], cmd = "echo hello > \$(location result.txt)" ) If the main workspace file references that repository with a rule: local_repository( name = "other_repo", path = "../a", repo_mapping = {"@x" : "@y"} ) Then when a/BUILD is evaluated, the string "@x//:x.txt" will be turned into a Label "@y//:x.txt" RELNOTES: None PiperOrigin-RevId: 201562148
* Keep order of dict attributes the same as it was in the BUILD file.Gravatar lberki2018-02-26
| | | | | | | | This is a change from behavior introduced in unknown commit, which was added to preserve determinism even though the ordering of dicts in Python is non-deterministic. Now that we don't call into Python anymore, this is not necessary. RELNOTES[INC]: The order of dict-valued attributes is now the order in the BUILD file (or in the Skylark dict they were created from) and not lexicographically sorted. PiperOrigin-RevId: 187003317
* Fix SelectorList.isListType to properly consider all classes that can be ↵Gravatar jcater2017-10-27
| | | | | | assigned to java.util.List, not just ArrayList. PiperOrigin-RevId: 173577936
* Refactor PrinterGravatar vladmos2017-07-03
| | | | | | | It's now easier to customize Printer if in different situations objects should be printed differently. Also its API is cleaner now. Names of methods of SkylarkValue objects now reflect names of Skylark functions: SkylarkValue#repr and SkylarkPrintableValue#str. PiperOrigin-RevId: 160635154
* Migrate Java tests to Truth.Gravatar lberki2017-05-30
| | | | | | RELNOTES: None. PiperOrigin-RevId: 157446717
* Automated g4 rollback of commit d5217515002d468a3095243975e21e89eccc46b7.Gravatar ajmichael2017-05-02
| | | | | | | | | *** Reason for rollback *** Relies on a CL that is being rolled back due to breaking some LIPO builds. RELNOTES: None PiperOrigin-RevId: 154776370
* Add best practices docGravatar kchodorow2017-05-02
| | | | PiperOrigin-RevId: 154734540
* 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
* Allow ' ', '(', ')' and '$' in labels Gravatar Damien Martin-Guillerez2017-03-06
| | | | | | | | | | | | | | | | | | | | | | | This just add the special characters in labels and fixes the associated tests, left is the hard part to test adding those characters everywhere. This is experimental and several characters will break at several location especial in the runfiles manifest file. Follow-ups: Resolve quoting then test, test more and add even more tests. Issue found during development: Parentheses are not accepted in exclude pattern in globs Building a binary includes build-runfiles that relies on the runfiles manifest format so the added test would fails with a java_binary instead of a library. -- Change-Id: I9c87273a90318b931c61bdb86f1066962819960a Reviewed-on: https://cr.bazel.build/9055 PiperOrigin-RevId: 149108027 MOS_MIGRATED_REVID=149108027
* 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
* Fix Windows JDK7 testsGravatar Kristina Chodorow2016-09-22
| | | | | | | | | | | | | | They're accessing non-final variables in inner classes, e.g.,: src\test\java\com\google\devtools\build\lib\packages\BuildTypeTest.java:425: error: local variable result is accessed from within inner class; needs to be declared final result.add(label); (From http://ci.bazel.io/view/Bazel%20bootstrap%20and%20maintenance/job/Bazel/JAVA_VERSION=1.7,PLATFORM_NAME=windows-x86_64/845/consoleFull). Not sure how this is working on Linux/OS X JDK7. -- MOS_MIGRATED_REVID=133967835
* Be honest about type in Type#visitLabelsGravatar Michajlo Matijkiw2016-09-22
| | | | | | | | | | We avoided referencing Label directly, but as the code evolved it became inevitable. Also fix a typo I introduced earlier. -- MOS_MIGRATED_REVID=133831955
* Implement label visitation using visitorGravatar Michajlo Matijkiw2016-09-21
| | | | | | | | | As opposed to building up a collection. These collections, and all their iterators, add up creating a lot of garbage. This saves us at least an ImmutableList + Iterator per label. -- MOS_MIGRATED_REVID=133754998
* 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
* Add support for custom "no match" errors in select()s.Gravatar Greg Estren2016-05-11
| | | | | | | | | | | | | | | | | | | | From: https://github.com/bazelbuild/bazel/issues/1225 Example: cc_binary( name = "hello_custom_no_match_error", srcs = select( { "//conditions:a": ["not_chosen.cc"] }, no_match_error = "You always have to choose condition a!" ) ) Fixes #1225 -- MOS_MIGRATED_REVID=121978888
* 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
* Don't keep packages in the default repository around after loading.Gravatar Brian Silverman2016-03-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, this would get thrown when referring to the same package from both the main and default repositories: java.lang.IllegalArgumentException: Multiple entries with same key: tools/cpp=/home/brian/971-Robot-Code and tools/cpp=/home/brian/971-Robot-Code at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:136) at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:98) at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:84) at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:295) at com.google.devtools.build.lib.buildtool.BuildTool.transformPackageRoots(BuildTool.java:301) at com.google.devtools.build.lib.buildtool.BuildTool.buildTargets(BuildTool.java:209) at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:334) at com.google.devtools.build.lib.runtime.commands.TestCommand.doTest(TestCommand.java:119) at com.google.devtools.build.lib.runtime.commands.TestCommand.exec(TestCommand.java:104) at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:371) at com.google.devtools.build.lib.runtime.BlazeRuntime$3.exec(BlazeRuntime.java:1016) at com.google.devtools.build.lib.server.RPCService.executeRequest(RPCService.java:65) at com.google.devtools.build.lib.server.RPCServer.executeRequest(RPCServer.java:434) at com.google.devtools.build.lib.server.RPCServer.serve(RPCServer.java:229) at com.google.devtools.build.lib.runtime.BlazeRuntime.serverMain(BlazeRuntime.java:975) at com.google.devtools.build.lib.runtime.BlazeRuntime.main(BlazeRuntime.java:772) at com.google.devtools.build.lib.bazel.BazelMain.main(BazelMain.java:55) And this would get thrown for any packages in the main repository loaded from other repositories: java.lang.RuntimeException: Unrecoverable error while evaluating node 'PACKAGE:@//tools/build_rules/go/toolchain' (requested by nodes ) at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:982) at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:499) 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: Invalid BUILD file name for package '@//tools/build_rules/go/toolchain': /home/brian/bazel/tools/build_rules/go/toolchain/BUILD at com.google.devtools.build.lib.packages.Package.finishInit(Package.java:299) at com.google.devtools.build.lib.packages.Package$Builder.finishBuild(Package.java:1308) at com.google.devtools.build.lib.skyframe.PackageFunction.compute(PackageFunction.java:501) at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:933) ... 4 more Sponsor's comment: note the abundance of new Label.resolveRepositoryRelative() calls. They are ugly, but it's only making existing ugliness explicit. Yes, we should fix it, especially in the implementation of configurable attributes. Refs #940 -- Change-Id: I8bd7f7b00bec58a7157507595421bc50c81b404c Reviewed-on: https://bazel-review.googlesource.com/#/c/2591 MOS_MIGRATED_REVID=117429733
* Fileset (Google internal): code cleanup.Gravatar Laszlo Csomor2016-01-19
| | | | | -- MOS_MIGRATED_REVID=112466264
* Permit proto serialization of configured attribute valuesGravatar Mark Schaller2016-01-04
| | | | | | | | | This commit adds proto messages that represent configurable values, and modifies attribute value serialization code to handle those values, which are called SelectorLists. -- MOS_MIGRATED_REVID=111149272
* Migrated tests in devtools/build/lib/packages to JUnit 4.Gravatar Florian Weikert2015-12-01
| | | | | -- MOS_MIGRATED_REVID=109079812
* Replace home-made assertions with equivalent Google Truth calls.Gravatar Carmi Grushko2015-11-11
| | | | | -- MOS_MIGRATED_REVID=107492955
* Open source more tests for packages/Gravatar Han-Wen Nienhuys2015-10-22
| | | | | | | | | | Tested: bazel test on merge-to-os-blaze.sh checked total test method count on blaze test //javatests/com/google/devtools/build/lib:PackagesTests //third_party/bazel/src/test/java/com/google/devtools/build/lib:packages-tests -- MOS_MIGRATED_REVID=105963077
* Replace "Google Inc" with "The Bazel Authors" in every copyright notice.Gravatar Lukacs Berki2015-10-21
| | | | | -- MOS_MIGRATED_REVID=105949508
* 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