aboutsummaryrefslogtreecommitdiffstats
path: root/genrule
Commit message (Collapse)AuthorAgeFilesLines
* Fix `go vet` issuesDan Willemsen2018-07-221-1/+1
| | | | | Test: go vet ./... Change-Id: Ifb936ccc5e2b5a2c3fcbbbcb54f680e2973ea1b3
* Fix error reporting when parsing genrule cmdColin Cross2018-07-091-11/+16
| | | | | | | | | | | | Report errors inside the android.Expand lambda and don't return an error so that processing can continue and multiple errors can be reported. Check for errors (for example incorrect syntax of variables) immediately after Expand returns. Avoids a misleading error message: specified depfile=true but did not include a reference to '${depfile}' in cmd Bug: 111219250 Test: m checkbuild Change-Id: Id9a16c1609f5fd9345bfa1a2191261cff72fd382
* Remove references to SourceDepTag in module typesColin Cross2018-06-061-4/+0
| | | | | | | | | | SourceDepTag is going to become a set of tags of the same type instead of a single tag, remove references to it outside the android module. Bug: 80144045 Test: soong tests Change-Id: I00b2ea5040e4fc95dfbfdd79e21579853c478fcb
* Fix few issues with filegroupsPirama Arumuga Nainar2018-04-181-95/+0
| | | | | | | | | | | | | | | | | | | | Bug: http://b/64121881 Bug: http://b/78188880 - Allow filegroup's properties to be extended by a LoadHook - Support a filegroup (':module') in a prebuilt's 'Srcs' property to export files from a different path as the prebuilt's sources. This change also includes a refactoring that moves genrule/filegroup.go to android/filegroup.go so that FileGroupFactory is visible in prebuilt_test.go. Test: Test https://android-review.googlesource.com/c/platform/development/+/469159 in clang-tools branch on Linux, Darwin. Test regular build in aosp/master. Change-Id: I3ff6215ab2e62955f039fd1086c31f1bd50ebcf6
* Fix the flaky build breakage for droiddoc target.Nan Zhang2018-03-282-2/+2
| | | | | | | | | | | | | | ExpandSourcesSubDir was calling SourceFileProducer.Srcs(), and then doing: moduleSrcs = append(moduleSrcs[:j], moduleSrcs[j+1:]...) This modifies the backing store of the slice, which may affect the original data stored in the SourceFileProducer. Make all Srcs implementations return slice that points to a copy of the backing array. Test: m out/target/common/obj/PACKAGING/checkpublicapi-current-timestamp Bug: b/76179848 b/76397326 Change-Id: I2432ce196984814daafc5aa9a2746e81de74494c
* Only depend on a single file for generated headersDan Willemsen2018-02-221-0/+7
| | | | | | | | | | | | | | | | While the rule may really need all of the generated header files to exist, only one of them (per genrule task) needs to be in the dependency list, since the rest are essentially aliases. This brings an AOSP aosp_arm-userdebug out/soong/build.ninja file from 372MB to 156MB, with equivalent functionality. The Android-aosp_arm.mk file is reduced from 11MB to 6.5MB. Bug: 73745773 Test: diff out/soong/build.ninja Test: diff out/soong/Android-aosp_arm.mk Test: rm -rf out; m Change-Id: If17377666292cc20957417fc4c3cd52f98971d0c
* Use __SBOX_OUT_DIR__ in sbox output file listColin Cross2018-02-211-17/+31
| | | | | | | | | | | | | | | The path to the output directory may be arbitrarily long, use __SBOX_OUT_DIR__ in the list of output files passed to sbox to avoid expanding it multiple times in the command line. Fixes: ninja: fatal: posix_spawn: Argument list too long 09:40:14 ninja failed with: exit status 1 when building libchrome with a long OUT or OUT_DIR_COMMON_BASE. Bug: 73726635 Test: m checkbuild Change-Id: I59024b2164287c8e531711afd9273b692ce9c28a
* Revert "Revert "Support filegroup in exclude_srcs""Nan Zhang2018-02-151-0/+1
| | | | | | | | | This reverts commit 606e9de344fae07473dd79e5ac556886a72035de. Reason for revert: <try to fix the broken build yesterday> Change-Id: I2963b9af63c7c7398159e5e9a1e448266e1c81d5 Test: unittest
* Revert "Support filegroup in exclude_srcs"Tobias Thierer2018-02-091-1/+0
| | | | | | | | | | This reverts commit f36a3d9b6da654bf8bd7a49315b1625cf0e774ce. Reason for revert: Broke several builds. I'm acting build cop, reverting. Bug: 70351683 Change-Id: I775ada4e9cb6473519d51420b41b818af163da44
* Support filegroup in exclude_srcsNan Zhang2018-02-071-0/+1
| | | | | | Test: add unit-test, m -j32 Bug: b/70351683 Change-Id: Iff83c56d45dd668d9df6131c7df2e23e5c73a21b
* Escape genrule commandsJeff Gaston2017-12-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | Bug: 70387174 Test: Put this text into an Android.bp: genrule { name: "test_genrule", tool_files: ["foo"], out: ["foo.c"], cmd: "for i in a b c; do echo $$i; done > $(out)", } cc_library { name: "libtest_genrule", srcs: [":test_genrule"], } and then run `m -j libtest_genrule`. Although the library shouldn't compile, check that it produces a foo.c that has "a\nb\n\c\n" and not "\n\n\n". Change-Id: I139106479439c9b3a95f1a2ecc23e73570d7bd59
* Allow java binary wrapper files to reference filegroupsColin Cross2017-12-111-6/+5
| | | | | | | | Also allow commands with no tools for the case when standard shell utilities are used to munge an input file. Test: m checkbuild Change-Id: Ie061e90cafe1a0a0db004a89e9a17fb48709cb03
* Allow globs in tool_filesColin Cross2017-12-081-8/+9
| | | | | | | | tool_files can be used to add dependencies on files used by tools, so let it support globs. Test: m checkbuild Change-Id: I1c1cb098190e1bb1c81292f6eb0c4ed0e240c1e1
* Replace ModuleContext.AConfig() with Config()Colin Cross2017-11-301-2/+2
| | | | | | | | | AConfig() now duplicates Config(). Replace the uses of AConfig() with Config(). Leave AConfig() for now until code in other projects is cleaned up. Test: m checkbuild Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
* Fix genrules depending on Go toolsColin Cross2017-11-171-1/+9
| | | | | | | | | | | | | genrules lost the ability to depend on Go tools after I05e945f38915d49cd3c0ab72a86576949bc7eff2 which converted VisitDirectDeps from blueprint Modules to android Modules. Add VisitDirectDepsBlueprint to visit all modules including blueprint Modules, and use it in genrule. Also add a check for disabled modules that was being handled by VisitDirectDeps. Test: m checkbuild Change-Id: I65724283166c63596d071e598c08fed87ef32896
* Change remaining properties to *string, *bool in Soong.Nan Zhang2017-11-091-2/+2
| | | | | | Test: m -j checkbuild Bug: b/68853585 Change-Id: I0fd10ff31e90c1941e80cfbf25e40e9988f1e202
* Change bool, and string properties to *bool, and *string for java,Nan Zhang2017-11-082-15/+17
| | | | | | | | python, and genrule. Test: m -j checkbuild Bug: b/68853585 Change-Id: Ic9a8083818e920dc399a4b00841e2aa496f70faa
* Consolidate gensrcs implementation into one task eachJeff Gaston2017-11-081-25/+57
| | | | | | | | | | in preparation for each task to delete its output dir before running. Bug: 38205169 Test: rm out -rf && m -j Change-Id: Ifcd42073d4fb74f532adc0c095555b4a542feb99
* Have genrule use $genDir as sbox's --output-rootJeff Gaston2017-11-081-17/+5
| | | | | | | | | rather than passing buildDir . This will make it reasonable for sbox to delete its --output-root Bug: 38205169 Test: m -j Change-Id: Ic3a82a8df040117870c251c068a88545143257cf
* Make $(depfile) work with sboxJeff Gaston2017-10-301-13/+36
| | | | | | | | | Most notably, the sandbox depfile path should be passed into the tool. Bug: 68336760 Test: m -j checkbuild Change-Id: I22f944a3f57d613fda26de0ea777a915cafcd020
* Convert Visit*Deps from blueprint.Module to android.ModuleColin Cross2017-10-241-1/+1
| | | | | | | | Also adds checks that the dependencies are android.Modules and are not disabled. Test: m checkbuild Change-Id: I05e945f38915d49cd3c0ab72a86576949bc7eff2
* Move ModuleContext.ModuleBuild to ModuleContext.BuildColin Cross2017-10-241-2/+2
| | | | | | | | | | | | Now that android.ModuleContext does not include blueprint.ModuleContext we can rename android.ModuleContext.ModuleBuild to android.ModuleContext.Build without colliding with blueprint.ModuleContext.Build. Leave ModuleBuild as a wrapper around Build for now to avoid having to update all the users outside build/soong simultaneously. Test: m checkbuild Change-Id: I18eb8cc04faf002049a11d9aac97e9732ff5d638
* Support multiple outputs in genrules with depfile: trueColin Cross2017-10-201-7/+15
| | | | | | | | | Ninja doesn't support depfiles on a rule with multiple outputs. Use a single output and put all the rest as implicit outputs. Bug: 68057449 Test: java_test.go Change-Id: Ia544493b1b3b51b185c865149d8f3e0eb3c57ee2
* Use indent to preformat genrule property documentationColin Cross2017-10-181-7/+7
| | | | | Test: manual inspection of soong_build.html Change-Id: Ibb5086de5497eb096ee7f68a5fd1ccaba630aa89
* Add test for java generated sourcesColin Cross2017-10-091-4/+4
| | | | | | Bug: 67364649 Test: TestGeneratedSources Change-Id: I5400e4b013dc47c04b9d32787e50c5281033484d
* Merge "Allow exporting filegroups to make"Treehugger Robot2017-09-191-0/+28
|\
| * Allow exporting filegroups to makeColin Cross2017-09-181-0/+28
| | | | | | | | | | | | | | | | Allow sharing lists of files between make and soong by allowing filegroups to export them as a make variable. Test: m -j checkbuild Change-Id: I27ae2f6d180bf01d69a628dbe59edcdba93da015
* | Add cc_genruleDan Willemsen2017-09-181-16/+30
|/ | | | | | | | cc_genrule is the same as a normal genrule, but can depend on other cc modules (like cc_object). Test: mmma external/minijail Change-Id: I8df87665c7bdc76ce89c92755c054f967a818e57
* Support using blueprint_go_binary as tools in genrulesDan Willemsen2017-09-141-9/+20
| | | | | | Test: m Test: Add genrule using go tool; m Change-Id: I9a85348b6cf41f2cdb7684f787553c07de220d67
* Use dependency tags for genrulesDan Willemsen2017-09-141-10/+30
| | | | | | | | So that we don't get confused when using :<module> in srcs to depend on a module that could also be a HostBinTool. Test: m -j Change-Id: Ia3b1c26826e70f84c6dc5ff78c95dd11d76901b6
* Refactor factoriesColin Cross2017-06-302-10/+12
| | | | | | | | | Change module factories from returning a blueprint.Module and a list of property structs to returning an android.Module, which holds the list of property structs. Test: build.ninja identical except for Factory: comment lines Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
* Make absolute OUT_DIR work with sboxJeff Gaston2017-06-121-11/+8
| | | | | | | | Test: make OUT_DIR=/tmp/abspath Test: make OUT_DIR=relative-out Bug: 35562758 Change-Id: I688d5f6117b194440c5d01c1040033b5671187c2
* Have Soong try to enforce that genrules declare all their outputs.Jeff Gaston2017-06-091-8/+38
| | | | | | | | | | | This causes Soong to put the outputs of each genrule into a temporary location and copy the declared outputs back to the output directory. This gets the process closer to having an actual sandbox. Bug: 35562758 Test: make Change-Id: I8048fbf1a3899a86fb99d71b60669b6633b07b3e
* Prettify soong ninja build descriptionsColin Cross2017-05-101-4/+10
| | | | | | | | | | | | | | | | | Descriptions currently look like: [ 0% 4/29328] cc out-soong/.intermediates/external/clang/lib/Sema/libclangSema/android_arm_armv7-a-neon_denver_static_core/obj/external/clang/lib/Sema/SemaCodeComplete.o This is not very helpful - most of the characters are used to show the output path, which contains useful information like target architecture, but also contains most of the path to the source files twice, and less useful information like the exact variant name used by soong. Make the descriptions look like: [ 0% 3/29329] //external/clang/lib/Sema:libclangSema clang++ SemaTemplateInstantiate.cpp This is //path/to/module:modulename tool relative/path/to/source/file Test: builds, looks pretty Change-Id: I3087aa7d4eb1860ef6239d77407b8b35445616d7
* Fix genrule documentationDan Willemsen2017-05-091-1/+1
| | | | Change-Id: Ieffb2bd7d739527db129ff300d8aec70d82c278a
* Exit early on genrule command parsing failureColin Cross2017-04-191-0/+1
| | | | | | | | cmd may be empty if android.Expand fails, and continuing results in a panic. Return immediately. Test: m -j checkbuild Change-Id: Ibf4d57ce048db9f7f16ce118ed9e9ecea5a6551c
* Use a minimal set of mutators, module types, and singletons for testsColin Cross2017-03-161-2/+2
| | | | | | | | | | | | Calling android.NewContext() in tests results in a context that contains all the mutators, module types, and singletons, which causes unexpected interactions in unit tests. Create an empty context instead, and add in only the necessary mutators, module types, and singletons. Bug: 36366816 Test: soong tests Change-Id: Ic61262c37e3436b3ad4ccaca18b737021c304be6
* Merge "Support data properties for test binaries"Colin Cross2017-02-061-1/+7
|\
| * Support data properties for test binariesColin Cross2017-02-021-1/+7
| | | | | | | | | | | | | | | | | | | | | | Allow tests to specify a data property that lists files or filegroup modules that will be packaged alongside the test. Also add a path property to filegroup modules to allow shifting the path of the packaged files, and add ExpandSourcesSubDir to expand the filegroup sources while including a shifted relative path in the Paths objects. Test: soong tests, manually adding data to a module Change-Id: I52a48942660e12755d313ef13279313361b4fc35
* | Allow non-tool dependencies in genrulesColin Cross2017-02-041-2/+0
|/ | | | | | | | | | | The genrule tool dependency handling was rejecting any dependencies that were not tools. This caused a failure when ExtractSourceDeps added a source file dependency on a filegroup module. Remove the unnecessary check in the tool handling. Test: builds Bug: 35002681 Change-Id: Ibd8dff306be3ef55aac2e12a28ddc187be2234d9
* Allow genrules to reference generated sourcesColin Cross2017-01-131-12/+10
| | | | | | | | Call ExtractSourceDeps on genrule srcs properties. Bug: 34283327 Test: no change to build.ninja Change-Id: I934a418f32d4c94400728579543ca5c910bf7dfc
* Support filegroupsColin Cross2016-12-172-0/+65
| | | | | | | | | | filegroup is a module that contains a list of files, and can be used to export files across package boundaries. filegroups (and genrules) can be referenced from srcs properties of other modules using the syntax ":module". Test: m -j Change-Id: I3d6fc4819c0b4225b474e0ad42f0d947f55a5961
* genrule: let Android.bp file specify exported header dirsColin Cross2016-11-221-6/+16
| | | | | | | | Instead of exporting the generated sources dir as headers, let the Android.bp file specify subdirectories as exported. Test: m -j checkbuild Change-Id: I18dd900d63ce7485c8fbfcc39dc77abad6f733d7
* genrule: support deps filesColin Cross2016-11-221-4/+24
| | | | | | | | If a genrule sets deps_file: true, use a file in the gen directory as a GCC-style deps file. Test: m -j libLLVMObject Change-Id: Id410165847e4eaea1853a392512e38787c431523
* Support genrules with multiple toolsColin Cross2016-11-071-54/+74
| | | | | | | | | | | | | | | To allow genrules with more than one tool, rename the tool property to tools and make it an array, replace $tool with $(location <label>), and use $() for other variables for consistency. Also remove the host bin directory from the genrule path, and the $srcDir variable, using either of them would have caused dependency issues. Bug: 31948427 Test: compare build.ninja Change-Id: Icf6d3bce2bea00fec1363fd65c0bdf96d09281bf (cherry picked from commit de6bd86d240b98b7ea7ff6a0454a13edc639a163)
* Add subdir to GenPathDan Willemsen2016-11-021-1/+1
| | | | | | | | | We were emulating this for proto files, standardize it and make the other generators use it as well. Test: Compare out/soong/build.ninja before/after change Test: mmma -j system/tools/hidl Change-Id: I1888c7b981749060a398387bbb9b481270bf6d75
* Control mutator orderColin Cross2016-10-121-3/+1
| | | | | | | | Register mutators inside lambdas that are called in a defined order to correctly order mutators before and after the arch and deps mutators. Test: build.ninja identical Change-Id: Iefe2a3515aee8570e76a6e76925db4cda0e9e822
* Move registration into android packageandroid-n-mr1-preview-2android-n-mr1-preview-1Colin Cross2016-10-121-3/+2
| | | | | | | | Mutator registration is tightly coupled with the android package, move all registration from the soong package to the android package. Test: build.ninja identical Change-Id: Ie183d0b52cc7431c9e05b231934d189208ef1efe
* Support multiple outputs for genruleDan Willemsen2016-09-281-7/+13
| | | | | | | | | | | The underlying code to expose outputs to other modules has suppported this already for gensrcs (which runs the command multiple times to create multiple outputs). This allows a genrule to run a command once, and output multiple files. Bug: 31742855 Test: Add multi-output genrule; Inspect build.ninja Change-Id: I72054cc39c0d0e3e44feebba72005e5af1a1709a
* Parse genrule's cmd propertyDan Willemsen2016-09-281-3/+26
| | | | | | | | | | | Instead of just passing this to ninja, use os.Expand to parse the variable substitutions. While we're here, define a new "genDir" variable that is the root of this module's generated directory. Bug: 31742855 Test: Ensure invalid variables cause error Test: Inspect commands in build.ninja Change-Id: Iff6d0499ab57367669e73df52ab7c647358da13b