This commit is contained in:
Alexander Nozik 2021-09-28 12:12:03 +03:00
parent 680bd9ed33
commit 931d69ec1d
4 changed files with 15 additions and 21 deletions

View File

@ -9,12 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
### Changed ### Changed
- Kotlin 1.6
### Deprecated ### Deprecated
### Removed ### Removed
### Fixed ### Fixed
- Some issues with opt-ins
### Security ### Security
## [0.10.2] ## [0.10.2]
@ -22,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Experimental automatic JS project bundling in MPP - Experimental automatic JS project bundling in MPP
### Changed ### Changed
- Remove vcs requirement for Space publication
### Deprecated ### Deprecated

View File

@ -34,6 +34,8 @@ dependencies {
implementation(libs.kotlin.jupyter.gradle) implementation(libs.kotlin.jupyter.gradle)
implementation(libs.kotlin.serialization) implementation(libs.kotlin.serialization)
implementation("org.tomlj:tomlj:1.0.0") implementation("org.tomlj:tomlj:1.0.0")
// // nexus publishing plugin
// implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
} }
@ -189,16 +191,6 @@ afterEvaluate {
apply<SigningPlugin>() apply<SigningPlugin>()
} }
repositories.maven {
name = "sonatype"
url = uri(sonatypeRepo)
credentials {
username = sonatypeUser
password = sonatypePassword
}
}
signing { signing {
//useGpgCmd() //useGpgCmd()
sign(publications) sign(publications)

View File

@ -32,7 +32,7 @@ public class KSciencePublishingExtension(public val project: Project) {
} }
/** /**
* Configures Git repository for the publication. * Configures Git repository (sources) for the publication.
* *
* @param vcsUrl URL of the repository's web interface. * @param vcsUrl URL of the repository's web interface.
* @param connectionUrl URL of the Git repository. * @param connectionUrl URL of the Git repository.
@ -69,8 +69,9 @@ public class KSciencePublishingExtension(public val project: Project) {
*/ */
public fun github(githubProject: String, githubOrg: String = "mipt-npm", release: Boolean = false, publish: Boolean = true) { public fun github(githubProject: String, githubOrg: String = "mipt-npm", release: Boolean = false, publish: Boolean = true) {
// Automatically initialize VCS using GitHub // Automatically initialize VCS using GitHub
if (!isVcsInitialized) if (!isVcsInitialized) {
git("https://github.com/$githubOrg/${githubProject}", "https://github.com/$githubOrg/${githubProject}.git") git("https://github.com/$githubOrg/${githubProject}", "https://github.com/$githubOrg/${githubProject}.git")
}
if (publish) project.addGithubPublishing(githubOrg, githubProject) if (publish) project.addGithubPublishing(githubOrg, githubProject)
if (release) linkPublicationsToReleaseTask("github") if (release) linkPublicationsToReleaseTask("github")
@ -87,7 +88,6 @@ public class KSciencePublishingExtension(public val project: Project) {
* @param release whether publish packages in the `release` task to the Space repository. * @param release whether publish packages in the `release` task to the Space repository.
*/ */
public fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", release: Boolean = true) { public fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", release: Boolean = true) {
require(isVcsInitialized) { "The project vcs is not set up use 'vcs' method to do so" }
project.addSpacePublishing(spaceRepo) project.addSpacePublishing(spaceRepo)
if (release) linkPublicationsToReleaseTask("space") if (release) linkPublicationsToReleaseTask("space")
@ -105,7 +105,7 @@ public class KSciencePublishingExtension(public val project: Project) {
* @param release whether publish packages in the `release` task to the Sonatype repository. * @param release whether publish packages in the `release` task to the Sonatype repository.
*/ */
public fun sonatype(release: Boolean = true) { public fun sonatype(release: Boolean = true) {
require(isVcsInitialized) { "The project vcs is not set up use 'vcs' method to do so" } require(isVcsInitialized) { "The project vcs is not set up use 'git' method to do so" }
project.addSonatypePublishing() project.addSonatypePublishing()
if (release) linkPublicationsToReleaseTask("sonatype") if (release) linkPublicationsToReleaseTask("sonatype")

View File

@ -25,7 +25,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
plugins.withId("org.jetbrains.kotlin.js") { plugins.withId("org.jetbrains.kotlin.js") {
val kotlin: KotlinJsProjectExtension = extensions.findByType()!! val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
val sourcesJar by tasks.creating(Jar::class) { val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources") archiveClassifier.set("sources")
kotlin.sourceSets.all { kotlin.sourceSets.all {
@ -155,7 +155,7 @@ internal fun Project.addGithubPublishing(
internal fun Project.addSpacePublishing(spaceRepo: String) { internal fun Project.addSpacePublishing(spaceRepo: String) {
if (requestPropertyOrNull("publishing.enabled") != "true") { if (requestPropertyOrNull("publishing.enabled") != "true") {
logger.info("Skipping github publishing because publishing is disabled") logger.info("Skipping space publishing because publishing is disabled")
return return
} }
@ -188,7 +188,7 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
internal fun Project.addSonatypePublishing() { internal fun Project.addSonatypePublishing() {
if (requestPropertyOrNull("publishing.enabled") != "true") { if (requestPropertyOrNull("publishing.enabled") != "true") {
logger.info("Skipping github publishing because publishing is disabled") logger.info("Skipping sonatype publishing because publishing is disabled")
return return
} }
@ -204,18 +204,16 @@ internal fun Project.addSonatypePublishing() {
val sonatypeUser: String = requestProperty("publishing.sonatype.user") val sonatypeUser: String = requestProperty("publishing.sonatype.user")
val sonatypePassword: String = requestProperty("publishing.sonatype.password") val sonatypePassword: String = requestProperty("publishing.sonatype.password")
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
allprojects { allprojects {
plugins.withId("maven-publish") { plugins.withId("maven-publish") {
configure<PublishingExtension> { configure<PublishingExtension> {
val sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2" if (!plugins.hasPlugin("signing")) {
if (!plugins.hasPlugin("signing") ) {
apply<SigningPlugin>() apply<SigningPlugin>()
} }
extensions.configure<SigningExtension>("signing") { extensions.configure<SigningExtension>("signing") {
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
if (!signingId.isNullOrBlank()) { if (!signingId.isNullOrBlank()) {
val signingKey: String = requestProperty("publishing.signing.key") val signingKey: String = requestProperty("publishing.signing.key")
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase") val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
@ -227,6 +225,7 @@ internal fun Project.addSonatypePublishing() {
} }
repositories.maven { repositories.maven {
val sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
name = "sonatype" name = "sonatype"
url = uri(sonatypeRepo) url = uri(sonatypeRepo)