blob: dbfe29ce767cc1ad2549e38602669a97457564ad [file] [log] [blame]
# Copyright 2021 The Cobalt Authors. All Rights Reserved.
#
# 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.
template("install_target") {
not_needed(invoker, [ "type" ])
content_dir = "usr/share/cobalt"
action("build_${target_name}_apk") {
forward_variables_from(invoker,
[
"installable_target_name",
"testonly",
])
deps = [
":$installable_target_name",
"//starboard/android/apk:apk_sources",
]
target_output = "$root_out_dir/lib${installable_target_name}.so"
gradle_content_dir = "$sb_install_output_dir/$content_dir"
gradle_files_dir = "$root_out_dir/gradle/$installable_target_name"
if (is_gold) {
gradle_build_type = "release"
} else {
gradle_build_type = build_type
}
sources = [
"$root_out_dir/gradle/apk_sources.stamp",
target_output,
]
outputs = [ "$root_out_dir/${installable_target_name}.apk" ]
cobalt_project_dir = rebase_path("//starboard/android/apk")
cobalt_deploy_apk = rebase_path(outputs[0])
cobalt_content_dir = rebase_path(gradle_content_dir)
cobalt_gradle_dir = rebase_path(gradle_files_dir)
cobalt_product_dir = rebase_path(root_out_dir)
cobalt_library_dir = rebase_path(root_out_dir)
script = "//starboard/build/run_bash.py"
bash_script =
rebase_path("//starboard/android/apk/cobalt-gradle.sh", root_build_dir)
args = [
bash_script,
"--sdk",
android_sdk_path,
"--cache",
rebase_path(root_build_dir),
"--project-dir",
cobalt_project_dir,
"-P",
"cobaltBuildAbi=$android_abi",
"-P",
"cobaltDeployApk=$cobalt_deploy_apk",
"-P",
"cobaltContentDir=$cobalt_content_dir",
"-P",
"cobaltGradleDir=$cobalt_gradle_dir",
"-P",
"cobaltProductDir=$cobalt_product_dir",
"-P",
"cobaltLibraryDir=$cobalt_library_dir",
"-P",
"cobaltTarget=$installable_target_name",
"-P",
"enableVulkan=$enable_vulkan",
"assembleCobalt_$gradle_build_type",
]
}
}