2019-12-03 16:25:00 +01:00
// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package sdk
import (
2022-07-15 15:12:35 +02:00
"fmt"
2019-12-03 16:25:00 +01:00
"testing"
2020-07-09 18:32:57 +02:00
2021-03-09 23:27:13 +01:00
"android/soong/android"
2023-05-08 18:28:38 +02:00
"android/soong/dexpreopt"
2020-07-09 18:32:57 +02:00
"android/soong/java"
2019-12-03 16:25:00 +01:00
)
2021-03-18 10:14:23 +01:00
var prepareForSdkTestWithJava = android . GroupFixturePreparers (
java . PrepareForTestWithJavaBuildComponents ,
PrepareForTestWithSdkBuildComponents ,
2023-05-08 18:28:38 +02:00
dexpreopt . PrepareForTestWithFakeDex2oatd ,
2021-03-21 23:01:55 +01:00
// Ensure that all source paths are provided. This helps ensure that the snapshot generation is
// consistent and all files referenced from the snapshot's Android.bp file have actually been
// copied into the snapshot.
android . PrepareForTestDisallowNonExistentPaths ,
// Files needs by most of the tests.
android . MockFS {
2023-02-08 17:09:24 +01:00
"Test.java" : nil ,
"art-profile" : nil ,
2021-03-21 23:01:55 +01:00
} . AddToFixture ( ) ,
2021-03-18 10:14:23 +01:00
)
2021-03-15 12:17:52 +01:00
var prepareForSdkTestWithJavaSdkLibrary = android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
java . PrepareForTestWithJavaDefaultModules ,
java . PrepareForTestWithJavaSdkLibraryFiles ,
java . FixtureWithLastReleaseApis ( "myjavalib" ) ,
2024-01-08 09:56:20 +01:00
android . FixtureModifyProductVariables ( func ( variables android . FixtureProductVariables ) {
variables . BuildFlags = map [ string ] string {
"RELEASE_HIDDEN_API_EXPORTABLE_STUBS" : "true" ,
}
} ) ,
2021-03-15 12:17:52 +01:00
)
2019-12-03 16:25:00 +01:00
// Contains tests for SDK members provided by the java package.
2020-07-09 18:32:57 +02:00
func TestSdkDependsOnSourceEvenWhenPrebuiltPreferred ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJava ) . RunTestWithBp ( t , `
2020-07-09 18:32:57 +02:00
sdk {
name : "mysdk" ,
java_header_libs : [ "sdkmember" ] ,
}
java_library {
name : "sdkmember" ,
srcs : [ "Test.java" ] ,
system_modules : "none" ,
sdk_version : "none" ,
}
` )
// Make sure that the mysdk module depends on "sdkmember" and not "prebuilt_sdkmember".
2021-03-21 13:56:33 +01:00
sdkChecker := func ( t * testing . T , result * android . TestResult ) {
java . CheckModuleDependencies ( t , result . TestContext , "mysdk" , "android_common" , [ ] string { "sdkmember" } )
}
2020-07-09 18:32:57 +02:00
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2021-03-21 13:56:33 +01:00
snapshotTestChecker ( checkSnapshotWithSourcePreferred , sdkChecker ) ,
snapshotTestChecker ( checkSnapshotPreferredWithSource , sdkChecker ) ,
)
2020-07-09 18:32:57 +02:00
}
2019-12-05 12:25:53 +01:00
func TestSnapshotWithJavaHeaderLibrary ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
android . FixtureAddFile ( "aidl/foo/bar/Test.aidl" , nil ) ,
) . RunTestWithBp ( t , `
2019-12-05 12:25:53 +01:00
sdk {
name : "mysdk" ,
java_header_libs : [ "myjavalib" ] ,
}
java_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
aidl : {
export_include_dirs : [ "aidl" ] ,
} ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
host_supported : true ,
2021-07-15 15:14:41 +02:00
permitted_packages : [ "pkg.myjavalib" ] ,
2019-12-05 12:25:53 +01:00
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2019-12-05 12:25:53 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2019-12-05 12:25:53 +01:00
java_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2019-12-05 12:25:53 +01:00
jars : [ "java/myjavalib.jar" ] ,
2021-07-15 15:14:41 +02:00
permitted_packages : [ "pkg.myjavalib" ] ,
2019-12-05 12:25:53 +01:00
}
` ) ,
checkAllCopyRules ( `
. intermediates / myjavalib / android_common / turbine - combined / myjavalib . jar - > java / myjavalib . jar
aidl / foo / bar / Test . aidl - > aidl / aidl / foo / bar / Test . aidl
` ) ,
)
}
func TestHostSnapshotWithJavaHeaderLibrary ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
android . FixtureAddFile ( "aidl/foo/bar/Test.aidl" , nil ) ,
) . RunTestWithBp ( t , `
2019-12-05 12:25:53 +01:00
sdk {
name : "mysdk" ,
device_supported : false ,
host_supported : true ,
java_header_libs : [ "myjavalib" ] ,
}
java_library {
name : "myjavalib" ,
device_supported : false ,
host_supported : true ,
srcs : [ "Test.java" ] ,
aidl : {
export_include_dirs : [ "aidl" ] ,
} ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2019-12-05 12:25:53 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2019-12-05 12:25:53 +01:00
java_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2019-12-05 12:25:53 +01:00
device_supported : false ,
host_supported : true ,
jars : [ "java/myjavalib.jar" ] ,
}
` ) ,
checkAllCopyRules ( `
2023-07-19 07:11:07 +02:00
. intermediates / myjavalib / linux_glibc_common / javac - header / myjavalib . jar - > java / myjavalib . jar
2019-12-05 12:25:53 +01:00
aidl / foo / bar / Test . aidl - > aidl / aidl / foo / bar / Test . aidl
` ) ,
)
}
2020-03-02 11:16:35 +01:00
func TestDeviceAndHostSnapshotWithJavaHeaderLibrary ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJava ) . RunTestWithBp ( t , `
2020-03-02 11:16:35 +01:00
sdk {
name : "mysdk" ,
host_supported : true ,
java_header_libs : [ "myjavalib" ] ,
}
java_library {
name : "myjavalib" ,
host_supported : true ,
srcs : [ "Test.java" ] ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-03-02 11:16:35 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2020-03-02 11:16:35 +01:00
java_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2020-03-02 11:16:35 +01:00
host_supported : true ,
target : {
android : {
jars : [ "java/android/myjavalib.jar" ] ,
} ,
linux_glibc : {
jars : [ "java/linux_glibc/myjavalib.jar" ] ,
} ,
} ,
}
` ) ,
checkAllCopyRules ( `
. intermediates / myjavalib / android_common / turbine - combined / myjavalib . jar - > java / android / myjavalib . jar
2023-07-19 07:11:07 +02:00
. intermediates / myjavalib / linux_glibc_common / javac - header / myjavalib . jar - > java / linux_glibc / myjavalib . jar
2020-03-02 11:16:35 +01:00
` ) ,
)
}
2019-12-05 12:25:53 +01:00
func TestSnapshotWithJavaImplLibrary ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
android . FixtureAddFile ( "aidl/foo/bar/Test.aidl" , nil ) ,
2021-03-21 23:01:55 +01:00
android . FixtureAddFile ( "resource.txt" , nil ) ,
2021-03-15 12:17:52 +01:00
) . RunTestWithBp ( t , `
2019-12-16 18:43:48 +01:00
module_exports {
name : "myexports" ,
2019-12-03 16:25:00 +01:00
java_libs : [ "myjavalib" ] ,
}
java_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
2020-06-24 13:10:42 +02:00
java_resources : [ "resource.txt" ] ,
2019-12-03 16:25:00 +01:00
aidl : {
export_include_dirs : [ "aidl" ] ,
} ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
host_supported : true ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "myexports" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2019-12-03 16:25:00 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "myexports.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2019-12-03 16:25:00 +01:00
java_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2019-12-03 16:25:00 +01:00
jars : [ "java/myjavalib.jar" ] ,
}
` ) ,
checkAllCopyRules ( `
2020-06-24 13:10:42 +02:00
. intermediates / myjavalib / android_common / withres / myjavalib . jar - > java / myjavalib . jar
2019-12-03 16:25:00 +01:00
aidl / foo / bar / Test . aidl - > aidl / aidl / foo / bar / Test . aidl
` ) ,
)
}
2020-12-08 18:48:25 +01:00
func TestSnapshotWithJavaBootLibrary ( t * testing . T ) {
2021-03-21 23:01:55 +01:00
result := android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
android . FixtureAddFile ( "aidl" , nil ) ,
android . FixtureAddFile ( "resource.txt" , nil ) ,
) . RunTestWithBp ( t , `
2022-07-15 15:12:35 +02:00
sdk {
name : "mysdk" ,
2020-12-08 18:48:25 +01:00
java_boot_libs : [ "myjavalib" ] ,
}
java_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
java_resources : [ "resource.txt" ] ,
// The aidl files should not be copied to the snapshot because a java_boot_libs member is not
// intended to be used for compiling Java, only for accessing the dex implementation jar.
aidl : {
export_include_dirs : [ "aidl" ] ,
} ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
2021-07-15 15:14:41 +02:00
permitted_packages : [ "pkg.myjavalib" ] ,
2020-12-08 18:48:25 +01:00
}
` )
2022-07-15 15:12:35 +02:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-12-08 18:48:25 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ ] ,
}
2020-12-08 18:48:25 +01:00
java_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-12-08 18:48:25 +01:00
visibility : [ "//visibility:public" ] ,
apex_available : [ "//apex_available:platform" ] ,
2022-11-21 11:57:30 +01:00
jars : [ "java_boot_libs/snapshot/jars/are/invalid/myjavalib.jar" ] ,
2021-07-15 15:14:41 +02:00
permitted_packages : [ "pkg.myjavalib" ] ,
2020-12-08 18:48:25 +01:00
}
` ) ,
checkAllCopyRules ( `
2022-11-21 11:57:30 +01:00
. intermediates / mysdk / common_os / empty - > java_boot_libs / snapshot / jars / are / invalid / myjavalib . jar
2020-12-08 18:48:25 +01:00
` ) ,
)
}
2022-07-15 15:12:35 +02:00
func TestSnapshotWithJavaBootLibrary_UpdatableMedia ( t * testing . T ) {
2022-11-21 11:57:30 +01:00
runTest := func ( t * testing . T , targetBuildRelease , expectedJarPath , expectedCopyRule string ) {
2022-07-15 15:12:35 +02:00
result := android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
android . FixtureMergeEnv ( map [ string ] string {
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE" : targetBuildRelease ,
} ) ,
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
android . FixtureModifyProductVariables ( func ( variables android . FixtureProductVariables ) {
variables . Platform_version_active_codenames = [ ] string { "VanillaIceCream" }
} ) ,
2022-07-15 15:12:35 +02:00
) . RunTestWithBp ( t , `
sdk {
name : "mysdk" ,
java_boot_libs : [ "updatable-media" ] ,
}
java_library {
name : "updatable-media" ,
srcs : [ "Test.java" ] ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
permitted_packages : [ "pkg.media" ] ,
apex_available : [ "com.android.media" ] ,
}
` )
CheckSnapshot ( t , result , "mysdk" , "" ,
checkAndroidBpContents ( fmt . Sprintf ( `
// This is auto-generated. DO NOT EDIT.
java_import {
name : "updatable-media" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
apex_available : [ "com.android.media" ] ,
jars : [ "%s" ] ,
permitted_packages : [ "pkg.media" ] ,
}
2022-11-21 11:57:30 +01:00
` , expectedJarPath ) ) ,
2022-07-15 15:12:35 +02:00
checkAllCopyRules ( expectedCopyRule ) ,
)
}
t . Run ( "updatable-media in S" , func ( t * testing . T ) {
2022-11-21 11:57:30 +01:00
runTest ( t , "S" , "java/updatable-media.jar" , `
2022-07-15 15:12:35 +02:00
. intermediates / updatable - media / android_common / package - check / updatable - media . jar - > java / updatable - media . jar
` )
} )
t . Run ( "updatable-media in T" , func ( t * testing . T ) {
2022-11-21 11:57:30 +01:00
runTest ( t , "Tiramisu" , "java_boot_libs/snapshot/jars/are/invalid/updatable-media.jar" , `
. intermediates / mysdk / common_os / empty - > java_boot_libs / snapshot / jars / are / invalid / updatable - media . jar
2022-07-15 15:12:35 +02:00
` )
} )
}
2022-11-26 14:36:38 +01:00
func TestSnapshotWithJavaLibrary_MinSdkVersion ( t * testing . T ) {
runTest := func ( t * testing . T , targetBuildRelease , minSdkVersion , expectedMinSdkVersion string ) {
result := android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
android . FixtureModifyProductVariables ( func ( variables android . FixtureProductVariables ) {
variables . Platform_version_active_codenames = [ ] string { "S" , "Tiramisu" , "Unfinalized" }
} ) ,
android . FixtureMergeEnv ( map [ string ] string {
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE" : targetBuildRelease ,
} ) ,
) . RunTestWithBp ( t , fmt . Sprintf ( `
sdk {
name : "mysdk" ,
java_header_libs : [ "mylib" ] ,
}
java_library {
name : "mylib" ,
srcs : [ "Test.java" ] ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
min_sdk_version : "%s" ,
}
` , minSdkVersion ) )
expectedMinSdkVersionLine := ""
if expectedMinSdkVersion != "" {
expectedMinSdkVersionLine = fmt . Sprintf ( " min_sdk_version: %q,\n" , expectedMinSdkVersion )
}
CheckSnapshot ( t , result , "mysdk" , "" ,
checkAndroidBpContents ( fmt . Sprintf ( `
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_mylib" ] ,
}
2022-11-26 14:36:38 +01:00
java_import {
name : "mylib" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
apex_available : [ "//apex_available:platform" ] ,
jars : [ "java/mylib.jar" ] ,
% s }
` , expectedMinSdkVersionLine ) ) ,
)
}
t . Run ( "min_sdk_version=S in S" , func ( t * testing . T ) {
// min_sdk_version was not added to java_import until Tiramisu.
runTest ( t , "S" , "S" , "" )
} )
t . Run ( "min_sdk_version=S in Tiramisu" , func ( t * testing . T ) {
// The canonical form of S is 31.
runTest ( t , "Tiramisu" , "S" , "31" )
} )
t . Run ( "min_sdk_version=24 in Tiramisu" , func ( t * testing . T ) {
// A numerical min_sdk_version is already in canonical form.
runTest ( t , "Tiramisu" , "24" , "24" )
} )
t . Run ( "min_sdk_version=Unfinalized in latest" , func ( t * testing . T ) {
// An unfinalized min_sdk_version has no numeric value yet.
runTest ( t , "" , "Unfinalized" , "Unfinalized" )
} )
}
2021-09-26 10:58:02 +02:00
func TestSnapshotWithJavaSystemserverLibrary ( t * testing . T ) {
result := android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
android . FixtureAddFile ( "aidl" , nil ) ,
android . FixtureAddFile ( "resource.txt" , nil ) ,
) . RunTestWithBp ( t , `
module_exports {
name : "myexports" ,
java_systemserver_libs : [ "myjavalib" ] ,
}
java_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
java_resources : [ "resource.txt" ] ,
// The aidl files should not be copied to the snapshot because a java_systemserver_libs member
// is not intended to be used for compiling Java, only for accessing the dex implementation
// jar.
aidl : {
export_include_dirs : [ "aidl" ] ,
} ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
permitted_packages : [ "pkg.myjavalib" ] ,
}
` )
CheckSnapshot ( t , result , "myexports" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2021-09-26 10:58:02 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "myexports.contributions" ,
contents : [ ] ,
}
2021-09-26 10:58:02 +02:00
java_import {
name : "myjavalib" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
apex_available : [ "//apex_available:platform" ] ,
2022-11-21 11:57:30 +01:00
jars : [ "java_systemserver_libs/snapshot/jars/are/invalid/myjavalib.jar" ] ,
2021-09-26 10:58:02 +02:00
permitted_packages : [ "pkg.myjavalib" ] ,
}
` ) ,
checkAllCopyRules ( `
2022-11-21 11:57:30 +01:00
. intermediates / myexports / common_os / empty - > java_systemserver_libs / snapshot / jars / are / invalid / myjavalib . jar
2021-09-26 10:58:02 +02:00
` ) ,
)
}
2019-12-05 12:25:53 +01:00
func TestHostSnapshotWithJavaImplLibrary ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
android . FixtureAddFile ( "aidl/foo/bar/Test.aidl" , nil ) ,
) . RunTestWithBp ( t , `
2019-12-16 18:43:48 +01:00
module_exports {
name : "myexports" ,
2019-12-03 16:25:00 +01:00
device_supported : false ,
host_supported : true ,
java_libs : [ "myjavalib" ] ,
}
java_library {
name : "myjavalib" ,
device_supported : false ,
host_supported : true ,
srcs : [ "Test.java" ] ,
aidl : {
export_include_dirs : [ "aidl" ] ,
} ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "myexports" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2019-12-03 16:25:00 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "myexports.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2019-12-03 16:25:00 +01:00
java_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2019-12-03 16:25:00 +01:00
device_supported : false ,
host_supported : true ,
jars : [ "java/myjavalib.jar" ] ,
}
` ) ,
checkAllCopyRules ( `
. intermediates / myjavalib / linux_glibc_common / javac / myjavalib . jar - > java / myjavalib . jar
aidl / foo / bar / Test . aidl - > aidl / aidl / foo / bar / Test . aidl
` ) ,
)
}
2019-12-03 19:06:47 +01:00
func TestSnapshotWithJavaTest ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJava ) . RunTestWithBp ( t , `
2019-12-03 19:06:47 +01:00
module_exports {
name : "myexports" ,
java_tests : [ "myjavatests" ] ,
}
java_test {
name : "myjavatests" ,
srcs : [ "Test.java" ] ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
host_supported : true ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "myexports" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2019-12-03 19:06:47 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "myexports.contributions" ,
contents : [ "prebuilt_myjavatests" ] ,
}
2019-12-03 19:06:47 +01:00
java_test_import {
2021-04-16 18:05:10 +02:00
name : "myjavatests" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2019-12-03 19:06:47 +01:00
jars : [ "java/myjavatests.jar" ] ,
test_config : "java/myjavatests-AndroidTest.xml" ,
}
` ) ,
checkAllCopyRules ( `
. intermediates / myjavatests / android_common / javac / myjavatests . jar - > java / myjavatests . jar
. intermediates / myjavatests / android_common / myjavatests . config - > java / myjavatests - AndroidTest . xml
` ) ,
)
}
func TestHostSnapshotWithJavaTest ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJava ) . RunTestWithBp ( t , `
2019-12-03 19:06:47 +01:00
module_exports {
name : "myexports" ,
device_supported : false ,
host_supported : true ,
java_tests : [ "myjavatests" ] ,
}
java_test {
name : "myjavatests" ,
device_supported : false ,
host_supported : true ,
srcs : [ "Test.java" ] ,
system_modules : "none" ,
sdk_version : "none" ,
compile_dex : true ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "myexports" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2019-12-03 19:06:47 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "myexports.contributions" ,
contents : [ "prebuilt_myjavatests" ] ,
}
2019-12-03 19:06:47 +01:00
java_test_import {
2021-04-16 18:05:10 +02:00
name : "myjavatests" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2019-12-03 19:06:47 +01:00
device_supported : false ,
host_supported : true ,
jars : [ "java/myjavatests.jar" ] ,
test_config : "java/myjavatests-AndroidTest.xml" ,
}
` ) ,
checkAllCopyRules ( `
. intermediates / myjavatests / linux_glibc_common / javac / myjavatests . jar - > java / myjavatests . jar
. intermediates / myjavatests / linux_glibc_common / myjavatests . config - > java / myjavatests - AndroidTest . xml
` ) ,
)
}
2020-01-13 22:03:22 +01:00
func TestSnapshotWithJavaSystemModules ( t * testing . T ) {
2022-05-16 15:10:47 +02:00
result := android . GroupFixturePreparers (
prepareForSdkTestWithJava ,
java . PrepareForTestWithJavaDefaultModules ,
java . PrepareForTestWithJavaSdkLibraryFiles ,
java . FixtureWithPrebuiltApisAndExtensions ( map [ string ] [ ] string {
"31" : { "myjavalib" } ,
"32" : { "myjavalib" } ,
"current" : { "myjavalib" } ,
} , map [ string ] [ ] string {
"1" : { "myjavalib" } ,
"2" : { "myjavalib" } ,
} ) ,
2024-01-08 09:56:20 +01:00
android . FixtureModifyProductVariables ( func ( variables android . FixtureProductVariables ) {
variables . BuildFlags = map [ string ] string {
"RELEASE_HIDDEN_API_EXPORTABLE_STUBS" : "true" ,
}
} ) ,
2022-05-16 15:10:47 +02:00
) . RunTestWithBp ( t , `
2020-01-13 22:03:22 +01:00
sdk {
name : "mysdk" ,
2020-01-20 19:16:30 +01:00
java_header_libs : [ "exported-system-module" ] ,
2021-06-22 12:00:07 +02:00
java_sdk_libs : [ "myjavalib" ] ,
2020-01-13 22:03:22 +01:00
java_system_modules : [ "my-system-modules" ] ,
}
2021-06-22 12:00:07 +02:00
java_sdk_library {
name : "myjavalib" ,
apex_available : [ "//apex_available:anyapex" ] ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
shared_library : false ,
public : {
enabled : true ,
} ,
2024-04-18 11:37:56 +02:00
system : {
enabled : true ,
} ,
module_lib : {
enabled : true ,
} ,
2021-06-22 12:00:07 +02:00
}
2020-01-13 22:03:22 +01:00
java_system_modules {
name : "my-system-modules" ,
2021-06-22 12:00:07 +02:00
libs : [ "system-module" , "exported-system-module" , "myjavalib.stubs" ] ,
2020-01-13 22:03:22 +01:00
}
java_library {
name : "system-module" ,
srcs : [ "Test.java" ] ,
sdk_version : "none" ,
system_modules : "none" ,
}
2020-01-20 19:16:30 +01:00
java_library {
name : "exported-system-module" ,
srcs : [ "Test.java" ] ,
sdk_version : "none" ,
system_modules : "none" ,
}
2020-01-13 22:03:22 +01:00
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-01-13 22:03:22 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [
"prebuilt_exported-system-module" ,
"prebuilt_myjavalib" ,
"prebuilt_my-system-modules" ,
] ,
}
2020-01-20 19:16:30 +01:00
java_import {
2021-04-16 18:05:10 +02:00
name : "exported-system-module" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2020-01-20 19:16:30 +01:00
jars : [ "java/exported-system-module.jar" ] ,
}
java_import {
2021-04-16 18:05:10 +02:00
name : "mysdk_system-module" ,
2020-01-20 19:16:30 +01:00
prefer : false ,
2021-04-16 18:05:10 +02:00
visibility : [ "//visibility:private" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2021-04-16 18:05:10 +02:00
jars : [ "java/system-module.jar" ] ,
2020-01-20 19:16:30 +01:00
}
2021-06-22 12:00:07 +02:00
java_sdk_library_import {
name : "myjavalib" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
apex_available : [ "//apex_available:anyapex" ] ,
shared_library : false ,
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
2024-04-18 11:37:56 +02:00
system : {
jars : [ "sdk_library/system/myjavalib-stubs.jar" ] ,
stub_srcs : [ "sdk_library/system/myjavalib_stub_sources" ] ,
current_api : "sdk_library/system/myjavalib.txt" ,
removed_api : "sdk_library/system/myjavalib-removed.txt" ,
sdk_version : "system_current" ,
} ,
module_lib : {
jars : [ "sdk_library/module-lib/myjavalib-stubs.jar" ] ,
stub_srcs : [ "sdk_library/module-lib/myjavalib_stub_sources" ] ,
current_api : "sdk_library/module-lib/myjavalib.txt" ,
removed_api : "sdk_library/module-lib/myjavalib-removed.txt" ,
sdk_version : "module_current" ,
} ,
2021-06-22 12:00:07 +02:00
}
2021-04-16 18:05:10 +02:00
java_system_modules_import {
name : "my-system-modules" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
libs : [
"mysdk_system-module" ,
"exported-system-module" ,
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 a1aa7387f74a49c8c974ba2198def0e081488624)
2021-04-29 22:50:40 +02:00
"myjavalib.stubs" ,
2021-04-16 18:05:10 +02:00
] ,
}
2020-01-13 22:03:22 +01:00
` ) ,
2020-01-20 19:16:30 +01:00
checkAllCopyRules ( `
. intermediates / exported - system - module / android_common / turbine - combined / exported - system - module . jar - > java / exported - system - module . jar
. intermediates / system - module / android_common / turbine - combined / system - module . jar - > java / system - module . jar
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
2024-04-18 11:37:56 +02:00
. intermediates / myjavalib . stubs . exportable . system / android_common / combined / myjavalib . stubs . exportable . system . jar - > sdk_library / system / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source . system / android_common / exportable / myjavalib . stubs . source . system_api . txt - > sdk_library / system / myjavalib . txt
. intermediates / myjavalib . stubs . source . system / android_common / exportable / myjavalib . stubs . source . system_removed . txt - > sdk_library / system / myjavalib - removed . txt
. intermediates / myjavalib . stubs . exportable . module_lib / android_common / combined / myjavalib . stubs . exportable . module_lib . jar - > sdk_library / module - lib / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source . module_lib / android_common / exportable / myjavalib . stubs . source . module_lib_api . txt - > sdk_library / module - lib / myjavalib . txt
. intermediates / myjavalib . stubs . source . module_lib / android_common / exportable / myjavalib . stubs . source . module_lib_removed . txt - > sdk_library / module - lib / myjavalib - removed . txt
2022-05-06 11:38:02 +02:00
` ) ,
2022-05-16 15:10:47 +02:00
checkInfoContents ( result . Config , `
2022-05-06 11:38:02 +02:00
[
{
"@type" : "sdk" ,
"@name" : "mysdk" ,
"java_header_libs" : [
"exported-system-module" ,
"system-module"
] ,
"java_sdk_libs" : [
"myjavalib"
] ,
"java_system_modules" : [
"my-system-modules"
]
} ,
{
"@type" : "java_library" ,
"@name" : "exported-system-module"
} ,
{
"@type" : "java_system_modules" ,
"@name" : "my-system-modules" ,
"@deps" : [
"exported-system-module" ,
"system-module"
]
} ,
{
"@type" : "java_sdk_library" ,
2022-05-16 15:10:47 +02:00
"@name" : "myjavalib" ,
"dist_stem" : "myjavalib" ,
"scopes" : {
2024-04-18 11:37:56 +02:00
"module-lib" : {
"current_api" : "sdk_library/module-lib/myjavalib.txt" ,
"latest_api" : "out/soong/.intermediates/prebuilts/sdk/myjavalib.api.module-lib.latest/gen/myjavalib.api.module-lib.latest" ,
"latest_removed_api" : "out/soong/.intermediates/prebuilts/sdk/myjavalib-removed.api.module-lib.latest/gen/myjavalib-removed.api.module-lib.latest" ,
"removed_api" : "sdk_library/module-lib/myjavalib-removed.txt"
} ,
2022-05-16 15:10:47 +02:00
"public" : {
"current_api" : "sdk_library/public/myjavalib.txt" ,
"latest_api" : "out/soong/.intermediates/prebuilts/sdk/myjavalib.api.public.latest/gen/myjavalib.api.public.latest" ,
"latest_removed_api" : "out/soong/.intermediates/prebuilts/sdk/myjavalib-removed.api.public.latest/gen/myjavalib-removed.api.public.latest" ,
"removed_api" : "sdk_library/public/myjavalib-removed.txt"
2024-04-18 11:37:56 +02:00
} ,
"system" : {
"current_api" : "sdk_library/system/myjavalib.txt" ,
"latest_api" : "out/soong/.intermediates/prebuilts/sdk/myjavalib.api.system.latest/gen/myjavalib.api.system.latest" ,
"latest_removed_api" : "out/soong/.intermediates/prebuilts/sdk/myjavalib-removed.api.system.latest/gen/myjavalib-removed.api.system.latest" ,
"removed_api" : "sdk_library/system/myjavalib-removed.txt"
2022-05-16 15:10:47 +02:00
}
}
2022-05-06 11:38:02 +02:00
} ,
{
"@type" : "java_library" ,
"@name" : "system-module"
}
]
2020-01-20 19:16:30 +01:00
` ) ,
2020-01-13 22:03:22 +01:00
)
}
func TestHostSnapshotWithJavaSystemModules ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJava ) . RunTestWithBp ( t , `
2020-01-13 22:03:22 +01:00
sdk {
name : "mysdk" ,
device_supported : false ,
host_supported : true ,
java_system_modules : [ "my-system-modules" ] ,
}
java_system_modules {
name : "my-system-modules" ,
device_supported : false ,
host_supported : true ,
libs : [ "system-module" ] ,
}
java_library {
name : "system-module" ,
device_supported : false ,
host_supported : true ,
srcs : [ "Test.java" ] ,
sdk_version : "none" ,
system_modules : "none" ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-01-13 22:03:22 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_my-system-modules" ] ,
}
2020-01-13 22:03:22 +01:00
java_import {
2021-04-16 18:05:10 +02:00
name : "mysdk_system-module" ,
prefer : false ,
2020-01-20 19:16:30 +01:00
visibility : [ "//visibility:private" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2020-01-13 22:03:22 +01:00
device_supported : false ,
host_supported : true ,
jars : [ "java/system-module.jar" ] ,
}
2021-04-16 18:05:10 +02:00
java_system_modules_import {
name : "my-system-modules" ,
2020-01-13 22:03:22 +01:00
prefer : false ,
2021-04-16 18:05:10 +02:00
visibility : [ "//visibility:public" ] ,
device_supported : false ,
host_supported : true ,
libs : [ "mysdk_system-module" ] ,
}
2020-01-13 22:03:22 +01:00
` ) ,
2023-07-19 07:11:07 +02:00
checkAllCopyRules ( ".intermediates/system-module/linux_glibc_common/javac-header/system-module.jar -> java/system-module.jar" ) ,
2020-01-13 22:03:22 +01:00
)
}
2020-03-02 19:38:15 +01:00
func TestDeviceAndHostSnapshotWithOsSpecificMembers ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJava ) . RunTestWithBp ( t , `
2020-03-02 19:38:15 +01:00
module_exports {
name : "myexports" ,
host_supported : true ,
java_libs : [ "myjavalib" ] ,
target : {
android : {
java_header_libs : [ "androidjavalib" ] ,
} ,
host : {
java_header_libs : [ "hostjavalib" ] ,
} ,
} ,
}
java_library {
name : "myjavalib" ,
host_supported : true ,
srcs : [ "Test.java" ] ,
system_modules : "none" ,
sdk_version : "none" ,
}
java_library {
name : "androidjavalib" ,
srcs : [ "Test.java" ] ,
system_modules : "none" ,
sdk_version : "none" ,
}
java_library_host {
name : "hostjavalib" ,
srcs : [ "Test.java" ] ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "myexports" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-03-02 19:38:15 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "myexports.contributions" ,
contents : [
"prebuilt_hostjavalib" ,
"prebuilt_androidjavalib" ,
"prebuilt_myjavalib" ,
] ,
}
2020-03-02 19:38:15 +01:00
java_import {
name : "hostjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2020-03-02 19:38:15 +01:00
device_supported : false ,
host_supported : true ,
jars : [ "java/hostjavalib.jar" ] ,
}
java_import {
name : "androidjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2020-03-02 19:38:15 +01:00
jars : [ "java/androidjavalib.jar" ] ,
}
java_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2020-03-02 19:38:15 +01:00
host_supported : true ,
target : {
android : {
jars : [ "java/android/myjavalib.jar" ] ,
} ,
linux_glibc : {
jars : [ "java/linux_glibc/myjavalib.jar" ] ,
} ,
} ,
}
` ) ,
checkAllCopyRules ( `
2023-07-19 07:11:07 +02:00
. intermediates / hostjavalib / linux_glibc_common / javac - header / hostjavalib . jar - > java / hostjavalib . jar
2020-03-02 19:38:15 +01:00
. intermediates / androidjavalib / android_common / turbine - combined / androidjavalib . jar - > java / androidjavalib . jar
. intermediates / myjavalib / android_common / javac / myjavalib . jar - > java / android / myjavalib . jar
. intermediates / myjavalib / linux_glibc_common / javac / myjavalib . jar - > java / linux_glibc / myjavalib . jar
` ) ,
)
}
2020-02-10 14:37:10 +01:00
func TestSnapshotWithJavaSdkLibrary ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJavaSdkLibrary ) . RunTestWithBp ( t , `
2020-02-10 14:37:10 +01:00
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
apex_available : [ "//apex_available:anyapex" ] ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
2020-05-26 21:57:10 +02:00
shared_library : false ,
2020-04-30 00:35:13 +02:00
stubs_library_visibility : [ "//other" ] ,
stubs_source_visibility : [ "//another" ] ,
2021-07-15 15:14:41 +02:00
permitted_packages : [ "pkg.myjavalib" ] ,
2020-02-10 14:37:10 +01:00
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-02-10 14:37:10 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2020-02-10 14:37:10 +01:00
java_sdk_library_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-02-10 14:37:10 +01:00
apex_available : [ "//apex_available:anyapex" ] ,
2020-05-26 21:57:10 +02:00
shared_library : false ,
2021-07-15 15:14:41 +02:00
permitted_packages : [ "pkg.myjavalib" ] ,
2020-02-10 14:37:10 +01:00
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
2020-04-09 02:08:11 +02:00
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
2020-02-10 14:37:10 +01:00
sdk_version : "current" ,
} ,
system : {
jars : [ "sdk_library/system/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/system/myjavalib_stub_sources" ] ,
2020-04-09 02:08:11 +02:00
current_api : "sdk_library/system/myjavalib.txt" ,
removed_api : "sdk_library/system/myjavalib-removed.txt" ,
2020-02-10 14:37:10 +01:00
sdk_version : "system_current" ,
} ,
test : {
jars : [ "sdk_library/test/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/test/myjavalib_stub_sources" ] ,
2020-04-09 02:08:11 +02:00
current_api : "sdk_library/test/myjavalib.txt" ,
removed_api : "sdk_library/test/myjavalib-removed.txt" ,
2020-02-10 14:37:10 +01:00
sdk_version : "test_current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
. intermediates / myjavalib . stubs . exportable . system / android_common / combined / myjavalib . stubs . exportable . system . jar - > sdk_library / system / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source . system / android_common / exportable / myjavalib . stubs . source . system_api . txt - > sdk_library / system / myjavalib . txt
. intermediates / myjavalib . stubs . source . system / android_common / exportable / myjavalib . stubs . source . system_removed . txt - > sdk_library / system / myjavalib - removed . txt
. intermediates / myjavalib . stubs . exportable . test / android_common / combined / myjavalib . stubs . exportable . test . jar - > sdk_library / test / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source . test / android_common / exportable / myjavalib . stubs . source . test_api . txt - > sdk_library / test / myjavalib . txt
. intermediates / myjavalib . stubs . source . test / android_common / exportable / myjavalib . stubs . source . test_removed . txt - > sdk_library / test / myjavalib - removed . txt
2020-02-10 14:37:10 +01:00
` ) ,
2020-04-09 01:10:17 +02:00
checkMergeZips (
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ,
".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip" ,
2021-06-22 12:00:07 +02:00
".intermediates/mysdk/common_os/tmp/sdk_library/test/myjavalib_stub_sources.zip" ,
) ,
2020-02-10 14:37:10 +01:00
)
}
2020-04-28 11:44:03 +02:00
2022-09-22 17:24:46 +02:00
func TestSnapshotWithJavaSdkLibrary_DistStem ( t * testing . T ) {
result := android . GroupFixturePreparers ( prepareForSdkTestWithJavaSdkLibrary ) . RunTestWithBp ( t , `
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib-foo" ] ,
}
java_sdk_library {
name : "myjavalib-foo" ,
apex_available : [ "//apex_available:anyapex" ] ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
shared_library : false ,
public : {
enabled : true ,
} ,
dist_stem : "myjavalib" ,
}
` )
CheckSnapshot ( t , result , "mysdk" , "" ,
checkAndroidBpContents ( `
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib-foo" ] ,
}
2022-09-22 17:24:46 +02:00
java_sdk_library_import {
name : "myjavalib-foo" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
apex_available : [ "//apex_available:anyapex" ] ,
shared_library : false ,
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib - foo . stubs . exportable / android_common / combined / myjavalib - foo . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib - foo . stubs . source / android_common / exportable / myjavalib - foo . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib - foo . stubs . source / android_common / exportable / myjavalib - foo . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
2022-09-22 17:24:46 +02:00
` ) ,
checkMergeZips (
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ,
) ,
)
}
2021-05-13 00:13:22 +02:00
func TestSnapshotWithJavaSdkLibrary_UseSrcJar ( t * testing . T ) {
result := android . GroupFixturePreparers (
prepareForSdkTestWithJavaSdkLibrary ,
android . FixtureMergeEnv ( map [ string ] string {
"SOONG_SDK_SNAPSHOT_USE_SRCJAR" : "true" ,
} ) ,
) . RunTestWithBp ( t , `
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
shared_library : false ,
public : {
enabled : true ,
} ,
}
` )
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2021-05-13 00:13:22 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2021-05-13 00:13:22 +02:00
java_sdk_library_import {
name : "myjavalib" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
apex_available : [ "//apex_available:platform" ] ,
shared_library : false ,
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
stub_srcs : [ "sdk_library/public/myjavalib.srcjar" ] ,
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source - stubs . srcjar - > sdk_library / public / myjavalib . srcjar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
2021-05-13 00:13:22 +02:00
` ) ,
)
}
2021-09-21 16:25:12 +02:00
func TestSnapshotWithJavaSdkLibrary_AnnotationsZip ( t * testing . T ) {
result := android . GroupFixturePreparers ( prepareForSdkTestWithJavaSdkLibrary ) . RunTestWithBp ( t , `
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
shared_library : false ,
annotations_enabled : true ,
public : {
enabled : true ,
} ,
}
` )
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2021-09-21 16:25:12 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2021-09-21 16:25:12 +02:00
java_sdk_library_import {
name : "myjavalib" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
apex_available : [ "//apex_available:platform" ] ,
shared_library : false ,
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
annotations : "sdk_library/public/myjavalib_annotations.zip" ,
sdk_version : "current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_annotations . zip - > sdk_library / public / myjavalib_annotations . zip
2021-09-21 16:25:12 +02:00
` ) ,
checkMergeZips ( ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ) ,
)
}
2022-01-27 17:39:47 +01:00
func TestSnapshotWithJavaSdkLibrary_AnnotationsZip_PreT ( t * testing . T ) {
result := android . GroupFixturePreparers (
prepareForSdkTestWithJavaSdkLibrary ,
android . FixtureMergeEnv ( map [ string ] string {
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE" : "S" ,
} ) ,
) . RunTestWithBp ( t , `
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
2022-07-27 01:53:00 +02:00
sdk_version : "S" ,
2022-01-27 17:39:47 +01:00
shared_library : false ,
annotations_enabled : true ,
public : {
enabled : true ,
} ,
}
` )
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2022-01-27 17:39:47 +01:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2022-01-27 17:39:47 +01:00
java_sdk_library_import {
name : "myjavalib" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
apex_available : [ "//apex_available:platform" ] ,
shared_library : false ,
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
2022-01-27 17:39:47 +01:00
` ) ,
checkMergeZips ( ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ) ,
)
}
2021-04-16 18:21:36 +02:00
func TestSnapshotWithJavaSdkLibrary_CompileDex ( t * testing . T ) {
2023-12-26 20:08:01 +01:00
result := android . GroupFixturePreparers (
prepareForSdkTestWithJavaSdkLibrary ,
android . FixtureModifyProductVariables ( func ( variables android . FixtureProductVariables ) {
variables . BuildFlags = map [ string ] string {
"RELEASE_HIDDEN_API_EXPORTABLE_STUBS" : "true" ,
}
} ) ,
) . RunTestWithBp ( t , `
2021-04-16 18:21:36 +02:00
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
shared_library : false ,
compile_dex : true ,
public : {
enabled : true ,
} ,
system : {
enabled : true ,
} ,
}
` )
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2021-04-16 18:21:36 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2021-04-16 18:21:36 +02:00
java_sdk_library_import {
name : "myjavalib" ,
prefer : false ,
visibility : [ "//visibility:public" ] ,
apex_available : [ "//apex_available:platform" ] ,
shared_library : false ,
compile_dex : true ,
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
system : {
jars : [ "sdk_library/system/myjavalib-stubs.jar" ] ,
stub_srcs : [ "sdk_library/system/myjavalib_stub_sources" ] ,
current_api : "sdk_library/system/myjavalib.txt" ,
removed_api : "sdk_library/system/myjavalib-removed.txt" ,
sdk_version : "system_current" ,
} ,
}
` ) ,
snapshotTestChecker ( checkSnapshotWithSourcePreferred , func ( t * testing . T , result * android . TestResult ) {
ctx := android . ModuleInstallPathContextForTesting ( result . Config )
dexJarBuildPath := func ( name string , kind android . SdkKind ) string {
dep := result . Module ( name , "android_common" ) . ( java . SdkLibraryDependency )
2023-12-26 20:08:01 +01:00
path := dep . SdkApiExportableStubDexJar ( ctx , kind ) . Path ( )
2021-04-16 18:21:36 +02:00
return path . RelativeToTop ( ) . String ( )
}
dexJarPath := dexJarBuildPath ( "myjavalib" , android . SdkPublic )
2023-12-26 20:08:01 +01:00
android . AssertStringEquals ( t , "source dex public stubs jar build path" , "out/soong/.intermediates/myjavalib.stubs.exportable/android_common/dex/myjavalib.stubs.exportable.jar" , dexJarPath )
2021-04-16 18:21:36 +02:00
dexJarPath = dexJarBuildPath ( "myjavalib" , android . SdkSystem )
2023-12-26 20:08:01 +01:00
systemDexJar := "out/soong/.intermediates/myjavalib.stubs.exportable.system/android_common/dex/myjavalib.stubs.exportable.system.jar"
2021-04-16 18:21:36 +02:00
android . AssertStringEquals ( t , "source dex system stubs jar build path" , systemDexJar , dexJarPath )
// This should fall back to system as module is not available.
dexJarPath = dexJarBuildPath ( "myjavalib" , android . SdkModule )
android . AssertStringEquals ( t , "source dex module stubs jar build path" , systemDexJar , dexJarPath )
2023-12-26 20:08:01 +01:00
// Prebuilt dex jar does not come from the exportable stubs.
2021-04-16 18:21:36 +02:00
dexJarPath = dexJarBuildPath ( android . PrebuiltNameFromSource ( "myjavalib" ) , android . SdkPublic )
android . AssertStringEquals ( t , "prebuilt dex public stubs jar build path" , "out/soong/.intermediates/snapshot/prebuilt_myjavalib.stubs/android_common/dex/myjavalib.stubs.jar" , dexJarPath )
} ) ,
)
}
2020-05-12 16:52:55 +02:00
func TestSnapshotWithJavaSdkLibrary_SdkVersion_None ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJavaSdkLibrary ) . RunTestWithBp ( t , `
2020-05-12 16:52:55 +02:00
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
sdk_version : "none" ,
system_modules : "none" ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-05-12 16:52:55 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2020-05-12 16:52:55 +02:00
java_sdk_library_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2020-05-26 21:57:10 +02:00
shared_library : true ,
2020-05-12 16:52:55 +02:00
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
2020-05-12 16:52:55 +02:00
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "none" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
2020-05-12 16:52:55 +02:00
` ) ,
checkMergeZips (
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ,
) ,
)
}
2020-05-12 12:50:28 +02:00
func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJavaSdkLibrary ) . RunTestWithBp ( t , `
2020-05-12 12:50:28 +02:00
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
sdk_version : "module_current" ,
public : {
enabled : true ,
sdk_version : "module_current" ,
} ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-05-12 12:50:28 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2020-05-12 12:50:28 +02:00
java_sdk_library_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2020-05-26 21:57:10 +02:00
shared_library : true ,
2020-05-12 12:50:28 +02:00
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
2020-05-12 12:50:28 +02:00
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "module_current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
2020-05-12 12:50:28 +02:00
` ) ,
checkMergeZips (
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ,
) ,
)
}
func TestSnapshotWithJavaSdkLibrary_ApiScopes ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJavaSdkLibrary ) . RunTestWithBp ( t , `
2020-04-28 11:44:03 +02:00
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
apex_available : [ "//apex_available:anyapex" ] ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
public : {
enabled : true ,
} ,
system : {
enabled : true ,
} ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-04-28 11:44:03 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2020-04-28 11:44:03 +02:00
java_sdk_library_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-04-28 11:44:03 +02:00
apex_available : [ "//apex_available:anyapex" ] ,
2020-05-26 21:57:10 +02:00
shared_library : true ,
2020-04-28 11:44:03 +02:00
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
2020-04-28 11:44:03 +02:00
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
system : {
jars : [ "sdk_library/system/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/system/myjavalib_stub_sources" ] ,
2020-04-28 11:44:03 +02:00
current_api : "sdk_library/system/myjavalib.txt" ,
removed_api : "sdk_library/system/myjavalib-removed.txt" ,
sdk_version : "system_current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
. intermediates / myjavalib . stubs . exportable . system / android_common / combined / myjavalib . stubs . exportable . system . jar - > sdk_library / system / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source . system / android_common / exportable / myjavalib . stubs . source . system_api . txt - > sdk_library / system / myjavalib . txt
. intermediates / myjavalib . stubs . source . system / android_common / exportable / myjavalib . stubs . source . system_removed . txt - > sdk_library / system / myjavalib - removed . txt
2020-04-28 11:44:03 +02:00
` ) ,
checkMergeZips (
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ,
".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip" ,
) ,
)
}
2020-04-28 15:13:56 +02:00
func TestSnapshotWithJavaSdkLibrary_ModuleLib ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJavaSdkLibrary ) . RunTestWithBp ( t , `
2020-04-28 15:13:56 +02:00
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
apex_available : [ "//apex_available:anyapex" ] ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
public : {
enabled : true ,
} ,
system : {
enabled : true ,
} ,
module_lib : {
enabled : true ,
} ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-04-28 15:13:56 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2020-04-28 15:13:56 +02:00
java_sdk_library_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-04-28 15:13:56 +02:00
apex_available : [ "//apex_available:anyapex" ] ,
2020-05-26 21:57:10 +02:00
shared_library : true ,
2020-04-28 15:13:56 +02:00
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
2020-04-28 15:13:56 +02:00
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
system : {
jars : [ "sdk_library/system/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/system/myjavalib_stub_sources" ] ,
2020-04-28 15:13:56 +02:00
current_api : "sdk_library/system/myjavalib.txt" ,
removed_api : "sdk_library/system/myjavalib-removed.txt" ,
sdk_version : "system_current" ,
} ,
module_lib : {
2020-05-13 20:19:49 +02:00
jars : [ "sdk_library/module-lib/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/module-lib/myjavalib_stub_sources" ] ,
2020-05-13 20:19:49 +02:00
current_api : "sdk_library/module-lib/myjavalib.txt" ,
removed_api : "sdk_library/module-lib/myjavalib-removed.txt" ,
2020-04-28 15:13:56 +02:00
sdk_version : "module_current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
. intermediates / myjavalib . stubs . exportable . system / android_common / combined / myjavalib . stubs . exportable . system . jar - > sdk_library / system / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source . system / android_common / exportable / myjavalib . stubs . source . system_api . txt - > sdk_library / system / myjavalib . txt
. intermediates / myjavalib . stubs . source . system / android_common / exportable / myjavalib . stubs . source . system_removed . txt - > sdk_library / system / myjavalib - removed . txt
. intermediates / myjavalib . stubs . exportable . module_lib / android_common / combined / myjavalib . stubs . exportable . module_lib . jar - > sdk_library / module - lib / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source . module_lib / android_common / exportable / myjavalib . stubs . source . module_lib_api . txt - > sdk_library / module - lib / myjavalib . txt
. intermediates / myjavalib . stubs . source . module_lib / android_common / exportable / myjavalib . stubs . source . module_lib_removed . txt - > sdk_library / module - lib / myjavalib - removed . txt
2020-04-28 15:13:56 +02:00
` ) ,
checkMergeZips (
2022-07-18 15:18:23 +02:00
".intermediates/mysdk/common_os/tmp/sdk_library/module-lib/myjavalib_stub_sources.zip" ,
2020-04-28 15:13:56 +02:00
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ,
".intermediates/mysdk/common_os/tmp/sdk_library/system/myjavalib_stub_sources.zip" ,
) ,
)
}
2020-05-13 17:54:55 +02:00
2020-06-02 14:00:08 +02:00
func TestSnapshotWithJavaSdkLibrary_SystemServer ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJavaSdkLibrary ) . RunTestWithBp ( t , `
2020-06-02 14:00:08 +02:00
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
apex_available : [ "//apex_available:anyapex" ] ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
public : {
enabled : true ,
} ,
system_server : {
enabled : true ,
} ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-06-02 14:00:08 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2020-06-02 14:00:08 +02:00
java_sdk_library_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-06-02 14:00:08 +02:00
apex_available : [ "//apex_available:anyapex" ] ,
shared_library : true ,
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
2020-06-02 14:00:08 +02:00
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
system_server : {
jars : [ "sdk_library/system-server/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/system-server/myjavalib_stub_sources" ] ,
2020-06-02 14:00:08 +02:00
current_api : "sdk_library/system-server/myjavalib.txt" ,
removed_api : "sdk_library/system-server/myjavalib-removed.txt" ,
sdk_version : "system_server_current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
. intermediates / myjavalib . stubs . exportable . system_server / android_common / combined / myjavalib . stubs . exportable . system_server . jar - > sdk_library / system - server / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source . system_server / android_common / exportable / myjavalib . stubs . source . system_server_api . txt - > sdk_library / system - server / myjavalib . txt
. intermediates / myjavalib . stubs . source . system_server / android_common / exportable / myjavalib . stubs . source . system_server_removed . txt - > sdk_library / system - server / myjavalib - removed . txt
2020-06-02 14:00:08 +02:00
` ) ,
checkMergeZips (
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ,
".intermediates/mysdk/common_os/tmp/sdk_library/system-server/myjavalib_stub_sources.zip" ,
) ,
)
}
2020-05-13 17:54:55 +02:00
func TestSnapshotWithJavaSdkLibrary_NamingScheme ( t * testing . T ) {
2021-03-15 12:17:52 +01:00
result := android . GroupFixturePreparers ( prepareForSdkTestWithJavaSdkLibrary ) . RunTestWithBp ( t , `
2020-05-13 17:54:55 +02:00
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
apex_available : [ "//apex_available:anyapex" ] ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
2020-09-11 14:04:05 +02:00
naming_scheme : "default" ,
2020-05-13 17:54:55 +02:00
public : {
enabled : true ,
} ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-05-13 17:54:55 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2020-05-13 17:54:55 +02:00
java_sdk_library_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-05-13 17:54:55 +02:00
apex_available : [ "//apex_available:anyapex" ] ,
2020-09-11 14:04:05 +02:00
naming_scheme : "default" ,
2020-05-26 21:57:10 +02:00
shared_library : true ,
2020-05-13 17:54:55 +02:00
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
2020-05-13 17:54:55 +02:00
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
2020-05-13 17:54:55 +02:00
` ) ,
checkMergeZips (
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip" ,
) ,
)
}
2020-09-11 12:55:00 +02:00
func TestSnapshotWithJavaSdkLibrary_DoctagFiles ( t * testing . T ) {
2021-03-21 23:01:55 +01:00
result := android . GroupFixturePreparers (
prepareForSdkTestWithJavaSdkLibrary ,
android . FixtureAddFile ( "docs/known_doctags" , nil ) ,
) . RunTestWithBp ( t , `
2020-09-11 12:55:00 +02:00
sdk {
name : "mysdk" ,
java_sdk_libs : [ "myjavalib" ] ,
}
java_sdk_library {
name : "myjavalib" ,
srcs : [ "Test.java" ] ,
sdk_version : "current" ,
public : {
enabled : true ,
} ,
doctag_files : [ "docs/known_doctags" ] ,
}
filegroup {
name : "mygroup" ,
srcs : [ ":myjavalib{.doctags}" ] ,
}
` )
2021-03-12 13:19:43 +01:00
CheckSnapshot ( t , result , "mysdk" , "" ,
2022-05-24 22:10:05 +02:00
checkAndroidBpContents ( `
2020-09-11 12:55:00 +02:00
// This is auto-generated. DO NOT EDIT.
Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.
Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
name: "art-module-host-exports.contributions",
contents: [
"prebuilt_art.module.api.annotations",
"prebuilt_dex2oat",
"prebuilt_dex2oatd",
"prebuilt_dexdump",
"prebuilt_hiddenapi",
"prebuilt_oatdump",
"prebuilt_profman",
"prebuilt_veridex",
"prebuilt_libartpalette",
"prebuilt_libartbase",
],
}
Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-06 15:04:36 +01:00
apex_contributions_defaults {
name : "mysdk.contributions" ,
contents : [ "prebuilt_myjavalib" ] ,
}
2020-09-11 12:55:00 +02:00
java_sdk_library_import {
2021-04-16 18:05:10 +02:00
name : "myjavalib" ,
prefer : false ,
2020-09-29 17:00:55 +02:00
visibility : [ "//visibility:public" ] ,
2020-11-03 01:11:09 +01:00
apex_available : [ "//apex_available:platform" ] ,
2020-09-11 12:55:00 +02:00
shared_library : true ,
doctag_files : [ "doctags/docs/known_doctags" ] ,
public : {
jars : [ "sdk_library/public/myjavalib-stubs.jar" ] ,
2020-11-18 17:37:35 +01:00
stub_srcs : [ "sdk_library/public/myjavalib_stub_sources" ] ,
2020-09-11 12:55:00 +02:00
current_api : "sdk_library/public/myjavalib.txt" ,
removed_api : "sdk_library/public/myjavalib-removed.txt" ,
sdk_version : "current" ,
} ,
}
` ) ,
checkAllCopyRules ( `
2024-01-08 09:56:20 +01:00
. intermediates / myjavalib . stubs . exportable / android_common / combined / myjavalib . stubs . exportable . jar - > sdk_library / public / myjavalib - stubs . jar
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_api . txt - > sdk_library / public / myjavalib . txt
. intermediates / myjavalib . stubs . source / android_common / exportable / myjavalib . stubs . source_removed . txt - > sdk_library / public / myjavalib - removed . txt
2020-09-11 12:55:00 +02:00
docs / known_doctags - > doctags / docs / known_doctags
` ) ,
)
}