Skip to content

Commit 1aa2c6d

Browse files
committed
Changes to support automated building of samples via Gradle.
Change-Id: Ib3698e18d4cc478c749335e70c1fa4f367c5d766
1 parent 7c19ff5 commit 1aa2c6d

21 files changed

Lines changed: 165 additions & 72 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ libs/
55
local.properties
66
obj/
77
.settings/
8+
9+
.gradle/
10+
build/
11+
12+
samples-android/Common/gpg-sdk/gpg-cpp-sdk/
13+
samples-android/Common/gpg-sdk/gpg_cpp_sdk.zip

samples-android/ButtonClicker/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Properties properties = new Properties()
55
properties.load(project.rootProject.file('local.properties').newDataInputStream())
66
def ndkDir = properties.getProperty('ndk.dir')
77

8-
def gpg_cpp_path = file(project(':gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
8+
def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
99

1010
// stlport configuration ["c++_static", "c++_shared", "gnustl_static", "gnustl_shared"]
1111
// used to set stl and location of libgpg.a
@@ -38,8 +38,8 @@ model {
3838
jni {
3939
dependencies {
4040
library "gpg" linkage "static"
41-
project ":cpufeatures" linkage "static"
42-
project ":native_app_glue" linkage "static"
41+
project ":Common/cpufeatures" linkage "static"
42+
project ":Common/native_app_glue" linkage "static"
4343
}
4444
source {
4545
srcDir 'src/main/jni'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Google Play game services IDs.
4+
Replace this file with the games-ids.xml downloaded from the Play Game Console.
5+
-->
6+
<resources>
7+
<string name="app_id">REPLACE_ME</string>
8+
</resources>
9+
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<resources>
22

33
<string name="app_name">ButtonClicker</string>
4-
<string name="app_id">REPLACE_ME</string>
54

65
</resources>

samples-android/CollectAllTheStarsNative/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Properties properties = new Properties()
44
properties.load(project.rootProject.file('local.properties').newDataInputStream())
55
def ndkDir = properties.getProperty('ndk.dir')
66

7-
def gpg_cpp_path = file(project(':gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
7+
def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
88

99
// stlport configuration ["c++_static", "c++_shared", "gnustl_static", "gnustl_shared"]
1010
// used to set stl and location of libgpg.a
@@ -39,8 +39,8 @@ model {
3939
jni {
4040
dependencies {
4141
library "gpg" linkage "static"
42-
project ":cpufeatures" linkage "static"
43-
project ":native_app_glue" linkage "static"
42+
project ":Common/cpufeatures" linkage "static"
43+
project ":Common/native_app_glue" linkage "static"
4444
}
4545
source {
4646
srcDir 'src/main/jni'
@@ -80,4 +80,4 @@ model {
8080
dependencies {
8181
compile 'com.android.support:support-v4:22.2.1'
8282
compile 'com.google.android.gms:play-services:8.3.0'
83-
}
83+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Google Play game services IDs.
4+
Save this file as res/values/games-ids.xml in your project.
5+
-->
6+
<resources>
7+
<string name="app_id">REPLACE_ME</string>
8+
</resources>
9+
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<resources>
22
<string name="app_name">CollectAllTheStarsNative</string>
3-
<string name="app_id">REPLACE_ME</string>
4-
</resources>
3+
</resources>

samples-android/Common/native_app_glue/build.gradle

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ model {
1111
}
1212

1313
android.ndk {
14+
abiFilters.addAll(["armeabi", "armeabi-v7a", "x86", "arm64-v8a"])
1415
moduleName = "native_app_glue"
1516
}
16-
17+
1718
android.sources {
1819
main {
1920
jni {
@@ -27,3 +28,57 @@ model {
2728
}
2829
}
2930
}
31+
32+
/*
33+
We are building a static library, so disable all the shared library tasks.
34+
*/
35+
tasks.whenTaskAdded { task ->
36+
if (task.name == 'linkArmeabi-v7aDebugNative_app_glueSharedLibrary') {
37+
task.enabled = false
38+
}
39+
else if (task.name == 'linkArm64-v8aDebugNative_app_glueSharedLibrary') {
40+
task.enabled = false
41+
}
42+
else if (task.name == 'linkArmeabiDebugNative_app_glueSharedLibrary') {
43+
task.enabled = false
44+
}
45+
else if (task.name == 'linkX86DebugNative_app_glueSharedLibrary') {
46+
task.enabled = false
47+
}
48+
else if (task.name == 'stripSymbolsArmeabi-v7aDebugNative_app_glueSharedLibrary') {
49+
task.enabled = false
50+
}
51+
else if (task.name == 'stripSymbolsArm64-v8aDebugNative_app_glueSharedLibrary') {
52+
task.enabled = false
53+
}
54+
else if (task.name == 'stripSymbolsArmeabiDebugNative_app_glueSharedLibrary') {
55+
task.enabled = false
56+
}
57+
else if (task.name == 'stripSymbolsX86DebugNative_app_glueSharedLibrary') {
58+
task.enabled = false
59+
}
60+
else if (task.name == 'linkArm64-v8aReleaseNative_app_glueSharedLibrary') {
61+
task.enabled = false
62+
}
63+
else if (task.name == 'stripSymbolsArm64-v8aReleaseNative_app_glueSharedLibrary') {
64+
task.enabled = false
65+
}
66+
else if (task.name == 'linkArmeabi-v7aReleaseNative_app_glueSharedLibrary') {
67+
task.enabled = false
68+
}
69+
else if (task.name == 'stripSymbolsArmeabi-v7aReleaseNative_app_glueSharedLibrary') {
70+
task.enabled = false
71+
}
72+
else if (task.name == 'linkArmeabiReleaseNative_app_glueSharedLibrary') {
73+
task.enabled = false
74+
}
75+
else if (task.name == 'stripSymbolsArmeabiReleaseNative_app_glueSharedLibrary') {
76+
task.enabled = false
77+
}
78+
else if (task.name == 'linkX86ReleaseNative_app_glueSharedLibrary') {
79+
task.enabled = false
80+
}
81+
else if (task.name == 'stripSymbolsX86ReleaseNative_app_glueSharedLibrary') {
82+
task.enabled = false
83+
}
84+
}

samples-android/Minimalist/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Properties properties = new Properties()
44
properties.load(project.rootProject.file('local.properties').newDataInputStream())
55
def ndkDir = properties.getProperty('ndk.dir')
66

7-
def gpg_cpp_path = file(project(':gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
7+
def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
88

99
// stlport configuration ["c++_static", "c++_shared", "gnustl_static", "gnustl_shared"]
1010
// used to set stl and location of libgpg.a
@@ -40,7 +40,7 @@ model {
4040
jni {
4141
dependencies {
4242
library "gpg" linkage "static"
43-
project ":native_app_glue" linkage "static"
43+
project ":Common/native_app_glue" linkage "static"
4444
}
4545
source {
4646
srcDir 'src/main/jni'

samples-android/TbmpSkeletonNative/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Properties properties = new Properties()
44
properties.load(project.rootProject.file('local.properties').newDataInputStream())
55
def ndkDir = properties.getProperty('ndk.dir')
66

7-
def gpg_cpp_path = file(project(':gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
7+
def gpg_cpp_path = file(project(':Common/gpg-sdk').projectDir).absolutePath + "/gpg-cpp-sdk/android"
88

99
// stlport configuration ["c++_static", "c++_shared", "gnustl_static", "gnustl_shared"]
1010
// used to set stl and location of libgpg.a
@@ -42,8 +42,8 @@ model {
4242
jni {
4343
dependencies {
4444
library "gpg" linkage "static"
45-
project ":cpufeatures" linkage "static"
46-
project ":native_app_glue" linkage "static"
45+
project ":Common/cpufeatures" linkage "static"
46+
project ":Common/native_app_glue" linkage "static"
4747
}
4848
source {
4949
srcDir 'src/main/jni'
@@ -84,4 +84,4 @@ model {
8484
dependencies {
8585
compile 'com.android.support:support-v4:22.2.1'
8686
compile 'com.google.android.gms:play-services:8.3.0'
87-
}
87+
}

0 commit comments

Comments
 (0)