Commit graph

785 commits

Author SHA1 Message Date
Jaewoong Jung
6c29688691 Split up Soong build doc.
Previously the build doc was a gigantic list of modules and properties,
which can be overwhelming to new users. This change breaks it up by
packages, so that it is easier to look up and feels more coherent.

Bug: 123521276
Test: m soong_docs
Change-Id: I1a1a331f4b4deb8782d698e9076098c5a27b9566
2019-02-20 15:43:06 -08:00
Treehugger Robot
48db2b15fb Merge "Revert "Remove armv7-a without neon support"" 2019-02-20 12:56:37 +00:00
Treehugger Robot
4c317f1cbb Merge "Allow Singletons to export Make variables" 2019-02-20 08:38:23 +00:00
Colin Cross
aa1491fd41 Merge changes I7801fc7c,I7d407bd1
* changes:
  Add CopyOf utility method
  Fix a bug in OncePer.Get that could return a waiter
2019-02-20 07:15:17 +00:00
Dan Albert
8818f49989 Revert "Remove armv7-a without neon support"
Unfortunately we still need to build the NDK sysroot as non-NEON
since that's still supported, though it's no longer the default.

This reverts commit f4e0601c7e.

Test: treehugger
Test: rebuilt NDK sysroot and imported into the NDK, ran NDK tests
Bug: None
2019-02-19 13:53:01 -08:00
Colin Cross
ed023eca73 Allow Singletons to export Make variables
Register any Singletons that implement a MakeVars method as
MakeVarsProviders, and convert the hiddenapi singleton to
use it.

Test: m checkbuild
Change-Id: I6a2044ad34ef46a8b267762ddfeb51aa01d7734d
2019-02-19 12:45:14 -08:00
Colin Cross
454c087be6 Add CopyOf utility method
Add a utility method that returns a copy of a slice of strings.
This is primarily useful when appending to a string slice to avoid
accidentally reusing the backing array.

Test: util_test.go
Change-Id: I7801fc7ca19e27ddc9f1b1b452788b723c7f619c
2019-02-19 11:19:09 -08:00
Colin Cross
d7cfaeeebc Fix a bug in OncePer.Get that could return a waiter
OncePer.Get must call maybeWaitFor on the value it reads, otherwise
it could return a waiter instead of the real value.

Test: onceper_test.go
Change-Id: I7d407bd1c577dbb43bc14fa107d5f606bf2b1c67
2019-02-19 11:19:09 -08:00
Colin Cross
93a9e5e3a2 Don't check ABIs in SecondArchIsTranslated
SecondArchIsTranslated is only used to determine whether or not to
dexpreopt the second arch, so it should return false for the case
where the primary and secondary arches are X86_64 and X86, but the
primary arch also lists an Arm ABI.

Bug: 124711830
Test: m on failing build
Change-Id: I6afc2fdda466e0c406dbeada2e9c3df2bb6853bf
2019-02-19 18:18:30 +00:00
Colin Cross
40e3373d41 Add more paths helper methods
Add PathsForOutput to convert multiple strings into WritablePaths.

Add OutputPath.InSameDir to build a new OutputPath pointing to a
file in the same directory as an existing OutputPath.

Add WritablePathForTesting and WritablePathsForTesting that mirror
PathForTesting and PathsForTesting but return WritablePaths.

Add PathContextForTesting to return a minimal PathContext
implementation.

Test: paths_test.go
Change-Id: I9708eb164b273514a96dae0a260ef9a963fb9bcf
2019-02-16 17:08:07 -08:00
Colin Cross
800fe13146 Move dexpreopting of boot jars into Soong
Implement the dexpreopting of boot jars in singleton rules in
Soong.

Test: m checkbuild
Change-Id: Ic02ce941fa5e238b839b3eb4c06a3e10c62d98ff
2019-02-15 16:16:25 -08:00
Jaewoong Jung
fc46f28b6f Merge "Add a prebuilt module type for usr/share." 2019-02-14 15:39:33 +00:00
Jaewoong Jung
dfa4a486eb Merge "Update Soong docs generator for blueprint changes" 2019-02-14 01:51:04 +00:00
Inseob Kim
c0907f191a Create sysprop_library soong module
A newly introduced sysprop_library soong module will generate a
java_sdk_library and a cc_library from .sysprop description files.
Both Java modules and C++ modules can link against sysprop_library
module, thus giving consistency for using generated sysprop API.

As Java controls accessibility of Internal / System properties with
@hide and @SystemApi, 2 different header files will be created. And
build system will selectively expose depending on the property owner
and the place where the client libraries go into.

