@@ -38,6 +38,7 @@ pluginManagement {
3838 .removeSuffix(" /gradle-conventions-settings" )
3939 .removeSuffix(" /compiler-plugin" )
4040 .removeSuffix(" /gradle-plugin" )
41+ .removeSuffix(" /dokka-plugin" )
4142 )
4243 val localFile = File (propertiesDir, " local.properties" )
4344 if (localFile.exists()) {
@@ -100,94 +101,99 @@ pluginManagement {
100101 }
101102}
102103
103- gradle.rootProject {
104- fun findGlobalRootDirPath (): java.nio.file.Path {
105- var path = file(" ." ).toPath().toAbsolutePath()
104+ fun findGlobalRootDirPath (): java.nio.file.Path {
105+ var path = file(" ." ).toPath().toAbsolutePath()
106106
107- // we assume that the 'versions-root' folder can only be present in the root folder
108- while (
109- java.nio.file.Files .newDirectoryStream(path).use { it.toList() }.none {
110- java.nio.file.Files .isDirectory(it) && it.fileName.toString() == " versions-root"
111- }
112- ) {
113- path = path.parent ? : error(" Unable to find root path for kotlinx.rpc project" )
107+ // we assume that the 'versions-root' folder can only be present in the root folder
108+ while (
109+ java.nio.file.Files .newDirectoryStream(path).use { it.toList() }.none {
110+ java.nio.file.Files .isDirectory(it) && it.fileName.toString() == " versions-root"
114111 }
115-
116- return path
112+ ) {
113+ path = path.parent ? : error( " Unable to find root path for kotlinx.rpc project " )
117114 }
118115
119- fun logAbsentProperty ( name : String ): Nothing? {
120- logger.info( " Property ' $name ' is not present for repository credentials. " )
116+ return path
117+ }
121118
122- return null
123- }
119+ fun logAbsentProperty ( name : String ): Nothing? {
120+ logger.info( " Property ' $name ' is not present for repository credentials. " )
124121
125- fun getEnv (propertyName : String ): String? = System .getenv(
126- propertyName.replace(" ." , " _" ).uppercase()
127- )?.ifEmpty { null }
122+ return null
123+ }
128124
129- fun getLocalProperties (): java.util.Properties {
130- return java.util.Properties ().apply {
131- val propertiesDir = File (
132- rootDir.path
133- .removeSuffix(" /gradle-conventions" )
134- .removeSuffix(" /gradle-conventions-settings" )
135- .removeSuffix(" /compiler-plugin" )
136- .removeSuffix(" /gradle-plugin" )
137- )
138- val localFile = File (propertiesDir, " local.properties" )
139- if (localFile.exists()) {
140- localFile.inputStream().use { load(it) }
141- }
125+ fun getEnv (propertyName : String ): String? = System .getenv(
126+ propertyName.replace(" ." , " _" ).uppercase()
127+ )?.ifEmpty { null }
128+
129+ fun getLocalProperties (): java.util.Properties {
130+ return java.util.Properties ().apply {
131+ val propertiesDir = File (
132+ rootDir.path
133+ .removeSuffix(" /gradle-conventions" )
134+ .removeSuffix(" /gradle-conventions-settings" )
135+ .removeSuffix(" /compiler-plugin" )
136+ .removeSuffix(" /gradle-plugin" )
137+ .removeSuffix(" /dokka-plugin" )
138+ )
139+ val localFile = File (propertiesDir, " local.properties" )
140+ if (localFile.exists()) {
141+ localFile.inputStream().use { load(it) }
142142 }
143143 }
144+ }
144145
145- fun java.util.Properties.isUsingProxyRepositories (): Boolean {
146- val useProxyProperty = this [" kotlinx.rpc.useProxyRepositories" ] as String?
147- return useProxyProperty == null || useProxyProperty == " true"
148- }
146+ fun java.util.Properties.isUsingProxyRepositories (): Boolean {
147+ val useProxyProperty = this [" kotlinx.rpc.useProxyRepositories" ] as String?
148+ return useProxyProperty == null || useProxyProperty == " true"
149+ }
149150
150- fun getSpacePassword (): String? {
151- val password = " kotlinx.rpc.team.space.password"
152- return getLocalProperties()[password] as String?
153- ? : settings.providers.gradleProperty(password).orNull
154- ? : getEnv(password)
155- ? : logAbsentProperty(password)
156- }
151+ fun getSpacePassword (): String? {
152+ val password = " kotlinx.rpc.team.space.password"
153+ return getLocalProperties()[password] as String?
154+ ? : settings.providers.gradleProperty(password).orNull
155+ ? : getEnv(password)
156+ ? : logAbsentProperty(password)
157+ }
157158
158- /* *
159- * Creates a publishing repository targeting Space Packages on jetbrains.team.
160- *
161- * @param repoName the name of the Space Packages repository
162- */
163- fun RepositoryHandler.jbTeamPackages (repoName : String ) {
164- maven {
165- name = repoName.split(" -" ).joinToString(" " ) { it.replaceFirstChar { c -> c.titlecase() } }
166- url = uri(" https://packages.jetbrains.team/maven/p/krpc/$repoName " )
159+ /* *
160+ * Creates a publishing repository targeting Space Packages on jetbrains.team.
161+ *
162+ * @param repoName the name of the Space Packages repository
163+ */
164+ fun RepositoryHandler.jbTeamPackages (repoName : String ) {
165+ maven {
166+ name = repoName.split(" -" ).joinToString(" " ) { it.replaceFirstChar { c -> c.titlecase() } }
167+ url = uri(" https://packages.jetbrains.team/maven/p/krpc/$repoName " )
167168
168- val spacePassword = getSpacePassword()
169+ val spacePassword = getSpacePassword()
169170
170- if (spacePassword != null ) {
171- credentials(HttpHeaderCredentials ::class .java) {
172- name = " Authorization"
173- value = " Bearer $spacePassword "
174- }
171+ if (spacePassword != null ) {
172+ credentials(HttpHeaderCredentials ::class .java) {
173+ name = " Authorization"
174+ value = " Bearer $spacePassword "
175+ }
175176
176- authentication {
177- create<HttpHeaderAuthentication >(" http_auth_header" )
178- }
179- } else {
180- logger.info(" Skipping adding credentials for Space repository '$repoName '" )
177+ authentication {
178+ create<HttpHeaderAuthentication >(" http_auth_header" )
181179 }
180+ } else {
181+ logger.info(" Skipping adding credentials for Space repository '$repoName '" )
182182 }
183183 }
184+ }
184185
185- fun RepositoryHandler.buildDeps () = jbTeamPackages(repoName = " build-deps" )
186- fun RepositoryHandler.buildDepsEap () = jbTeamPackages(repoName = " build-deps-eap" )
186+ fun RepositoryHandler.buildDeps () = jbTeamPackages(repoName = " build-deps" )
187+ fun RepositoryHandler.buildDepsEap () = jbTeamPackages(repoName = " build-deps-eap" )
187188
188- allprojects {
189- val localProps = getLocalProperties()
189+ val localProps = getLocalProperties()
190+
191+ settings.extra[" spacePassword" ] = getSpacePassword()
192+ settings.extra[" localProperties" ] = localProps
193+ settings.extra[" useProxyRepositories" ] = localProps.isUsingProxyRepositories()
190194
195+ gradle.rootProject {
196+ allprojects {
191197 this .extra[" spacePassword" ] = getSpacePassword()
192198 this .extra[" localProperties" ] = localProps
193199 this .extra[" useProxyRepositories" ] = localProps.isUsingProxyRepositories()
0 commit comments