| Colin Cross | e4759b9 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 1 | // 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 |  | 
|  | 15 | package java | 
|  | 16 |  | 
|  | 17 | import ( | 
|  | 18 | "fmt" | 
|  | 19 |  | 
|  | 20 | "android/soong/android" | 
|  | 21 | ) | 
|  | 22 |  | 
|  | 23 | func 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 Cross | e4759b9 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 31 |  | 
| Colin Cross | e4759b9 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 32 | return config | 
|  | 33 | } | 
|  | 34 |  | 
|  | 35 | func GatherRequiredDepsForTest() string { | 
|  | 36 | var bp string | 
|  | 37 |  | 
|  | 38 | extraModules := []string{ | 
|  | 39 | "core-lambda-stubs", | 
| Colin Cross | e4759b9 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 40 | "ext", | 
|  | 41 | "android_stubs_current", | 
|  | 42 | "android_system_stubs_current", | 
|  | 43 | "android_test_stubs_current", | 
|  | 44 | "core.current.stubs", | 
|  | 45 | "core.platform.api.stubs", | 
|  | 46 | "kotlin-stdlib", | 
| Colin Cross | 0b03d97 | 2019-05-13 11:06:25 -0700 | [diff] [blame] | 47 | "kotlin-stdlib-jdk7", | 
|  | 48 | "kotlin-stdlib-jdk8", | 
| Colin Cross | e4759b9 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 49 | "kotlin-annotations", | 
|  | 50 | } | 
|  | 51 |  | 
|  | 52 | for _, extra := range extraModules { | 
|  | 53 | bp += fmt.Sprintf(` | 
|  | 54 | java_library { | 
|  | 55 | name: "%s", | 
|  | 56 | srcs: ["a.java"], | 
|  | 57 | no_standard_libs: true, | 
|  | 58 | sdk_version: "core_current", | 
|  | 59 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 60 | } | 
|  | 61 | `, extra) | 
|  | 62 | } | 
|  | 63 |  | 
|  | 64 | bp += ` | 
| Colin Cross | 3047fa2 | 2019-04-18 10:56:44 -0700 | [diff] [blame] | 65 | java_library { | 
|  | 66 | name: "framework", | 
|  | 67 | srcs: ["a.java"], | 
|  | 68 | no_standard_libs: true, | 
|  | 69 | sdk_version: "core_current", | 
|  | 70 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 71 | aidl: { | 
|  | 72 | export_include_dirs: ["framework/aidl"], | 
|  | 73 | }, | 
|  | 74 | } | 
|  | 75 |  | 
| Colin Cross | e4759b9 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 76 | android_app { | 
|  | 77 | name: "framework-res", | 
|  | 78 | no_framework_libs: true, | 
|  | 79 | } | 
| Colin Cross | 50ddcc4 | 2019-05-16 12:28:22 -0700 | [diff] [blame] | 80 |  | 
|  | 81 | java_library { | 
|  | 82 | name: "android.hidl.base-V1.0-java", | 
|  | 83 | srcs: ["a.java"], | 
|  | 84 | no_standard_libs: true, | 
|  | 85 | sdk_version: "core_current", | 
|  | 86 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 87 | installable: true, | 
|  | 88 | } | 
|  | 89 |  | 
|  | 90 | java_library { | 
|  | 91 | name: "android.hidl.manager-V1.0-java", | 
|  | 92 | srcs: ["a.java"], | 
|  | 93 | no_standard_libs: true, | 
|  | 94 | sdk_version: "core_current", | 
|  | 95 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 96 | installable: true, | 
|  | 97 | } | 
|  | 98 |  | 
|  | 99 | java_library { | 
|  | 100 | name: "org.apache.http.legacy", | 
|  | 101 | srcs: ["a.java"], | 
|  | 102 | no_standard_libs: true, | 
|  | 103 | sdk_version: "core_current", | 
|  | 104 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 105 | installable: true, | 
|  | 106 | } | 
| Colin Cross | e4759b9 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 107 | ` | 
|  | 108 |  | 
|  | 109 | systemModules := []string{ | 
|  | 110 | "core-system-modules", | 
| Neil Fuller | ba88c41 | 2018-10-21 22:57:26 +0100 | [diff] [blame] | 111 | "core-current-stubs-system-modules", | 
| Colin Cross | e4759b9 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 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 | } |