Skip to content

Commit

Permalink
Support multiple proguard flags from java_apk.gypi. Proguard supports…
Browse files Browse the repository at this point in the history
… multiple proguard configuration files but java_apk and apk-build.xml supports only one proguard configuration.

BUG=181470


Review URL: https://chromiumcodereview.appspot.com/12913017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191806 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jayjang@chromium.org committed Apr 2, 2013
1 parent d4edb10 commit 36e7781
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 4 deletions.
1 change: 1 addition & 0 deletions build/all_android.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'../android_webview/android_webview.gyp:android_webview_unittests',
'../base/android/jni_generator/jni_generator.gyp:jni_generator_tests',
'../base/base.gyp:base_unittests',
'../build/android/tests/multiple_proguards/multiple_proguards.gyp:multiple_proguards_test_apk',
'../cc/cc_tests.gyp:cc_perftests_apk',
'../cc/cc_tests.gyp:cc_unittests',
'../chrome/chrome.gyp:unit_tests',
Expand Down
2 changes: 1 addition & 1 deletion build/android/ant/apk-obfuscate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
are added under the <proguard> call below.
-->
<path id="proguard.configpath">
<pathelement path="${proguard.config}"/>
<filelist files="${proguard.config}"/>
</path>
<pathconvert pathsep='" -include "' property="proguard.configcmd"
refid="proguard.configpath"/>
Expand Down
30 changes: 30 additions & 0 deletions build/android/tests/multiple_proguards/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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>
33 changes: 33 additions & 0 deletions build/android/tests/multiple_proguards/multiple_proguards.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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,
'package_name': 'multiple_proguard',
},
'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': [
'proguard1.flags',
'proguard2.flags',
],
'R_package': 'dummy',
'R_package_relpath': 'dummy',
'apk_name': 'MultipleProguards',
},
'dependencies': [
# guava has references to objects using reflection which
# should be ignored in proguard step.
'../../../../third_party/guava/guava.gyp:guava_javalib',
],
'includes': [ '../../../../build/java_apk.gypi' ],
},
],
}
2 changes: 2 additions & 0 deletions build/android/tests/multiple_proguards/proguard1.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# src/third_party/guava/guava.gyp:guava_javalib
-dontwarn sun.misc.Unsafe
3 changes: 3 additions & 0 deletions build/android/tests/multiple_proguards/proguard2.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Striped64 uses reflection to access some local fields.
-dontnote com.google.common.cache.Striped64
-dontnote com.google.common.cache.Striped64$Cell
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// 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.

package dummy;

import android.app.Activity;
import android.os.Bundle;

/**
* Dummy activity to build apk.
*/
public class DummyActivity extends Activity {
}
6 changes: 3 additions & 3 deletions build/java_apk.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
'app_manifest_version_name%': '<(android_app_version_name)',
'app_manifest_version_code%': '<(android_app_version_code)',
'proguard_enabled%': 'false',
'proguard_flags_path%': '<(DEPTH)/build/android/empty_proguard.flags',
'proguard_flags_paths%': ['<(DEPTH)/build/android/empty_proguard.flags'],
'native_libs_paths': [],
'jar_name': 'chromium_apk_<(_target_name).jar',
'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
Expand Down Expand Up @@ -346,7 +346,7 @@
'<(DEPTH)/build/android/ant/apk-obfuscate.xml',
'<(DEPTH)/build/android/ant/create-test-jar.js',
'<(compile_stamp)',
'<(proguard_flags_path)',
'>@(proguard_flags_paths)',
],
'outputs': [
'<(obfuscate_stamp)',
Expand All @@ -367,7 +367,7 @@
'-DOBFUSCATED_JAR_PATH=<(obfuscated_jar_path)',
'-DOUT_DIR=<(intermediate_dir)',
'-DPROGUARD_ENABLED=<(proguard_enabled)',
'-DPROGUARD_FLAGS=<(proguard_flags_path)',
'-DPROGUARD_FLAGS=<(proguard_flags_paths)',
'-DTEST_JAR_PATH=<(PRODUCT_DIR)/test.lib.java/<(apk_name).jar',

'-DSTAMP=<(obfuscate_stamp)',
Expand Down

0 comments on commit 36e7781

Please sign in to comment.