Commit graph

768 commits

Author SHA1 Message Date
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
Jaewoong Jung
9d22a914bf Add a prod var to override package names.
Currently only java/app.go is affected by package name overrides. When
the var is used, the corresponding module's install APK name is changed
to the overriding name.

Bug: 122957760
Test: app_test.go + TreeHugger
Change-Id: Ie522da3d7280970d740d779cf2694560feae6180
2019-01-25 19:11:57 +00:00
Dan Willemsen
e4f12785db Merge "Remove armv7-a without neon support" 2019-01-25 03:52:17 +00:00
Treehugger Robot
2f4789d612 Merge "Avoid filepath.Abs" 2019-01-25 00:35:24 +00:00
Dan Willemsen
f4e0601c7e Remove armv7-a without neon support
Test: treehugger
Change-Id: I8565d84224daedb6a6dde6dfb9c0fe5f5fabb0f6
2019-01-24 15:51:26 -08:00
Colin Cross
7b3dcc31eb Avoid filepath.Abs
filepath.Abs is surprisingly expensive, it calls os.Getwd every
time, which involves multiple syscalls, a lock, and and allocations.
Use IsAbs and prefix matching instead.

Test: paths_test.go
Change-Id: Ia6cf34d6bef24c694702af1e7a6ff08ffd2d822b
2019-01-24 21:35:16 +00:00
Doug Horn
c32c6b0d79 Support building for Fuchsia.
This CL adds configs for the arm64 and x64 fuchsia
device targets, sets up the necessary linker flags,
and disables some functionality that is not currently
supported on Fuchsia.

Bug: 119831161
Test: Compile walleye, internal validation against
fuchsia_arm64-eng and fuchsia_x86_64-eng.
Change-Id: I2881b99d2e3a1995e2d8c00a2d86ee101a972c94
2019-01-24 18:59:29 +00:00
Jaewoong Jung
2ad817c65d Enable certificate overrides with product vars.
Currently it is only for android_app, though it can be easily ported to
apex.

The make-side change will be made later, along with a real application.

Bug: 122957760
Test: app_test.go
Change-Id: I41f0be84f8b9f93e9518a16160e10eaa649388cd
2019-01-24 14:55:58 +00:00
David Brazdil
91b4e3e78b Disable all-assigned check in hiddenapi on master-art
Master-art configurations do not have frameworks/base and therefore do
not have hidden API flags. Pass --no-force-assign-all to `hiddenapi`
when frameworks/base does not exist to disable the corresponding
assertion. This enables us to enforce the assertion on non-master-art
builds and also get rid of logspam about missing flags on ART buildbots.

Test: art/tools/buildbot-build.sh on master-art
Bug: 123143676
Change-Id: I074d9554fb11dab3eef904016375730520107ec2
2019-01-23 22:55:41 +00:00
Logan Chien
f1b3352b97 Merge "Add prebuilt ABI checker support to soong" 2019-01-23 07:21:17 +00:00
Logan Chien
4fcea3d9a3 Add prebuilt ABI checker support to soong
This commit adds prebuilt ABI checker support to soong so that
`cc_prebuilt_library_shared` and `cc_prebuilt_binary` are checked.

To opt out the check, add `check_elf_files: false` to your module.

Bug: 119086738
Test: lunch aosp_sailfish-userdebug && CHECK_ELF_FILES=true make check-elf-files
Change-Id: Idb4290c8f48aad545894a7ae718a537cbf832233
2019-01-23 10:15:02 +08:00
Colin Cross
afbb1734f6 Pass annotation processors to kotlinc
Enable the kotlin-annotation-processing plugin and pass annotation
processors to it.

Bug: 122251693
Test: m checkbuild
Test: TestKapt in kotlin_test.go
Change-Id: I841df454beaaa7edd263eea714ca0d958a03c9de
2019-01-22 21:47:19 +00:00
David Brazdil
0f670a22df Replace hiddenapi-{public,private}-list.txt with a CSV file
`hiddenapi` is being refactored to work with a single CSV file as
opposued to a multitude of text files (one per flag). This patch
changes the singleton rule for listing public/private APIs from
stubs to expect a CSV as an output.

Bug: 119068555
Test: compiles, hiddenapi-flags.csv unchanged
Change-Id: I622521d59979a6b01ecc8065a278412fedf7b9bc
2019-01-21 14:30:49 +00:00
Treehugger Robot
8abbd93928 Merge "Fix incorrect soong symlink rule" 2019-01-18 00:32:36 +00:00
Colin Cross
8faf8fc060 Move hiddenapi to Soong
Perform hiddenapi CSV generation and dex encoding for Soong modules
in Soong.  This fixes an issue where dexpreopting was happening on
a different jar than was being installed.

Bug: 122856783
Test: m checkbuild
Test: no change out/target/common/obj/PACKAGING/hiddenapi-flags.csv
Test: only ordering change to out/target/common/obj/PACKAGING/hiddenapi-greylist.csv
Test: cts/tests/signature/runSignatureTests.sh
Change-Id: I4fc481efc29e73cb2bdaacf672e86d5f6f0075ae
2019-01-17 22:19:28 +00:00
Alex Light
fb4353d476 Fix incorrect soong symlink rule
Soong was incorrectly creating symlinks by not making the link target
relative to the link location. This caused symlink_prefered_arch to
not work when run with --skip-make.

Test: ALLOW_MISSING_DEPENDENCIES=true OUT_DIR=out DIST_DIR=out/dist \
      ./art/tools/dist_linux_bionic.sh -j80 com.android.runtime.host dex2oatd
      ls -l out/host/linux_bionic-x86/bin

Change-Id: I0ae5f059d19c0eec53e4d7c8dc68ae890980e6b4
2019-01-17 14:03:26 -08:00
Jaewoong Jung
a4d4570e91 Merge "Enable arch variant properties in prebuilt_etc." 2019-01-17 20:59:00 +00:00
Jaewoong Jung
b9a11518bc Enable arch variant properties in prebuilt_etc.
Bug: 122332178
Test: Soong unit tests + TreeHugger.
Change-Id: Ia8fab0add09478599398e8cbb703debc39f658f6
2019-01-17 09:02:34 -08:00