Commit graph

29 commits

Author SHA1 Message Date
Cole Faust
a963b94cde Make the enabled property configurable
This allows using select statements with it.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I6f3efaaa3d82505e38a91ee4ba0e18e404360191
Merged-In: If355d24506e3f117d27b21442a6c02bca3402dc7
2024-05-02 15:41:24 -07:00
Cole Faust
02987bd9d2 Implement OtherModulePropertyErrorf proxies
Also move EvaluateConfiguration() to a standalone configurationEvalutor
object, which can be constructed from a ModuleBase and a minimial
context. This allows us to evaluate configurable properties in
scenarios where we don't have much more than the module.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I2d1c9f42a469c399f34c759410509aeae095becb
2024-03-25 17:19:24 -07:00
Cole Faust
9a24d90936 Add more specific partition visibility rules
//visibility:any_system_partition, //visibility:any_vendor_partition,
etc.

Then, if a partition visibility rule is not specificed, but the module
is installed on a non-system partition via the `vendor: true` or other
properties, the visibility rule for that partition will be added by
default.

This is so that "any_partition" doesn't imply that modules could be put
on the vendor partition when they weren't designed for that, and so that
modules that do need to go on the vendor partition don't need to specify
both vendor: true and visibility:any_vendor_partition.

Eventually, the partition properties should be deprecated, and replaced
with just these visibility rules.

Bug: 321000103
Test: go tests
Change-Id: I24dba36bbc20921941f892480bf7c050e93827c6
2024-03-20 10:55:05 -07:00
Cole Faust
894bb3b530 Add //visibility:any_partition
When we convert the partitions to be built with soong, there will
likely be separate partition modules per product. This means that a
lot of installable modules will have to be visible to a lot of
partitions. To make this easier, add the //visibility:any_partition
visibility spec, which allows the module to be used from any module
of type android_filesystem or android_system_image.

Fixes: 321000103
Test: go test
Change-Id: Iea1f1ab7d88dfdb1fd00f19eb8c9941693a2375f
2024-02-07 12:03:32 -08:00
Cole Faust
9a346f6da3 Remove SymlinkOutputs
symlink_outputs was added so bazel could run ninja files, but we
abanoned that approach in roboleaf, and then roboleaf was cancelled
entirely. Remove this feature so we're more compatible with upstream
ninja / n2.

Bug: 160568334
Test: Presubmits
Change-Id: Ic368c48dd01b68e51c471c3fe90d0c02c55956e9
2024-01-18 12:43:24 -08:00
Colin Cross
5a37718c95 Convert ModuleProvder to generic providers API
Convert all of the callers of ModuleProvider/ModuleHasProvider to use the
type-safe android.SingletonModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: I6f11638546b64749e451cebbf33140248dc1d193
2023-12-14 16:12:22 -08:00
Colin Cross
3c0a83d19f Use generics for providers API
Using generics for the providers API allows a type to be associated
with a ProviderKey, resulting in a type-safe API without that doesn't
require runtime type assertions by every caller.

Unfortunately, Go does not allow generic types in methods, only in
functions [1].  This prevents a type-safe API on ModuleContext, and
requires moving the API to be functions that take a ModuleContext as
a parameter.

This CL creates the new API, but doesn't convert all of the callers.

[1] https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#no-parameterized-methods)

Bug: 316410648
Test: builds
Change-Id: I3e30d68b966b730efd968166a38a25cc144bd6de
2023-12-14 16:12:20 -08:00
Bob Badour
a5ea2479d3 Fix bug: allow multiple gen_notice modules.
Test: m cts dist reportmissinglicenses

Change-Id: I07963c83eaddfe363a04871e813b56fe7f1465ad
2022-05-20 16:54:00 -07:00
Bob Badour
eef4c1c563 Add gen_notice module.
Refactor notices to support notices for multiple modules.

Enforce visibility and handle missing dependencies.

Bug: 213388645

Change-Id: Id6a81987f087419ad37d0cce57a71e8a7c4cd6e0
2022-05-18 16:38:19 -07:00
Lukacs T. Berki
9f6c24a887 Rename BuildDir and NinjaBuildDir.
These are just out/ and out/soong/ and the old names were quite
confusing.

