| Colin Cross | b197453 | 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 | b197453 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 31 |  | 
| Colin Cross | b197453 | 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 | b197453 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 40 | "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 Cross | 0b03d97 | 2019-05-13 11:06:25 -0700 | [diff] [blame] | 48 | "kotlin-stdlib-jdk7", | 
|  | 49 | "kotlin-stdlib-jdk8", | 
| Colin Cross | b197453 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 50 | "kotlin-annotations", | 
|  | 51 | } | 
|  | 52 |  | 
|  | 53 | for _, extra := range extraModules { | 
|  | 54 | bp += fmt.Sprintf(` | 
|  | 55 | java_library { | 
|  | 56 | name: "%s", | 
|  | 57 | srcs: ["a.java"], | 
| Paul Duffin | 52d398a | 2019-06-11 12:31:14 +0100 | [diff] [blame] | 58 | sdk_version: "none", | 
| Colin Cross | b197453 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 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"], | 
| Paul Duffin | a3d0986 | 2019-06-11 13:40:47 +0100 | [diff] [blame] | 68 | sdk_version: "none", | 
| Colin Cross | 3047fa2 | 2019-04-18 10:56:44 -0700 | [diff] [blame] | 69 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 70 | aidl: { | 
|  | 71 | export_include_dirs: ["framework/aidl"], | 
|  | 72 | }, | 
|  | 73 | } | 
|  | 74 |  | 
| Colin Cross | b197453 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 75 | android_app { | 
|  | 76 | name: "framework-res", | 
| Paul Duffin | 50c217c | 2019-06-12 13:25:22 +0100 | [diff] [blame] | 77 | sdk_version: "core_platform", | 
| Colin Cross | b197453 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 78 | } | 
| Colin Cross | 50ddcc4 | 2019-05-16 12:28:22 -0700 | [diff] [blame] | 79 |  | 
|  | 80 | java_library { | 
|  | 81 | name: "android.hidl.base-V1.0-java", | 
|  | 82 | srcs: ["a.java"], | 
| Paul Duffin | a3d0986 | 2019-06-11 13:40:47 +0100 | [diff] [blame] | 83 | sdk_version: "none", | 
| Colin Cross | 50ddcc4 | 2019-05-16 12:28:22 -0700 | [diff] [blame] | 84 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 85 | installable: true, | 
|  | 86 | } | 
|  | 87 |  | 
|  | 88 | java_library { | 
|  | 89 | name: "android.hidl.manager-V1.0-java", | 
|  | 90 | srcs: ["a.java"], | 
| Paul Duffin | a3d0986 | 2019-06-11 13:40:47 +0100 | [diff] [blame] | 91 | sdk_version: "none", | 
| Colin Cross | 50ddcc4 | 2019-05-16 12:28:22 -0700 | [diff] [blame] | 92 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 93 | installable: true, | 
|  | 94 | } | 
|  | 95 |  | 
|  | 96 | java_library { | 
|  | 97 | name: "org.apache.http.legacy", | 
|  | 98 | srcs: ["a.java"], | 
| Paul Duffin | a3d0986 | 2019-06-11 13:40:47 +0100 | [diff] [blame] | 99 | sdk_version: "none", | 
| Colin Cross | 50ddcc4 | 2019-05-16 12:28:22 -0700 | [diff] [blame] | 100 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 101 | installable: true, | 
|  | 102 | } | 
| Colin Cross | b197453 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 103 | ` | 
|  | 104 |  | 
|  | 105 | systemModules := []string{ | 
|  | 106 | "core-system-modules", | 
| Neil Fuller | ba88c41 | 2018-10-21 22:57:26 +0100 | [diff] [blame] | 107 | "core-current-stubs-system-modules", | 
| Colin Cross | b197453 | 2019-02-15 10:37:39 -0800 | [diff] [blame] | 108 | "core-platform-api-stubs-system-modules", | 
|  | 109 | "android_stubs_current_system_modules", | 
|  | 110 | "android_system_stubs_current_system_modules", | 
|  | 111 | "android_test_stubs_current_system_modules", | 
|  | 112 | } | 
|  | 113 |  | 
|  | 114 | for _, extra := range systemModules { | 
|  | 115 | bp += fmt.Sprintf(` | 
|  | 116 | java_system_modules { | 
|  | 117 | name: "%s", | 
|  | 118 | } | 
|  | 119 | `, extra) | 
|  | 120 | } | 
|  | 121 |  | 
|  | 122 | return bp | 
|  | 123 | } |