Skip to content

Commit

Permalink
Simplify access to various extensions
Browse files Browse the repository at this point in the history
In Kotlin script files (`*.kts`), we can use extension methods that
various plugins add.  IntelliJ IDEA understands these too, so we still
get static-type-aware autocompletion and other nice IDE features.
  • Loading branch information
liblit committed Jul 31, 2024
1 parent 2cf2514 commit 96d2a96
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.ibm.wala.gradle

import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost

plugins {
Expand All @@ -22,7 +21,7 @@ val testFixturesJavadocJar by
from(testFixturesJavadoc.map { it.destinationDir!! })
}

configure<MavenPublishBaseExtension> {
mavenPublishing {
configureBasedOnAppliedPlugins()
publishToMavenCentral(SonatypeHost.DEFAULT)
signAllPublications()
Expand Down Expand Up @@ -92,15 +91,15 @@ configure<MavenPublishBaseExtension> {
}
}

configure<PublishingExtension> {
publishing {
repositories.maven {
name = "fakeRemote"
setUrl(rootProject.layout.buildDirectory.dir("maven-fake-remote-repository"))
}

publications.named<MavenPublication>("maven") {
groupId = "com.ibm.wala"
artifactId = the<BasePluginExtension>().archivesName.get()
artifactId = base.archivesName.get()

val testFixturesCodeElementsNames =
listOf("testFixturesApiElements", "testFixturesRuntimeElements")
Expand All @@ -122,7 +121,7 @@ configure<PublishingExtension> {
}
}

configure<SigningExtension> {
signing {
setRequired {
// Signatures are a hard requirement if publishing a non-snapshot to Maven Central.
!isSnapshot &&
Expand Down

0 comments on commit 96d2a96

Please sign in to comment.