Merge "Convert Android.mk to Android.bp for CtsShim*"

This commit is contained in:
Treehugger Robot
2019-11-18 16:22:00 +00:00
committed by Gerrit Code Review
4 changed files with 191 additions and 180 deletions

View File

@@ -0,0 +1,74 @@
//
// Copyright (C) 2016 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.
//
//##########################################################
// Variant: Privileged app
android_app_import {
name: "CtsShimPrivPrebuilt",
// this needs to be a privileged application
privileged: true,
// Make sure the build system doesn't try to resign the APK
dex_preopt: {
enabled: false,
},
arch: {
arm: {
apk: "apk/arm/CtsShimPriv.apk",
},
arm64: {
apk: "apk/arm/CtsShimPriv.apk",
},
x86: {
apk: "apk/x86/CtsShimPriv.apk",
},
x86_64: {
apk: "apk/x86/CtsShimPriv.apk",
},
},
presigned: true,
}
//##########################################################
// Variant: System app
android_app_import {
name: "CtsShimPrebuilt",
// Make sure the build system doesn't try to resign the APK
dex_preopt: {
enabled: false,
},
arch: {
arm: {
apk: "apk/arm/CtsShim.apk",
},
arm64: {
apk: "apk/arm/CtsShim.apk",
},
x86: {
apk: "apk/x86/CtsShim.apk",
},
x86_64: {
apk: "apk/x86/CtsShim.apk",
},
},
presigned: true,
}

View File

@@ -1,64 +0,0 @@
#
# Copyright (C) 2016 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.
#
LOCAL_PATH := $(call my-dir)
###########################################################
# Variant: Privileged app
include $(CLEAR_VARS)
LOCAL_MODULE := CtsShimPrivPrebuilt
LOCAL_MODULE_TAGS := optional
# this needs to be a privileged application
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MODULE_CLASS := APPS
LOCAL_BUILT_MODULE_STEM := package.apk
# Make sure the build system doesn't try to resign the APK
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_DEX_PREOPT := false
LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 x86_64
LOCAL_SRC_FILES_arm := apk/arm/CtsShimPriv.apk
LOCAL_SRC_FILES_arm64 := apk/arm/CtsShimPriv.apk
LOCAL_SRC_FILES_x86 := apk/x86/CtsShimPriv.apk
LOCAL_SRC_FILES_x86_64 := apk/x86/CtsShimPriv.apk
include $(BUILD_PREBUILT)
###########################################################
# Variant: System app
include $(CLEAR_VARS)
LOCAL_MODULE := CtsShimPrebuilt
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := APPS
LOCAL_BUILT_MODULE_STEM := package.apk
# Make sure the build system doesn't try to resign the APK
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_DEX_PREOPT := false
LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 x86_64
LOCAL_SRC_FILES_arm := apk/arm/CtsShim.apk
LOCAL_SRC_FILES_arm64 := apk/arm/CtsShim.apk
LOCAL_SRC_FILES_x86 := apk/x86/CtsShim.apk
LOCAL_SRC_FILES_x86_64 := apk/x86/CtsShim.apk
include $(BUILD_PREBUILT)
include $(call all-makefiles-under,$(LOCAL_PATH))

View File

