Cherry-pick "Refactor lazy JNI registration support."
> Rename the "linker_script_copy" target to "android_exports" and move the
> link_settings clause to that target. This avoids the linker flag being
> duplicated once for every target which includes jni_generator.gypi,
> which causes problems on some linker versions.
>
> BUG=402003
>
> Review URL: https://codereview.chromium.org/473173004
>
> Cr-Commit-Position: refs/heads/master@{#289941}
> git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289941 0039d316-1c4b-4281-b951-d872f2087c98
BUG: 16870075
Change-Id: Ic8a0906563edc777c3fc9a831643b8b535ede184
diff --git a/build/android/android_exports.gyp b/build/android/android_exports.gyp
new file mode 100644
index 0000000..c259eee
--- /dev/null
+++ b/build/android/android_exports.gyp
@@ -0,0 +1,39 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'android_exports',
+ 'type': 'none',
+ 'inputs': [
+ '<(DEPTH)/build/android/android_exports.lst',
+ ],
+ 'outputs': [
+ '<(android_linker_script)',
+ ],
+ 'copies': [
+ {
+ 'destination': '<(SHARED_INTERMEDIATE_DIR)',
+ 'files': [
+ '<@(_inputs)',
+ ],
+ },
+ ],
+ 'conditions': [
+ ['component=="static_library"', {
+ 'link_settings': {
+ 'ldflags': [
+ # Only export symbols that are specified in version script.
+ '-Wl,--version-script=<(android_linker_script)',
+ ],
+ 'ldflags!': [
+ '-Wl,--exclude-libs=ALL',
+ ],
+ },
+ }],
+ ],
+ },
+ ],
+}
diff --git a/build/jar_file_jni_generator.gypi b/build/jar_file_jni_generator.gypi
index 0c989b5..4c01c8a 100644
--- a/build/jar_file_jni_generator.gypi
+++ b/build/jar_file_jni_generator.gypi
@@ -70,20 +70,7 @@
'native_exports%': '--native_exports',
},
'dependencies': [
- '<(DEPTH)/build/linker_script_copy.gyp:linker_script_copy',
- ],
- 'conditions': [
- ['component=="static_library"', {
- 'link_settings': {
- 'ldflags': [
- # Only export symbols that are specified in version script.
- '-Wl,--version-script=<(android_linker_script)',
- ],
- 'ldflags!': [
- '-Wl,--exclude-libs=ALL',
- ],
- },
- }],
+ '<(DEPTH)/build/android/android_exports.gyp:android_exports',
],
}],
],
diff --git a/build/jni_generator.gypi b/build/jni_generator.gypi
index 48ec24e..6edc512 100644
--- a/build/jni_generator.gypi
+++ b/build/jni_generator.gypi
@@ -38,9 +38,6 @@
),
'native_exports%': '',
},
- 'dependencies': [
- '<(DEPTH)/build/linker_script_copy.gyp:linker_script_copy',
- ],
'rules': [
{
'rule_name': 'generate_jni_headers',
@@ -92,20 +89,7 @@
'native_exports%': '--native_exports',
},
'dependencies': [
- '<(DEPTH)/build/linker_script_copy.gyp:linker_script_copy',
- ],
- 'conditions': [
- ['component=="static_library"', {
- 'link_settings': {
- 'ldflags': [
- # Only export symbols that are specified in version script.
- '-Wl,--version-script=<(android_linker_script)',
- ],
- 'ldflags!': [
- '-Wl,--exclude-libs=ALL',
- ],
- },
- }],
+ '<(DEPTH)/build/android/android_exports.gyp:android_exports',
],
}],
],
diff --git a/build/linker_script_copy.gyp b/build/linker_script_copy.gyp
deleted file mode 100644
index 8962725..0000000
--- a/build/linker_script_copy.gyp
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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.
-
-{
- 'targets': [
- {
- 'target_name': 'linker_script_copy',
- 'type': 'none',
- 'inputs': [
- '<(DEPTH)/build/android/android_exports.lst',
- ],
- 'outputs': [
- '<(android_linker_script)',
- ],
- 'copies': [
- {
- 'destination': '<(SHARED_INTERMEDIATE_DIR)',
- 'files': [
- '<@(_inputs)',
- ],
- },
- ],
- },
- ],
-}