summaryrefslogtreecommitdiff
path: root/chromium/build/java_prebuilt.gypi
blob: cec881dfd113727cb8d93a33f819bc99db9e5489 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# 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',
    'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)',
    'android_jar': '<(android_sdk)/android.jar',
    'input_jars_paths': [ '<(android_jar)' ],
    'proguard_config%': '',
    'proguard_preprocess%': '0',
    'variables': {
      'variables': {
        'proguard_preprocess%': 0,
      },
      'conditions': [
        ['proguard_preprocess == 1', {
          'dex_input_jar_path': '<(intermediate_dir)/<(_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)'],
      'library_dexed_jars_paths': ['<(dex_path)'],
    },
  },
  'conditions' : [
    ['proguard_preprocess == 1', {
      'actions': [
        {
          'action_name': 'proguard_<(_target_name)',
          'message': 'Proguard preprocessing <(_target_name) jar',
          'inputs': [
            '<(android_sdk_root)/tools/proguard/bin/proguard.sh',
            '<(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=<(android_sdk_root)/tools/proguard/bin/proguard.sh',
            '--input-path=<(jar_path)',
            '--output-path=<(dex_input_jar_path)',
            '--proguard-config=<(proguard_config)',
            '--classpath=>(input_jars_paths)',

            # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
            '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
          ]
        },
      ],
    }],
  ],
  'actions': [
    {
      'action_name': 'dex_<(_target_name)',
      'message': 'Dexing <(_target_name) jar',
      'inputs': [
        '<(DEPTH)/build/android/gyp/util/build_utils.py',
        '<(DEPTH)/build/android/gyp/dex.py',
        '<(dex_input_jar_path)',
      ],
      'outputs': [
        '<(dex_path)',
      ],
      'action': [
        'python', '<(DEPTH)/build/android/gyp/dex.py',
        '--dex-path=<(dex_path)',
        '--android-sdk-tools=<(android_sdk_tools)',

        # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
        '--ignore=>!(echo \'>(_inputs)\' | md5sum)',

        '<(dex_input_jar_path)',
      ]
    },

  ],
}