@@ -0,0 +1,117 @@
// 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.
// Build rules to build shim apks.
//##########################################################
// Variant: Privileged app upgrade
android_app {
name: "CtsShimPrivUpgrade",
// this needs to be a privileged application
privileged: true,
sdk_version: "current",
optimize: {
enabled: false,
},
dex_preopt: {
enabled: false,
},
manifest: "shim_priv_upgrade/AndroidManifest.xml",
compile_multilib: "both",
jni_libs: ["libshim_jni"],
}
genrule {
name: "generate_priv_manifest",
srcs: [
"shim_priv/AndroidManifest.xml",
":CtsShimPrivUpgrade"
],
out: ["AndroidManifest.xml"],
cmd: "sed -e s/__HASH__/`sha512sum -b $(location :CtsShimPrivUpgrade) | cut -d' ' -f1`/ $(location shim_priv/AndroidManifest.xml) > $(out)",
}
//##########################################################
// Variant: Privileged app
android_app {
name: "CtsShimPriv",
// this needs to be a privileged application
privileged: true,
sdk_version: "current",
optimize: {
enabled: false,
},
dex_preopt: {
enabled: false,
},
manifest: ":generate_priv_manifest",
compile_multilib: "both",
jni_libs: ["libshim_jni"],
// Explicitly uncompress native libs rather than letting the build system doing it and destroy the
// v2/v3 signature.
use_embedded_native_libs: true,
}
//##########################################################
// Variant: Privileged app upgrade w/ the wrong SHA
android_app {
name: "CtsShimPrivUpgradeWrongSHA",
// this needs to be a privileged application
privileged: true,
sdk_version: "current",
optimize: {
enabled: false,
},
dex_preopt: {
enabled: false,
},
// anything to make this package's SHA different from CtsShimPrivUpgrade
aaptflags: [
"--version-name",
"WrongSHA",
],
manifest: "shim_priv_upgrade/AndroidManifest.xml",
compile_multilib: "both",
jni_libs: ["libshim_jni"],
}
//##########################################################
// Variant: System app
android_app {
name: "CtsShim",
sdk_version: "current",
optimize: {
enabled: false,
},
dex_preopt: {
enabled: false,
},
manifest: "shim/AndroidManifest.xml",
}

View File

@@ -1,116 +0,0 @@
#
# Copyright (C) 2016 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.
#
LOCAL_PATH := $(my-dir)
###########################################################
# Variant: Privileged app upgrade
include $(CLEAR_VARS)
# this needs to be a privileged application
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_SDK_VERSION := current
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
LOCAL_PACKAGE_NAME := CtsShimPrivUpgrade
LOCAL_MANIFEST_FILE := shim_priv_upgrade/AndroidManifest.xml
LOCAL_MULTILIB := both
LOCAL_JNI_SHARED_LIBRARIES := libshim_jni
include $(BUILD_PACKAGE)
my_shim_priv_upgrade_apk := $(LOCAL_BUILT_MODULE)
###########################################################
# Variant: Privileged app
include $(CLEAR_VARS)
# this needs to be a privileged application
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_SDK_VERSION := current
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
LOCAL_PACKAGE_NAME := CtsShimPriv
# Generate the upgrade key by taking the hash of the built CtsShimPrivUpgrade apk
gen := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,true)/AndroidManifest.xml
$(gen): PRIVATE_CUSTOM_TOOL = sed -e "s/__HASH__/`sha512sum $(PRIVATE_INPUT_APK) | cut -d' ' -f1`/" $< >$@
$(gen): PRIVATE_INPUT_APK := $(my_shim_priv_upgrade_apk)
$(gen): $(LOCAL_PATH)/shim_priv/AndroidManifest.xml $(my_shim_priv_upgrade_apk)
$(transform-generated-source)
my_shim_priv_upgrade_apk :=
LOCAL_FULL_MANIFEST_FILE := $(gen)
LOCAL_MULTILIB := both
LOCAL_JNI_SHARED_LIBRARIES := libshim_jni
LOCAL_USE_AAPT2 := true
include $(BUILD_PACKAGE)
###########################################################
# Variant: Privileged app upgrade w/ the wrong SHA
include $(CLEAR_VARS)
# this needs to be a privileged application
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MODULE_TAGS := optional
LOCAL_SDK_VERSION := current
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
# anything to make this package's SHA different from CtsShimPrivUpgrade
LOCAL_AAPT_FLAGS := --version-name WrongSHA
LOCAL_PACKAGE_NAME := CtsShimPrivUpgradeWrongSHA
LOCAL_MANIFEST_FILE := shim_priv_upgrade/AndroidManifest.xml
LOCAL_MULTILIB := both
LOCAL_JNI_SHARED_LIBRARIES := libshim_jni
include $(BUILD_PACKAGE)
###########################################################
# Variant: System app
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SDK_VERSION := current
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
LOCAL_PACKAGE_NAME := CtsShim
LOCAL_MANIFEST_FILE := shim/AndroidManifest.xml
LOCAL_USE_AAPT2 := true
include $(BUILD_PACKAGE)
###########################################################
include $(call all-makefiles-under,$(LOCAL_PATH))