Commit Graph

270 Commits

Author SHA1 Message Date
Priyanka Advani (xWF)
c2ba6683c5 Merge "Revert^3 "Implement detecting container violations."" into main am: 88a8daf8ca
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3248525

Change-Id: I7969a4be11e013e100f4be9fb13914244b094b7f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-28 23:30:03 +00:00
Priyanka Advani (xWF)
33b3a638a5 Revert^3 "Implement detecting container violations."
2a88491afc

Change-Id: Iba4527f391a093703978fe01177b56fec4604b28
2024-08-28 23:10:29 +00:00
Jihoon Kang
4e373a7904 Merge changes Ia693c4a5,I8e5620d2 into main am: c14be38f1a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3247222

Change-Id: Id0c06c93eda0e4978d9df052542370f28e64da38
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-28 21:43:02 +00:00
Jihoon Kang
2a88491afc Revert^2 "Implement detecting container violations."
This change introduces a method to detect violating inter-container
dependencies between modules. The method is run in
`ModuleBase.GenerateBuildActions`, after the container info provider is
set. Given that the provider of the direct dependencies would have been
set at this time, the method utilizes this information to determine
the violations, which are introduced in https://r.android.com/3141104.

Note that this enforcement does not turn all inter-container
dependencies as errors. Instead, it will only turn dependencies that
matches the pre-defined violations into errors. Even if the dependency
matches the violation, an error will not be thrown if the dependency
satisfies any of the exception functions (e.g. the dependent module is
stubs, or the two modules belong to the same apexes).

Test: m nothing --no-skip-soong-tests
Bug: 338660802
Change-Id: Ia693c4a53369c757a3e96656a769405c759b111c
2024-08-28 18:01:25 +00:00
Satish Yalla
b2407feae1 Merge "Revert "Implement detecting container violations."" into main am: f2d6e5004f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3244001

Change-Id: Ibfcf7b1965a52402917a32a203bf55cb82d1626b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-28 05:52:08 +00:00
Satish Yalla
f2d6e5004f Merge "Revert "Implement detecting container violations."" into main 2024-08-28 05:48:21 +00:00
Satish Yalla
b2b1ef63e2 Revert "Implement detecting container violations."
This reverts commit bb678f82d6.

Reason for revert: Droidmonitor created revert due to b/362639013. Will be verifying through ABTD before submission.

Change-Id: I1dcb71672eeb44a17cf176d3731bcaf9aaf81edf
2024-08-28 05:10:31 +00:00
Treehugger Robot
30f3795688 Merge "Implement detecting container violations." into main am: 26f071db92
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3155659

Change-Id: Id60c6920d6c964193b53c8b5f7026472c5fcacb0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-28 04:43:21 +00:00
Treehugger Robot
26f071db92 Merge "Implement detecting container violations." into main 2024-08-28 04:39:12 +00:00
Treehugger Robot
e1028aa539 Merge changes from topic "ctx_in_ideinfo" into main am: 9cbbafe300
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3246818

Change-Id: Ia2b721e9967c0772acd7dd261ec18315f6c26b5e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-28 00:53:10 +00:00
Cole Faust
b36d31d870 Add ctx argument to IDEInfo()
The IDEInfo() methods read properties. To make those properties
configurable, we need a context to evaluate them with.

Bug: 362579941
Test: m nothing --no-skip-soong-tests
Change-Id: I26d4b7084439b3006e50b02277298f74a929e1aa
2024-08-27 16:04:28 -07:00
Jihoon Kang
bb678f82d6 Implement detecting container violations.
This change introduces a method to detect violating inter-container
dependencies between modules. The method is run in
`ModuleBase.GenerateBuildActions`, after the container info provider is
set. Given that the provider of the direct dependencies would have been
set at this time, the method utilizes this information to determine
the violations, which are introduced in https://r.android.com/3141104.

Note that this enforcement does not turn all inter-container
dependencies as errors. Instead, it will only turn dependencies that
matches the pre-defined violations into errors. Even if the dependency
matches the violation, an error will not be thrown if the dependency
satisfies any of the exception functions (e.g. the dependent module is
stubs, or the two modules belong to the same apexes).

Test: m nothing --no-skip-soong-tests
Bug: 338660802
Change-Id: I36e9cd956c5a076a53635be0c6ff27f77725516e
2024-08-27 17:30:42 +00:00
Treehugger Robot
85beba636a Merge "Remove suffix based stub matching logic" into main am: 65c530c17e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3235808

