-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
87 lines (73 loc) · 2.37 KB
/
build.gradle
File metadata and controls
87 lines (73 loc) · 2.37 KB
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
import org.apache.commons.io.FileUtils
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.13.2'
if (file("${rootDir}/basic-sample/google-services.json").exists()) {
classpath 'com.google.gms:google-services:4.4.2'
classpath 'com.google.firebase:firebase-appdistribution-gradle:5.0.0'
}
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
def getZenIDVersion() {
try {
def output = new ByteArrayOutputStream()
def scriptPath = file("../../Scripts/get_zenid_version.ps1").absolutePath
def isWindows = System.getProperty('os.name').toLowerCase().contains('windows')
def isMacOs = System.getProperty('os.name').toLowerCase().contains('mac')
if (isWindows) {
exec {
commandLine 'powershell', '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', scriptPath
standardOutput = output
}
} else {
exec {
commandLine 'pwsh', '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', scriptPath
standardOutput = output
}
}
def versionFound = output.toString().trim()
if (versionFound.isEmpty()) {
throw new GradleException("Version not found in PowerShell script output.")
}
return versionFound
} catch (GradleException e) {
"1.0"
}
}
def copyZenIdSDKArtifacts() {
def destDir = new File("${project.rootDir}/libs/")
println "Delete libs dir: ${destDir.deleteDir()}"
def srcDir = new File("${project.rootDir.parent}/android/Zenid_Android_XXX/artifacts/zenid_sdk")
FileUtils.copyDirectory(srcDir, destDir)
def olModels = new File(destDir, "sdk-core-models-ol-release.aar")
def iqsHologram = new File(destDir, "sdk-iqs-hologram-release.aar")
if (olModels.exists()) {
olModels.delete()
}
if (iqsHologram.exists()) {
iqsHologram.delete()
}
}
subprojects {
version = getZenIDVersion()
}
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
tasks.register('copyZenIdSDKArtifacts') {
group = 'zenid'
doLast {
copyZenIdSDKArtifacts()
}
}