Test: Presubmits.
Merged-In: I999ca62162062f27e449f83ffb00fa580d4065b8
Merged-In: I2fcd80a9e376a6842a06aa104a9f6f5c5e16f8c7
Change-Id: Ib481d2aac40df8da1b74174dc8ec576c1cb48be0
2021-08-27 10:08:49 +02:00
Jingwen Chen
ce679d29ec Add symlink_outputs support to Soong.
This CL adds symlink_outputs to various locations in Soong that creates
actions that creates symlink outputs, and explicitly mark them as such.

Test: m
Bug: 160568334
Change-Id: I322751bada52a9f49011c74731d84761586e03e7
2020-10-19 01:26:50 -04:00
Colin Cross
d27e7b8e45 Add providers support
Propagate the providers methods from
https://github.com/google/blueprint/pull/309 to Soong.

Test: m checkbuild
Change-Id: Iad7a9023df4421cd01dbb0518be0e85382097481
2020-09-17 18:57:03 -07:00
Colin Cross
c3d87d3112 Define Soong phony rules in Make
To support dist-for-goals in Soong, we need to define all phony rules
in Make so that dist-for-goals can insert additional dependencies on
them.  Collect all the phony rules in phonySingleton and write them
out as Make rules when Soong is embedded in Make, or as blueprint.Phony
rules when Soong is run standalone.

Test: m checkbuild
Change-Id: I68201eff30744b0f487fc4f11f033767b53a627d
2020-06-09 14:38:50 -07:00
Ramy Medhat
944839a88a Fix RuleBuilder remoteable actions running in the local pool.
This CL fixes a bug with RuleBuilder's handling of remoteable actions.
It adds a new type of pool to identify remoteable rules by the android
module context. The pool is then set to nil to actually run actions at
NINJA_REMOTE_NUM_JOBS parallelism.

Test: built aosp crosshatch userdebug
Change-Id: I29452f6fc7a161b94189731e3e3cc1f34907b80c
2020-03-31 22:18:40 -04:00
Colin Cross
8b8bec3b3a Create a highmem pool and put metalava into it
Create a highmem pool based on the total RAM and the number of CPUs,
with an override via the NINJA_HIGHMEM_NUM_JOBS variable.  Put
metalava into the highmem pool.

Ninja does not support nested pools, and when goma or RBE is enabled
the maximum ninja parallelism is set very high with local jobs in a
local pool.  When both the local pool and highmem pool are enabled,
the total number of local jobs will be as high as the sum of the sizes
of the two pools.  Keep the highmem pool limited to 1/16th of the
local pool when remote builds are enabled to try to minimize the
effect while still limiting highmem jobs.

Fixes: 142644983
Test: m nothing, examine pools
Test: m USE_GOMA=true nothing, examine pools
Change-Id: Id79f11f44948992960ac34ecf831dacbe21bd332
2020-01-24 11:44:23 -08:00
Colin Cross
988414c2cf Sandbox soong_build by changing to root directory
This relands I12a0f907753fefd1997ab8b4ea2ac331234093cf along with
a fix to blueprint for absolute paths.

Store the current working directory and then change to the root
directory so that all file accesses must go through helpers in
the android package that properly track dependencies.

Change-Id: I24ac485677aa102eec1a2521d16820da6ee1ae77
Fixes: 146437378
Test: m checkbuild
Test: m OUT_DIR=/tmp/out nothing
2020-01-11 01:11:46 +00:00
Colin Cross
47e4f9e1e8 Revert "Sandbox soong_build by changing to root directory"
This reverts commit 05c25ccb4a.

Reason for revert: broke absolute OUT_DIR
Bug: 146437378

Change-Id: I523ed79d40e1c1ef040212ba794a7a084abea75d
2020-01-10 18:51:04 +00:00
Colin Cross
05c25ccb4a Sandbox soong_build by changing to root directory
Store the current working directory and then change to the root
directory so that all file accesses must go through helpers in
the android package that properly track dependencies.

