Skip to content

Commit af2eebf

Browse files
committed
Fix crash on first build when gradle.properties is empty
1 parent 9575de2 commit af2eebf

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,3 @@ allprojects {
1313
mavenCentral()
1414
}
1515
}
16-
17-
def generateIfEmpty = { projectPath ->
18-
def properties = new File(projectPath, "gradle.properties")
19-
if(!properties.exists()) {
20-
properties << new File(properties.getAbsolutePath() + ".example").readBytes()
21-
}
22-
}
23-
generateIfEmpty('./StudyplusAndroidSDK')
24-
generateIfEmpty('./SDKExample')

settings.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
11
include ':StudyplusAndroidSDK', ':SDKExample'
2+
3+
def setupDefaultProperties = { project ->
4+
String dir = project.projectDir.absolutePath
5+
def properties = new File(dir, "gradle.properties")
6+
def example = new File(properties.getAbsolutePath() + ".example")
7+
def notFound = !properties.exists() && example.exists()
8+
if (notFound){
9+
properties << example.readBytes()
10+
}
11+
}
12+
[':StudyplusAndroidSDK', ':SDKExample'].each{
13+
setupDefaultProperties project(it)
14+
}

0 commit comments

Comments
 (0)