@@ -10,12 +10,13 @@ plugins {
1010 alias(libs.plugins.detekt)
1111 alias(libs.plugins.dokka)
1212 alias(libs.plugins.kover)
13+ alias(libs.plugins.maven.publish)
1314 alias(libs.plugins.sqldelight)
14- id(" maven-publish" )
1515 id(" signing" )
1616}
1717
1818val defaultGroupId = " cz.sazel.sqldelight"
19+ val nameStr = " node-sqlite3-driver"
1920val versionBase = " 0.5.0"
2021
2122val localProperties = Properties ().apply {
@@ -99,7 +100,7 @@ kotlin {
99100 publicationsFromMainHost = listOf (js()).map { it.name } + " kotlinMultiplatform"
100101
101102 dokka {
102- moduleName = " node-sqlite3-driver "
103+ moduleName = nameStr
103104 moduleVersion = versionStr
104105
105106 dokkaSourceSets {
@@ -119,47 +120,7 @@ val javadocJar = tasks.register<Jar>("javadocJar") {
119120 from(layout.buildDirectory.dir(" dokka/html" ))
120121}
121122
122- publishing {
123- publications {
124- matching { it.name in publicationsFromMainHost }.all {
125- val targetPublication = this @all
126- tasks.withType<AbstractPublishToMaven >().matching { it.publication == targetPublication }
127- .configureEach { onlyIf { findProperty(" isMainHost" ) == " true" } }
128- }
129-
130-
131- withType<MavenPublication > {
132- artifact(javadocJar)
133-
134- pom {
135- name.set(" node-sqlite3-driver" )
136- description.set(" Driver for the library SQLDelight that supports sqlite3 Node.js module" )
137- licenses {
138- license {
139- name.set(" Apache-2.0" )
140- url.set(" https://opensource.org/licenses/Apache-2.0" )
141- }
142- }
143- url.set(" https://github.com/wojta/sqldelight-node-sqlite3-driver" )
144- issueManagement {
145- system.set(" Github" )
146- url.set(" https://github.com/wojta/sqldelight-node-sqlite3-driver/issues" )
147- }
148- scm {
149- connection.set(" https://github.com/wojta/sqldelight-node-sqlite3-driver.git" )
150- url.set(" https://github.com/wojta/sqldelight-node-sqlite3-driver" )
151- }
152- developers {
153- developer {
154- name.set(" Vojtěch Sázel" )
155- email.set(" sqldelight@sazel.cz" )
156- }
157- }
158- }
159- }
160-
161- }
162-
123+ mavenPublishing {
163124 repositories {
164125 val githubUserName = System .getenv(" GITHUB_USER" ) ? : localProperties[" github.user" ] as String?
165126 if (githubUserName != null ) { // Github packages repo
@@ -174,30 +135,55 @@ publishing {
174135 }
175136 }
176137 }
177- maven { // OSS Sonatype (default)
178- val isSnapshot = version.toString().endsWith(" SNAPSHOT" )
179- val destination = if (! isSnapshot) {
180- " https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
181- } else " https://central.sonatype.com/repository/maven-snapshots/"
182- url = uri(destination)
138+ mavenCentral {
183139 credentials {
184140 username = System .getenv(" SONATYPE_USER" ) ? : localProperties[" sonatype.user" ] as String?
185141 password = System .getenv(" SONATYPE_PASSWORD" ) ? : localProperties[" sonatype.password" ] as String?
186142 }
187143 }
188144 mavenLocal()
189145 }
190- }
146+ coordinates(group.toString(), nameStr, versionStr)
147+
148+ signing {
149+ useInMemoryPgpKeys(
150+ System .getenv(" GPG_KEY_SECRET" ) ? : localProperties[" gpg.keySecret" ] as String? ,
151+ System .getenv(" GPG_KEY_PASSWORD" ) ? : localProperties[" gpg.keyPassword" ] as String?
152+ )
153+ sign(publishing.publications)
154+ }
191155
192- signing {
193- useInMemoryPgpKeys(
194- System .getenv(" GPG_KEY_SECRET" ) ? : localProperties[" gpg.keySecret" ] as String? ,
195- System .getenv(" GPG_KEY_PASSWORD" ) ? : localProperties[" gpg.keyPassword" ] as String?
196- )
156+ // publish to Maven Central
157+ publishToMavenCentral()
197158
198- sign(publishing.publications)
159+ pom {
160+ name.set(" node-sqlite3-driver" )
161+ description.set(" Driver for the library SQLDelight that supports sqlite3 Node.js module" )
162+ licenses {
163+ license {
164+ name.set(" Apache-2.0" )
165+ url.set(" https://opensource.org/licenses/Apache-2.0" )
166+ }
167+ }
168+ url.set(" https://github.com/wojta/sqldelight-node-sqlite3-driver" )
169+ issueManagement {
170+ system.set(" Github" )
171+ url.set(" https://github.com/wojta/sqldelight-node-sqlite3-driver/issues" )
172+ }
173+ scm {
174+ connection.set(" https://github.com/wojta/sqldelight-node-sqlite3-driver.git" )
175+ url.set(" https://github.com/wojta/sqldelight-node-sqlite3-driver" )
176+ }
177+ developers {
178+ developer {
179+ name.set(" Vojtěch Sázel" )
180+ email.set(" sqldelight@sazel.cz" )
181+ }
182+ }
183+ }
199184}
200185
186+
201187// workaround for missing sqlite3 bindings
202188val bindingsInstall = tasks.register(" sqlite3BindingsInstall" ) {
203189 doFirst {
@@ -225,7 +211,7 @@ detekt {
225211 buildUponDefaultConfig = true // preconfigure defaults
226212 allRules = false // activate all available (even unstable) rules.
227213 config.setFrom(" $projectDir /gradle/detekt/detekt.yml" ) // point to your custom config defining rules to run, overwriting default behavior
228- // baseline = file("$projectDir/config/baseline.xml") // a way of suppressing issues before introducing detekt
214+ // baseline = file("$projectDir/config/baseline.xml") // a way of suppressing issues before introducing detekt
229215
230216 reports {
231217 html.required.set(true ) // observe findings in your browser with structure and code snippets
0 commit comments