Bug: 80125326
Bug: 122170616
Test: 1) Create sysprop_library module.
Test: 2) Create empty txt files under prebuilts/sdk.
Test: 3) Create api directory, make update-api, and see changes.
Test: 4) Try to link against sysprop_library with various clients.
Test: 5) Soc_specific, Device_specific, Product_specific, recovery flags
work as intended.
Change-Id: I78dc5780ccfbb4b69e5c61dec26b94e92d43c333
2019-02-13 23:32:51 +00:00
Jaewoong Jung
c3fcdb4baa Add a prebuilt module type for usr/share.
This is almost the same as prebuilt_etc except the base path.

Bug: 122616578
Test: prebuilt_etc_test.go + manual test with external/neven
Change-Id: Ie3d17c06a878853ec9df93fe2c61c8772bc5cff4
2019-02-13 12:56:24 -08:00
Colin Cross
7089c27c07 Update Soong docs generator for blueprint changes
bootstrap.ModuleTypeDocs needs a mapping of module types to factories
to support factories that are wrapped in ModuleFactoryAdapter closures.

It also returns ModuleType objects grouped into Package objects.

Bug: 67909957
Test: m soong_docs
Change-Id: I70eac9f0f0e13075580da92d4219792ca0b18fbf
2019-02-13 20:39:26 +00: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
8854a5a805 Add OutputPath.ReplaceExtension()
Add a helper method that returns a new OutputPath with the
extension replaced.

Test: paths_test.go
Change-Id: I7f93b3475031a19b53652022740488373a1b7d97
2019-02-12 17:07:35 -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
74ba962d29 Use ArchType in dexpreopt config
Make ArchType implement the encoding.TextMarshaller and
encoding.TextUnmarshaller interfaces so that it can be used
as a value in the dexpreopt config structs that are passed
through JSON files.

Test: m checkbuild
Change-Id: Ie4c12443e7ee5fe43f42d5403bcde12d62f617e2
2019-02-12 17:05:47 -08:00
Colin Cross
a838004f8c Merge "Run makevars singleton after all other registered singletons" 2019-02-13 00:27:33 +00:00
Treehugger Robot
75569e0f46 Merge "Make OncePer.Once reentrant" 2019-02-12 22:58:09 +00:00
Colin Cross
450bde14b8 Merge "Change type of Once keys to OnceKey" 2019-02-12 21:13:56 +00:00
Colin Cross
e5cdaf9221 Make OncePer.Once reentrant
The value constructor passed to OncePer.Once may call back into
Once.  Replace the global mutex with a temporary channel stored
in the map using the key, and have callers for the same key
wait on the channel if they find it instead of a real value.

Test: TestOncePerReentrant
Change-Id: Ifa88a3c48981b5076b83f47fbdee5d26311725c6
2019-02-12 19:03:53 +00:00
Colin Cross
580d2ce642 Run makevars singleton after all other registered singletons
Move the makevars singleton after all dyamically registered
singletons, but before the env singleton, to ensure that it
can reference values initialized in other singletons.

Test: m checkbuild
Change-Id: I6ea45d3a174b94d4e89f3168894399e7022733e4
2019-02-11 15:29:51 -08:00
Colin Cross
e48ff5bbd4 Change type of Once keys to OnceKey
Require that the key for Once calls be created with NewOnceKey
or NewCustomOnceKey.

Test: m checkbuild
Change-Id: I44b8ea6034338b45f558f862b21d5732364cbf0f
2019-02-11 15:29:51 -08:00
Jaewoong Jung
0dcfee56b8 Merge "Make PrebuiltEtcHostFactory public." 2019-02-11 16:22:13 +00:00
Mikhail Naganov
ab1f518fb0 Improve error messages about paths
Quote the path parameter in the message to distinguish it
from the text. This makes messages more understandable.

Before: source path include does not exist
After:  source path "include" does not exist

Test: build Android
Change-Id: I99dbbce3cf090682a230d05bf120549a2cc7af3c
2019-02-08 13:32:08 -08:00
Colin Cross
3e48a994e8 Merge "Allow disabling implicit resource_dirs and asset_dirs" 2019-02-08 02:29:35 +00:00
Colin Cross
0ddae7fddd Allow disabling implicit resource_dirs and asset_dirs
Specifying [] for resource_dirs or asset_dirs will prevent using
the default "res" or "assets" directories.

Test: TestResourceDirs
Bug: 124035856
Change-Id: I96e38ac1319260db43950299a8b1774da68ea85e
2019-02-08 00:24:01 +00:00
Colin Cross
65494b962b Make MakeVarsContext a PathContext
Expose all of SingletonContext to makeVarsContext, and then export
the subset of it that is used through MakeVarsContext.SingletonContext,
plus what is necessary for PathContext, directly through
MakeVarsContext.