Change-Id: Iad8c5a6fc68dc6e8cc2770a4f3f57a9fac18d3be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-23 03:52:13 +00:00
Jihoon Kang
fa3f0782f7 Remove suffix based stub matching logic
This change prevents non-stub modules with stub suffix from being
determined as the stub module, and instead makes the check more robust
by determining the condition based on the user-hidden
`Stub_contributing_api` property, which is only set for the stub
submodules generated by `java_sdk_library`.

Test: m nothing --no-skip-soong-tests
Bug: 361179822
Change-Id: I28a599c5b4fe1e8460e60580c0535aaf19e39ba3
2024-08-22 22:05:03 +00:00
Treehugger Robot
903a500065 Merge changes Ia0e1b307,I63c7c33e into main am: a5289ac9ef
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3216639

Change-Id: I5de31ae329756b4fd028e58e1bf9299eb3ad8347
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-17 04:43:09 +00:00
Treehugger Robot
a5289ac9ef Merge changes Ia0e1b307,I63c7c33e into main
* changes:
  Define unstable container
  Define additional exception functions for container enforcement
2024-08-17 04:07:00 +00:00
Jihoon Kang
224ea08ee6 Define additional exception functions for container enforcement
These exception functions allow restriction to be loosened for some
inter-container dependencies.

Note that these functions are still no-op. Restriction enforcement will
be done in the child change.

Test: m nothing
Bug: 338660802
Change-Id: I63c7c33e33f271d4c2a84cc6070eb4896e030ab4
2024-08-16 22:57:39 +00:00
Treehugger Robot
099f466484 Merge "Run "ravenizer" on ravenwood jars" into main am: 08e76d9591
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3225782

Change-Id: I1c9c6faadae080fd32d769b1acafc090ed1d85e4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-16 22:30:08 +00:00
Treehugger Robot
08e76d9591 Merge "Run "ravenizer" on ravenwood jars" into main 2024-08-16 22:16:41 +00:00
Colin Cross
45e2c9ba92 Merge "Move kotlin stdlib to normal dependency tag" into main am: f0df94a76d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3216738

Change-Id: Ib86bb51550db89f2e926229610b969fa98e2a79a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-16 21:19:48 +00:00
Colin Cross
f0df94a76d Merge "Move kotlin stdlib to normal dependency tag" into main 2024-08-16 21:01:23 +00:00
Makoto Onuki
7ded3827a4 Run "ravenizer" on ravenwood jars
Ravenizer is a new tool to preprocess ravenwood tests.

It can optionally be applied to other java targets (for analyzing them,
etc).

The actual tool is being implemented internally, so in AOSP, we just
use a script that copies the jar file as a replacement.

Test: manual -- run `m RavenwoodBivalentTest` and make sure the ravenizer
    log message shows up.
Flag: EXEMPT host test change only
Bug: 360390999
Change-Id: I6d1f81e7c425397b16c37e7c30267957097387fd
2024-08-16 12:08:35 -07:00
Colin Cross
882d600d79 Move kotlin stdlib to normal dependency tag
The kotlin standard library was added with a custom dependency tag,
which then required special handling later.  We know up front whether
it will be treated the same as a static_libs or libs dependency, so
just reuse staticLibTag or libTag, and remove all the special handling.

Bug: 308016794
Test: TestKotlin
Flag: exempt REFACTOR
Change-Id: I2c5601faec284d88f28e13378d9cbffc24560efa
2024-08-14 15:28:34 -07:00
Colin Cross
6bdec0cbe6 Merge changes If313580b,I68d50d68 into main am: 08b6061539
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3214342

Change-Id: I301643cc587ff80e243115b8f729eba4e0cd3e02
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-12 17:37:42 +00:00
Spandan Das
9b5740ceeb Merge changes Ib4581079,Ia3887bae into main am: 9dfccb91a5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3214336

Change-Id: I03e42b30ce41cdadee05041afc717bf8fee36d8d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-12 17:37:24 +00:00
Colin Cross
08b6061539 Merge changes If313580b,I68d50d68 into main
* changes:
  Use a provider for systems modules
  Add PrepareForTestWithBuildFlag
2024-08-12 16:53:42 +00:00
Colin Cross
b61c226943 Use a provider for systems modules
Replace the SystemModulesProvider interface with Provider

Test: all soong tests
Flag: EXEMPT refactor
Change-Id: If313580b28094d55b71f1635259bafa850ef7af5
2024-08-09 16:47:45 -07:00
Spandan Das
b4cd5df573 Make IdeInfo aware of jarjar-ing
jarjar can be used to repackage a java_library. e.g. Foo.java in package
com.android might get repackaged to prefix.com.android.Foo in the
resultant jar. To allow code completion of rdeps, we should use the
repackaged jar instead of the src files.

