diff options
author | Xavier Ducrohet <xav@google.com> | 2014-03-06 12:15:25 -0800 |
---|---|---|
committer | Xavier Ducrohet <xav@google.com> | 2014-05-15 10:24:03 -0700 |
commit | 0a55da438e6076a93e2bd7d69384a1d4565a251f (patch) | |
tree | 2a20987f06651e2b8ad6aa66e2395c9f894492eb | |
parent | 13ed8257042b3d5229518aa5f686eb9eff3755e0 (diff) | |
download | sdk-0a55da438e6076a93e2bd7d69384a1d4565a251f.zip sdk-0a55da438e6076a93e2bd7d69384a1d4565a251f.tar.gz sdk-0a55da438e6076a93e2bd7d69384a1d4565a251f.tar.bz2 |
Build mksdcard for mac/linux with Gradle.
Change-Id: Ie7db983ab953ee3820189e9eb0f4cf47fe40d1e5
-rw-r--r-- | build.gradle | 26 | ||||
-rw-r--r-- | emulator/mksdcard/.gitignore | 3 | ||||
-rw-r--r-- | emulator/mksdcard/Android.mk | 2 | ||||
-rw-r--r-- | emulator/mksdcard/build.gradle | 62 | ||||
-rw-r--r-- | emulator/mksdcard/src/source/mksdcard.c (renamed from emulator/mksdcard/mksdcard.c) | 0 |
5 files changed, 79 insertions, 14 deletions
diff --git a/build.gradle b/build.gradle index e73607b..0e4120b 100644 --- a/build.gradle +++ b/build.gradle @@ -2,28 +2,28 @@ apply plugin: 'sdk-files' sdk { common { - path('files/tools_source.properties') { name 'source.properties' } - path('files/plugin.prop') { into 'lib' } + item('files/tools_source.properties') { name 'source.properties' } + item('files/plugin.prop') { into 'lib' } - path('emulator/snapshot/snapshots.img') { into 'lib/emulator' } - path('emulator/skins/dynamic') { into 'lib/emulator/skins/dynamic' } + item('emulator/snapshot/snapshots.img') { into 'lib/emulator' } + item('emulator/skins/dynamic') { into 'lib/emulator/skins/dynamic' } - path('templates/build.template') { into 'lib' } - path('templates/uibuild.template') { into 'lib' } - path('templates/build_gradle.template') { into 'lib' } + item('templates/build.template') { into 'lib' } + item('templates/uibuild.template') { into 'lib' } + item('templates/build_gradle.template') { into 'lib' } - path('files/ant') { into 'ant' } - path('files/sdk_files_NOTICE.txt') { + item('files/ant') { into 'ant' } + item('files/sdk_files_NOTICE.txt') { into 'ant' name 'NOTICE.txt' } - path('files/devices.xml') { into 'lib' } - path('files/android.el') { into 'lib' } + item('files/devices.xml') { into 'lib' } + item('files/android.el') { into 'lib' } - path('apps/SdkController') { into 'apps/SdkController' } + item('apps/SdkController') { into 'apps/SdkController' } - path('files/typos') { into 'support' } + item('files/typos') { into 'support' } } linux { diff --git a/emulator/mksdcard/.gitignore b/emulator/mksdcard/.gitignore new file mode 100644 index 0000000..4a78fc8 --- /dev/null +++ b/emulator/mksdcard/.gitignore @@ -0,0 +1,3 @@ +build +.gradle + diff --git a/emulator/mksdcard/Android.mk b/emulator/mksdcard/Android.mk index a5641b4..0547f00 100644 --- a/emulator/mksdcard/Android.mk +++ b/emulator/mksdcard/Android.mk @@ -5,7 +5,7 @@ LOCAL_PATH:= $(call my-dir) # host executable # include $(CLEAR_VARS) -LOCAL_SRC_FILES:= mksdcard.c +LOCAL_SRC_FILES:= src/source/mksdcard.c LOCAL_MODULE = mksdcard include $(BUILD_HOST_EXECUTABLE) diff --git a/emulator/mksdcard/build.gradle b/emulator/mksdcard/build.gradle new file mode 100644 index 0000000..6dd0aa0 --- /dev/null +++ b/emulator/mksdcard/build.gradle @@ -0,0 +1,62 @@ +apply plugin: 'c' +apply plugin: 'sdk-files' + +executables { + mksdcard {} +} + +sources { + mksdcard { + c { + source { + srcDir "src/source" + include "**/*.c" + } + } + } +} + +model { + platforms { + linux { + architecture "i386" + operatingSystem "linux" + } + darwin { + architecture "i386" + operatingSystem "osx" + } + } +} + +binaries.all { + // Define toolchain-specific compiler and linker options + + if (toolChain in Gcc) { + cCompiler.args "-O2" + linker.args "-S" + } +} + +sdk { + mac { + item( { getExeName("darwin") } ) { + executable true + builtBy 'darwinMksdcardExecutable' + } + } + linux { + item( { getExeName("linux") } ) { + executable true + builtBy 'linuxMksdcardExecutable' + } + } +} + +def getExeName(String platform) { + // binaries will return a set of binaries + def binaries = executables.mksdcard.binaries.matching { it.name == "${platform}MksdcardExecutable" } + // calling .exeFile on the set returns an array with the result from each item in the set... + return binaries.executableFile.get(0) +} + diff --git a/emulator/mksdcard/mksdcard.c b/emulator/mksdcard/src/source/mksdcard.c index c9a3eeb..c9a3eeb 100644 --- a/emulator/mksdcard/mksdcard.c +++ b/emulator/mksdcard/src/source/mksdcard.c |