summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/jarjar/jarjar.gypi
blob: f94c351cd82ad468ed91ad1344c09c79bed36f6b (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
# 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 an action to
# repackage Java libraries and embed them into your own distribution.
#
# To use this, create a gyp target with the following form:
# {
#   'target_name': 'my_package_java',
#   'type': 'none',
#   'variables': {
#     'input_jar': 'path_to_your.jar',
#     'pattern': 'com.example.library.**',
#   },
#   'includes': ['path/to/this/gypi/file'],
# }
#
# The generated jar-file will be as defined in <(output_jar_file).
# Required variables:
#  input_jar - The source jar you want to jarjar.
#  pattern - a class name with optional wildcards.
#    ** will match against any valid class name substring.
#    To match a single package component (by excluding . from the match), a
#    single * may be used instead.
# Optional variables:
#  result_package - is a class name which can optionally reference the
#    substrings matched by the wildcards. A numbered reference is available for
#    every * or ** in the <pattern>, starting from left to right: @1, @2, etc.
#    A special @0 reference contains the entire matched class name.
#
# Note: This can not be used together with building a jar in your own target
# using src/build/java.gypi, since you will then have both jar files added to
# input_jars_paths through the use of the all_dependent_settings.
{
  'dependencies': [
    '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs'
  ],
  # This all_dependent_settings is used for java targets only. This will add the
  # <(output_jar_file) jar to the classpath of dependent java targets.
  'all_dependent_settings': {
    'variables': {
      'input_jars_paths': [ '<(output_jar_file)' ],
    },
  },
  'variables': {
    'output_jar_file': '<(PRODUCT_DIR)/lib.java/chromium_repackaged_<(_target_name).jar',
    'jarjar_build_file': '<(DEPTH)/third_party/jarjar/build.xml',
    'jarjar_javalib_file': '<(DEPTH)/third_party/jarjar/binary-distribution/jarjar-1.4.jar',
    'result_package%': 'org.chromium.repackaged.@0',
  },
  'actions': [
    {
      'action_name': 'ant_<(_target_name)',
      'message': 'Repackaging <(_target_name) from <(input_jar_file) to <(output_jar_file)',
      'inputs': [
        '<(jarjar_build_file)',
        '<(jarjar_javalib_file)',
        '<(input_jar_file)',
      ],
      'outputs': [
        '<(output_jar_file)',
      ],
      'action': [
        'ant',
        '-Dbasedir=.',
        '-DJARJAR_JAR=<(jarjar_javalib_file)',
        '-DINPUT_JAR=<(input_jar_file)',
        '-DOUTPUT_JAR=<(output_jar_file)',
        '-DPATTERN=<(pattern)',
        '-DRESULT_PACKAGE=<(result_package)',
        '-buildfile',
        '<(jarjar_build_file)'
      ]
    },
  ],
}