forked from aosp-mirror/platform_external_qemu
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
176 lines (154 loc) · 5.17 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
apply plugin: 'sdk-files'
/***
DEPRECATED! DEPRECATED! DEPRECATED! DEPRECATED!
WARNING THIS FILE IS NO LONGER BEING USED AND WILL BE REMOVED IN THE NEAR FUTURE
INSTEAD MODIFY:
android/build/python/aemu/distribution.py
OR BETTER:
Modify the CMakeLists.txt such that the install(xxx) binplaces what you want
to have end up in the release
DEPRECATED! DEPRECATED! DEPRECATED! DEPRECATED!
**/
import com.android.tools.internal.emulator.BuildEmulator
// Get SDK revision to define emulator revision
File fprops = new File(rootDir.getParentFile(), 'external/qemu/source.properties')
Properties props = new Properties()
props.load(fprops.newDataInputStream())
// Mac/Win emulator now has dependency on haxm 6.2.1
File fprops_mac = new File(rootDir.getParentFile(), 'external/qemu/mac.source.properties')
File fprops_win = new File(rootDir.getParentFile(), 'external/qemu/win.source.properties')
task buildDefaultEmulator(type: BuildEmulator) {
revision = props."Pkg.Revision"
build_number = System.getenv("BUILD_NUMBER")
output = new File(project.buildDir, "default")
}
task buildEmulatorCodeCoverage(type: BuildEmulator) {
debug = true
revision = props."Pkg.Revision"
build_number = System.getenv("BUILD_NUMBER")
output = new File(project.buildDir, "coverage")
}
task buildWindowsEmulator(type: BuildEmulator) {
revision = props."Pkg.Revision"
build_number = System.getenv("BUILD_NUMBER")
output = new File(project.buildDir, "windows")
windows = true
}
// Package all data to construct a coverage report.
task packageCodeCoverage(type: Zip) {
dependsOn buildEmulatorCodeCoverage
outputs.upToDateWhen { false }
archiveName = "code-coverage.zip"
destinationDir = new File(project.buildDir, "coverage")
from(buildEmulatorCodeCoverage.output) {
include "**/*.csv"
}
from(buildEmulatorCodeCoverage.output) {
include "**/*.gcda"
}
from(buildEmulatorCodeCoverage.output) {
include "**/*.gcno"
}
}
sdk {
common(mac, linux) {
item("$buildDefaultEmulator.output/distribution/emulator") {
into ''
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/build/debug_info/") {
into ''
builtBy buildDefaultEmulator
debug true
}
item("$project.rootDir/../external/qemu/android-info.txt") {
into ''
}
// This will make it end up in the Debug configuration.
item("$buildEmulatorCodeCoverage.output/code-coverage.zip") {
debug true
into ''
builtBy packageCodeCoverage
}
}
linux {
item(fprops) {
notice null
}
}
mac {
item(fprops_mac) {
name 'source.properties'
notice null
}
}
windows {
item("$buildWindowsEmulator.output/distribution/emulator") {
into ''
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/build/debug_info/") {
into ''
builtBy buildWindowsEmulator
debug true
}
item("$project.rootDir/../external/qemu/android-info.txt") {
into ''
}
item(fprops_win) {
name 'source.properties'
notice null
}
item("$project.rootDir/../external/qemu/android-info.txt") {
into ''
}
}
}
import com.android.tools.internal.sdk.base.PlatformConfig
import com.android.tools.internal.sdk.base.ToolItem
import com.google.common.collect.Lists
for (PlatformConfig platform : sdk.getPlatforms()) {
def itemlist = Lists.newArrayList()
for (ToolItem toolitem: platform.getItems()) {
if (toolitem.getDebug() || !toolitem.getExecutable()) {
continue
}
def prop = toolitem.properties
def itemPath = prop.itemPath
if (itemPath instanceof String || itemPath instanceof GString) {
def debugItemPath = itemPath
def path = debugItemPath.split("/")
def s = path[path.size()-1]
if (!s.contains("emulator")) {
continue
}
debugItemPath = debugItemPath.replaceFirst("$buildDefaultEmulator.output",
"$buildDefaultEmulator.output/build/debug_info")
if (debugItemPath.equals(itemPath)) {
continue
}
if (platform.getName().equals("mac")) {
debugItemPath += ".dSYM"
if (!prop.destinationPath) {
path = debugItemPath.split("/")
prop.destinationPath = path[path.size()-1]
}
}
prop.debug=true;
prop.remove('itemPath')
prop.remove('class')
def propcopy = {
prop.each { k, v ->
delegate."$k"=v
}
return debugItemPath
}
def debugitem = new ToolItem(propcopy)
propcopy.delegate = debugitem
itemlist.add(debugitem)
}
}
for (ToolItem debugitem: itemlist) {
platform.getItems().add(debugitem)
}
}