This CL sets dpInfo.Jars to the header jar _only_ when jarjar_rules is
not empty. We could probably set `Jars` to the header jar even for non
jarjar-d libraries and get rid of `Srcs`, `SrcJars` altogether, but that
would likely slow down any tools that index
out/soong/module_bp_java_deps.json for code completion.

Test: go test ./java
Bug: 356572093
Change-Id: Ib45810799a479cb315aed011a34351d386a21357
2024-08-09 22:37:33 +00:00
Spandan Das
742394d3e6 Merge changes Iab6efe78,I73affae8 into main am: 788f69722c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3214777

Change-Id: I6ea2dc099a65c623271f3abe4eb9f76db7f38aac
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-09 22:36:25 +00:00
Spandan Das
6e8bd1cc37 Register versioned sdk dependency in module_bp_java_deps.json
java modules that link against a versioned sdk (sdk_version: <num>) get
the appropriate stub jar on its classpath, but the dependency is not
registered in its build graph. This CL registers this dependency for
module_bp_java_deps.json. Ideally, we should move this to `decodeSdkDep`
so that this dependendency becomes known to other tools that analyze
soong's module graph (e.g. soongdbg)

Test: go test ./java
Bug: 358608607
Bug: 356572093
Change-Id: Iab6efe7826d18dedfadbe4d34d78e7eb2888bd8d
2024-08-09 17:16:23 +00:00
Colin Cross
5866fc2d42 Merge changes Ib238a83a,I9ed6a649 into main am: 82201c2db1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3212336

Change-Id: I3499299e5069555bb3b7df1fcd712fc4aea7e3f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-08 18:26:02 +00:00
Colin Cross
151156760c Merge changes I2b182cd3,Ibf6d9b79 into main am: 8c844e0b8f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3198494

Change-Id: If9cd85e3ae2c51007a0884ada2dfe9207208f242
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-08 00:09:42 +00:00
Colin Cross
edec77c453 Split jarjarIfNecessary out of compileJavaHeader
A future CL is going to change transitive classpath behavior when
jarjar is enabled.  In preparation, split the jarjar rules out
of compileJavaHeader into a separate jarjarIfNecessary method, and
use it on the classes and resource jars too.

Also tweak the naming of the output files in repackageFlagsIfNecessary
to be prettier.

Bug: 308016794
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I2b182cd30631f2bd7925341b9171e6b3c0e8d450
2024-08-07 14:11:43 -07:00
Colin Cross
d1d8f17e9e Move kotlin stdlib after javac jars
A future CL is going to treat local jars separately from dependency
jars.  Rearrange the order of the kotlin standard library jars to
come after the local jars produced by javac, which will better match
the future ordering and ease ninja file comparisions.

Bug: 308016794
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I9ed6a649350451bf1788077752db5222f50c0247
2024-08-07 14:11:43 -07:00
Colin Cross
7727c7f096 Convert JavaInfoProvider to *JavaInfo
Convert JavaInfoProvider to return a *JavaInfo instead of a JavaInfo.
This will reduce copying when reading the provider, and also allows
JavaInfo to recursively contain a depset of JavaInfos from
dependencies.

Bug: 308016794
Test: go test ./java/...
Flag: EXEMPT refactor
Change-Id: Ibf6d9b797f760ad1fe815d59839839fdfad91733
2024-08-07 14:11:43 -07:00
Treehugger Robot
3f0b5f6f12 Merge "Don't hold on to WritablePath" into main am: d40aac1340
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3198492

Change-Id: I4fdf37dbd48d995efc26f6784e61f5af57538f11
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-07 21:09:40 +00:00
Treehugger Robot
d40aac1340 Merge "Don't hold on to WritablePath" into main 2024-08-07 20:48:50 +00:00
Colin Cross
7707b246ef Don't hold on to WritablePath
Since only a single rule can write to a given WritablePath, it is
unecessary to hold on to the WritablePath once the rule has been
created.  Keeping a WritablePath causes complications, as it
prevents using the input Path as the output when no modifications to
the input file are necessary.  The normal pattern should be to create
a WritablePath using PathForModuleOut, build the rule that writes to
the WritablePath, and then store the WritablePath as a Path for use
as an input to any future rules.

WithoutRel previously only existed on OutputPath, which required
keeping the output path of the module as an OutputPath for as long
as possible in order to call WithoutRel on it at the end of the module.

Add WithoutRel to Path, make it always return a Path type, and implement
it on all the types that implement Path by using a helper in basePath.

Replace long-lived WritablePaths with Paths.

Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I40f28075ce151e4be80d6cfc7ec173dfa46f9bbf
2024-07-30 14:46:13 -07:00
Treehugger Robot
7f3f3002d6 Merge "Add jarjar_rename property to java modules." into main am: e69b3218f3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3186139

