summaryrefslogtreecommitdiffstats
path: root/testing/android/native_test.gyp
blob: 4b25f7cc80276b93b5f60d89b5b0a88ea51b60fc (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
# 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.

{
  'conditions': [
    ['OS=="android"', {
      'targets': [
        {
          'target_name': 'native_test_apk',
          'message': 'building native test apk',
          'type': 'none',
          'dependencies': [
            'native_test_native_code',
          ],
          'actions': [
            {
              'action_name': 'native_test_apk',
              'inputs': [
                '<(DEPTH)/testing/android/native_test_apk.xml',
                '<!@(find <(DEPTH)/testing/android -name "*.java")',
                'native_test_launcher.cc'
              ],
              'outputs': [
                # Awkwardly, we build a Debug APK even when gyp is in
                # Release mode.  I don't think it matters (e.g. we're
                # probably happy to not codesign) but naming should be
                # fixed.  The -debug name is an aspect of the android
                # SDK antfiles (e.g. ${sdk.dir}/tools/ant/build.xml)
                '<(PRODUCT_DIR)/ChromeNativeTests-debug.apk',
              ],
              'action': [
                'ant',
                '-DPRODUCT_DIR=<(ant_build_out)',
                '-buildfile',
                '<(DEPTH)/testing/android/native_test_apk.xml',
              ]
            }
          ],
        },
        {
          'target_name': 'native_test_native_code',
          'message': 'building native pieces of native test package',
          'type': 'static_library',
           'sources': [
             'native_test_launcher.cc',
           ],
          'direct_dependent_settings': {
            'ldflags!': [
              # JNI_OnLoad is implemented in a .a and we need to
              # re-export in the .so.
              '-Wl,--exclude-libs=ALL',
            ],
          },
          'dependencies': [ 
            'jni_headers',
            '../../base/base.gyp:base',
            '../../base/base.gyp:test_support_base',
            '../gtest.gyp:gtest',
          ],
        },
        {
          'target_name': 'jni_headers',
          'type': 'none',
          'actions': [
            {
              'action_name': 'generate_jni_headers',
              'inputs': [
                '../../base/android/jni_generator/jni_generator.py',
                'java/src/org/chromium/native_test/ChromeNativeTestActivity.java'
              ],
              'outputs': [
                '<(SHARED_INTERMEDIATE_DIR)/testing/android/jni/'
                'chrome_native_test_activity_jni.h',
              ],
              'action': [
                'python',
                '../../base/android/jni_generator/jni_generator.py',
                '-o',
                '<@(_inputs)',
                '<@(_outputs)',
              ],
            }
          ],
          # So generated jni headers can be found by targets that
          # depend on this.
          'direct_dependent_settings': {
            'include_dirs': [
              '<(SHARED_INTERMEDIATE_DIR)',
            ],
          },
        },
      ],
    }]
  ],
}