diff --git a/gradle.properties b/gradle.properties index 5b0a697..beb9a10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.parallel=true # Project properties -------------------------- title=PlayIO Gradle Plugin description=Gradle Plugin for open source and PlayIO application -version=0.2.0 +version=0.2.1 semanticVersion=-SNAPSHOT buildBy=local buildHash= diff --git a/src/main/kotlin/cloud/playio/gradle/OSSProjectPlugin.kt b/src/main/kotlin/cloud/playio/gradle/OSSProjectPlugin.kt index 35c5135..d129a9b 100644 --- a/src/main/kotlin/cloud/playio/gradle/OSSProjectPlugin.kt +++ b/src/main/kotlin/cloud/playio/gradle/OSSProjectPlugin.kt @@ -120,9 +120,15 @@ class OSSProjectPlugin : Plugin, PluginConstraint, ProjectConstraint { .configure { distributionBaseName.set(ossExt.baseName) } configure { - publications { addMavenPublication(project, ossExt) } - repositories { addGitHubRegistry(project, ossExt) } - project.afterEvaluate { publications { withType { addPomMetadata(ossExt) } } } + project.afterEvaluate { + publications { + if (ossExt.publishing.enabled.get()) { + addMavenPublication(project, ossExt) + withType { addPomMetadata(ossExt) } + } + } + repositories { addGitHubRegistry(project, ossExt) } + } } configure { @@ -140,35 +146,31 @@ class OSSProjectPlugin : Plugin, PluginConstraint, ProjectConstraint { } private fun PublicationContainer.addMavenPublication(project: Project, ossExt: OSSExtension) { - if (ossExt.publishing.enabled.get()) { - create(ossExt.publishing.mavenPublicationName.get()) { - groupId = project.group as String? - artifactId = ossExt.baseName.get() - version = project.version as String? - from(project.components["java"]) - - versionMapping { - usage("java-api") { - fromResolutionOf("runtimeClasspath") - } - usage("java-runtime") { - fromResolutionResult() - } + create(ossExt.publishing.mavenPublicationName.get()) { + groupId = project.group as String? + artifactId = ossExt.baseName.get() + version = project.version as String? + from(project.components["java"]) + + versionMapping { + usage("java-api") { + fromResolutionOf("runtimeClasspath") + } + usage("java-runtime") { + fromResolutionResult() } } } } private fun RepositoryHandler.addGitHubRegistry(project: Project, ossExt: OSSExtension) { - project.afterEvaluate { - if (ossExt.githubConfig.publishToRegistry.get()) { - maven { - name = "GitHubPackages" - url = project.uri(ossExt.githubConfig.getProjectRegistryUrl()) - credentials { - username = prop(project, NexusConfig.USER_KEY) - password = prop(project, NexusConfig.PASSPHRASE_KEY) - } + if (ossExt.githubConfig.publishToRegistry.get()) { + maven { + name = "GitHubPackages" + url = project.uri(ossExt.githubConfig.getProjectRegistryUrl()) + credentials { + username = prop(project, NexusConfig.USER_KEY) + password = prop(project, NexusConfig.PASSPHRASE_KEY) } } }