@@ -7,7 +7,71 @@ apply plugin: 'com.android.library'
77apply plugin : ' kotlin-android'
88apply plugin : ' kotlin-parcelize'
99
10+ def loadPropertyFile = { path ->
11+ try {
12+ if (project. hasProperty(" loadedProperties_${ path} " )) {
13+ logger. info " \t + gradle properties already loaded. SKIPPING"
14+ } else {
15+ logger. info " \t + trying to load gradle properties from \" $path \" "
16+
17+ Properties properties = new Properties ()
18+ properties. load(new FileInputStream (" $path " ))
19+ properties. each { prop ->
20+ logger. info " \t + [$path ] setting ${ prop.key} = ${ prop.value} "
21+ project. ext. set(prop. key, prop. value)
22+ }
23+ project. ext. set(" loadedProperties_${ path} " , true )
24+
25+ outLogger. withStyle(Style.SuccessHeader ). println " \t + loaded gradle properties from \" $path \" "
26+ }
27+ } catch (Exception ex) {
28+ logger. warn " \t + failed to load gradle properties from \" $path \" . Error is: ${ ex.getMessage()} "
29+ }
30+ }
31+
1032buildscript {
33+ def GRADLE_PROPERTIES_FILENAME = " gradle.properties"
34+
35+ def getFile = { dir , filename ->
36+ File file = new File (" $dir $File . separator $filename " )
37+ file?. exists() ? file : null
38+ }
39+
40+ def getPropertyFile = { dir ->
41+ return getFile(dir, GRADLE_PROPERTIES_FILENAME )
42+ }
43+ def getUserProperties = { dir ->
44+ def file = getPropertyFile(dir)
45+ if (! file) {
46+ return null
47+ }
48+
49+ Properties properties = new Properties ()
50+ properties. load(file. newInputStream())
51+
52+ return properties
53+ }
54+ def loadPropertyFile = { path ->
55+ try {
56+ if (project. hasProperty(" loadedProperties_${ path} " )) {
57+ logger. info " \t + gradle properties already loaded. SKIPPING"
58+ } else {
59+ logger. info " \t + trying to load gradle properties from \" $path \" "
60+
61+ Properties properties = new Properties ()
62+ properties. load(new FileInputStream (" $path " ))
63+ properties. each { prop ->
64+ logger. info " \t + [$path ] setting ${ prop.key} = ${ prop.value} "
65+ project. ext. set(prop. key, prop. value)
66+ }
67+ project. ext. set(" loadedProperties_${ path} " , true )
68+
69+ outLogger. withStyle(Style.SuccessHeader ). println " \t + loaded gradle properties from \" $path \" "
70+ }
71+ } catch (Exception ex) {
72+ logger. warn " \t + failed to load gradle properties from \" $path \" . Error is: ${ ex.getMessage()} "
73+ }
74+ }
1175 def initialize = { ->
1276 // set up our logger
1377 project. ext. outLogger = services. get(StyledTextOutputFactory ). create(" colouredOutputLogger" )
@@ -19,8 +83,6 @@ buildscript {
1983 project. ext. PLUGIN_NAME = " {{pluginName}}"
2084
2185 def userDir = " $USER_PROJECT_ROOT "
22- apply from : " $USER_PROJECT_ROOT /${ project.ext.PLATFORMS_ANDROID} /gradle-helpers/user_properties_reader.gradle"
23- apply from : " $USER_PROJECT_ROOT /${ project.ext.PLATFORMS_ANDROID} /gradle-helpers/paths.gradle"
2486 rootProject. ext. userDefinedGradleProperties = getUserProperties(" ${ getAppResourcesPath(USER_PROJECT_ROOT)} /Android" )
2587
2688 loadPropertyFile(" $USER_PROJECT_ROOT /${ project.ext.PLATFORMS_ANDROID} /gradle.properties" )
0 commit comments