forked from openremote/openremote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
47 lines (42 loc) · 1.74 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
import java.nio.file.Paths
import static org.apache.tools.ant.taskdefs.condition.Os.FAMILY_WINDOWS
import static org.apache.tools.ant.taskdefs.condition.Os.isFamily
allprojects {
apply from: "${findProject(":openremote") != null ? project(":openremote").projectDir : rootDir}/project.gradle"
}
// Uncomment the following to configure files to be encrypted/decrypted
// Each file must be explicitly added to .gitignore otherwise git commit will fail
// When using encryption the the GFE_PASSWORD environment variable must be set or the build will fail
// use ./gradlew encryptFiles to encrypt files
apply plugin: "com.cherryperry.gradle-file-encrypt"
gradleFileEncrypt {
// files to encrypt
plainFiles.from("deployment/manager/fcm.json")
// (optional) setup file mapping to store all encrypted files in one place for example
//mapping = [ 'deployment/mySensitiveFile' : 'secrets/mySensitiveFile' ]
// Use custom password provider as standard env mechanism doesn't seem to work
passwordProvider = {
def password = System.env.GFE_PASSWORD
return password != null ? password.toCharArray() : ''.toCharArray()
}
}
task checkFilesGitIgnoredNew(type: Exec) {
// The provided checkFilesGitIgnored task doesn't work on Windows so here's one that does
def args = []
if (isFamily(FAMILY_WINDOWS)) {
args.add("cmd")
args.add("/c")
}
args.add("git")
args.add("check-ignore")
args.add("-q")
args.addAll(project.getProperties().get("gradleFileEncrypt").plainFiles)
commandLine args
}
// openremote .git dir doesn't exist when used as a submodule
checkFilesGitIgnoredNew.enabled = Paths.get(projectDir.path, ".git").toFile().exists()
task clean() {
doLast {
delete "tmp"
}
}