File tree Expand file tree Collapse file tree 2 files changed +9
-19
lines changed
src/commonMain/kotlin/com/algolia/search/configuration Expand file tree Collapse file tree 2 files changed +9
-19
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ plugins {
77 id(" kotlinx-serialization" ) version " 1.3.31"
88 id(" maven-publish" )
99 id(" com.jfrog.bintray" ) version " 1.8.4"
10+ id(" com.github.kukuhyoniatmoko.buildconfigkotlin" ) version " 1.0.5"
1011}
1112
1213version = Library .version
@@ -19,6 +20,12 @@ repositories {
1920 maven { url = URI (" https://kotlin.bintray.com/kotlinx" ) }
2021}
2122
23+ buildConfigKotlin {
24+ sourceSet(" metadata" ) {
25+ buildConfig(name = " version" , value = Library .version)
26+ }
27+ }
28+
2229kotlin {
2330 jvm {
2431 compilations.all {
@@ -142,24 +149,7 @@ bintray {
142149 }
143150}
144151
145- val generate by tasks.registering {
146- val directory = File (" build/generated" ).apply {
147- if (! exists()) mkdir()
148- }
149- val file = File (" ${directory.path} /Library.kt" ).apply {
150- if (! exists()) createNewFile()
151- }
152-
153- file.bufferedWriter().use {
154- it.write(" package com.algolia.search.build\n\n " )
155- it.write(" object Library {\n\n " )
156- it.write(" \t val version: String = \" ${Library .version} \"\n " )
157- it.write(" }" )
158- }
159- }
160-
161152tasks {
162- this [" assemble" ].dependsOn(generate)
163153 val bintrayUpload by getting(BintrayUploadTask ::class ) {
164154 dependsOn(publishToMavenLocal)
165155 doFirst {
Original file line number Diff line number Diff line change 11package com.algolia.search.configuration
22
3- import com.algolia.search.build.Library
3+ import BuildConfig
44import com.algolia.search.model.response.ResponseABTest
55import com.algolia.search.model.response.ResponseBatches
66import com.algolia.search.model.response.creation.CreationAPIKey
@@ -42,7 +42,7 @@ internal fun HttpClientConfig<*>.configure(configuration: Configuration) {
4242 logger = Logger .SIMPLE
4343 }
4444 install(UserAgent ) {
45- this .agent = " Algolia for Kotlin (${Library .version} )"
45+ this .agent = " Algolia for Kotlin (${BuildConfig .version} )"
4646 }
4747 configuration.defaultHeaders?.let {
4848 install(DefaultRequest ) {
You can’t perform that action at this time.
0 commit comments