blob: 1965b5d26faa0c2bcd8834b66e99a5183a6e37af [file] [log] [blame]
Colin Cross1f7f3bd2016-07-27 10:12:38 -07001// Copyright (C) 2016 The Android Open Source Project
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 art
16
Colin Cross6e95dd52016-09-12 15:37:10 -070017import (
David Srbeckyb0713ca2020-07-01 15:04:39 +010018 "path/filepath"
Colin Cross6e95dd52016-09-12 15:37:10 -070019 "sort"
20 "strings"
21
22 "android/soong/android"
David Srbecky7400a542020-07-09 13:40:57 +010023 "android/soong/cc/config"
Colin Cross6e95dd52016-09-12 15:37:10 -070024)
Colin Cross1f7f3bd2016-07-27 10:12:38 -070025
26var (
David Srbeckyb461b532020-07-13 17:45:22 +000027 pctx = android.NewPackageContext("android/soong/art")
28
29 // Copy the following prebuilts to the testcases directory.
30 // The original prebuilts directory is not accessible when running tests remotely.
31 prebuiltToolsForTests = []string{
32 "bin/clang",
33 "bin/clang.real",
34 "bin/llvm-addr2line",
35 "bin/llvm-dwarfdump",
36 "bin/llvm-objdump",
37 "lib64/libc++.so.1",
38 }
Colin Cross1f7f3bd2016-07-27 10:12:38 -070039)
40
41func init() {
42 android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
David Srbeckyb0713ca2020-07-01 15:04:39 +010043 pctx.Import("android/soong/cc/config")
Colin Cross1f7f3bd2016-07-27 10:12:38 -070044}
45
46func makeVarsProvider(ctx android.MakeVarsContext) {
47 ctx.Strict("LIBART_IMG_HOST_BASE_ADDRESS", ctx.Config().LibartImgHostBaseAddress())
48 ctx.Strict("LIBART_IMG_TARGET_BASE_ADDRESS", ctx.Config().LibartImgDeviceBaseAddress())
Colin Cross6e95dd52016-09-12 15:37:10 -070049
50 testMap := testMap(ctx.Config())
51 var testNames []string
52 for name := range testMap {
53 testNames = append(testNames, name)
54 }
55
56 sort.Strings(testNames)
57
58 for _, name := range testNames {
59 ctx.Strict("ART_TEST_LIST_"+name, strings.Join(testMap[name], " "))
60 }
David Srbecky1cf46a32020-06-22 15:39:00 +010061
62 // Create list of copy commands to install the content of the testcases directory.
63 testcasesContent := testcasesContent(ctx.Config())
64 copy_cmds := []string{}
65 for _, key := range android.SortedStringKeys(testcasesContent) {
66 copy_cmds = append(copy_cmds, testcasesContent[key]+":"+key)
67 }
68 ctx.Strict("ART_TESTCASES_CONTENT", strings.Join(copy_cmds, " "))
David Srbeckyb0713ca2020-07-01 15:04:39 +010069
70 // Add prebuilt tools.
David Srbecky7400a542020-07-09 13:40:57 +010071 clang_path := filepath.Join(config.ClangDefaultBase, ctx.Config().PrebuiltOS(), config.ClangDefaultVersion)
David Srbeckyb0713ca2020-07-01 15:04:39 +010072 copy_cmds = []string{}
David Srbeckyb461b532020-07-13 17:45:22 +000073 for _, tool := range prebuiltToolsForTests {
74 src := filepath.Join(clang_path, "/", tool)
75 copy_cmds = append(copy_cmds, src+":"+src)
David Srbeckyb0713ca2020-07-01 15:04:39 +010076 }
77 ctx.Strict("ART_TESTCASES_PREBUILT_CONTENT", strings.Join(copy_cmds, " "))
Colin Cross1f7f3bd2016-07-27 10:12:38 -070078}