Add -bootclasspath argument to javac.

This silences the warning "bootstrap class path not set in conjunction
with -source 1.7" when building with OpenJDK 1.8.

The multiple_proguards test was removed as javac will now catch the use
of host packages that do not exist on Android.

BUG=

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

Cr-Original-Commit-Position: refs/heads/master@{#337805}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 718538ef3a6e6f7104101ef37502052c88c5641c
This commit is contained in:
ohrn 2015-07-08 06:09:05 -07:00 коммит произвёл Commit bot
Родитель 5a8ef83d1f
Коммит 5ec29bd726
11 изменённых файлов: 21 добавлений и 112 удалений

Просмотреть файл

@ -810,7 +810,6 @@
'../breakpad/breakpad.gyp:symupload#host',
'../breakpad/breakpad.gyp:minidump_dump#host',
'../breakpad/breakpad.gyp:minidump_stackwalk#host',
'../build/android/tests/multiple_proguards/multiple_proguards.gyp:multiple_proguards_test_apk',
'../build/android/pylib/device/commands/commands.gyp:chromium_commands',
'../cc/blink/cc_blink_tests.gyp:cc_blink_unittests',
'../cc/cc_tests.gyp:cc_perftests_apk',

Просмотреть файл

@ -66,7 +66,7 @@ ERRORPRONE_OPTIONS = [
]
def DoJavac(
classpath, classes_dir, chromium_code,
bootclasspath, classpath, classes_dir, chromium_code,
use_errorprone_path, java_files):
"""Runs javac.
@ -91,6 +91,10 @@ def DoJavac(
'-target', '1.7',
'-classpath', ':'.join(classpath),
'-d', classes_dir]
if bootclasspath:
javac_args.extend(['-bootclasspath', ':'.join(bootclasspath)])
if chromium_code:
# TODO(aurimas): re-enable '-Xlint:deprecation' checks once they are fixed.
javac_args.extend(['-Xlint:unchecked'])
@ -180,6 +184,12 @@ def main(argv):
action='append',
default=[],
help='List of srcjars to include in compilation.')
parser.add_option(
'--bootclasspath',
action='append',
default=[],
help='Boot classpath for javac. If this is specified multiple times, '
'they will all be appended to construct the classpath.')
parser.add_option(
'--classpath',
action='append',
@ -223,6 +233,10 @@ def main(argv):
if options.main_class and not options.jar_path:
parser.error('--main-class requires --jar-path')
bootclasspath = []
for arg in options.bootclasspath:
bootclasspath += build_utils.ParseGypList(arg)
classpath = []
for arg in options.classpath:
classpath += build_utils.ParseGypList(arg)
@ -236,7 +250,7 @@ def main(argv):
src_gendirs = build_utils.ParseGypList(options.src_gendirs)
java_files += build_utils.FindInDirectories(src_gendirs, '*.java')
input_files = classpath + java_srcjars + java_files
input_files = bootclasspath + classpath + java_srcjars + java_files
with build_utils.TempDir() as temp_dir:
classes_dir = os.path.join(temp_dir, 'classes')
os.makedirs(classes_dir)
@ -259,6 +273,7 @@ def main(argv):
if len(java_files) != 0:
DoJavac(
bootclasspath,
classpath,
classes_dir,
options.chromium_code,

Просмотреть файл

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright 2013 Google Inc.
-
- 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dummy"
android:versionCode="1"
android:versionName="1.0">
<application android:label="dummy">
<activity android:name="dummy.DummyActivity"
android:label="dummy">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Просмотреть файл

@ -1,34 +0,0 @@
# Copyright (c) 2013 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.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'multiple_proguards_test_apk',
'type': 'none',
'variables': {
'app_manifest_version_name%': '<(android_app_version_name)',
'java_in_dir': '.',
'proguard_enabled': 'true',
'proguard_flags_paths': [
# Both these proguard?.flags files need to be part of the build to
# remove both warnings from the src/dummy/DummyActivity.java file, else the
# build will fail.
'proguard1.flags',
'proguard2.flags',
],
'R_package': 'dummy',
'R_package_relpath': 'dummy',
'apk_name': 'MultipleProguards',
# This is a build-only test. There's nothing to install.
'gyp_managed_install': 0,
# The Java code produces warnings, so force the build to not show them.
'chromium_code': 0,
},
'includes': [ '../../../../build/java_apk.gypi' ],
},
],
}

Просмотреть файл

@ -1 +0,0 @@
-dontwarn sun.misc.Unsafe

Просмотреть файл

@ -1 +0,0 @@
-dontwarn sun.reflect.Reflection

Просмотреть файл

@ -1,26 +0,0 @@
// Copyright 2013 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.
package dummy;
import android.app.Activity;
/**
* Dummy activity to build apk.
*
* This class is created to ensure that proguard will produce two separate warnings.
*/
public class DummyActivity extends Activity {
private static void doBadThings1() {
try {
sun.misc.Unsafe.getUnsafe();
} catch (Exception e) {
throw new Error(e);
}
}
private static void doBadThings2() {
sun.reflect.Reflection.getCallerClass(2);
}
}

Просмотреть файл

@ -1,17 +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.
package org.chromium.base.library_loader;
/**
* This is a complete dummy, required because base now requires a version of
* NativeLibraries to build, but doesn't include it in its jar file.
*/
public class NativeLibraries {
public static boolean sUseLinker = false;
public static boolean sUseLibraryInZipFile = false;
public static boolean sEnableLinkerTests = false;
static final String[] LIBRARIES = {};
static String sVersionNumber = "";
}

Просмотреть файл

@ -1002,11 +1002,13 @@ template("compile_java") {
sources = _java_files + _java_srcjars
inputs = _system_jars + [ _build_config ]
_rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir)
_rebased_system_jars = rebase_path(_system_jars, root_build_dir)
_rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir)
_rebased_depfile = rebase_path(depfile, root_build_dir)
args = [
"--depfile=$_rebased_depfile",
"--bootclasspath=$_rebased_android_sdk_jar",
"--classpath=$_rebased_system_jars",
"--classpath=@FileArg($_rebased_build_config:javac:classpath)",
"--jar-path=$_rebased_jar_path",

Просмотреть файл

@ -283,6 +283,7 @@
],
'action': [
'python', '<(DEPTH)/build/android/gyp/javac.py',
'--bootclasspath=<(android_sdk_jar)',
'--classpath=>(input_jars_paths)',
'--src-gendirs=>(generated_src_dirs)',
'--javac-includes=<(javac_includes)',

Просмотреть файл

@ -860,6 +860,7 @@
],
'action': [
'python', '<(DEPTH)/build/android/gyp/javac.py',
'--bootclasspath=<(android_sdk_jar)',
'--classpath=>(input_jars_paths) <(android_sdk_jar)',
'--src-gendirs=>(gen_src_dirs)',
'--javac-includes=<(javac_includes)',