Commit graph

8 commits

Author SHA1 Message Date
Paul Duffin
b97b1579d3 Remove duplicate component from sdk snapshot
Previously, an sdk snapshot could contain the following:
* A java_sdk_library_import module, e.g. "foo" which creates component
  modules "foo.stubs", etc.
* A corresponding versioned module, e.g. "sdk_foo@current" which
  created component modules "sdk_foo@current.stubs", etc.
* An internal (to the sdk snapshot) java_import for one of "foo"'s
  components, e.g. "sdk_foo.stubs"
* A corresponding versioned module, e.g. "sdk_foo.stubs@current".

That causes a few problems:
1. The "foo.stubs" is duplicated.
2. The names of the components created by the versioned
   java_sdk_library_import are invalid, as they append the component's
   suffix to the version and not the name before the version.

The latter causes problems when building against prebuilts and fixing
that causes the generated snapshot to be invalid because it contains
duplicate definitions of the "sdk_foo.stubs@current" module. One
explicitly in the Android.bp file and one created by the
"sdk_foo@current" module.

Removing the duplicates from the snapshot causes errors as the name
generated by the snapshot for the component module, i.e.
"sdk_foo.stubs@current" does not match the name generated by the
"sdk_foo@current", i.e. "sdk_foo@current.stubs".

This change fixes them together.

Bug: 179354495
Test: m nothing
Merged-In: I515f235fe21755b5275af12366e96c24c94c0273
Change-Id: I515f235fe21755b5275af12366e96c24c94c0273
(cherry picked from commit a1aa7387f7)
2021-06-23 21:38:14 +01:00
Colin Cross
67c17aede8 Don't use unsafe_ignore_missing_latest_api in TestJavaSdkLibraryDist
Use FixtureWithLastReleaseApis to create the necessary files instead
of disabling the check with unsafe_ignore_missing_latest_api.

Bug: 186723288
Test: TestJavaSdkLibraryDist
Change-Id: I162b0f68eec596274f8d98dca9d3f0500ab13f5d
2021-06-02 13:02:51 -07:00
Colin Cross
f0eace9eed Remove core_lib property from java_sdk_library
Its not used, remove it.

Bug: 186723288
Test: TestJavaSdkLibraryDist
Change-Id: I1689b670a8ae6a614e5e4ec5e79cb5e283b2e277
2021-06-02 13:02:23 -07:00
Colin Cross
59b92bfdb3 Ignore owner property when computing java_sdk_library dist subdirectory
The owner property is no longer used, the dist subdirectory is determined
by the dist_group property.

Bug: 186723288
Test: TestJavaSdkLibraryDist
Change-Id: Id6d997eef05f6511070677974219674f248cb754
2021-06-02 13:02:01 -07:00
Colin Cross
3dd662509d Make the default java_sdk_library dist_group "unknown"
Change the default dist_group from "android" to "unknown" to prevent
accidentally including java_sdk_library stubs that do not set
dist_group or owner in the public SDK.

Bug: 186723288
Test: TestJavaSdkLibraryDist
Change-Id: I9aae2a16254ac1a8d444acfa63bc571d1ef4b045
2021-06-02 12:59:21 -07:00
Colin Cross
986b69aa51 Support dist_group property instead of owner for setting sdk dist subdirectory
Reusing the owner property is confusing, especially when the property is
required on every java_sdk_library module.  Create a new dist_group property
to use instead.

Bug: 186723288
Test: TestJavaSdkLibraryDist
Change-Id: I9e62c703a95d6b63cafa60bffb1b37ba85388593
2021-06-01 13:40:44 -07:00
Colin Cross
30c491b885 Add test for java_sdk_library dist properties
Add tests that cover the owner, core_lib and dist_stem properties.

Bug: 186723288
Test: TestJavaSdkLibraryDist
Change-Id: I4c2ae2a23dcd9a668c46ed5cc23b1d7dcfae798a
2021-06-01 13:40:17 -07:00
Colin Cross
1d2b6b3b2e Move java_sdk_library tests to sdk_library_test.go
Seperate the java_sdk_library tests into their own file.

Bug: 186723288
Test: go test ./java/...
Change-Id: I899c2946cb2234dc595a4281e64bbb239b89bda8
2021-06-01 13:40:17 -07:00