blob: 6d7ddd3639975364e375a912ffc0c037cfc2db70 [file] [log] [blame]
apply plugin: 'sdk-files'
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())
task buildDefaultEmulator(type: BuildEmulator) {
revision = props."Pkg.Revision"
build_number = System.getenv("BUILD_NUMBER")
output = new File(project.buildDir, "default")
}
task buildWindowsEmulator(type: BuildEmulator) {
revision = props."Pkg.Revision"
build_number = System.getenv("BUILD_NUMBER")
output = new File(project.buildDir, "windows")
windows = true
}
sdk {
common(mac, linux) {
item(fprops) {
notice null
}
item('android/avd/hardware-properties.ini') {
into 'lib'
notice null
}
item("$buildDefaultEmulator.output/emulator") {
executable true
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/emulator-check") {
executable true
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/bin64") {
into 'bin64'
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/qemu") {
into 'qemu'
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/build/debug_info/qemu") {
into 'qemu'
builtBy buildDefaultEmulator
debug true
}
item("$buildDefaultEmulator.output/lib") {
into 'lib'
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/lib64") {
into 'lib64'
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/build/debug_info/lib64") {
into 'lib64'
builtBy buildDefaultEmulator
debug true
}
item("$project.rootDir/../prebuilts/qemu-kernel/x86/pc-bios/bios.bin") {
into 'lib/pc-bios'
}
item("$project.rootDir/../prebuilts/qemu-kernel/x86/pc-bios/vgabios-cirrus.bin") {
into 'lib/pc-bios'
}
item("$buildDefaultEmulator.output/emulator64-arm") {
executable true
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/emulator64-mips") {
executable true
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/emulator64-x86") {
executable true
builtBy buildDefaultEmulator
}
item("$buildDefaultEmulator.output/emulator64-crash-service") {
executable true
builtBy buildDefaultEmulator
}
}
windows {
item(fprops) {
notice null
}
item('android/avd/hardware-properties.ini') {
into 'lib'
notice null
}
item("$buildWindowsEmulator.output/emulator.exe") {
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/emulator-check.exe") {
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/bin") {
into 'bin'
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/qemu") {
into 'qemu'
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/build/debug_info/qemu") {
into 'qemu'
builtBy buildWindowsEmulator
debug true
}
item("$buildWindowsEmulator.output/lib") {
into 'lib'
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/build/debug_info/lib") {
into 'lib'
builtBy buildWindowsEmulator
debug true
}
item("$buildWindowsEmulator.output/lib64") {
into 'lib64'
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/build/debug_info/lib64") {
into 'lib64'
builtBy buildWindowsEmulator
debug true
}
item("$project.rootDir/../prebuilts/qemu-kernel/x86/pc-bios/bios.bin") {
into 'lib/pc-bios'
}
item("$project.rootDir/../prebuilts/qemu-kernel/x86/pc-bios/vgabios-cirrus.bin") {
into 'lib/pc-bios'
}
item("$buildWindowsEmulator.output/emulator-arm.exe") {
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/emulator-mips.exe") {
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/emulator-x86.exe") {
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/emulator-crash-service.exe") {
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/emulator64-crash-service.exe") {
builtBy buildWindowsEmulator
}
/*
XAV(2014-06-17): DISABLE win64 exe until it's ready
item("$buildWindowsEmulator.output/emulator64-arm.exe") {
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/emulator64-mips.exe") {
builtBy buildWindowsEmulator
}
item("$buildWindowsEmulator.output/emulator64-x86.exe") {
builtBy buildWindowsEmulator
}
*/
}
}
import com.android.tools.internal.sdk.base.PlatformConfig
import com.android.tools.internal.sdk.base.ToolItem
import com.google.common.collect.Lists
// Duplicate 'emulator' executables for debug info paths
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
}
if (platform.getName().equals("win")) {
debugItemPath = debugItemPath.replaceFirst("$buildWindowsEmulator.output",
"$buildWindowsEmulator.output/build/debug_info")
} else {
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)
}
}