@@ -28,11 +28,12 @@ import java.nio.file.Paths
2828import java.nio.file.StandardCopyOption
2929import java.security.MessageDigest
3030import org.gradle.internal.logging.text.StyledTextOutputFactory
31+ import static org.gradle.internal.logging.text.StyledTextOutput.Style
3132
3233apply plugin : " com.android.application"
3334apply from : " gradle-helpers/BuildToolTask.gradle"
35+ apply from : " gradle-helpers/CustomExecutionLogger.gradle"
3436def outLogger = services. get(StyledTextOutputFactory ). create(" colouredOutputLogger" )
35- gradle. useLogger(new BuildAdapter ())
3637
3738def enableKotlin = (project. hasProperty(" useKotlin" ) && project. useKotlin == " true" )
3839
@@ -43,7 +44,7 @@ if (enableKotlin) {
4344
4445def onlyX86 = project. hasProperty(" onlyX86" )
4546if (onlyX86) {
46- println " OnlyX86 build triggered."
47+ outLogger . withStyle( Style.Info ) . println " OnlyX86 build triggered."
4748}
4849
4950// common
@@ -150,15 +151,15 @@ version of the {N} CLI install a previous version of the runtime package - 'tns
150151 def pathToBuildScriptGradle = " $absolutePathToAppResources /Android/buildscript.gradle"
151152 def buildScriptGradle = file(pathToBuildScriptGradle)
152153 if (buildScriptGradle. exists()) {
153- println " \t + applying user-defined buildscript from ${ buildScriptGradle} "
154+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + applying user-defined buildscript from ${ buildScriptGradle} "
154155 apply from : pathToBuildScriptGradle, to : buildscript
155156 }
156157
157158 nativescriptDependencies. each { dep ->
158159 def pathToPluginBuildScriptGradle = " $rootDir /${ dep.directory} /$PLATFORMS_ANDROID /buildscript.gradle"
159160 def pluginBuildScriptGradle = file(pathToPluginBuildScriptGradle)
160161 if (pluginBuildScriptGradle. exists()) {
161- println " \t + applying user-defined buildscript from dependency ${ pluginBuildScriptGradle} "
162+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + applying user-defined buildscript from dependency ${ pluginBuildScriptGradle} "
162163 apply from : pathToPluginBuildScriptGradle, to : buildscript
163164 }
164165 }
@@ -176,7 +177,7 @@ def applyBeforePluginGradleConfiguration = { ->
176177 def pathToBeforePluginGradle = " $appResourcesPath /Android/before-plugins.gradle"
177178 def beforePluginGradle = file(pathToBeforePluginGradle)
178179 if (beforePluginGradle. exists()) {
179- println " \t + applying user-defined configuration from ${ beforePluginGradle} "
180+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + applying user-defined configuration from ${ beforePluginGradle} "
180181 apply from : pathToBeforePluginGradle
181182 }
182183}
@@ -186,10 +187,10 @@ def applyAppGradleConfiguration = { ->
186187 def pathToAppGradle = " $appResourcesPath /Android/app.gradle"
187188 def appGradle = file(pathToAppGradle)
188189 if (appGradle. exists()) {
189- println " \t + applying user-defined configuration from ${ appGradle} "
190+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + applying user-defined configuration from ${ appGradle} "
190191 apply from : pathToAppGradle
191192 } else {
192- println " \t + couldn't load user-defined configuration from ${ appGradle} . File doesn't exist."
193+ outLogger . withStyle( Style.Info ) . println " \t + couldn't load user-defined configuration from ${ appGradle} . File doesn't exist."
193194 }
194195}
195196
@@ -215,7 +216,7 @@ def getAppIdentifier = { packageJsonMap ->
215216}
216217
217218def setAppIdentifier = { ->
218- println " \t + setting applicationId"
219+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + setting applicationId"
219220 File packageJsonFile = new File (" $USER_PROJECT_ROOT /$PACKAGE_JSON " )
220221
221222 if (packageJsonFile. exists()) {
@@ -343,7 +344,7 @@ dependencies {
343344 androidXMaterialVersion = androidXMaterial
344345 }
345346
346- println " \t + using android X library androidx.legacy:legacy-support-v4:$androidXLegacyVersion "
347+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + using android X library androidx.legacy:legacy-support-v4:$androidXLegacyVersion "
347348
348349 implementation " androidx.multidex:multidex:2.0.1"
349350 implementation " androidx.legacy:legacy-support-v4:$androidXLegacyVersion "
@@ -378,7 +379,7 @@ dependencies {
378379 runtime = " nativescript-regular"
379380 }
380381
381- println " \t + adding nativescript runtime package dependency: $runtime "
382+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + adding nativescript runtime package dependency: $runtime "
382383 project. dependencies. add(" implementation" , [name : runtime, ext : " aar" ])
383384 } else {
384385 implementation project(' :runtime' )
@@ -401,14 +402,14 @@ task addDependenciesFromNativeScriptPlugins {
401402 aarFiles. each { aarFile ->
402403 def length = aarFile. name. length() - 4
403404 def fileName = aarFile. name[0 .. < length]
404- println " \t + adding aar plugin dependency: " + aarFile. getAbsolutePath()
405+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + adding aar plugin dependency: " + aarFile. getAbsolutePath()
405406 project. dependencies. add(" implementation" , [name : fileName, ext : " aar" ])
406407 }
407408
408409 def jarFiles = fileTree(dir : file(" $rootDir /${ dep.directory} /$PLATFORMS_ANDROID " ), include : [" **/*.jar" ])
409410 jarFiles. each { jarFile ->
410411 def jarFileAbsolutePath = jarFile. getAbsolutePath()
411- println " \t + adding jar plugin dependency: $jarFileAbsolutePath "
412+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + adding jar plugin dependency: $jarFileAbsolutePath "
412413 pluginsJarLibraries. add(jarFile. getAbsolutePath())
413414 }
414415
@@ -424,14 +425,14 @@ task addDependenciesFromAppResourcesLibraries {
424425 aarFiles. each { aarFile ->
425426 def length = aarFile. name. length() - 4
426427 def fileName = aarFile. name[0 .. < length]
427- println " \t + adding aar library dependency: " + aarFile. getAbsolutePath()
428+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + adding aar library dependency: " + aarFile. getAbsolutePath()
428429 project. dependencies. add(" implementation" , [name : fileName, ext : " aar" ])
429430 }
430431
431432 def jarFiles = fileTree(dir : appResourcesLibraries, include : [" **/*.jar" ])
432433 jarFiles. each { jarFile ->
433434 def jarFileAbsolutePath = jarFile. getAbsolutePath()
434- println " \t + adding jar plugin dependency: $jarFileAbsolutePath "
435+ outLogger . withStyle( Style.SuccessHeader ) . println " \t + adding jar plugin dependency: $jarFileAbsolutePath "
435436 pluginsJarLibraries. add(jarFile. getAbsolutePath())
436437 }
437438
@@ -582,7 +583,7 @@ afterEvaluate { project ->
582583 }
583584 }
584585 } else {
585- println " WARNING: Folder ${ jarDir.path} does not exists, the dependent project's classes won't be included in the metadata"
586+ outLogger . withStyle( Style.Info ) . println " WARNING: Folder ${ jarDir.path} does not exists, the dependent project's classes won't be included in the metadata"
586587 }
587588 }
588589 }
@@ -792,7 +793,7 @@ task generateTypescriptDefinitions(type: BuildToolTask) {
792793 new File (" $TYPINGS_PATH " ). mkdirs()
793794
794795 logger. info(" Task generateTypescriptDefinitions: Call dts-generator.jar with arguments: " + paramz. toString(). replaceAll(' ,' , ' ' ))
795- println " Task generateTypescriptDefinitions: Call dts-generator.jar with arguments: " + paramz. toString(). replaceAll(' ,' , ' ' )
796+ outLogger . withStyle( Style.SuccessHeader ) . println " Task generateTypescriptDefinitions: Call dts-generator.jar with arguments: " + paramz. toString(). replaceAll(' ,' , ' ' )
796797
797798 setOutputs outLogger
798799
@@ -818,7 +819,7 @@ static def shouldIncludeDirForTypings(path, includeDirs) {
818819
819820task copyTypings {
820821 doLast {
821- println " Copied generated typings to application root level. Make sure to import android.d.ts in reference.d.ts"
822+ outLogger . withStyle( Style.Info ) . println " Copied generated typings to application root level. Make sure to import android.d.ts in reference.d.ts"
822823
823824 copy {
824825 from " $TYPINGS_PATH "
0 commit comments