blob: 95b1efa7f88fcb4cda611a52d43ee84bbdee7e39 [file] [log] [blame]
Kenny Root0e27f2a2013-09-16 13:58:19 -07001# -*- mode: makefile -*-
2# Copyright (C) 2013 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16#
17# Definitions for building the Conscrypt Java library, native code,
18# and associated tests.
19#
20
21#
22# Common definitions for host and target.
23#
24
25# Conscrypt is divided into modules.
26#
27# The structure is:
28#
nmittler72ddbd92016-12-20 08:59:37 -080029# constants/
30# src/gen # Generates NativeConstants.java.
nmittler7782d132016-11-22 11:34:01 -080031# common/
32# src/main/java # Common Java source for all platforms.
33# src/jni/
34# main # Common C++ source for all platforms.
35# unbundled # C++ source used for OpenJDK and unbundled Android.
36# android/
37# src/main/java # Java source for unbundled Android.
38# openjdk/
39# src/main/java # Java source for OpenJDK.
nmittler33a56e72016-12-16 16:59:48 -080040# src/test
41# java/ # Java source for common tests.
42# resources/ # Support files for tests
nmittler7782d132016-11-22 11:34:01 -080043# platform/
44# src/main/java # Java source for bundled Android.
45# src/test
46# java/ # Java source for bundled tests.
Kenny Root0e27f2a2013-09-16 13:58:19 -070047#
48# All subdirectories are optional (hence the "2> /dev/null"s below).
49
50LOCAL_PATH := $(call my-dir)
51
Colin Crossb77aef42015-03-30 17:23:41 -070052local_javac_flags:=-Xmaxwarns 9999999
Kenny Root0e27f2a2013-09-16 13:58:19 -070053#local_javac_flags+=-Xlint:all -Xlint:-serial,-deprecation,-unchecked
Kenny Root0e27f2a2013-09-16 13:58:19 -070054
Kenny Root0e27f2a2013-09-16 13:58:19 -070055#
56# Build for the target (device).
57#
58
Kenny Root1cf50c82017-03-29 10:36:40 -070059bundled_test_java_files := $(call all-java-files-under,platform/src/test/java)
Adam Vartanian488471a2018-05-22 16:07:35 +010060bundled_test_java_files += $(filter-out %/ConscryptSuite.java %/ConscryptJava6Suite.java,\
Adam Vartanian6b42eeb2018-01-04 20:07:22 +000061 $(call all-java-files-under,openjdk-integ-tests/src/test/java))
Kenny Root93e9a3c2017-03-03 13:35:16 -080062bundled_test_java_files += $(call all-java-files-under,testing/src/main/java)
63bundled_test_java_files := $(foreach j,$(bundled_test_java_files),\
64 $(if $(findstring testing/src/main/java/libcore/,$(j)),,$(j)))
nmittler33a56e72016-12-16 16:59:48 -080065
Kenny Root0e27f2a2013-09-16 13:58:19 -070066ifeq ($(LIBCORE_SKIP_TESTS),)
67# Make the conscrypt-tests library.
68include $(CLEAR_VARS)
Nathan Mittler3f3e55f2017-01-10 09:11:14 -080069LOCAL_SRC_FILES := $(bundled_test_java_files)
Adam Vartanian3c9adfd2018-02-20 19:24:11 +000070LOCAL_JAVA_RESOURCE_DIRS := openjdk/src/test/resources openjdk-integ-tests/src/test/resources
Kenny Root0e27f2a2013-09-16 13:58:19 -070071LOCAL_NO_STANDARD_LIBRARIES := true
Adam Vartanian6b42eeb2018-01-04 20:07:22 +000072LOCAL_JAVA_LIBRARIES := \
73 core-oj \
74 core-libart \
75 junit \
76 mockito-target-minus-junit4
77LOCAL_STATIC_JAVA_LIBRARIES := \
78 core-tests-support \
79 conscrypt-nojarjar \
Narayan Kamatheaa601a2018-02-27 18:27:49 +000080 bouncycastle-unbundled \
81 bouncycastle-bcpkix-unbundled \
82 bouncycastle-ocsp-unbundled
Kenny Root0e27f2a2013-09-16 13:58:19 -070083LOCAL_JAVACFLAGS := $(local_javac_flags)
84LOCAL_MODULE_TAGS := optional
Kenny Root92b12a82013-10-02 16:44:41 -070085LOCAL_MODULE := conscrypt-tests
Kenny Root0e27f2a2013-09-16 13:58:19 -070086LOCAL_REQUIRED_MODULES := libjavacrypto
87LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
Neil Fuller53d42112016-02-16 13:19:19 +000088LOCAL_JAVA_LANGUAGE_VERSION := 1.7
Kenny Root0e27f2a2013-09-16 13:58:19 -070089include $(BUILD_STATIC_JAVA_LIBRARY)
Adam Vartaniane56b72a2017-08-07 11:49:48 +010090
91bundled_benchmark_java_files := $(call all-java-files-under,testing/src/main/java)
92bundled_benchmark_java_files := $(foreach j,$(bundled_benchmark_java_files),\
93 $(if $(findstring testing/src/main/java/libcore/,$(j)),,$(j)))
94bundled_benchmark_java_files += $(call all-java-files-under,benchmark-base/src/main/java)
Adam Vartaniane56b72a2017-08-07 11:49:48 +010095bundled_benchmark_java_files += $(call all-java-files-under,benchmark-android/src/main/java)
96
97# Make the conscrypt-benchmarks library.
98include $(CLEAR_VARS)
99LOCAL_SRC_FILES := $(bundled_benchmark_java_files)
100LOCAL_NO_STANDARD_LIBRARIES := true
Adam Vartanianf6dfbd22018-01-08 12:28:43 +0000101LOCAL_JAVA_LIBRARIES := \
102 core-oj \
103 core-libart \
104 junit \
Narayan Kamatheaa601a2018-02-27 18:27:49 +0000105 bouncycastle-unbundled \
106 bouncycastle-bcpkix-unbundled \
107 bouncycastle-ocsp-unbundled \
Adam Vartanianf6dfbd22018-01-08 12:28:43 +0000108 caliper-api-target
Adam Vartaniane56b72a2017-08-07 11:49:48 +0100109LOCAL_STATIC_JAVA_LIBRARIES := core-tests-support conscrypt-nojarjar
110LOCAL_JAVACFLAGS := $(local_javac_flags)
111LOCAL_MODULE_TAGS := optional
112LOCAL_MODULE := conscrypt-benchmarks
113LOCAL_REQUIRED_MODULES := libjavacrypto
114LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
115LOCAL_JAVA_LANGUAGE_VERSION := 1.7
116include $(BUILD_STATIC_JAVA_LIBRARY)
Kenny Root0e27f2a2013-09-16 13:58:19 -0700117endif
118
Kenny Root0e27f2a2013-09-16 13:58:19 -0700119#
120# Build for the host.
121#
122
Elliott Hughesd9b323c2014-12-17 13:29:43 -0800123ifeq ($(HOST_OS),linux)
124
Ian Rogers3a03c732014-05-23 11:53:18 -0700125# Make the conscrypt-tests library.
126ifeq ($(LIBCORE_SKIP_TESTS),)
Kenny Root0e27f2a2013-09-16 13:58:19 -0700127 include $(CLEAR_VARS)
Nathan Mittler3f3e55f2017-01-10 09:11:14 -0800128 LOCAL_SRC_FILES := $(bundled_test_java_files)
Adam Vartanian3c9adfd2018-02-20 19:24:11 +0000129 LOCAL_JAVA_RESOURCE_DIRS := openjdk/src/test/resources openjdk-integ-tests/src/test/resources
Adam Vartanianf6dfbd22018-01-08 12:28:43 +0000130 LOCAL_JAVA_LIBRARIES := \
Narayan Kamatheaa601a2018-02-27 18:27:49 +0000131 bouncycastle-unbundled-hostdex \
132 bouncycastle-bcpkix-unbundled-hostdex \
133 bouncycastle-ocsp-unbundled-hostdex \
Adam Vartanianf6dfbd22018-01-08 12:28:43 +0000134 junit-hostdex \
135 core-tests-support-hostdex \
136 mockito-api-hostdex
Adam Vartanian55338872017-10-18 15:26:55 +0100137 LOCAL_STATIC_JAVA_LIBRARIES := conscrypt-nojarjar-hostdex
Kenny Root0e27f2a2013-09-16 13:58:19 -0700138 LOCAL_JAVACFLAGS := $(local_javac_flags)
139 LOCAL_MODULE_TAGS := optional
Kenny Root92b12a82013-10-02 16:44:41 -0700140 LOCAL_MODULE := conscrypt-tests-hostdex
Kenny Root0e27f2a2013-09-16 13:58:19 -0700141 LOCAL_REQUIRED_MODULES := libjavacrypto
Kenny Rootf8c4be02016-10-06 09:28:13 -0700142 LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
Neil Fuller53d42112016-02-16 13:19:19 +0000143 LOCAL_JAVA_LANGUAGE_VERSION := 1.7
Narayan Kamathb32d6792013-10-28 14:22:43 +0000144 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
Ian Rogers3a03c732014-05-23 11:53:18 -0700145endif
Kenny Root0e27f2a2013-09-16 13:58:19 -0700146
Elliott Hughesd9b323c2014-12-17 13:29:43 -0800147endif # HOST_OS == linux
148
Kenny Root18ed3be2014-11-24 10:57:37 -0800149# clear out local variables
Kenny Root18ed3be2014-11-24 10:57:37 -0800150local_javac_flags :=
Nathan Mittler3f3e55f2017-01-10 09:11:14 -0800151bundled_test_java_files :=