Commit ca675d3e authored by cjhopman's avatar cjhopman Committed by Commit bot

GN: Some small changes to support chrome android internal stuff

This actually hooks up (i.e. passes from invoker) several variables
controlling apk creation (version name, version code,
use_relocation_packer, use_chromium_linker, unzip_libraries_from_apk).

Adds support for overriding some configuration in the private repo.

Adds support for public_configs in grit_rule.gni.

Adds some junit targets (these are built as android libraries currently
instead of host libraries, but that just means we do a bit extra work
that we don't really need).

BUG=359249

Review URL: https://codereview.chromium.org/659703002

Cr-Commit-Position: refs/heads/master@{#301039}
parent 7ec86e83
......@@ -9,6 +9,9 @@
# file to your new one or GN won't know about it.
import("//build/config/ui.gni")
if (is_android) {
import("//build/config/android/config.gni")
}
declare_args() {
# A list of extra dependencies to add to the root target. This allows a
......@@ -188,6 +191,12 @@ group("root") {
"//third_party/eyesfree:eyesfree_java",
]
if (has_chrome_android_internal) {
deps += [
"//clank",
]
}
deps -= [
"//apps", # Needs testing.
"//chrome/browser",
......
......@@ -5,12 +5,25 @@
# This file contains common system config stuff for the Android build.
if (is_android) {
has_chrome_android_internal = exec_script("//build/dir_exists.py",
[ rebase_path("//clank", root_build_dir) ],
"string") == "True"
if (has_chrome_android_internal) {
import("//clank/config.gni")
} else {
default_android_sdk_root = "//third_party/android_tools/sdk"
default_android_sdk_version = "21"
default_android_sdk_build_tools_version = "21.0.0"
}
declare_args() {
# Absolute directory containing the Android source code.
android_src = ""
android_sdk_root = "//third_party/android_tools/sdk"
android_sdk_version = "21"
android_sdk_root = default_android_sdk_root
android_sdk_version = default_android_sdk_version
android_sdk_build_tools_version = default_android_sdk_build_tools_version
# This is set when building the Android WebView inside the Android build
# system, using the 'android' gyp backend. The WebView code is still built
......@@ -32,7 +45,6 @@ if (is_android) {
"You must specify android_src for an Android WebView build.")
}
# Host stuff -----------------------------------------------------------------
# Defines the name the Android build gives to the current host CPU
......@@ -68,7 +80,7 @@ if (is_android) {
android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
android_sdk_tools = "${android_sdk_root}/tools"
android_sdk_build_tools = "${android_sdk_root}/build-tools/21.0.0"
android_sdk_build_tools = "${android_sdk_root}/build-tools/$android_sdk_build_tools_version"
# Path to the SDK's android.jar
android_sdk_jar = "$android_sdk/android.jar"
......
......@@ -253,8 +253,8 @@ template("create_apk") {
_asset_location = invoker.asset_location
}
_version_code = "1"
_version_name = "Developer Build"
_version_code = invoker.version_code
_version_name = invoker.version_name
_base_apk_path = _base_path + ".apk_intermediates"
......@@ -557,7 +557,7 @@ template("android_java_library") {
if (defined(invoker.testonly)) { testonly = invoker.testonly }
assert(defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir)
|| defined(invoker.srcjars))
|| defined(invoker.srcjars) || defined(invoker.srcjar_deps))
assert(defined(invoker.build_config))
assert(defined(invoker.jar_path))
assert(defined(invoker.dex_path))
......
......@@ -420,6 +420,8 @@ template("jinja_template_resources") {
_build_config = _base_path + ".build_config"
write_build_config("${target_name}__build_config") {
build_config = _build_config
resources_zip = _resources_zip
type = "android_resources"
}
......@@ -679,7 +681,7 @@ template("android_library") {
if (defined(invoker.testonly)) { testonly = invoker.testonly }
assert(defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir)
|| defined(invoker.srcjars))
|| defined(invoker.srcjars) || defined(invoker.srcjar_deps))
_base_path = "$target_gen_dir/$target_name"
_build_config = _base_path + ".build_config"
_jar_path = _base_path + ".jar"
......@@ -989,6 +991,12 @@ template("android_apk") {
"$root_build_dir/lib.stripped/libchromium_android_linker.so"
]
}
_enable_relocation_packing = false
if (_use_chromium_linker && defined(invoker.enable_relocation_packing) &&
invoker.enable_relocation_packing) {
_enable_relocation_packing = true
}
}
_rebased_build_config = rebase_path(build_config, root_build_dir)
......@@ -1157,6 +1165,16 @@ template("android_apk") {
dex_path = final_dex_path
load_library_from_apk = _load_library_from_apk
version_code = "1"
if (defined(invoker.version_code)) {
version_code = invoker.version_code
}
version_name = "Developer Build"
if (defined(invoker.version_name)) {
version_name = invoker.version_name
}
if (defined(invoker.asset_location)) {
asset_location = invoker.asset_location
}
......
......@@ -330,6 +330,10 @@ template("grit") {
deps = [ ":$grit_custom_target" ]
public_configs = [ ":$grit_config" ]
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
if (defined(invoker.visibility)) {
visibility = invoker.visibility
}
......
......@@ -134,6 +134,13 @@ source_set("test_support") {
]
}
if (enable_extensions) {
deps += [
"//chrome/common/extensions/api",
"//extensions:test_support",
]
}
if (is_linux) {
deps += [ "//crypto:platform" ]
}
......
# Copyright 2014 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.
assert(is_android)
import("//build/config/android/rules.gni")
# TODO(GYP): should be java_library
# GYP: //testing/android/junit_test.gyp:junit_test_support
android_library("junit_test_support") {
DEPRECATED_java_in_dir = "java/src"
deps = [
"//third_party/junit"
]
}
# TODO(GYP): should be java_library
# GYP: //testing/android/junit_test.gyp:junit_unit_tests
android_library("junit_unittests") {
deps = [
":junit_test_support",
"//third_party/junit",
]
#main_class = "org.chromium.testing.local.JuniTestMain"
DEPRECATED_java_in_dir = "javatests/src"
}
......@@ -5,6 +5,7 @@
{
'targets': [
{
# GN: //testing/android/junit:junit_test_support
'target_name': 'junit_test_support',
'type': 'none',
'dependencies': [
......@@ -20,6 +21,7 @@
],
},
{
# GN: //testing/android/junit:junit_unittests
'target_name': 'junit_unit_tests',
'type': 'none',
'dependencies': [
......
# Copyright 2014 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")
# TODO(GYP): should be java_prebuilt
# GYP: //third_party/junit.gyp:hamcrest_jar
android_java_prebuilt("hamcrest") {
jar_path = "src/lib/hamcrest-core-1.3.jar"
}
# TODO(GYP): should be java_library
# GYP: //third_party/junit.gyp:junit_jar
android_library("junit") {
deps = [
":hamcrest"
]
DEPRECATED_java_in_dir = "src/src/main/java"
}
......@@ -5,6 +5,7 @@
{
'targets': [
{
# GN: //third_party/junit:hamcrest
'target_name': 'hamcrest_jar',
'type': 'none',
'variables': {
......@@ -15,6 +16,7 @@
]
},
{
# GN: //third_party/junit:junit
'target_name': 'junit_jar',
'type': 'none',
'dependencies': [
......
......@@ -125,20 +125,33 @@ static_library("util") {
]
}
if (!is_android) {
# The list of files in libaddressinput.gypi.
gypi_values = exec_script(
if (is_android) {
import("//build/config/android/rules.gni")
android_resources("android_addressinput_widget_resources") {
custom_package = "com.android.i18n.addressinput"
resource_dirs = [ "src/java/res" ]
v14_verify_only = true
}
# GYP: //third_party/libaddressinput/libaddressinput.gyp:android_addressinput_widget
android_library("android_addressinput_widget_java") {
DEPRECATED_java_in_dir = "src/java/src"
deps = [ ":android_addressinput_widget_resources" ]
}
} else {
# The list of files in libaddressinput.gypi.
gypi_values = exec_script(
"//build/gypi_to_gn.py",
[ rebase_path("src/cpp/libaddressinput.gypi") ],
"scope",
[ "src/cpp/libaddressinput.gypi" ])
# This target provides more complicated functionality like pinging servers
# for validation rules.
# GYP version: third_party/libaddressinput/libaddressinput.gyp:libaddressinput
static_library("libaddressinput") {
# This target provides more complicated functionality like pinging servers
# for validation rules.
# GYP version: third_party/libaddressinput/libaddressinput.gyp:libaddressinput
static_library("libaddressinput") {
sources = rebase_path(gypi_values.libaddressinput_files, ".", "src/cpp")
sources += [
"chromium/chrome_address_validator.cc",
......@@ -167,10 +180,11 @@ static_library("libaddressinput") {
"//third_party/icu",
"//third_party/re2",
]
}
}
test("libaddressinput_unittests") {
sources = rebase_path(gypi_values.libaddressinput_test_files, ".", "src/cpp")
test("libaddressinput_unittests") {
sources = rebase_path(
gypi_values.libaddressinput_test_files, ".", "src/cpp")
sources += [
"chromium/addressinput_util_unittest.cc",
"chromium/chrome_address_validator_unittest.cc",
......@@ -201,6 +215,5 @@ test("libaddressinput_unittests") {
"//net:test_support",
"//testing/gtest",
]
}
}
} # !is_android
......@@ -165,6 +165,7 @@
['OS=="android"', {
'targets': [
{
# GN: //third_party/libaddressinput:android_addressinput_widget_java
'target_name': 'android_addressinput_widget',
'type': 'none',
'variables': {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment