DEADSOFTWARE

Cut creative inventory
[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 "alpha0.1"
26 }
27 buildTypes {
28 release {
29 minifyEnabled false
30 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 }
32 }
33 }
34 // called every time gradle gets executed, takes the native dependencies of
35 // the natives configuration, and extracts them to the proper libs/ folders
36 // so they get packed with the APK.
37 task copyAndroidNatives() {
38 file("libs/armeabi/").mkdirs();
39 file("libs/armeabi-v7a/").mkdirs();
40 file("libs/arm64-v8a/").mkdirs();
41 file("libs/x86_64/").mkdirs();
42 file("libs/x86/").mkdirs();
44 configurations.natives.files.each { jar ->
45 def outputDir = null
46 if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
47 if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
48 if (jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
49 if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
50 if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
51 if (outputDir != null) {
52 copy {
53 from zipTree(jar)
54 into outputDir
55 include "*.so"
56 }
57 }
58 }
59 }
60 task run(type: Exec) {
61 def path
62 def localProperties = project.file("../local.properties")
63 if (localProperties.exists()) {
64 Properties properties = new Properties()
65 localProperties.withInputStream { instr ->
66 properties.load(instr)
67 }
68 def sdkDir = properties.getProperty('sdk.dir')
69 if (sdkDir) {
70 path = sdkDir
71 } else {
72 path = "$System.env.ANDROID_HOME"
73 }
74 } else {
75 path = "$System.env.ANDROID_HOME"
76 }
78 def adb = path + "/platform-tools/adb"
79 commandLine "$adb", 'shell', 'am', 'start', '-n', 'ru.deadsoftware.cavecraft/ru.deadsoftware.cavecraft.AndroidLauncher'
80 }
81 // sets up the Android Eclipse project, using the old Ant based build.
82 eclipse {
83 // need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
84 // ignores any nodes added in classpath.file.withXml
85 sourceSets {
86 main {
87 java.srcDirs "src", 'gen'
88 }
89 }
91 jdt {
92 sourceCompatibility = 1.6
93 targetCompatibility = 1.6
94 }
96 classpath {
97 plusConfigurations += [project.configurations.compile]
98 containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
99 }
101 project {
102 name = appName + "-android"
103 natures 'com.android.ide.eclipse.adt.AndroidNature'
104 buildCommands.clear();
105 buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
106 buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
107 buildCommand "org.eclipse.jdt.core.javabuilder"
108 buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
111 // sets up the Android Idea project, using the old Ant based build.
112 idea {
113 module {
114 sourceDirs += file("src");
115 scopes = [COMPILE: [plus: [project.configurations.compile]]]
117 iml {
118 withXml {
119 def node = it.asNode()
120 def builder = NodeBuilder.newInstance();
121 builder.current = node;
122 builder.component(name: "FacetManager") {
123 facet(type: "android", name: "Android") {
124 configuration {
125 option(name: "UPDATE_PROPERTY_FILES", value: "true")
133 dependencies {