/
build.gradle
122 lines (104 loc) · 2.71 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
buildscript {
repositories {
google()
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
apply plugin: 'maven'
apply plugin: 'com.android.library'
group 'com.google.games'
project.ext.baseName = "gpgs-plugin-support"
if (project.hasProperty("projVersion")) {
project.version = project.projVersion
} else {
project.version '0-SNAPSHOT'
}
if (project.hasProperty("uploadDir")) {
project.ext.uploadDir = project.uploadDir
} else {
project.ext.uploadDir = "${buildDir}/m2repository"
}
if (project.hasProperty("gpgSdkDir")) {
project.ext.gpgSdkDir = project.gpgSdkDir
} else {
project.ext.gpgSdkDir = "${projectDir}/gpg-cpp-sdk/android"
}
android {
lintOptions {
abortOnError true
warningsAsErrors true
}
defaultConfig {
versionName project.version
archivesBaseName = project.ext.baseName
minSdkVersion 14
ndk.abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -Wall -Werror"
arguments "-DGPG_SDK_PATH=${gpgSdkDir}",
"-DANDROID_STL=c++_static",
"-DANDROID_TOOLCHAIN=clang"
}
}
}
compileSdkVersion 27
externalNativeBuild {
cmake.path "CMakeLists.txt"
}
}
// Rename the .aar file to be .srcaar to work around
// // having the local repo in a subdirectory in a Unity project.
// // The jar resolver plugin handles the changing back from .srcaar
// // to .aar
// //
// // This is done in 2 parts, first declare the .srcaar as an
// // artifact, the second is a task to rename the aar -> srcaar.
//
artifacts {
archives file("build/${baseName}-${version}.srcaar")
}
task renameLibrary() {
doFirst {
copy {
from "${buildDir}/outputs/aar/${baseName}-release.aar"
into "${buildDir}"
rename {
String fn ->
return fn.replace("release.aar", "${version}.srcaar")
}
}
}
doLast {
configurations.archives.with {
artifacts.remove artifacts.find { it.extension == "aar"}
}
}
}
tasks.whenTaskAdded { task ->
if (task.name == 'assembleRelease')
renameLibrary.dependsOn task
}
uploadArchives {
dependsOn renameLibrary
repositories {
mavenDeployer {
repository(url: uri(project.ext.uploadDir))
}
}
}
dependencies {
implementation 'com.google.android.gms:play-services-games:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-nearby:16.0.0'
}