DEADSOFTWARE

Initial commit
[cavedroid.git] / android / build.gradle
1 android {
2 buildToolsVersion "25.0.0"
3 compileSdkVersion 20
4 sourceSets {
5 main {
6 manifest.srcFile 'AndroidManifest.xml'
7 java.srcDirs = ['src']
8 aidl.srcDirs = ['src']
9 renderscript.srcDirs = ['src']
10 res.srcDirs = ['res']
11 assets.srcDirs = ['assets']
12 jniLibs.srcDirs = ['libs']
13 }
15 instrumentTest.setRoot('tests')
16 }
17 packagingOptions {
18 exclude 'META-INF/robovm/ios/robovm.xml'
19 }
20 defaultConfig {
21 applicationId "ru.deadsoftware.cavecraft"
22 minSdkVersion 9
23 targetSdkVersion 20
24 versionCode 1
25 versionName "1.0"
26 }
27 buildTypes {
28 release {
29 minifyEnabled false
30 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 }
32 }
33 }
36 // called every time gradle gets executed, takes the native dependencies of
37 // the natives configuration, and extracts them to the proper libs/ folders
38 // so they get packed with the APK.
39 task copyAndroidNatives() {
40 file("libs/armeabi/").mkdirs();
41 file("libs/armeabi-v7a/").mkdirs();
42 file("libs/arm64-v8a/").mkdirs();
43 file("libs/x86_64/").mkdirs();
44 file("libs/x86/").mkdirs();
46 configurations.natives.files.each { jar ->
47 def outputDir = null
48 if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
49 if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
50 if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
51 if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
52 if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
53 if(outputDir != null) {
54 copy {
55 from zipTree(jar)
56 into outputDir
57 include "*.so"
58 }
59 }
60 }
61 }
63 task run(type: Exec) {
64 def path
65 def localProperties = project.file("../local.properties")
66 if (localProperties.exists()) {
67 Properties properties = new Properties()
68 localProperties.withInputStream { instr ->
69 properties.load(instr)
70 }
71 def sdkDir = properties.getProperty('sdk.dir')
72 if (sdkDir) {
73 path = sdkDir
74 } else {
75 path = "$System.env.ANDROID_HOME"
76 }
77 } else {
78 path = "$System.env.ANDROID_HOME"
79 }
81 def adb = path + "/platform-tools/adb"
82 commandLine "$adb", 'shell', 'am', 'start', '-n', 'ru.deadsoftware.cavecraft/ru.deadsoftware.cavecraft.AndroidLauncher'
83 }
85 // sets up the Android Eclipse project, using the old Ant based build.
86 eclipse {
87 // need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
88 // ignores any nodes added in classpath.file.withXml
89 sourceSets {
90 main {
91 java.srcDirs "src", 'gen'
92 }
93 }
95 jdt {
96 sourceCompatibility = 1.6
97 targetCompatibility = 1.6
98 }
100 classpath {
101 plusConfigurations += [ project.configurations.compile ]
102 containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
105 project {
106 name = appName + "-android"
107 natures 'com.android.ide.eclipse.adt.AndroidNature'
108 buildCommands.clear();
109 buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
110 buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
111 buildCommand "org.eclipse.jdt.core.javabuilder"
112 buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
116 // sets up the Android Idea project, using the old Ant based build.
117 idea {
118 module {
119 sourceDirs += file("src");
120 scopes = [ COMPILE: [plus:[project.configurations.compile]]]
122 iml {
123 withXml {
124 def node = it.asNode()
125 def builder = NodeBuilder.newInstance();
126 builder.current = node;
127 builder.component(name: "FacetManager") {
128 facet(type: "android", name: "Android") {
129 configuration {
130 option(name: "UPDATE_PROPERTY_FILES", value:"true")