aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--app/build.gradle2
-rw-r--r--nonnull.gradle (renamed from app/nonnull.gradle)21
-rw-r--r--tunnel/build.gradle1
3 files changed, 12 insertions, 12 deletions
diff --git a/app/build.gradle b/app/build.gradle
index a21c202..e4caeb6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,6 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
-apply from: 'nonnull.gradle'
+apply from: rootProject.file('nonnull.gradle')
// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
diff --git a/app/nonnull.gradle b/nonnull.gradle
index a10c10d..7fc9b25 100644
--- a/app/nonnull.gradle
+++ b/nonnull.gradle
@@ -26,18 +26,18 @@ task generateNonNullJavaFiles(dependsOn: "assembleDebug", type: Copy) {
"androidTest" + File.separatorChar + "java" + File.separatorChar +
basePackage )
- generateInfoFiles(sourceDir, mainSrcPhrase);
+ generateInfoFiles(sourceDir, mainSrcPhrase)
sourceDir.eachDirRecurse { dir ->
generateInfoFiles(dir, mainSrcPhrase)
}
if (file(testSourceDir).exists()) {
- generateInfoFiles(testSourceDir, mainTestSrcPhrase);
+ generateInfoFiles(testSourceDir, mainTestSrcPhrase)
testSourceDir.eachDirRecurse { dir ->
generateInfoFiles(dir, mainTestSrcPhrase)
}
}
if (file(androidTestSourceDir).exists()) {
- generateInfoFiles(androidTestSourceDir, mainAndroidTestSrcPhrase);
+ generateInfoFiles(androidTestSourceDir, mainAndroidTestSrcPhrase)
androidTestSourceDir.eachDirRecurse { dir ->
generateInfoFiles(dir, mainAndroidTestSrcPhrase)
}
@@ -46,20 +46,20 @@ task generateNonNullJavaFiles(dependsOn: "assembleDebug", type: Copy) {
}
private void generateInfoFiles(File dir, String mainSrcPhrase) {
- def infoFileContentHeader = getFileContentHeader();
- def infoFileContentFooter = getFileContentFooter();
+ def infoFileContentHeader = getFileContentHeader()
+ def infoFileContentFooter = getFileContentFooter()
def infoFilePath = dir.getAbsolutePath() + File.separatorChar + "package-info.java"
//file(infoFilePath).delete(); //do not use in production code
if (!file(infoFilePath).exists()) {
- def infoFileContentPackage = getFileContentPackage(dir.getAbsolutePath(), mainSrcPhrase);
+ def infoFileContentPackage = getFileContentPackage(dir.getAbsolutePath(), mainSrcPhrase)
new File(infoFilePath).write(infoFileContentHeader +
infoFileContentPackage + infoFileContentFooter)
- println "[dir] " + infoFilePath + " created";
+ println "[dir] " + infoFilePath + " created"
}
}
-def getFileContentPackage(String path, String mainSrcPhrase) {
+static def getFileContentPackage(String path, String mainSrcPhrase) {
def mainSrcPhraseIndex = path.indexOf(mainSrcPhrase)
def output = path.substring(mainSrcPhraseIndex)
@@ -73,15 +73,14 @@ def getFileContentPackage(String path, String mainSrcPhrase) {
"/", ".") + ";\n"
}
-def getFileContentHeader() {
+static def getFileContentHeader() {
return "/**\n" +
" * Make all method parameters @NonNull by default.\n" +
" */\n" +
"@NonNullForAll\n"
}
-def getFileContentFooter() {
+static def getFileContentFooter() {
return "\n" +
"import com.wireguard.util.NonNullForAll;\n"
}
-
diff --git a/tunnel/build.gradle b/tunnel/build.gradle
index 65ac6ce..984382e 100644
--- a/tunnel/build.gradle
+++ b/tunnel/build.gradle
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
+apply from: rootProject.file('nonnull.gradle')
android {
buildToolsVersion '29.0.3'