blob: fa93bccf509187407fe6bacc0b5af67ddfe5312a [file] [log] [blame]
Colin Crossb1974532019-02-15 10:37:39 -08001// Copyright 2019 Google Inc. All rights reserved.
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
15package java
16
17import (
18 "fmt"
19
20 "android/soong/android"
21)
22
23func TestConfig(buildDir string, env map[string]string) android.Config {
24 if env == nil {
25 env = make(map[string]string)
26 }
27 if env["ANDROID_JAVA8_HOME"] == "" {
28 env["ANDROID_JAVA8_HOME"] = "jdk8"
29 }
30 config := android.TestArchConfig(buildDir, env)
Colin Crossb1974532019-02-15 10:37:39 -080031
Colin Crossb1974532019-02-15 10:37:39 -080032 return config
33}
34
35func GatherRequiredDepsForTest() string {
36 var bp string
37
38 extraModules := []string{
39 "core-lambda-stubs",
Colin Crossb1974532019-02-15 10:37:39 -080040 "ext",
41 "updatable_media_stubs",
42 "android_stubs_current",
43 "android_system_stubs_current",
44 "android_test_stubs_current",
45 "core.current.stubs",
46 "core.platform.api.stubs",
47 "kotlin-stdlib",
Colin Cross0b03d972019-05-13 11:06:25 -070048 "kotlin-stdlib-jdk7",
49 "kotlin-stdlib-jdk8",
Colin Crossb1974532019-02-15 10:37:39 -080050 "kotlin-annotations",
51 }
52
53 for _, extra := range extraModules {
54 bp += fmt.Sprintf(`
55 java_library {
56 name: "%s",
57 srcs: ["a.java"],
58 no_standard_libs: true,
59 sdk_version: "core_current",
60 system_modules: "core-platform-api-stubs-system-modules",
61 }
62 `, extra)
63 }
64
65 bp += `
Colin Cross3047fa22019-04-18 10:56:44 -070066 java_library {
67 name: "framework",
68 srcs: ["a.java"],
69 no_standard_libs: true,
70 sdk_version: "core_current",
71 system_modules: "core-platform-api-stubs-system-modules",
72 aidl: {
73 export_include_dirs: ["framework/aidl"],
74 },
75 }
76
Colin Crossb1974532019-02-15 10:37:39 -080077 android_app {
78 name: "framework-res",
79 no_framework_libs: true,
80 }
Colin Cross50ddcc42019-05-16 12:28:22 -070081
82 java_library {
83 name: "android.hidl.base-V1.0-java",
84 srcs: ["a.java"],
85 no_standard_libs: true,
86 sdk_version: "core_current",
87 system_modules: "core-platform-api-stubs-system-modules",
88 installable: true,
89 }
90
91 java_library {
92 name: "android.hidl.manager-V1.0-java",
93 srcs: ["a.java"],
94 no_standard_libs: true,
95 sdk_version: "core_current",
96 system_modules: "core-platform-api-stubs-system-modules",
97 installable: true,
98 }
99
100 java_library {
101 name: "org.apache.http.legacy",
102 srcs: ["a.java"],
103 no_standard_libs: true,
104 sdk_version: "core_current",
105 system_modules: "core-platform-api-stubs-system-modules",
106 installable: true,
107 }
Colin Crossb1974532019-02-15 10:37:39 -0800108 `
109
110 systemModules := []string{
111 "core-system-modules",
112 "core-platform-api-stubs-system-modules",
113 "android_stubs_current_system_modules",
114 "android_system_stubs_current_system_modules",
115 "android_test_stubs_current_system_modules",
116 }
117
118 for _, extra := range systemModules {
119 bp += fmt.Sprintf(`
120 java_system_modules {
121 name: "%s",
122 }
123 `, extra)
124 }
125
126 return bp
127}