Change-Id: Ia8d7068b8026dd26808242e80f51a969a0007b61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-07-22 14:20:42 +00:00
Joe Onorato
a5d171773d Add jarjar_rename property to java modules.
It's the same mechanism that aconfig uses, but now it's exposed directly
to Android.bp files.  (I had wanted to test it out there before making
it a property just in case it didn't work well)

Bug: 352385368
Test: go test -v -run TestJarJar.*
Change-Id: I72d797d08a250be93779ee4b038a1b8fc62123b7
2024-07-20 17:46:15 -07:00
Spandan Das
1680176498 Merge "Add all compile deps to module_bp_java_deps.json" into main am: ad2aa3d220
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3183819

Change-Id: I9e697860a14ba9e09f0bbb9031bab73f90bf0b29
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-07-19 16:40:28 +00:00
Spandan Das
8aac993b94 Add all compile deps to module_bp_java_deps.json
`Dependencies` in module_bp_java_deps.json currently only contains the
`libs` and `static_libs` of the corresponding module. This is only a
subset of the dependencies which are required to compile the java
module. Most notably, the SDK deps (determined using `sdk_version`) are
missing.

This CL adds all the compile dependencies to the json file. Implementation
details:
1. Add a `compileDepNames` to java.Module in base.go. Almost all the
   module types in java package are composed with the java.Module
struct.
2. Populate this property in java.Module.collectDeps. This function is
   used by java.Module.compile to determine the classpath used for
compilation.
3. Return `compileDepNames` in java.Module.CompilerDeps.

Since `compileDepNames` is populated in `GenerateAndroidBuildActions`,
update existing unit tests that check for correctness of IDEInfo.Deps

Bug: 353811607
Test: m nothing --no-skip-soong-tests
Test: cat out/soong/module_bp_java_deps.json | jq '."DebuggingRestrictionController".dependencies'
[
  "android_system_stubs_current", <-- missing previously
  "core-lambda-stubs", <-- missing previously
  "core-public-stubs-system-modules", <-- missing previously
  "com.google.android.material_material",
  ...
  ...
]

Change-Id: I166c0eaf6e87ca7adc98bb4e21447cf82612d103
2024-07-19 01:03:27 +00:00
Treehugger Robot
fd440d75e5 Merge changes I861a60e1,I01bf99fa,I9d16dfec into main am: 9678733731
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3150116

Change-Id: I3745d3347b71ef589a74366f449041b0391d64a5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-07-16 01:06:07 +00:00
Treehugger Robot
9678733731 Merge changes I861a60e1,I01bf99fa,I9d16dfec into main
* changes:
  Add util method HasIntersection(...)
  Implement InstallableModule for Java modules
  Collect container informations
2024-07-16 00:43:04 +00:00
Jihoon Kang
f86fe9a876 Implement InstallableModule for Java modules
This change enables the container information to be collected for Java
modules.

Test: m nothing --no-skip-soong-tests
Bug: 338660802
Change-Id: I01bf99fa274275a608601ad6248d577ae8f6dffc
2024-07-15 23:46:01 +00:00
Zi Wang
c86a0975fe Merge "Use OutputFilesProvider on java modules" into main am: 256772f02c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3165563

Change-Id: Iad4f22396b46ac797fbfab031764166c269742f0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-07-11 01:52:40 +00:00
mrziwang
9f7b9f4a9a Use OutputFilesProvider on java modules
In the context of incremental soong, the output files
inter-module-communication will be through OutputFilesProvider.
The OutputFileProducer interface will be deprecated.

Test: CI
Bug: 339477385
Change-Id: I3c9f0b766325dd490bc903dc65259c3953d34606
2024-07-10 12:18:06 -07:00
Treehugger Robot
8806166b1d Merge "release_config: various cleanup" into main am: 000fe5ac5d am: 4c8f885b84
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3129154

Change-Id: I6fa7afca689c54c2f95e8c65c026da78633a5591
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-14 01:59:09 +00:00
Treehugger Robot
4c8f885b84 Merge "release_config: various cleanup" into main am: 000fe5ac5d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3129154

Change-Id: Iddd2935b353fdfb8a22fccdbe5aa56c6cc17496d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-14 01:51:17 +00:00
LaMont Jones
09721868db release_config: various cleanup
- move WriteMakefile to release_config.go
- use slices.Sort instead of slices.SortFunc where applicable.
- improve error message when inheriting an invalid release config

Bug: None
Test: manual
Change-Id: Id959ddccc75fad912518d5cce8d14da506e0bbea
2024-06-13 09:18:03 -07:00