naiveproxy/android_webview/glue/generate_resource_rewriter.gni

56 lines
1.7 KiB
Plaintext
Raw Normal View History

2018-02-02 13:49:39 +03:00
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/android/rules.gni")
# Generate ResourceRewriter.java from Android Libraries according the dep
# graph.
# Argument:
# deps
# The same deps of target that uses the generated ResourceRewriter.
# package_name
# The package name of ResourceRewriter.java.
#
# This target generates a single srcjar containing generated
# ResourceRewrite.java which will list the R classes generated by all the
# Android libraries reachabled from the target specified in deps. Add this
# target to srcjar_deps of android_library will call ResourceRewriter.
#
template("generate_resource_rewriter") {
set_sources_assignment_filter([])
assert(defined(invoker.package_name))
_final_target_name = target_name
_build_config = "$target_gen_dir/${target_name}.build_config"
_build_config_target_name = "${target_name}__build_config"
_srcjar = "$target_gen_dir/${target_name}.srcjar"
write_build_config(_build_config_target_name) {
possible_config_deps = invoker.deps
type = "resource_rewriter"
build_config = _build_config
}
action(_final_target_name) {
forward_variables_from(invoker, [ "visibility" ])
inputs = [
_build_config,
]
deps = invoker.deps + [ ":${_build_config_target_name}" ]
script = "//build/android/gyp/generate_resource_rewriter.py"
_rebased_build_config = rebase_path(_build_config)
args = [
"--package-name",
invoker.package_name,
"--dep-packages",
"@FileArg($_rebased_build_config:resources:extra_package_names)",
"--srcjar",
rebase_path(_srcjar),
]
outputs = [
_srcjar,
]
}
}