blob: cb654cbe82e60426176b2706cb7a73d1d8e92970 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001# Copyright (c) 2012 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# This file is meant to be included into a target to provide a rule
6# to package prebuilt Java JARs in a consistent manner.
7#
8# To use this, create a gyp target with the following form:
9# {
10# 'target_name': 'my-package_java',
11# 'type': 'none',
12# 'variables': {
13# 'jar_path': 'path/to/your.jar',
14# },
15# 'includes': ['path/to/this/gypi/file'],
16# }
17#
18# Required variables:
19# jar_path - The path to the prebuilt Java JAR file.
20
21{
22 'dependencies': [
23 '<(DEPTH)/build/android/setup.gyp:build_output_dirs'
24 ],
25 'variables': {
26 'dex_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).dex.jar',
27 'android_jar': '<(android_sdk)/android.jar',
28 'input_jars_paths': [ '<(android_jar)' ],
29 'neverlink%': 0,
30 'proguard_config%': '',
31 'proguard_preprocess%': '0',
32 'variables': {
33 'variables': {
34 'proguard_preprocess%': 0,
35 },
36 'conditions': [
37 ['proguard_preprocess == 1', {
38 'dex_input_jar_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).pre.jar',
39 }, {
40 'dex_input_jar_path': '<(jar_path)',
41 }],
42 ],
43 },
44 'dex_input_jar_path': '<(dex_input_jar_path)',
45 },
46 'all_dependent_settings': {
47 'variables': {
48 'input_jars_paths': ['<(dex_input_jar_path)'],
49 'conditions': [
50 ['neverlink == 1', {
51 'library_dexed_jars_paths': [],
52 }, {
53 'library_dexed_jars_paths': ['<(dex_path)'],
54 }],
55 ],
56 },
57 },
58 'conditions' : [
59 ['proguard_preprocess == 1', {
60 'actions': [
61 {
62 'action_name': 'proguard_<(_target_name)',
63 'message': 'Proguard preprocessing <(_target_name) jar',
64 'inputs': [
65 '<(DEPTH)/third_party/proguard/lib/proguard.jar',
66 '<(DEPTH)/build/android/gyp/util/build_utils.py',
67 '<(DEPTH)/build/android/gyp/proguard.py',
68 '<(jar_path)',
69 '<(proguard_config)',
70 ],
71 'outputs': [
72 '<(dex_input_jar_path)',
73 ],
74 'action': [
75 'python', '<(DEPTH)/build/android/gyp/proguard.py',
76 '--proguard-path=<(DEPTH)/third_party/proguard/lib/proguard.jar',
77 '--input-path=<(jar_path)',
78 '--output-path=<(dex_input_jar_path)',
79 '--proguard-config=<(proguard_config)',
80 '--classpath=>(input_jars_paths)',
81 ]
82 },
83 ],
84 }],
85 ['neverlink == 0', {
86 'actions': [
87 {
88 'action_name': 'dex_<(_target_name)',
89 'message': 'Dexing <(_target_name) jar',
90 'variables': {
91 'dex_input_paths': [
92 '<(dex_input_jar_path)',
93 ],
94 'output_path': '<(dex_path)',
95 },
96 'includes': [ 'android/dex_action.gypi' ],
97 },
98 ],
99 }],
100 ],
101}