Test: m checkbuild
Change-Id: Ie00f36e577fe110b6fa03b901da489d8547773c6
2019-02-07 22:31:04 +00:00
Jaewoong Jung
4b44fcd772 Make PrebuiltEtcHostFactory public.
Bug: 122332220
Test: prebuilt_etc_test.go + manual builds
Change-Id: Ia2f882f0d18f3f06f396b2bf3f3052d27c6ab96d
2019-02-07 08:28:03 -08:00
Treehugger Robot
4c3a4aded3 Merge changes from topic "hiddenapi"
* changes:
  Move hiddenapi singleton rules to Soong
  Add MissingDeps to RuleBuilder
2019-02-07 07:27:33 +00:00
Colin Cross
f24a22a98a Move hiddenapi singleton rules to Soong
Move the rules that build hiddenapi-stubs-flags.txt,
hiddenapi-flags.csv and hiddenapi-greylist.csv into Soong.

Bug: 123645297
Test: m checkbuild
Test: m UNSAFE_DISABLE_HIDDEN_API_FLAGS=true
Change-Id: I90bf58710f6153ee8565994f799d3ec5699bc7fa
2019-02-06 11:23:40 -08:00
Jaewoong Jung
e3c98e7ba4 Merge "Add prebuilt_etc_host module type." 2019-02-06 19:22:09 +00: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
571cccfcbc Prepare for a type-safe OnceKey
Add an opaque OnceKey type and use it for all calls to Once in
build/soong.  A future patch will convert the arguments to
Once* to OnceKey once users outside build/soong have been updated.

Test: onceper_test.go
Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
2019-02-06 01:52:41 +00: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
Jaewoong Jung
24788182a9 Add prebuilt_etc_host module type.
Change-Id: I667ac7325331fa2c1ecaa0f68c24bfb6d47aa8ad
Fixes: 123380976
Test: prebuilt_etc_test.go + external/parameter-framework/Schemas.mk
2019-02-04 14:48:51 -08:00
Kostya Kortchinsky
d5275c8657 Add option to disable Scudo globally [Soong]
This adds an option in Soong to turn off Scudo globally.

Bug: 123228023
Test: enable Scudo for tombstoned, lunch marlin_svelte-eng && m -j, and
make sure that Scudo is not linked in
out/target/product/marlin/system/bin/tombstoned
Test: enable Scudo for tombstoned, lunch marlin-userdebug && m -j, and
make sure that Scudo is linked in
out/target/product/marlin/system/bin/tombstoned

Change-Id: I0b0992446953fc4074bde94507b66f92764c8143
Merged-In: I0b0992446953fc4074bde94507b66f92764c8143
2019-02-04 12:29:17 -08:00
Colin Cross
54956abf1f Merge changes I545a832a,I85a51b04
* changes:
  Remove empty DepsMutator methods
  Replace *[]string with []string in product variables
2019-02-04 17:38:05 +00:00
Anton Hansson
ce0e258977 Write out module owner for prebuilt_etc
Translate owner: "x" into LOCAL_MODULE_OWNER := x in prebuilt_etc
rules.

Test: unit test in CL exercised with m nothing
Change-Id: Ic177b61e6f685f7a0263129a34acdf0bd46d16c2
2019-02-04 14:20:43 +00:00
Colin Cross
5f692ec219 Remove empty DepsMutator methods
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
2019-02-01 17:17:58 -08:00
Colin Cross
a74ca046da Replace *[]string with []string in product variables
There is no need for *[]string, []string can already hold a nil
value to specify "not set".

Test: all soong tests
Change-Id: I85a51b042c12aee1565a9287d62924feeeafd486
2019-02-01 16:43:02 -08:00
Dan Willemsen
b05526711e Add sh_binary[_host] for shell script that should be installed as executable
We've been putting these in cc_prebuilt_binary, but that's not really
correct. It also tries adding '.exe' to the end of windows executables,
which isn't desirable for bat files.

Test: Use sh_binary_host
Change-Id: Idd5418dceb81ac55b766c987fbb69a810aeb8a3b
2019-01-28 10:59:10 -08:00
Jaewoong Jung
10357c3b22 Merge "Add a prod var to override package names." 2019-01-25 22:07:48 +00:00
Colin Cross
cb9880786d Optimize filterArchStruct when nothing is filtered
Runtime-created struct types have limit on the name of the type,
which is the full text of the fields in the struct.  Avoid creating
runtime struct types when filtering produces an identical struct.
Also add tests and godoc for filterArchStruct.

Test: arch_test.go
Change-Id: If7eb27ea9e72073d5252e93f2110b08889ed76b1
2019-01-25 21:26:53 +00:00