2019-12-03 23:25:00 +08: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 (
|
|
|
|
"testing"
|
2020-07-10 00:32:57 +08:00
|
|
|
|
2021-03-10 06:27:13 +08:00
|
|
|
"android/soong/android"
|
2020-07-10 00:32:57 +08:00
|
|
|
"android/soong/java"
|
2019-12-03 23:25:00 +08:00
|
|
|
)
|
|
|
|
|
2021-03-18 17:14:23 +08:00
|
|
|
var prepareForSdkTestWithJava = android.GroupFixturePreparers(
|
|
|
|
java.PrepareForTestWithJavaBuildComponents,
|
|
|
|
PrepareForTestWithSdkBuildComponents,
|
2021-03-22 06:01:55 +08: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{
|
|
|
|
"Test.java": nil,
|
|
|
|
}.AddToFixture(),
|
2021-03-18 17:14:23 +08:00
|
|
|
)
|
|
|
|
|
2021-03-15 19:17:52 +08:00
|
|
|
var prepareForSdkTestWithJavaSdkLibrary = android.GroupFixturePreparers(
|
|
|
|
prepareForSdkTestWithJava,
|
|
|
|
java.PrepareForTestWithJavaDefaultModules,
|
|
|
|
java.PrepareForTestWithJavaSdkLibraryFiles,
|
|
|
|
java.FixtureWithLastReleaseApis("myjavalib"),
|
|
|
|
)
|
|
|
|
|
2019-12-03 23:25:00 +08:00
|
|
|
// Contains tests for SDK members provided by the java package.
|
|
|
|
|
2020-07-10 00:32:57 +08:00
|
|
|
func TestSdkDependsOnSourceEvenWhenPrebuiltPreferred(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
|
2020-07-10 00:32:57 +08: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 20:56:33 +08:00
|
|
|
sdkChecker := func(t *testing.T, result *android.TestResult) {
|
|
|
|
java.CheckModuleDependencies(t, result.TestContext, "mysdk", "android_common", []string{"sdkmember"})
|
|
|
|
}
|
2020-07-10 00:32:57 +08:00
|
|
|
|
2021-03-12 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2021-03-21 20:56:33 +08:00
|
|
|
snapshotTestChecker(checkSnapshotWithSourcePreferred, sdkChecker),
|
|
|
|
snapshotTestChecker(checkSnapshotPreferredWithSource, sdkChecker),
|
|
|
|
)
|
2020-07-10 00:32:57 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 23:25:00 +08:00
|
|
|
func TestBasicSdkWithJavaLibrary(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(
|
|
|
|
prepareForSdkTestWithJava,
|
|
|
|
prepareForSdkTestWithApex,
|
|
|
|
).RunTestWithBp(t, `
|
2019-12-03 23:25:00 +08:00
|
|
|
sdk {
|
|
|
|
name: "mysdk",
|
apex_available tracks static dependencies
This change fixes a bug that apex_available is not enforced for static
dependencies. For example, a module with 'apex_available:
["//apex_available:platform"]' was able to be statically linked to any
APEX. This was happening because the check was done on the modules that
are actually installed to an APEX. Static dependencies of the modules
were not counted as they are not installed to the APEX as files.
Fixing this bug by doing the check by traversing the tree in the method
checkApexAvailability.
This change includes a few number of related changes:
1) DepIsInSameApex implementation for cc.Module was changed as well.
Previuosly, it returned false only when the dependency is actually a
stub variant of a lib. Now, it returns false when the dependency has one
or more stub variants. To understand why, we need to recall that when
there is a dependency to a lib having stubs, we actually create two
dependencies: to the non-stub variant and to the stub variant during the
DepsMutator phase. And later in the build action generation phase, we
choose one of them depending on the context. Also recall that an APEX
variant is created only when DepIsInSameApex returns true. Given these,
with the previous implementatin of DepIsInSameApex, we did create apex
variants of the non-stub variant of the dependency, while not creating
the apex variant for the stub variant. This is not right; we needlessly
created the apex variant. The extra apex variant has caused no harm so
far, but since the apex_available check became more correct, it actually
breaks the build. To fix the issue, we stop creating the APEX variant
both for non-stub and stub variants.
2) platform variant is created regardless of the apex_available value.
This is required for the case when a library X that provides stub is in
an APEX A and is configured to be available only for A. In that case,
libs in other APEX can't use the stub library since the stub library is
mutated only for apex A. By creating the platform variant for the stub
library, it can be used from outside as the default dependency variation
is set to the platform variant when creating the APEX variations.
3) The ApexAvailableWhitelist is added with the dependencies that were
revealed with this change.
Exempt-From-Owner-Approval: cherry-pick from internal
Bug: 147671264
Test: m
Merged-In: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
(cherry picked from commit fa89944c79f19552e906b41fd03a4981903eee7e)
Change-Id: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
2020-01-31 01:49:53 +08:00
|
|
|
java_header_libs: ["sdkmember"],
|
2019-12-03 23:25:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@1",
|
2019-12-05 19:25:53 +08:00
|
|
|
java_header_libs: ["sdkmember_mysdk_1"],
|
2019-12-03 23:25:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@2",
|
2019-12-05 19:25:53 +08:00
|
|
|
java_header_libs: ["sdkmember_mysdk_2"],
|
2019-12-03 23:25:00 +08:00
|
|
|
}
|
|
|
|
|
apex_available tracks static dependencies
This change fixes a bug that apex_available is not enforced for static
dependencies. For example, a module with 'apex_available:
["//apex_available:platform"]' was able to be statically linked to any
APEX. This was happening because the check was done on the modules that
are actually installed to an APEX. Static dependencies of the modules
were not counted as they are not installed to the APEX as files.
Fixing this bug by doing the check by traversing the tree in the method
checkApexAvailability.
This change includes a few number of related changes:
1) DepIsInSameApex implementation for cc.Module was changed as well.
Previuosly, it returned false only when the dependency is actually a
stub variant of a lib. Now, it returns false when the dependency has one
or more stub variants. To understand why, we need to recall that when
there is a dependency to a lib having stubs, we actually create two
dependencies: to the non-stub variant and to the stub variant during the
DepsMutator phase. And later in the build action generation phase, we
choose one of them depending on the context. Also recall that an APEX
variant is created only when DepIsInSameApex returns true. Given these,
with the previous implementatin of DepIsInSameApex, we did create apex
variants of the non-stub variant of the dependency, while not creating
the apex variant for the stub variant. This is not right; we needlessly
created the apex variant. The extra apex variant has caused no harm so
far, but since the apex_available check became more correct, it actually
breaks the build. To fix the issue, we stop creating the APEX variant
both for non-stub and stub variants.
2) platform variant is created regardless of the apex_available value.
This is required for the case when a library X that provides stub is in
an APEX A and is configured to be available only for A. In that case,
libs in other APEX can't use the stub library since the stub library is
mutated only for apex A. By creating the platform variant for the stub
library, it can be used from outside as the default dependency variation
is set to the platform variant when creating the APEX variations.
3) The ApexAvailableWhitelist is added with the dependencies that were
revealed with this change.
Exempt-From-Owner-Approval: cherry-pick from internal
Bug: 147671264
Test: m
Merged-In: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
(cherry picked from commit fa89944c79f19552e906b41fd03a4981903eee7e)
Change-Id: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
2020-01-31 01:49:53 +08:00
|
|
|
java_library {
|
2019-12-03 23:25:00 +08:00
|
|
|
name: "sdkmember",
|
apex_available tracks static dependencies
This change fixes a bug that apex_available is not enforced for static
dependencies. For example, a module with 'apex_available:
["//apex_available:platform"]' was able to be statically linked to any
APEX. This was happening because the check was done on the modules that
are actually installed to an APEX. Static dependencies of the modules
were not counted as they are not installed to the APEX as files.
Fixing this bug by doing the check by traversing the tree in the method
checkApexAvailability.
This change includes a few number of related changes:
1) DepIsInSameApex implementation for cc.Module was changed as well.
Previuosly, it returned false only when the dependency is actually a
stub variant of a lib. Now, it returns false when the dependency has one
or more stub variants. To understand why, we need to recall that when
there is a dependency to a lib having stubs, we actually create two
dependencies: to the non-stub variant and to the stub variant during the
DepsMutator phase. And later in the build action generation phase, we
choose one of them depending on the context. Also recall that an APEX
variant is created only when DepIsInSameApex returns true. Given these,
with the previous implementatin of DepIsInSameApex, we did create apex
variants of the non-stub variant of the dependency, while not creating
the apex variant for the stub variant. This is not right; we needlessly
created the apex variant. The extra apex variant has caused no harm so
far, but since the apex_available check became more correct, it actually
breaks the build. To fix the issue, we stop creating the APEX variant
both for non-stub and stub variants.
2) platform variant is created regardless of the apex_available value.
This is required for the case when a library X that provides stub is in
an APEX A and is configured to be available only for A. In that case,
libs in other APEX can't use the stub library since the stub library is
mutated only for apex A. By creating the platform variant for the stub
library, it can be used from outside as the default dependency variation
is set to the platform variant when creating the APEX variations.
3) The ApexAvailableWhitelist is added with the dependencies that were
revealed with this change.
Exempt-From-Owner-Approval: cherry-pick from internal
Bug: 147671264
Test: m
Merged-In: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
(cherry picked from commit fa89944c79f19552e906b41fd03a4981903eee7e)
Change-Id: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
2020-01-31 01:49:53 +08:00
|
|
|
srcs: ["Test.java"],
|
|
|
|
system_modules: "none",
|
|
|
|
sdk_version: "none",
|
2019-12-03 23:25:00 +08:00
|
|
|
host_supported: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "sdkmember_mysdk_1",
|
|
|
|
sdk_member_name: "sdkmember",
|
|
|
|
host_supported: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "sdkmember_mysdk_2",
|
|
|
|
sdk_member_name: "sdkmember",
|
|
|
|
host_supported: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
java_library {
|
|
|
|
name: "myjavalib",
|
|
|
|
srcs: ["Test.java"],
|
|
|
|
libs: ["sdkmember"],
|
|
|
|
system_modules: "none",
|
|
|
|
sdk_version: "none",
|
|
|
|
compile_dex: true,
|
|
|
|
host_supported: true,
|
2020-01-10 23:12:39 +08:00
|
|
|
apex_available: [
|
|
|
|
"myapex",
|
|
|
|
"myapex2",
|
|
|
|
],
|
2019-12-03 23:25:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
apex {
|
|
|
|
name: "myapex",
|
|
|
|
java_libs: ["myjavalib"],
|
|
|
|
uses_sdks: ["mysdk@1"],
|
|
|
|
key: "myapex.key",
|
|
|
|
certificate: ":myapex.cert",
|
2021-02-16 19:40:16 +08:00
|
|
|
updatable: false,
|
2019-12-03 23:25:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
apex {
|
|
|
|
name: "myapex2",
|
|
|
|
java_libs: ["myjavalib"],
|
|
|
|
uses_sdks: ["mysdk@2"],
|
|
|
|
key: "myapex.key",
|
|
|
|
certificate: ":myapex.cert",
|
2021-02-16 19:40:16 +08:00
|
|
|
updatable: false,
|
2019-12-03 23:25:00 +08:00
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
2021-03-11 20:18:24 +08:00
|
|
|
sdkMemberV1 := result.ModuleForTests("sdkmember_mysdk_1", "android_common").Rule("combineJar").Output
|
|
|
|
sdkMemberV2 := result.ModuleForTests("sdkmember_mysdk_2", "android_common").Rule("combineJar").Output
|
2019-12-03 23:25:00 +08:00
|
|
|
|
2021-03-11 20:18:24 +08:00
|
|
|
javalibForMyApex := result.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_1")
|
|
|
|
javalibForMyApex2 := result.ModuleForTests("myjavalib", "android_common_apex10000_mysdk_2")
|
2019-12-03 23:25:00 +08:00
|
|
|
|
|
|
|
// Depending on the uses_sdks value, different libs are linked
|
|
|
|
ensureListContains(t, pathsToStrings(javalibForMyApex.Rule("javac").Implicits), sdkMemberV1.String())
|
|
|
|
ensureListContains(t, pathsToStrings(javalibForMyApex2.Rule("javac").Implicits), sdkMemberV2.String())
|
|
|
|
}
|
|
|
|
|
2019-12-05 19:25:53 +08:00
|
|
|
func TestSnapshotWithJavaHeaderLibrary(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(
|
|
|
|
prepareForSdkTestWithJava,
|
|
|
|
android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil),
|
|
|
|
).RunTestWithBp(t, `
|
2019-12-05 19:25:53 +08: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-03-12 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2019-12-05 19:25:53 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-05 19:25:53 +08:00
|
|
|
jars: ["java/myjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-05 19:25:53 +08:00
|
|
|
jars: ["java/myjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2019-12-05 19:25:53 +08:00
|
|
|
java_header_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
|
|
|
|
`),
|
|
|
|
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 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(
|
|
|
|
prepareForSdkTestWithJava,
|
|
|
|
android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil),
|
|
|
|
).RunTestWithBp(t, `
|
2019-12-05 19:25:53 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2019-12-05 19:25:53 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-05 19:25:53 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/myjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-05 19:25:53 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/myjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2019-12-05 19:25:53 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
java_header_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar -> java/myjavalib.jar
|
|
|
|
aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
|
|
|
|
`),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-03-02 18:16:35 +08:00
|
|
|
func TestDeviceAndHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
|
2020-03-02 18:16:35 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-03-02 18:16:35 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-03-02 18:16:35 +08:00
|
|
|
host_supported: true,
|
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
jars: ["java/android/myjavalib.jar"],
|
|
|
|
},
|
|
|
|
linux_glibc: {
|
|
|
|
jars: ["java/linux_glibc/myjavalib.jar"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-03-02 18:16:35 +08:00
|
|
|
host_supported: true,
|
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
jars: ["java/android/myjavalib.jar"],
|
|
|
|
},
|
|
|
|
linux_glibc: {
|
|
|
|
jars: ["java/linux_glibc/myjavalib.jar"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-03-02 18:16:35 +08:00
|
|
|
host_supported: true,
|
|
|
|
java_header_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/myjavalib/android_common/turbine-combined/myjavalib.jar -> java/android/myjavalib.jar
|
|
|
|
.intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar -> java/linux_glibc/myjavalib.jar
|
|
|
|
`),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-12-05 19:25:53 +08:00
|
|
|
func TestSnapshotWithJavaImplLibrary(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(
|
|
|
|
prepareForSdkTestWithJava,
|
|
|
|
android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil),
|
2021-03-22 06:01:55 +08:00
|
|
|
android.FixtureAddFile("resource.txt", nil),
|
2021-03-15 19:17:52 +08:00
|
|
|
).RunTestWithBp(t, `
|
2019-12-17 01:43:48 +08:00
|
|
|
module_exports {
|
|
|
|
name: "myexports",
|
2019-12-03 23:25:00 +08:00
|
|
|
java_libs: ["myjavalib"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_library {
|
|
|
|
name: "myjavalib",
|
|
|
|
srcs: ["Test.java"],
|
2020-06-24 19:10:42 +08:00
|
|
|
java_resources: ["resource.txt"],
|
2019-12-03 23:25:00 +08:00
|
|
|
aidl: {
|
|
|
|
export_include_dirs: ["aidl"],
|
|
|
|
},
|
|
|
|
system_modules: "none",
|
|
|
|
sdk_version: "none",
|
|
|
|
compile_dex: true,
|
|
|
|
host_supported: true,
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
2021-03-12 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "myexports", "",
|
2019-12-03 23:25:00 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_import {
|
2019-12-17 01:43:48 +08:00
|
|
|
name: "myexports_myjavalib@current",
|
2019-12-03 23:25:00 +08:00
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-03 23:25:00 +08:00
|
|
|
jars: ["java/myjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-03 23:25:00 +08:00
|
|
|
jars: ["java/myjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
2019-12-17 01:43:48 +08:00
|
|
|
module_exports_snapshot {
|
|
|
|
name: "myexports@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2019-12-17 01:43:48 +08:00
|
|
|
java_libs: ["myexports_myjavalib@current"],
|
2019-12-03 23:25:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
2020-06-24 19:10:42 +08:00
|
|
|
.intermediates/myjavalib/android_common/withres/myjavalib.jar -> java/myjavalib.jar
|
2019-12-03 23:25:00 +08:00
|
|
|
aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
|
|
|
|
`),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-12-09 01:48:25 +08:00
|
|
|
func TestSnapshotWithJavaBootLibrary(t *testing.T) {
|
2021-03-22 06:01:55 +08:00
|
|
|
result := android.GroupFixturePreparers(
|
|
|
|
prepareForSdkTestWithJava,
|
|
|
|
android.FixtureAddFile("aidl", nil),
|
|
|
|
android.FixtureAddFile("resource.txt", nil),
|
|
|
|
).RunTestWithBp(t, `
|
2020-12-09 01:48:25 +08:00
|
|
|
module_exports {
|
|
|
|
name: "myexports",
|
|
|
|
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-03-12 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "myexports", "",
|
2020-12-09 01:48:25 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myexports_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
|
|
|
visibility: ["//visibility:public"],
|
|
|
|
apex_available: ["//apex_available:platform"],
|
2021-02-04 19:15:34 +08:00
|
|
|
jars: ["java/myjavalib.jar"],
|
2020-12-09 01:48:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
|
|
|
visibility: ["//visibility:public"],
|
|
|
|
apex_available: ["//apex_available:platform"],
|
2021-02-04 19:15:34 +08:00
|
|
|
jars: ["java/myjavalib.jar"],
|
2020-12-09 01:48:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module_exports_snapshot {
|
|
|
|
name: "myexports@current",
|
|
|
|
visibility: ["//visibility:public"],
|
|
|
|
java_boot_libs: ["myexports_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
2021-02-04 19:15:34 +08:00
|
|
|
.intermediates/myjavalib/android_common/withres/myjavalib.jar -> java/myjavalib.jar
|
2020-12-09 01:48:25 +08:00
|
|
|
`),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-12-05 19:25:53 +08:00
|
|
|
func TestHostSnapshotWithJavaImplLibrary(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(
|
|
|
|
prepareForSdkTestWithJava,
|
|
|
|
android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil),
|
|
|
|
).RunTestWithBp(t, `
|
2019-12-17 01:43:48 +08:00
|
|
|
module_exports {
|
|
|
|
name: "myexports",
|
2019-12-03 23:25:00 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "myexports", "",
|
2019-12-03 23:25:00 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_import {
|
2019-12-17 01:43:48 +08:00
|
|
|
name: "myexports_myjavalib@current",
|
2019-12-03 23:25:00 +08:00
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-03 23:25:00 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/myjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-03 23:25:00 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/myjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
2019-12-17 01:43:48 +08:00
|
|
|
module_exports_snapshot {
|
|
|
|
name: "myexports@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2019-12-03 23:25:00 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
2019-12-17 01:43:48 +08:00
|
|
|
java_libs: ["myexports_myjavalib@current"],
|
2019-12-03 23:25:00 +08:00
|
|
|
}
|
|
|
|
`),
|
|
|
|
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-04 02:06:47 +08:00
|
|
|
func TestSnapshotWithJavaTest(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
|
2019-12-04 02:06:47 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "myexports", "",
|
2019-12-04 02:06:47 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_test_import {
|
|
|
|
name: "myexports_myjavatests@current",
|
|
|
|
sdk_member_name: "myjavatests",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-04 02:06:47 +08:00
|
|
|
jars: ["java/myjavatests.jar"],
|
|
|
|
test_config: "java/myjavatests-AndroidTest.xml",
|
|
|
|
}
|
|
|
|
|
|
|
|
java_test_import {
|
|
|
|
name: "myjavatests",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-04 02:06:47 +08:00
|
|
|
jars: ["java/myjavatests.jar"],
|
|
|
|
test_config: "java/myjavatests-AndroidTest.xml",
|
|
|
|
}
|
|
|
|
|
|
|
|
module_exports_snapshot {
|
|
|
|
name: "myexports@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2019-12-04 02:06:47 +08:00
|
|
|
java_tests: ["myexports_myjavatests@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
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 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
|
2019-12-04 02:06:47 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "myexports", "",
|
2019-12-04 02:06:47 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_test_import {
|
|
|
|
name: "myexports_myjavatests@current",
|
|
|
|
sdk_member_name: "myjavatests",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-04 02:06:47 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/myjavatests.jar"],
|
|
|
|
test_config: "java/myjavatests-AndroidTest.xml",
|
|
|
|
}
|
|
|
|
|
|
|
|
java_test_import {
|
|
|
|
name: "myjavatests",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2019-12-04 02:06:47 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/myjavatests.jar"],
|
|
|
|
test_config: "java/myjavatests-AndroidTest.xml",
|
|
|
|
}
|
|
|
|
|
|
|
|
module_exports_snapshot {
|
|
|
|
name: "myexports@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2019-12-04 02:06:47 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
java_tests: ["myexports_myjavatests@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
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-14 05:03:22 +08:00
|
|
|
func TestSnapshotWithJavaSystemModules(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
|
2020-01-14 05:03:22 +08:00
|
|
|
sdk {
|
|
|
|
name: "mysdk",
|
2020-01-21 02:16:30 +08:00
|
|
|
java_header_libs: ["exported-system-module"],
|
2020-01-14 05:03:22 +08:00
|
|
|
java_system_modules: ["my-system-modules"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_system_modules {
|
|
|
|
name: "my-system-modules",
|
2020-01-21 02:16:30 +08:00
|
|
|
libs: ["system-module", "exported-system-module"],
|
2020-01-14 05:03:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
java_library {
|
|
|
|
name: "system-module",
|
|
|
|
srcs: ["Test.java"],
|
|
|
|
sdk_version: "none",
|
|
|
|
system_modules: "none",
|
|
|
|
}
|
2020-01-21 02:16:30 +08:00
|
|
|
|
|
|
|
java_library {
|
|
|
|
name: "exported-system-module",
|
|
|
|
srcs: ["Test.java"],
|
|
|
|
sdk_version: "none",
|
|
|
|
system_modules: "none",
|
|
|
|
}
|
2020-01-14 05:03:22 +08:00
|
|
|
`)
|
|
|
|
|
2021-03-12 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-01-14 05:03:22 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
2020-01-21 02:16:30 +08:00
|
|
|
java_import {
|
|
|
|
name: "mysdk_exported-system-module@current",
|
|
|
|
sdk_member_name: "exported-system-module",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-01-21 02:16:30 +08:00
|
|
|
jars: ["java/exported-system-module.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "exported-system-module",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-01-21 02:16:30 +08:00
|
|
|
jars: ["java/exported-system-module.jar"],
|
|
|
|
}
|
|
|
|
|
2020-01-14 05:03:22 +08:00
|
|
|
java_import {
|
|
|
|
name: "mysdk_system-module@current",
|
|
|
|
sdk_member_name: "system-module",
|
2020-01-21 02:16:30 +08:00
|
|
|
visibility: ["//visibility:private"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-01-14 05:03:22 +08:00
|
|
|
jars: ["java/system-module.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
2020-01-21 02:16:30 +08:00
|
|
|
name: "mysdk_system-module",
|
2020-01-14 05:03:22 +08:00
|
|
|
prefer: false,
|
2020-01-21 02:16:30 +08:00
|
|
|
visibility: ["//visibility:private"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-01-14 05:03:22 +08:00
|
|
|
jars: ["java/system-module.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_system_modules_import {
|
|
|
|
name: "mysdk_my-system-modules@current",
|
|
|
|
sdk_member_name: "my-system-modules",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-01-21 02:16:30 +08:00
|
|
|
libs: [
|
|
|
|
"mysdk_system-module@current",
|
|
|
|
"mysdk_exported-system-module@current",
|
|
|
|
],
|
2020-01-14 05:03:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
java_system_modules_import {
|
|
|
|
name: "my-system-modules",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-01-21 02:16:30 +08:00
|
|
|
libs: [
|
|
|
|
"mysdk_system-module",
|
|
|
|
"exported-system-module",
|
|
|
|
],
|
2020-01-14 05:03:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-01-21 02:16:30 +08:00
|
|
|
java_header_libs: ["mysdk_exported-system-module@current"],
|
2020-01-14 05:03:22 +08:00
|
|
|
java_system_modules: ["mysdk_my-system-modules@current"],
|
|
|
|
}
|
|
|
|
`),
|
2020-01-21 02:16:30 +08: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
|
|
|
|
`),
|
2020-01-14 05:03:22 +08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestHostSnapshotWithJavaSystemModules(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
|
2020-01-14 05:03:22 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-01-14 05:03:22 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "mysdk_system-module@current",
|
|
|
|
sdk_member_name: "system-module",
|
2020-01-21 02:16:30 +08:00
|
|
|
visibility: ["//visibility:private"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-01-14 05:03:22 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/system-module.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
2020-01-21 02:16:30 +08:00
|
|
|
name: "mysdk_system-module",
|
2020-01-14 05:03:22 +08:00
|
|
|
prefer: false,
|
2020-01-21 02:16:30 +08:00
|
|
|
visibility: ["//visibility:private"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-01-14 05:03:22 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/system-module.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_system_modules_import {
|
|
|
|
name: "mysdk_my-system-modules@current",
|
|
|
|
sdk_member_name: "my-system-modules",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-01-14 05:03:22 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
libs: ["mysdk_system-module@current"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_system_modules_import {
|
|
|
|
name: "my-system-modules",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-01-14 05:03:22 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
2020-01-21 02:16:30 +08:00
|
|
|
libs: ["mysdk_system-module"],
|
2020-01-14 05:03:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-01-14 05:03:22 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
java_system_modules: ["mysdk_my-system-modules@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(".intermediates/system-module/linux_glibc_common/javac/system-module.jar -> java/system-module.jar"),
|
|
|
|
)
|
|
|
|
}
|
2020-03-03 02:38:15 +08:00
|
|
|
|
|
|
|
func TestDeviceAndHostSnapshotWithOsSpecificMembers(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
|
2020-03-03 02:38:15 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "myexports", "",
|
2020-03-03 02:38:15 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myexports_hostjavalib@current",
|
|
|
|
sdk_member_name: "hostjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-03-03 02:38:15 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/hostjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "hostjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-03-03 02:38:15 +08:00
|
|
|
device_supported: false,
|
|
|
|
host_supported: true,
|
|
|
|
jars: ["java/hostjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myexports_androidjavalib@current",
|
|
|
|
sdk_member_name: "androidjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-03-03 02:38:15 +08:00
|
|
|
jars: ["java/androidjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "androidjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-03-03 02:38:15 +08:00
|
|
|
jars: ["java/androidjavalib.jar"],
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myexports_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-03-03 02:38:15 +08:00
|
|
|
host_supported: true,
|
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
jars: ["java/android/myjavalib.jar"],
|
|
|
|
},
|
|
|
|
linux_glibc: {
|
|
|
|
jars: ["java/linux_glibc/myjavalib.jar"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-03-03 02:38:15 +08:00
|
|
|
host_supported: true,
|
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
jars: ["java/android/myjavalib.jar"],
|
|
|
|
},
|
|
|
|
linux_glibc: {
|
|
|
|
jars: ["java/linux_glibc/myjavalib.jar"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
module_exports_snapshot {
|
|
|
|
name: "myexports@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-03-03 02:38:15 +08:00
|
|
|
host_supported: true,
|
2020-03-12 02:17:42 +08:00
|
|
|
java_libs: ["myexports_myjavalib@current"],
|
2020-03-03 02:38:15 +08:00
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
java_header_libs: ["myexports_androidjavalib@current"],
|
|
|
|
},
|
|
|
|
linux_glibc: {
|
|
|
|
java_header_libs: ["myexports_hostjavalib@current"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/hostjavalib/linux_glibc_common/javac/hostjavalib.jar -> java/hostjavalib.jar
|
|
|
|
.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 21:37:10 +08:00
|
|
|
|
|
|
|
func TestSnapshotWithJavaSdkLibrary(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
|
2020-02-10 21:37:10 +08: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-27 03:57:10 +08:00
|
|
|
shared_library: false,
|
2020-04-30 06:35:13 +08:00
|
|
|
stubs_library_visibility: ["//other"],
|
|
|
|
stubs_source_visibility: ["//another"],
|
2020-02-10 21:37:10 +08:00
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
2021-03-12 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-02-10 21:37:10 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-02-10 21:37:10 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: false,
|
2020-02-10 21:37:10 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-04-09 08:08:11 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
2020-02-10 21:37:10 +08:00
|
|
|
sdk_version: "current",
|
|
|
|
},
|
|
|
|
system: {
|
|
|
|
jars: ["sdk_library/system/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
|
2020-04-09 08:08:11 +08:00
|
|
|
current_api: "sdk_library/system/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/system/myjavalib-removed.txt",
|
2020-02-10 21:37:10 +08:00
|
|
|
sdk_version: "system_current",
|
|
|
|
},
|
|
|
|
test: {
|
|
|
|
jars: ["sdk_library/test/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/test/myjavalib_stub_sources"],
|
2020-04-09 08:08:11 +08:00
|
|
|
current_api: "sdk_library/test/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/test/myjavalib-removed.txt",
|
2020-02-10 21:37:10 +08:00
|
|
|
sdk_version: "test_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-02-10 21:37:10 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: false,
|
2020-02-10 21:37:10 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-04-09 08:08:11 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
2020-02-10 21:37:10 +08:00
|
|
|
sdk_version: "current",
|
|
|
|
},
|
|
|
|
system: {
|
|
|
|
jars: ["sdk_library/system/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
|
2020-04-09 08:08:11 +08:00
|
|
|
current_api: "sdk_library/system/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/system/myjavalib-removed.txt",
|
2020-02-10 21:37:10 +08:00
|
|
|
sdk_version: "system_current",
|
|
|
|
},
|
|
|
|
test: {
|
|
|
|
jars: ["sdk_library/test/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/test/myjavalib_stub_sources"],
|
2020-04-09 08:08:11 +08:00
|
|
|
current_api: "sdk_library/test/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/test/myjavalib-removed.txt",
|
2020-02-10 21:37:10 +08:00
|
|
|
sdk_version: "test_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-02-10 21:37:10 +08:00
|
|
|
java_sdk_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
|
2020-02-10 21:37:10 +08:00
|
|
|
.intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt
|
2020-02-10 21:37:10 +08:00
|
|
|
.intermediates/myjavalib.stubs.test/android_common/javac/myjavalib.stubs.test.jar -> sdk_library/test/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source.test/android_common/metalava/myjavalib.stubs.source.test_api.txt -> sdk_library/test/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source.test/android_common/metalava/myjavalib.stubs.source.test_removed.txt -> sdk_library/test/myjavalib-removed.txt
|
2020-02-10 21:37:10 +08:00
|
|
|
`),
|
2020-04-09 07:10:17 +08: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",
|
|
|
|
".intermediates/mysdk/common_os/tmp/sdk_library/test/myjavalib_stub_sources.zip"),
|
2020-02-10 21:37:10 +08:00
|
|
|
)
|
|
|
|
}
|
2020-04-28 17:44:03 +08:00
|
|
|
|
2020-05-12 22:52:55 +08:00
|
|
|
func TestSnapshotWithJavaSdkLibrary_SdkVersion_None(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
|
2020-05-12 22:52:55 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-05-12 22:52:55 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-05-12 22:52:55 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-05-12 22:52:55 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
|
|
|
sdk_version: "none",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-05-12 22:52:55 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-05-12 22:52:55 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
|
|
|
sdk_version: "none",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-05-12 22:52:55 +08:00
|
|
|
java_sdk_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
|
2020-05-12 22:52:55 +08:00
|
|
|
`),
|
|
|
|
checkMergeZips(
|
|
|
|
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-05-12 18:50:28 +08:00
|
|
|
func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
|
2020-05-12 18:50:28 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-05-12 18:50:28 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-05-12 18:50:28 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-05-12 18:50:28 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
|
|
|
sdk_version: "module_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-05-12 18:50:28 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-05-12 18:50:28 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
|
|
|
sdk_version: "module_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-05-12 18:50:28 +08:00
|
|
|
java_sdk_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
|
2020-05-12 18:50:28 +08:00
|
|
|
`),
|
|
|
|
checkMergeZips(
|
|
|
|
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSnapshotWithJavaSdkLibrary_ApiScopes(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
|
2020-04-28 17:44:03 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-04-28 17:44:03 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-04-28 17:44:03 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-04-28 17:44:03 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-04-28 17:44:03 +08: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-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
|
2020-04-28 17:44:03 +08:00
|
|
|
current_api: "sdk_library/system/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/system/myjavalib-removed.txt",
|
|
|
|
sdk_version: "system_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-04-28 17:44:03 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-04-28 17:44:03 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-04-28 17:44:03 +08: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-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
|
2020-04-28 17:44:03 +08:00
|
|
|
current_api: "sdk_library/system/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/system/myjavalib-removed.txt",
|
|
|
|
sdk_version: "system_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-04-28 17:44:03 +08:00
|
|
|
java_sdk_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
|
2020-04-28 17:44:03 +08:00
|
|
|
.intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt
|
2020-04-28 17:44:03 +08: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 21:13:56 +08:00
|
|
|
|
|
|
|
func TestSnapshotWithJavaSdkLibrary_ModuleLib(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
|
2020-04-28 21:13:56 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-04-28 21:13:56 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-04-28 21:13:56 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-04-28 21:13:56 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-04-28 21:13:56 +08: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-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
|
2020-04-28 21:13:56 +08:00
|
|
|
current_api: "sdk_library/system/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/system/myjavalib-removed.txt",
|
|
|
|
sdk_version: "system_current",
|
|
|
|
},
|
|
|
|
module_lib: {
|
2020-05-14 02:19:49 +08:00
|
|
|
jars: ["sdk_library/module-lib/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"],
|
2020-05-14 02:19:49 +08:00
|
|
|
current_api: "sdk_library/module-lib/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/module-lib/myjavalib-removed.txt",
|
2020-04-28 21:13:56 +08:00
|
|
|
sdk_version: "module_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-04-28 21:13:56 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-04-28 21:13:56 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-04-28 21:13:56 +08: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-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/system/myjavalib_stub_sources"],
|
2020-04-28 21:13:56 +08:00
|
|
|
current_api: "sdk_library/system/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/system/myjavalib-removed.txt",
|
|
|
|
sdk_version: "system_current",
|
|
|
|
},
|
|
|
|
module_lib: {
|
2020-05-14 02:19:49 +08:00
|
|
|
jars: ["sdk_library/module-lib/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/module-lib/myjavalib_stub_sources"],
|
2020-05-14 02:19:49 +08:00
|
|
|
current_api: "sdk_library/module-lib/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/module-lib/myjavalib-removed.txt",
|
2020-04-28 21:13:56 +08:00
|
|
|
sdk_version: "module_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-04-28 21:13:56 +08:00
|
|
|
java_sdk_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
|
2020-04-28 21:13:56 +08:00
|
|
|
.intermediates/myjavalib.stubs.system/android_common/javac/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source.system/android_common/metalava/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt
|
2020-05-14 02:19:49 +08:00
|
|
|
.intermediates/myjavalib.stubs.module_lib/android_common/javac/myjavalib.stubs.module_lib.jar -> sdk_library/module-lib/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source.module_lib/android_common/metalava/myjavalib.stubs.source.module_lib_api.txt -> sdk_library/module-lib/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source.module_lib/android_common/metalava/myjavalib.stubs.source.module_lib_removed.txt -> sdk_library/module-lib/myjavalib-removed.txt
|
2020-04-28 21:13:56 +08: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-05-14 02:19:49 +08:00
|
|
|
".intermediates/mysdk/common_os/tmp/sdk_library/module-lib/myjavalib_stub_sources.zip",
|
2020-04-28 21:13:56 +08:00
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|
2020-05-13 23:54:55 +08:00
|
|
|
|
2020-06-02 20:00:08 +08:00
|
|
|
func TestSnapshotWithJavaSdkLibrary_SystemServer(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
|
2020-06-02 20:00:08 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-06-02 20:00:08 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-06-02 20:00:08 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
|
|
|
shared_library: true,
|
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-06-02 20:00:08 +08: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-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/system-server/myjavalib_stub_sources"],
|
2020-06-02 20:00:08 +08:00
|
|
|
current_api: "sdk_library/system-server/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/system-server/myjavalib-removed.txt",
|
|
|
|
sdk_version: "system_server_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-06-02 20:00:08 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
|
|
|
shared_library: true,
|
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-06-02 20:00:08 +08: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-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/system-server/myjavalib_stub_sources"],
|
2020-06-02 20:00:08 +08:00
|
|
|
current_api: "sdk_library/system-server/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/system-server/myjavalib-removed.txt",
|
|
|
|
sdk_version: "system_server_current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-06-02 20:00:08 +08:00
|
|
|
java_sdk_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
|
2020-06-02 20:00:08 +08:00
|
|
|
.intermediates/myjavalib.stubs.system_server/android_common/javac/myjavalib.stubs.system_server.jar -> sdk_library/system-server/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source.system_server/android_common/metalava/myjavalib.stubs.source.system_server_api.txt -> sdk_library/system-server/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source.system_server/android_common/metalava/myjavalib.stubs.source.system_server_removed.txt -> sdk_library/system-server/myjavalib-removed.txt
|
2020-06-02 20:00:08 +08: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 23:54:55 +08:00
|
|
|
func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
|
2021-03-15 19:17:52 +08:00
|
|
|
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
|
2020-05-13 23:54:55 +08: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 20:04:05 +08:00
|
|
|
naming_scheme: "default",
|
2020-05-13 23:54:55 +08:00
|
|
|
public: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
|
2021-03-12 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-05-13 23:54:55 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-05-13 23:54:55 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
2020-09-11 20:04:05 +08:00
|
|
|
naming_scheme: "default",
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-05-13 23:54:55 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-05-13 23:54:55 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
|
|
|
sdk_version: "current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-05-13 23:54:55 +08:00
|
|
|
apex_available: ["//apex_available:anyapex"],
|
2020-09-11 20:04:05 +08:00
|
|
|
naming_scheme: "default",
|
2020-05-27 03:57:10 +08:00
|
|
|
shared_library: true,
|
2020-05-13 23:54:55 +08:00
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-05-13 23:54:55 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
|
|
|
sdk_version: "current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-05-13 23:54:55 +08:00
|
|
|
java_sdk_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
2020-09-11 20:04:05 +08:00
|
|
|
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
|
2020-05-13 23:54:55 +08:00
|
|
|
`),
|
|
|
|
checkMergeZips(
|
|
|
|
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
|
|
|
|
),
|
|
|
|
)
|
|
|
|
}
|
2020-09-11 18:55:00 +08:00
|
|
|
|
|
|
|
func TestSnapshotWithJavaSdkLibrary_DoctagFiles(t *testing.T) {
|
2021-03-22 06:01:55 +08:00
|
|
|
result := android.GroupFixturePreparers(
|
|
|
|
prepareForSdkTestWithJavaSdkLibrary,
|
|
|
|
android.FixtureAddFile("docs/known_doctags", nil),
|
|
|
|
).RunTestWithBp(t, `
|
2020-09-11 18:55:00 +08: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 20:19:43 +08:00
|
|
|
CheckSnapshot(t, result, "mysdk", "",
|
2020-09-11 18:55:00 +08:00
|
|
|
checkAndroidBpContents(`
|
|
|
|
// This is auto-generated. DO NOT EDIT.
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "mysdk_myjavalib@current",
|
|
|
|
sdk_member_name: "myjavalib",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-09-11 18:55:00 +08:00
|
|
|
shared_library: true,
|
|
|
|
doctag_files: ["doctags/docs/known_doctags"],
|
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-09-11 18:55:00 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
|
|
|
sdk_version: "current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
java_sdk_library_import {
|
|
|
|
name: "myjavalib",
|
|
|
|
prefer: false,
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-11-03 08:11:09 +08:00
|
|
|
apex_available: ["//apex_available:platform"],
|
2020-09-11 18:55:00 +08:00
|
|
|
shared_library: true,
|
|
|
|
doctag_files: ["doctags/docs/known_doctags"],
|
|
|
|
public: {
|
|
|
|
jars: ["sdk_library/public/myjavalib-stubs.jar"],
|
2020-11-19 00:37:35 +08:00
|
|
|
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
|
2020-09-11 18:55:00 +08:00
|
|
|
current_api: "sdk_library/public/myjavalib.txt",
|
|
|
|
removed_api: "sdk_library/public/myjavalib-removed.txt",
|
|
|
|
sdk_version: "current",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
sdk_snapshot {
|
|
|
|
name: "mysdk@current",
|
2020-09-29 23:00:55 +08:00
|
|
|
visibility: ["//visibility:public"],
|
2020-09-11 18:55:00 +08:00
|
|
|
java_sdk_libs: ["mysdk_myjavalib@current"],
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
checkAllCopyRules(`
|
|
|
|
.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
|
2021-03-25 03:04:44 +08:00
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
|
|
|
|
.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
|
2020-09-11 18:55:00 +08:00
|
|
|
docs/known_doctags -> doctags/docs/known_doctags
|
|
|
|
`),
|
|
|
|
)
|
|
|
|
}
|