Commit graph

16 commits

Author SHA1 Message Date
Dan Willemsen
633c502295 Support RuleBuilder.Sbox to wrap commands in sbox
This essentially allows you to declare that everything in a directory
will be created by the rule, and we'll ensure that your command actually
writes out all of the claimed outputs, and remove any other files that
previously existed in that directory.

Test: built-in tests
Change-Id: I990dce2b3a0d89ebd2736ac1a0cadfb5864c6e73
2019-04-15 14:52:05 -07:00
Colin Cross
1d2cf0494a Add depfile support to RuleBuilder
Allow rules built with RuleBuilder to use depfiles.  Ninja only
supports a single depfile with single output.  If there are
multiple outputs in a rule, move all but the first to implicit
outputs.  If multiple depfiles are specified, use new support
in dep_fixer to combine additional depfiles into the first depfile.

Test: rule_builder_test.go
Change-Id: I7dd4ba7fdf9feaf89b3dd2b7abb0e79006e06018
2019-03-29 16:35:06 -07:00
Colin Cross
92b7d584c8 Add RuleBuilderCommand.Flags
Test: rule_builder_test.go
Change-Id: I7887a67aaef33bc591d83fade9175da3e401529f
2019-03-29 16:35:06 -07:00
Colin Cross
baa676f671 Fix RuleBuilder.Restat
RuleBuilder.Restat wasn't being propagated to the rule.

Test: rule_builder_test.go
Change-Id: Ie64c8076692ea10a0c47ed5a8832e3f553bea0fc
2019-03-05 03:17:33 +00:00
Colin Cross
0b9f31fb08 Replace *Escape with *EscapeList
Follow the change to blueprint to make *Escape take and return a string
and add *EscapeList that take and return slices of strings.  Fix up
a few places that were unnecessarily converting a string to a slice
and back to a string.

Test: m nothing
Change-Id: I3fa87de175522205f36544ef76aa2f04aef1b936
2019-03-04 18:11:53 +00:00
Roland Levillain
2da5d9a5fe Fix soong.android.RuleBuilderCommand.FlagWithList's comment.
Test: n/a
Change-Id: I96158244feaaaa25ada02275e20418ac30218004
2019-02-27 16:56:41 +00:00
Colin Cross
69f59a3327 Make RuleBuilder methods take Paths
There are no more Make paths being used in Soong now that
dexpreopting and hiddenapi are in Soong. Use the Path types
in the inputs to RuleBuilder, and fix all users of RuleBuilder.

This reapplies I886f803d9a3419a43b2cae412537645f94c5dfbf with
fixes to disable preopt for Soong-only builds when the global
dexpreopt.config doesn't exist.

Test: all soong tests
Test: m checkbuild
Change-Id: I4dae9ecd5de22f062f9478ec8f0747f099cf8190
2019-02-20 22:06:09 -08:00
Colin Cross
ab898dc4a4 Revert "Make RuleBuilder methods take Paths"
This reverts commit acdd694071.

Reason for revert: broke ndk build

Change-Id: I5655e48c15eb8f5f0267afdd853fbc25765b8623
2019-02-21 05:03:00 +00:00
Colin Cross
acdd694071 Make RuleBuilder methods take Paths
There are no more Make paths being used in Soong now that
dexpreopting and hiddenapi are in Soong. Use the Path types
in the inputs to RuleBuilder, and fix all users of RuleBuilder.

Test: all soong tests
Test: m checkbuild
Change-Id: I886f803d9a3419a43b2cae412537645f94c5dfbf
2019-02-20 14:23:37 -08:00
Colin Cross
deabb94380 Add RuleBuilder.Installs().String()
Add a RuleBuilderInstalls type for a slice of RuleBuilderInstalls,
and give it a String() method that returns the list of installs
in the format that is convenient for passing to Make.

Test: rule_builder_test.go
Change-Id: I2e9cd9abf4dfb0ad312d0a6662f1567baf9cd222
2019-02-13 08:03:29 -08:00
Colin Cross
c7ed004dd3 Add RuleBuilderCommand.FlagForEachArg()
Add an analog to FlagForEachInput that takes non-path arguments.

Test: rule_builder_test.go
Change-Id: Ifdf5a16079018bfff9b06ce48b13b104a93fddd7
2019-02-12 17:07:35 -08:00
Colin Cross
0d2f40ae6c Add MissingDeps to RuleBuilder
Add a method to be used when Config.AllowMissingDependencies() is true
to produce an error rule when the rule is missing dependencies.

Test: m checkbuild
Change-Id: If370fbb2734237a84a100b99b5238c7a2256c405
2019-02-06 10:59:42 -08:00
Colin Cross
5cb5b093d1 Add Temporary and DeleteTemporaryFiles to RuleBuilder
Temporary marks an output path as a temporary file that is not
necessary after the rule completes, removing it from the result of
Outputs.  DeleteTemporaryFiles adds a command to the command line
that deletes all files that have been marked with Temporary.

Test: rule_builder_test.go
Change-Id: Ie509ed800992962747fb287858e148e975eee54a
2019-02-05 13:28:43 -08:00
Colin Cross
758290d7ff Improve RuleBuilder documentation and methods
Add a few convenience methods, document all the methods and add
examples that would show up in the godoc if we were to actually
generate it.

Test: rule_builder_test.go
Change-Id: I270fed605ffec34e6f5b36fde0dc9ca52694b741
2019-02-05 13:28:43 -08:00
Colin Cross
786cd6dc13 Allow RuleBuilder to be used with SingletonContext
Make RuleBuilder.Build take a subset of ModuleContext and
SingletonContext, and dynamically call PathForModuleOut only
if it is available.

Test: rule_builder_test.go
Change-Id: Id825cb75236acf187e9d4a36353a47abcac71927
2019-02-05 13:28:43 -08:00
Colin Cross
feec25b084 Move dexpreopt.Script to android.RuleBuilder
Move dexpreopt.Script to android.RuleBuilder so that the builder
style can be used in more places.  Also add tests for it.

Test: rule_builder_test.go
Change-Id: I92a963bd112bf033b08899e930094b908acfcdfd
2019-02-05 13:28:43 -08:00