-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdocs-version.gradle
36 lines (34 loc) · 1.18 KB
/
docs-version.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
/* Writes version to docs */
task update() << {
if(VERSION_NAME.contains("SNAPSHOT")) {
println("Current version is SNAPHOT.")
println("Don't update version in docs.")
return;
}
// Gradle JAVA
def compile = "compile 'se.snylt:witch:${VERSION_NAME}'";
def apt = "annotationProcessor 'se.snylt:witch-processor:${VERSION_NAME}'";
File outputFile = new File("./docs/_includes/snippets", "download-java.gradle");
if(outputFile.exists()) {
outputFile.delete();
}
outputFile.createNewFile();
FileWriter fileWriter = new FileWriter(outputFile, true);
fileWriter.write(compile);
fileWriter.write("\n");
fileWriter.write(apt);
fileWriter.close();
// Gradle KOTLIN
def kapt = "kapt 'se.snylt:witch-processor:${VERSION_NAME}'";
outputFile = new File("./docs/_includes/snippets", "download-kotlin.gradle");
if(outputFile.exists()) {
outputFile.delete();
}
outputFile.createNewFile();
fileWriter = new FileWriter(outputFile, true);
fileWriter.write(compile);
fileWriter.write("\n");
fileWriter.write(kapt);
fileWriter.close();
println("Updated version ${VERSION_NAME} in docs")
}