From 8dbfa61234aafe37621968c1596ca056a23e306a Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Tue, 31 Oct 2017 17:12:37 +0100 Subject: [PATCH] logic: minor gradle project setup fix --- bin/app/data/java/gradle/init.gradle | 64 +++++++++++++++----------- src/lib_java/utility/utilityGradle.cpp | 4 +- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/bin/app/data/java/gradle/init.gradle b/bin/app/data/java/gradle/init.gradle index cc698da0..e009897d 100644 --- a/bin/app/data/java/gradle/init.gradle +++ b/bin/app/data/java/gradle/init.gradle @@ -1,41 +1,53 @@ allprojects { pp -> - task printMainSrcDirs << { - if (project.hasProperty("sourceSets")) { - project.sourceSets.main.java.srcDirs.each { dir -> - println "${dir}" - } + task printMainSrcDirs { + doLast { + if (project.hasProperty("sourceSets")) { + if (project.sourceSets.hasProperty("main")) { + project.sourceSets.main.java.srcDirs.each { dir -> + println "${dir}" + } + } + } } } - task printTestSrcDirs << { - if (project.hasProperty("sourceSets")) { - project.sourceSets.test.java.srcDirs.each { dir -> - println "${dir}" + task printTestSrcDirs { + doLast { + if (project.hasProperty("sourceSets")) { + if (project.sourceSets.hasProperty("test")) { + project.sourceSets.test.java.srcDirs.each { dir -> + println "${dir}" + } + } } } } - task copyCompileLibs << { - File rootDir = pp.getRootDir() - String destination = project.hasProperty('sourcetrail_lib_path') ? project.property('sourcetrail_lib_path').replace("\"", "") : rootDir.getPath() + rootDir.separator + "lib" - println destination; - if (pp.configurations.hasProperty("compile")) { - copy { - into destination - from pp.configurations.compile - eachFile { println "copying file \"" + it.file.name + "\" to \"" + destination + "\"" } + task copyCompileLibs { + doLast { + File rootDir = pp.getRootDir() + String destination = project.hasProperty('sourcetrail_lib_path') ? project.property('sourcetrail_lib_path').replace("\"", "") : rootDir.getPath() + rootDir.separator + "lib" + println destination; + if (pp.configurations.hasProperty("compile")) { + copy { + into destination + from pp.configurations.compile + eachFile { println "copying file \"" + it.file.name + "\" to \"" + destination + "\"" } + } } } } - task copyTestCompileLibs << { - File rootDir = pp.getRootDir() - String destination = project.hasProperty('sourcetrail_lib_path') ? project.property('sourcetrail_lib_path') : rootDir.getPath() + rootDir.separator + "lib" - if (pp.configurations.hasProperty("testCompile")) { - copy { - into destination - from pp.configurations.testCompile - eachFile { println "copying file \"" + it.file.name + "\" to \"" + destination + "\"" } + task copyTestCompileLibs { + doLast { + File rootDir = pp.getRootDir() + String destination = project.hasProperty('sourcetrail_lib_path') ? project.property('sourcetrail_lib_path') : rootDir.getPath() + rootDir.separator + "lib" + if (pp.configurations.hasProperty("testCompile")) { + copy { + into destination + from pp.configurations.testCompile + eachFile { println "copying file \"" + it.file.name + "\" to \"" + destination + "\"" } + } } } } diff --git a/src/lib_java/utility/utilityGradle.cpp b/src/lib_java/utility/utilityGradle.cpp index 26e4bf9e..af621599 100644 --- a/src/lib_java/utility/utilityGradle.cpp +++ b/src/lib_java/utility/utilityGradle.cpp @@ -66,7 +66,7 @@ namespace utility { // TODO: move error handling to caller of this function const std::string dialogMessage = - "The following error occurred while executing a Maven command:\n\n" + utility::replace(output, "\r\n", "\n"); + "The following error occurred while executing a Gradle command:\n\n" + utility::replace(output, "\r\n", "\n"); MessageStatus(dialogMessage, true, false).dispatch(); Application::getInstance()->handleDialog(dialogMessage); @@ -88,7 +88,7 @@ namespace utility { // TODO: move error handling to caller of this function const std::string dialogMessage = - "The following error occurred while executing a Maven command:\n\n" + utility::replace(output, "\r\n", "\n"); + "The following error occurred while executing a Gradle command:\n\n" + utility::replace(output, "\r\n", "\n"); MessageStatus(dialogMessage, true, false).dispatch(); Application::getInstance()->handleDialog(dialogMessage);