chromium-src-build/java_prebuilt.gypi

102 строки
2.9 KiB
Plaintext
Исходник Обычный вид История

# Copyright (c) 2012 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.
# This file is meant to be included into a target to provide a rule
# to package prebuilt Java JARs in a consistent manner.
#
# To use this, create a gyp target with the following form:
# {
# 'target_name': 'my-package_java',
# 'type': 'none',
# 'variables': {
# 'jar_path': 'path/to/your.jar',
# },
# 'includes': ['path/to/this/gypi/file'],
# }
#
# Required variables:
# jar_path - The path to the prebuilt Java JAR file.
{
'dependencies': [
'<(DEPTH)/build/android/setup.gyp:build_output_dirs'
],
'variables': {
'dex_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).dex.jar',
'android_jar': '<(android_sdk)/android.jar',
'input_jars_paths': [ '<(android_jar)' ],
Fix "Class resolved by unexpected DEX" in uiautomator tests Attemping to run uiautomator tests on a Nexus fails with the following error: W/dalvikvm(32338): Class resolved by unexpected DEX: Lorg/chromium/chrome/shell/uiautomator/DummyTest;(0x416544d0):0x5b738000 ref [Lcom/android/uiautomator/testrunner/ UiAutomatorTestCase;] Lcom/android/uiautomator/testrunner/UiAutomatorTestCase;(0x416544d0):0x5b6dc000 W/dalvikvm(32338): (Lorg/chromium/chrome/shell/uiautomator/DummyTest; had used a different Lcom/android/uiautomator/testrunner/UiAutomatorTestCase; during pre-verification) W/dalvikvm(32338): Unable to resolve superclass of Lorg/chromium/chrome/shell/uiautomator/DummyTest; (96) W/dalvikvm(32338): Link of class 'Lorg/chromium/chrome/shell/uiautomator/DummyTest;' failed D/AndroidRuntime(32338): Shutting down VM W/dalvikvm(32338): threadid=1: thread exiting with uncaught exception (group=0x4164abc0) E/UiAutomatorTestRunner(32338): uncaught exception E/UiAutomatorTestRunner(32338): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation This error occurs because uiautomator.jar is built into out/Debug/lib.java/chrome_shell_uiautomator_tests.dex.jar. This results in two different implementations of uiautomator classes on the device hence the dalvik error. The 'chrome_shell_uiautomator_tests' gyp target uses the uiautomator_test.gypi include. uiautomator.gypi dexes all dependent jars into a single .dex.jar. Since chrome_shell_uiautomator_tests has a transitive dependence, through chrome_shell_uiautomator_tests_java, on uiautomator.gyp, the uiautomator jar used for compilation will be built into its output. If we ignore chrome_shell_uiautomator_tests and instead just build chrome_shell_uiautomator_tests_java we can successfully run uiautomator tests. This gyp target already generates dexed jars through java.gypi (which calls dex_action.gypi). This commit removes uiautomator_test.gypi and renames chrome_shell_uiautomator_tests_java to chrome_shell_uiautomator_tests. BUG=434080 Review URL: https://codereview.chromium.org/734793002 Cr-Original-Commit-Position: refs/heads/master@{#306315} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 57dc71e6bf75f6f249c941a70c9139e1316516f9
2014-12-02 04:31:22 +03:00
'neverlink%': 0,
'proguard_config%': '',
'proguard_preprocess%': '0',
'variables': {
'variables': {
'proguard_preprocess%': 0,
},
'conditions': [
['proguard_preprocess == 1', {
'dex_input_jar_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).pre.jar',
}, {
'dex_input_jar_path': '<(jar_path)',
}],
],
},
'dex_input_jar_path': '<(dex_input_jar_path)',
},
'all_dependent_settings': {
'variables': {
'input_jars_paths': ['<(dex_input_jar_path)'],
Fix "Class resolved by unexpected DEX" in uiautomator tests Attemping to run uiautomator tests on a Nexus fails with the following error: W/dalvikvm(32338): Class resolved by unexpected DEX: Lorg/chromium/chrome/shell/uiautomator/DummyTest;(0x416544d0):0x5b738000 ref [Lcom/android/uiautomator/testrunner/ UiAutomatorTestCase;] Lcom/android/uiautomator/testrunner/UiAutomatorTestCase;(0x416544d0):0x5b6dc000 W/dalvikvm(32338): (Lorg/chromium/chrome/shell/uiautomator/DummyTest; had used a different Lcom/android/uiautomator/testrunner/UiAutomatorTestCase; during pre-verification) W/dalvikvm(32338): Unable to resolve superclass of Lorg/chromium/chrome/shell/uiautomator/DummyTest; (96) W/dalvikvm(32338): Link of class 'Lorg/chromium/chrome/shell/uiautomator/DummyTest;' failed D/AndroidRuntime(32338): Shutting down VM W/dalvikvm(32338): threadid=1: thread exiting with uncaught exception (group=0x4164abc0) E/UiAutomatorTestRunner(32338): uncaught exception E/UiAutomatorTestRunner(32338): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation This error occurs because uiautomator.jar is built into out/Debug/lib.java/chrome_shell_uiautomator_tests.dex.jar. This results in two different implementations of uiautomator classes on the device hence the dalvik error. The 'chrome_shell_uiautomator_tests' gyp target uses the uiautomator_test.gypi include. uiautomator.gypi dexes all dependent jars into a single .dex.jar. Since chrome_shell_uiautomator_tests has a transitive dependence, through chrome_shell_uiautomator_tests_java, on uiautomator.gyp, the uiautomator jar used for compilation will be built into its output. If we ignore chrome_shell_uiautomator_tests and instead just build chrome_shell_uiautomator_tests_java we can successfully run uiautomator tests. This gyp target already generates dexed jars through java.gypi (which calls dex_action.gypi). This commit removes uiautomator_test.gypi and renames chrome_shell_uiautomator_tests_java to chrome_shell_uiautomator_tests. BUG=434080 Review URL: https://codereview.chromium.org/734793002 Cr-Original-Commit-Position: refs/heads/master@{#306315} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 57dc71e6bf75f6f249c941a70c9139e1316516f9
2014-12-02 04:31:22 +03:00
'conditions': [
['neverlink == 1', {
'library_dexed_jars_paths': [],
}, {
'library_dexed_jars_paths': ['<(dex_path)'],
}],
],
},
},
'conditions' : [
['proguard_preprocess == 1', {
'actions': [
{
'action_name': 'proguard_<(_target_name)',
'message': 'Proguard preprocessing <(_target_name) jar',
'inputs': [
'<(DEPTH)/third_party/proguard/lib/proguard.jar',
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/proguard.py',
'<(jar_path)',
'<(proguard_config)',
],
'outputs': [
'<(dex_input_jar_path)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/proguard.py',
'--proguard-path=<(DEPTH)/third_party/proguard/lib/proguard.jar',
'--input-path=<(jar_path)',
'--output-path=<(dex_input_jar_path)',
'--proguard-config=<(proguard_config)',
'--classpath=>(input_jars_paths)',
]
},
],
}],
Fix "Class resolved by unexpected DEX" in uiautomator tests Attemping to run uiautomator tests on a Nexus fails with the following error: W/dalvikvm(32338): Class resolved by unexpected DEX: Lorg/chromium/chrome/shell/uiautomator/DummyTest;(0x416544d0):0x5b738000 ref [Lcom/android/uiautomator/testrunner/ UiAutomatorTestCase;] Lcom/android/uiautomator/testrunner/UiAutomatorTestCase;(0x416544d0):0x5b6dc000 W/dalvikvm(32338): (Lorg/chromium/chrome/shell/uiautomator/DummyTest; had used a different Lcom/android/uiautomator/testrunner/UiAutomatorTestCase; during pre-verification) W/dalvikvm(32338): Unable to resolve superclass of Lorg/chromium/chrome/shell/uiautomator/DummyTest; (96) W/dalvikvm(32338): Link of class 'Lorg/chromium/chrome/shell/uiautomator/DummyTest;' failed D/AndroidRuntime(32338): Shutting down VM W/dalvikvm(32338): threadid=1: thread exiting with uncaught exception (group=0x4164abc0) E/UiAutomatorTestRunner(32338): uncaught exception E/UiAutomatorTestRunner(32338): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation This error occurs because uiautomator.jar is built into out/Debug/lib.java/chrome_shell_uiautomator_tests.dex.jar. This results in two different implementations of uiautomator classes on the device hence the dalvik error. The 'chrome_shell_uiautomator_tests' gyp target uses the uiautomator_test.gypi include. uiautomator.gypi dexes all dependent jars into a single .dex.jar. Since chrome_shell_uiautomator_tests has a transitive dependence, through chrome_shell_uiautomator_tests_java, on uiautomator.gyp, the uiautomator jar used for compilation will be built into its output. If we ignore chrome_shell_uiautomator_tests and instead just build chrome_shell_uiautomator_tests_java we can successfully run uiautomator tests. This gyp target already generates dexed jars through java.gypi (which calls dex_action.gypi). This commit removes uiautomator_test.gypi and renames chrome_shell_uiautomator_tests_java to chrome_shell_uiautomator_tests. BUG=434080 Review URL: https://codereview.chromium.org/734793002 Cr-Original-Commit-Position: refs/heads/master@{#306315} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 57dc71e6bf75f6f249c941a70c9139e1316516f9
2014-12-02 04:31:22 +03:00
['neverlink == 0', {
'actions': [
{
'action_name': 'dex_<(_target_name)',
'message': 'Dexing <(_target_name) jar',
'variables': {
'dex_input_paths': [
'<(dex_input_jar_path)',
],
'output_path': '<(dex_path)',
},
'includes': [ 'android/dex_action.gypi' ],
},
],
}],
],
}