| 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", | 
|  | 48 | "kotlin-annotations", | 
|  | 49 | } | 
|  | 50 |  | 
|  | 51 | for _, extra := range extraModules { | 
|  | 52 | bp += fmt.Sprintf(` | 
|  | 53 | java_library { | 
|  | 54 | name: "%s", | 
|  | 55 | srcs: ["a.java"], | 
|  | 56 | no_standard_libs: true, | 
|  | 57 | sdk_version: "core_current", | 
|  | 58 | system_modules: "core-platform-api-stubs-system-modules", | 
|  | 59 | } | 
|  | 60 | `, extra) | 
|  | 61 | } | 
|  | 62 |  | 
|  | 63 | bp += ` | 
| Colin Cross | 9bdfaf0 | 2019-04-18 10:56:44 -0700 | [diff] [blame] | 64 | java_library { | 
|  | 65 | name: "framework", | 
|  | 66 | srcs: ["a.java"], | 
|  | 67 | no_standard_libs: true, | 
|  | 68 | sdk_version: "core_current", | 
|  | 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", | 
|  | 77 | no_framework_libs: true, | 
|  | 78 | } | 
|  | 79 | ` | 
|  | 80 |  | 
|  | 81 | systemModules := []string{ | 
|  | 82 | "core-system-modules", | 
|  | 83 | "core-platform-api-stubs-system-modules", | 
|  | 84 | "android_stubs_current_system_modules", | 
|  | 85 | "android_system_stubs_current_system_modules", | 
|  | 86 | "android_test_stubs_current_system_modules", | 
|  | 87 | } | 
|  | 88 |  | 
|  | 89 | for _, extra := range systemModules { | 
|  | 90 | bp += fmt.Sprintf(` | 
|  | 91 | java_system_modules { | 
|  | 92 | name: "%s", | 
|  | 93 | } | 
|  | 94 | `, extra) | 
|  | 95 | } | 
|  | 96 |  | 
|  | 97 | return bp | 
|  | 98 | } |