Fixes: 146437378
Test: m checkbuild
Change-Id: I12a0f907753fefd1997ab8b4ea2ac331234093cf
2020-01-09 14:19:46 -08:00
Ramy Medhat
dd0418a4d4 Run non-RBE supported actions in the local pool when USE_RBE is set.
Bug: 143938974
Test: ran CTS build at -j500 successfully.
Change-Id: I55074bd67308cd716972e24fb56a20bc393d5d9d
2019-11-05 22:57:35 +00:00
Treehugger Robot
344eed4eb1 Merge "Add SingletonContext::VisitDirectDepths[If] to Android proxy." 2019-10-17 00:45:25 +00:00
Mitch Phillips
3a7a31b0c1 Add SingletonContext::VisitDirectDepths[If] to Android proxy.
Adds the VisitDirectDepths[If] function from blueprint to the Android
SingletonContext proxy.

Bug: N/A
Test: N/A
Change-Id: I4037364ef11b545abc9a383db7e1e818854db68f
2019-10-16 15:06:32 -07:00
Colin Cross
2e2dbc250a Use localPool consistently for UseGoma() == true
Remove the distinction between pctx.StaticRule and
pctx.AndroidStaticRule so that all of the local rules correctly
get assigned to the localPool.  Also put Module and Singleton
rules into the localPool.

Test: compare out/soong/build.ninja
Change-Id: Id2bb38eff3c7209340fe55bc9006f00bd3661d81
2019-10-01 14:11:20 -07:00
Colin Cross
4c83e5ccd4 Support testing Rules in Modules and Rules and Builds in Singletons
Add support for TestingModule to return RuleParams for rules created
by the module.

Refactor TestingModule to use helpers, and use the helpers to
implement a similar TestingSingleton.

Use the new functionality to test RuleBuilder's module and singleton
rules.

Test: none
Change-Id: I8348c56ff5086d0c49401f5a00faf7c864e6b6f3
2019-03-05 03:17:26 +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
Colin Cross
2465c3d998 Add phony targets for go binary modules
Add custom handling to androidmk.go for the bootstrap.GoBinaryTool
interface in order to create .PHONY targets for each tool written
in go.

Bug: 64539926
Test: m checkbuild
Test: m androidmk
Test: m multiproduct_kati
Change-Id: Ic65faa27a6ee4dfbd54ed6d208091db7c1d657a2
2018-09-28 10:25:45 -07:00
Colin Cross
6b75360cbc Use WalkDeps instead of VisitDepsDepthFirst
VisitDepsDepthFirst is almost never correct, as it can't query
dependency tags of multiple dependencies between the same two modules.
Replace VisitDepsDepthFirst with WalkDeps in sanitize.go and
python.go.  Also verify the dependency tag before continuing to
recurse to ensure that they don't recurse through genrules and into
unrelated modules.

Test: m checkbuild
Change-Id: I2f7560126f56b51a40ec39dfbdcc18b5891489f7
2018-06-22 12:44:35 -07:00
Colin Cross
59014396ba Make SingletonContext.Rule take a blueprint.RuleParams
Make the currently-unused SingletonContext.Rule match
ModuleContext.Rule and take a blueprint.RuleParams instead
of an android.RuleParams, and delete android.RuleParams.

Test: m checkbuild
Change-Id: I018685a3dc13f60825b5ba383ef365df2bc98dfc
2017-12-12 11:12:32 -08:00
Colin Cross
aabf67968c Make *Context.Config return a Config instead of a interface{}
In Soong, a Config() method will always return a Config.  Make
ModuleContext, SingletonContext, TopDownMutatorContext and
BottomUpMutatorContext's Config() methods explictly return
a Config to avoid having to type-assert everywhere.  Overriding
the Config method requires duplicating the list of methods in
blueprint.BaseModuleContext and blueprint.BottomUpMutatorContext,
following the same pattern used by the other *Contexts.

Config() obsoletes the AConfig() method used in some places, which
will be cleaned up in the next patch.

Test: m checkbuild
Change-Id: Ibe21efde933959811d52443496967ab8ce71215e
2017-11-30 00:44:11 +00:00
Colin Cross
0875c52de7 Wrap PackageContext and SingletonContext
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}.  The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.

SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does.  This requires
updating every Singleton to use the android-specific methods.

Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
2017-11-29 05:04:30 +00:00