aboutsummaryrefslogtreecommitdiffstats
path: root/genrule
Commit message (Collapse)AuthorAgeFilesLines
* Fix missing genrule srcs and tools with ALLOW_MISSING_DEPENDENCIES=trueColin Cross2019-04-162-6/+68
| | | | | | | | | | | | | | | Set the location label for missing srcs and tools to avoid nonsensical errors when parsing the command. Cherry-pick note: Being cherry-picked to qt-dev to fix unbundled -qt builds, see b/130588113. Bug: 130588113 Test: genrule_test.go Test: paths_test.go Test: unbundled branch with missing framework-res module needed by robolectric genrule Change-Id: I9c1f1cd82a80f048c0e903b8e93910b1ae34b0b1 (cherry picked from commit ba71a3fb116729a73a950ed1e319069d219bb25b)
* Add support for protoc pluginsColin Cross2019-04-022-3/+5
| | | | | | | | | Add a proto.plugin property to allow specifying a custom protoc plugin to generate the code. Fixes: 70706119 Test: m am StreamingProtoTest Change-Id: I1ecdd346284b42bbcc8297019d98d2cd564eb94c
* Export genrules to Make as phony packagesColin Cross2019-03-201-0/+26
| | | | | | | | | | Export genrules to Make, which will allow it to support dist-for-goals. Test: m PRODUCT-sdk_phone_armv7-win_sdk sdk_repo dist Bug: 80494441 Bug: 128878015 Change-Id: Idb8dfcec2be5bfab94d17395826ef451b0dd9b63
* Replace ctx.ExpandSources with android.PathsForModuleSrcColin Cross2019-03-201-2/+2
| | | | | | | | | | | Move the logic from ctx.ExpandSources into android.PathsForModuleSrc and ctx.ExpandSource into android.PathForModuleSrc, and deprecate them. When combined with the pathDepsMutator this will let all properties that take source paths also take filegroups or genrule outputs, as long as they are tagged with `android:"path"`. Test: All soong tests Change-Id: I01625e76b5da19240e9649bf26a014eeeafcab8f
* Annotate paths and deprecate ExtractSource(s)DepsColin Cross2019-03-071-5/+3
| | | | | | | | | Add `android:"path"` to all properties that take paths to source files, and remove the calls to ExtractSource(s)Deps, the pathsDepsMutator will add the necessary SourceDepTag dependency. Test: All soong tests Change-Id: I488ba1a5d680aaa50b04fc38acf693e23c6d4d6d
* Replace *Escape with *EscapeListColin Cross2019-03-041-1/+1
| | | | | | | | | | 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
* Remove empty DepsMutator methodsColin Cross2019-02-012-5/+0
| | | | | | | | Add an empty DepsMutator to ModuleBase so it doesn't have to be implemented on every module that doesn't need it. Test: all soong tests Change-Id: I545a832a0dbf27386d3080377a75ea482cd9ce59
* Add defaults support to genrule.Jaewoong Jung2019-01-042-0/+79
| | | | | | Bug: 119635195 Test: genrule_test.go Change-Id: I8aeff18760b031491012dd4864985b4ed01dbf3a
* Add support for exclude_srcs in genruleDan Willemsen2018-11-181-1/+4
| | | | | Test: build iptables with Soong Change-Id: Ibffc188868f6e9fb86fbf932c010eccf7f4233bf
* Allow cc_genrule srcs to vary by architectureColin Cross2018-10-232-3/+3
| | | | | | | | Add arch_variant to the genrule srcs property so that cc_genrule modules can vary the srcs and outs by architecture. Test: cc/genrule_test.go Change-Id: Idb17013e137d7ca21ca4cfc3e4c1fa7d89977043
* genrule: add $(location) for inputs and outputsColin Cross2018-10-082-33/+187
| | | | | | | | | | | | | | | | | | | There was no way to select a single source file from a genrule that has multiple source files. Make Soong's genrule closer to Bazel by supporting $(location) for input and outputs. Change the label used for tools referenced through filegroups to the name of the module instead of the name of the file, which means it matches the string used in the tools property. Also support :module format in the tools property in preparation for deprecating the tool_files property and putting both files and modules in the tools property. Bug: 117354232 Test: genrule_test.go Change-Id: Id31a4ac4ff7064076a576c1d8ffeb7c19fc6b9a4 Merged-In: Id31a4ac4ff7064076a576c1d8ffeb7c19fc6b9a4 (cherry picked from commit 098d22b5f6d965872b524ce798ce728580ce405c)
* Add tests for genrule command expansionColin Cross2018-10-052-2/+378
| | | | | | | Add tests for expanding variables in a genrule cmd property. Test: genrule_test.go Change-Id: I8288b8616d518bb5f24a892c4e59f68d95055d0a
* Collect modules' info to create IDE project file.Brandon Lee2018-09-181-0/+11
| | | | | | | | | | | | | | | | - Register a singleton and implement GenerateBuildActions func in java/jdeps.go. - Declare a interface and a struct to collect info in android/module.go. - Implement IDEInfo for Library & Import module in java/jdeps.go. - Implement IDEInfo for Genrule module in genrule/genrule.go. - Implement IDEInfo for fileGroup module in android/filegroup.go. - Test codes for jdeps.go in java/jdeps_test.go. Bug: 111044346 Test: export SOONG_COLLECT_JAVA_DEPS=1;mmm packages/apps/Settings out/soong/module_bp_java_deps.json will be generated Change-Id: If61da77b4d7614c2c5da438b6af4c725ceccc5c3
* 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