Skip to content
This repository has been archived by the owner on Feb 7, 2021. It is now read-only.

Commit

Permalink
Remove autoPublishWaitForSeconds property
Browse files Browse the repository at this point in the history
  • Loading branch information
rpalcolea committed Mar 26, 2019
1 parent 9c74c03 commit 09b1f71
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/main/kotlin/nebula/plugin/bintray/BintrayExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ open class BintrayExtension(objects: ObjectFactory) {
val repo: Property<String> = objects.property()
val userOrg: Property<String> = objects.property()
val autoPublish: Property<Boolean> = objects.property()
val autoPublishWaitForSeconds: Property<Int> = objects.property()
val licenses: ListProperty<String> = objects.listProperty(String::class.java)
val customLicenses: ListProperty<String> = objects.listProperty(String::class.java)
val labels: ListProperty<String> = objects.listProperty(String::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ open class NebulaBintrayAbstractTask : DefaultTask() {
@Input
@Optional
val version: Property<String> = project.objects.property()
@Input
@Optional
val autoPublishWaitForSeconds: Property<Int> = project.objects.property()

fun resolveSubject() : String {
val resolvedSubject = userOrg.getOrElse(user.get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ open class NebulaBintrayPublishingPlugin : Plugin<Project> {
val bintray = project.extensions.create("bintray", BintrayExtension::class)
setExtensionDefaults(bintray, project)
setBintrayCredentials(bintray, project)
val description = if (project.hasProperty("description")) project.description else ""
val description = if (project.hasProperty("description") && project.description != null) project.description else project.name
val publishPackageToBintray = project.tasks.register<NebulaBintrayPackageTask>("publishPackageToBintray") {
user.set(bintray.user)
apiKey.set(bintray.apiKey)
Expand All @@ -33,7 +33,6 @@ open class NebulaBintrayPublishingPlugin : Plugin<Project> {
websiteUrl.set(bintray.websiteUrl)
issueTrackerUrl.set(bintray.issueTrackerUrl)
vcsUrl.set(bintray.vcsUrl)
autoPublishWaitForSeconds.set(bintray.autoPublishWaitForSeconds)
onlyIf { bintray.autoPublish.getOrElse(false) }
}

Expand All @@ -45,7 +44,6 @@ open class NebulaBintrayPublishingPlugin : Plugin<Project> {
repo.set(bintray.repo)
userOrg.set(bintray.userOrg)
version.set(project.version as String)
autoPublishWaitForSeconds.set(bintray.autoPublishWaitForSeconds)
onlyIf { bintray.autoPublish.getOrElse(false) }
}

Expand All @@ -58,7 +56,7 @@ open class NebulaBintrayPublishingPlugin : Plugin<Project> {
} else {
val subject = bintray.subject()
name = "Bintray"
url = project.uri("${bintray.apiUrl}/content/$subject/${bintray.repo.get()}/${bintray.pkgName.get()}/${project.version}")
url = project.uri("${bintray.apiUrl}/maven/$subject/${bintray.repo.get()}/${bintray.pkgName.get()}/${project.version}")
credentials {
username = bintray.user.get()
password = bintray.apiKey.get()
Expand All @@ -73,7 +71,7 @@ open class NebulaBintrayPublishingPlugin : Plugin<Project> {
project.logger.warn("Skipping task dependencies setup - Neither bintray.user or bintray.userOrg defined")
} else {
val subject = bintray.subject()
val repoUrl = "${bintray.apiUrl}/content/$subject/${bintray.repo.get()}/${bintray.pkgName.get()}/${project.version}"
val repoUrl = "${bintray.apiUrl}/maven/$subject/${bintray.repo.get()}/${bintray.pkgName.get()}/${project.version}"
if (repository.url == project.uri(repoUrl)) {
dependsOn(publishPackageToBintray)
finalizedBy(publishVersionToBintray)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ open class NebulaBintrayVersionTask : NebulaBintrayAbstractTask() {
.build()


val resolvedWait = autoPublishWaitForSeconds.getOrElse(0)
val result = bintrayClient.publishVersion(resolvedSubject, resolvedRepoName, resolvedPkgName, resolvedVersion, PublishRequest(resolvedWait))
val result = bintrayClient.publishVersion(resolvedSubject, resolvedRepoName, resolvedPkgName, resolvedVersion, PublishRequest())
if (result.isSuccessful) {
logger.info("$resolvedPkgName version $resolvedVersion has been published")
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,33 @@ class NebulaBintrayPublishingPluginIntegrationSpec extends LauncherSpec {
then:
result.standardOutput.contains('Task :publishPackageToBintray')
}

def 'publishes library to bintray'() {
given:
buildFile << """
apply plugin: 'nebula.nebula-bintray'
apply plugin: 'java'
group = 'test.nebula.netflix'
version = '1.0'
description = 'my plugin'
bintray {
user = 'nebula-plugins'
apiKey = 'mykey'
apiUrl = 'https://api.bintray.com'
pkgName = 'my-plugin'
autoPublish = true
}
"""

writeHelloWorld()

when:
def result = runTasks('publishPackageToBintray')

then:
result.standardOutput.contains('Task :publishPackageToBintray')
}
}

0 comments on commit 09b1f71

Please sign in to comment.