• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2007 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//
16// Definitions for building the native code needed for the core library.
17//
18
19// Defaults that apply to all of the modules
20
21cc_defaults {
22    name: "core_native_default_flags",
23    host_supported: true,
24    cflags: [
25        "-Wall",
26        "-Wextra",
27        "-Werror",
28    ],
29    cppflags: ["-DU_USING_ICU_NAMESPACE=0"],
30
31    target: {
32        darwin: {
33            enabled: false,
34        },
35    },
36}
37
38cc_defaults {
39    name: "core_native_default_libs",
40
41    shared_libs: [
42        "libbase",
43        "liblog",
44        "libnativehelper",
45    ],
46}
47
48cc_library_shared {
49    name: "libjavacore",
50    visibility: [
51        "//art/build/apex",
52    ],
53    apex_available: [
54        "com.android.art.release",
55        "com.android.art.debug",
56    ],
57    defaults: [
58        "core_native_default_flags",
59        "core_native_default_libs",
60    ],
61    srcs: [
62        ":luni_native_srcs",
63        "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp",
64    ],
65    shared_libs: [
66        "libandroidio",
67        "libbase",
68        "libcrypto",
69        "libexpat",
70        "libicuuc",
71        "libicui18n",
72        "libnativehelper",
73        "libz",
74    ],
75    static_libs: [
76        "libandroidicuinit",
77        "libziparchive",
78    ],
79    target: {
80        android: {
81            cflags: [
82                // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
83                // See external/icu/android_icu4c/include/uconfig_local.h
84                // for more information.
85                "-DANDROID_LINK_SHARED_ICU4C",
86            ],
87        },
88    },
89}
90
91cc_library_shared {
92    name: "libandroidio",
93    visibility: [
94        "//art/build/apex",
95        "//external/conscrypt",
96    ],
97    apex_available: [
98        "com.android.art.release",
99        "com.android.art.debug",
100        // TODO(b/147813447) remove this. This is currently due to the 'runtime_libs'
101        // dependency from libjavacrypto in the conscrypt APEX.
102        "com.android.conscrypt",
103        "test_com.android.conscrypt",
104    ],
105    defaults: [
106        "core_native_default_flags",
107    ],
108    shared_libs: [
109        "liblog",
110    ],
111    srcs: [
112        ":libandroidio_srcs",
113    ],
114    stubs: {
115        symbol_file: "libandroidio.map.txt",
116        versions: ["1"],
117    },
118}
119
120cc_defaults {
121    name: "libopenjdk_native_defaults",
122    defaults: [
123        "core_native_default_flags",
124        "core_native_default_libs",
125    ],
126    srcs: [":libopenjdk_native_srcs"],
127    local_include_dirs: [
128        "luni/src/main/native",
129    ],
130    cflags: [
131        // TODO(narayan): Prune down this list of exclusions once the underlying
132        // issues have been fixed. Most of these are small changes except for
133        // -Wunused-parameter.
134        "-Wno-unused-parameter",
135        "-Wno-unused-variable",
136        "-Wno-parentheses-equality",
137        "-Wno-constant-logical-operand",
138        "-Wno-sometimes-uninitialized",
139    ],
140
141    shared_libs: [
142        "libandroidio",
143        "libcrypto",
144        "libicuuc",
145        "libnativehelper",
146        "libz",
147    ],
148    static_libs: ["libfdlibm"],
149
150    target: {
151        linux_glibc: {
152            cflags: [ // Sigh.
153                "-D_LARGEFILE64_SOURCE",
154                "-D_GNU_SOURCE",
155                "-DLINUX",
156                "-D__GLIBC__",
157            ],
158        },
159        android: {
160            cflags: [
161                // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
162                // See external/icu/android_icu4c/include/uconfig_local.h
163                // for more information.
164                "-DANDROID_LINK_SHARED_ICU4C",
165            ],
166            shared_libs: [
167                "libdl_android",
168            ],
169        },
170    },
171
172    notice: "ojluni/NOTICE",
173}
174
175cc_library_shared {
176    name: "libopenjdk",
177    visibility: [
178        "//art/build/apex",
179    ],
180    apex_available: [
181        "com.android.art.release",
182        "com.android.art.debug",
183    ],
184    defaults: ["libopenjdk_native_defaults"],
185    shared_libs: [
186        "libopenjdkjvm",
187    ],
188}
189
190// Debug version of libopenjdk. Depends on libopenjdkjvmd.
191cc_library_shared {
192    name: "libopenjdkd",
193    visibility: [
194        "//art/build/apex",
195    ],
196    apex_available: [
197        "com.android.art.debug",
198    ],
199    defaults: ["libopenjdk_native_defaults"],
200    shared_libs: [
201        "libopenjdkjvmd",
202    ],
203}
204
205// Test JNI library.
206cc_library_shared {
207    name: "libjavacoretests",
208    visibility: [
209        "//art/build/sdk",
210        "//cts/tests/libcore/luni",
211    ],
212    defaults: ["core_native_default_flags"],
213    host_supported: true,
214
215    srcs: [
216        "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
217        "luni/src/test/native/libcore_java_io_FileTest.cpp",
218        "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
219        "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
220        "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
221    ],
222    target: {
223        android: {
224            shared_libs: ["libnativehelper_compat_libc++"],
225        },
226        host: {
227            shared_libs: ["libnativehelper"],
228        },
229    },
230
231    strip: {
232        keep_symbols: true,
233    },
234}
235
236// Set of gtest unit tests.
237cc_test {
238    name: "libjavacore-unit-tests",
239    defaults: ["core_native_default_flags"],
240
241    // Add -fno-builtin so that the compiler doesn't attempt to inline
242    // memcpy calls that are not really aligned.
243    cflags: ["-fno-builtin"],
244    srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"],
245
246    shared_libs: ["libnativehelper"],
247}
248
249// Set of benchmarks for libjavacore functions.
250cc_benchmark {
251    name: "libjavacore-benchmarks",
252    defaults: ["core_native_default_flags"],
253
254    srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"],
255    test_suites: ["device-tests"],
256
257    shared_libs: ["libnativehelper"],
258}
259