DEADSOFTWARE

Better creative inventory scrolling
[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 }
14 debug {
15 res.srcDirs = ['debug/res']
16 }
17 instrumentTest.setRoot('tests')
18 }
19 packagingOptions {
20 exclude 'META-INF/robovm/ios/robovm.xml'
21 }
22 defaultConfig {
23 applicationId "ru.deadsoftware.cavecraft"
24 minSdkVersion 9
25 targetSdkVersion 20
26 versionCode 5
27 versionName "alpha0.4-dev"
28 }
29 buildTypes {
30 release {
31 minifyEnabled false
32 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33 }
34 debug {
35 applicationIdSuffix ".debug"
36 }
37 }
38 }
39 // called every time gradle gets executed, takes the native dependencies of
40 // the natives configuration, and extracts them to the proper libs/ folders
41 // so they get packed with the APK.
42 task copyAndroidNatives() {
43 file("libs/armeabi/").mkdirs();
44 file("libs/armeabi-v7a/").mkdirs();
45 file("libs/arm64-v8a/").mkdirs();
46 file("libs/x86_64/").mkdirs();
47 file("libs/x86/").mkdirs();
49 configurations.natives.files.each { jar ->
50 def outputDir = null
51 if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
52 if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
53 if (jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
54 if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
55 if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
56 if (outputDir != null) {
57 copy {
58 from zipTree(jar)
59 into outputDir
60 include "*.so"
61 }
62 }
63 }
64 }
65 task run(type: Exec) {
66 def path
67 def localProperties = project.file("../local.properties")
68 if (localProperties.exists()) {
69 Properties properties = new Properties()
70 localProperties.withInputStream { instr ->
71 properties.load(instr)
72 }
73 def sdkDir = properties.getProperty('sdk.dir')
74 if (sdkDir) {
75 path = sdkDir
76 } else {
77 path = "$System.env.ANDROID_HOME"
78 }
79 } else {
80 path = "$System.env.ANDROID_HOME"
81 }
83 def adb = path + "/platform-tools/adb"
84 commandLine "$adb", 'shell', 'am', 'start', '-n', 'ru.deadsoftware.cavecraft/ru.deadsoftware.cavecraft.AndroidLauncher'
85 }
86 // sets up the Android Eclipse project, using the old Ant based build.
87 eclipse {
88 // need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
89 // ignores any nodes added in classpath.file.withXml
90 sourceSets {
91 main {
92 java.srcDirs "src", 'gen'
93 }
94 }
96 jdt {
97 sourceCompatibility = 1.6
98 targetCompatibility = 1.6
99 }
101 classpath {
102 plusConfigurations += [project.configurations.compile]
103 containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
106 project {
107 name = appName + "-android"
108 natures 'com.android.ide.eclipse.adt.AndroidNature'
109 buildCommands.clear();
110 buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
111 buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
112 buildCommand "org.eclipse.jdt.core.javabuilder"
113 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")
138 dependencies {