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
### Changed
- Kotlin 1.6
### Deprecated
### Removed
### Fixed
- Some issues with opt-ins
### Security
## [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
### Changed
- Remove vcs requirement for Space publication
### Deprecated

View File

@ -34,6 +34,8 @@ dependencies {
implementation(libs.kotlin.jupyter.gradle)
implementation(libs.kotlin.serialization)
implementation("org.tomlj:tomlj:1.0.0")
// // nexus publishing plugin
// implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
testImplementation(kotlin("test"))
}
@ -189,16 +191,6 @@ afterEvaluate {
apply<SigningPlugin>()
}
repositories.maven {
name = "sonatype"
url = uri(sonatypeRepo)
credentials {
username = sonatypeUser
password = sonatypePassword
}
}
signing {
//useGpgCmd()
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 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) {
// Automatically initialize VCS using GitHub
if (!isVcsInitialized)
if (!isVcsInitialized) {
git("https://github.com/$githubOrg/${githubProject}", "https://github.com/$githubOrg/${githubProject}.git")
}
if (publish) project.addGithubPublishing(githubOrg, githubProject)
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.
*/
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)
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.
*/
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()
if (release) linkPublicationsToReleaseTask("sonatype")

View File

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