Last active
December 17, 2015 11:49
-
-
Save ysb33r/5605401 to your computer and use it in GitHub Desktop.
Suggested DSL adaptation for publising to Bintray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FOR THE IMPATIENT: Final solution at the end | |
// Classic Ivy style to publish to Bintray. | |
// This requires the package to be pre-created, possibly by manual process on website | |
// or via call such as https://github.com/ysb33r/Gradle/blob/master/buildSrc/src/main/groovy/BintrayPackage.groovy | |
uploadArchives { | |
repositories { | |
ivy { | |
url 'http://api.bintray.com/ysb33r/grysb33r/gnumake-gradle-plugin/0.0.3' | |
credentials { | |
username = 'ysb33r' | |
password = bintray_api_key | |
} | |
} | |
} | |
// It would be create if everything could be combined into a single configuration | |
// Such a setup should be able to handle either IVY or MAVEN and also create the | |
// package metadata on Bintray if it does not exist. | |
// Proposal #1 | |
// bintray {} will return an IvyArtifactRepository (or a MavenArtifactRepository) | |
// Drawback: Specifying type=bintray.IVY looks a bit a stupid | |
uploadArchives { | |
repositories { | |
bintray { | |
username = 'ysb33r' | |
password = bintray_api_key | |
repository = 'grysb33r' | |
package = 'gnumake-gradle-plugin' | |
type = bintray.IVY | |
description = 'This is an example to simplifying bintray publishing' | |
descUrl = 'https://github.com/ysb33r/Gradle/blob/master/buildSrc/src/main/groovy/BintrayPackage.groovy' | |
tags = ['gradle'] | |
// Listing version here, but should really be determined from project version | |
version = '0.0.3' | |
} | |
} | |
} | |
// Proposal #2 | |
// This relies on 'bintray' being a closure which is being called | |
// Unknowns: | |
// [1] How to get inject 'bintray' so it can be resovled by ivy. Metaclass addition? | |
// [2] How to inject the dependency to call the package metdata creation task first | |
uploadArchives { | |
repositories { | |
ivy bintray { | |
username = 'ysb33r' | |
password = bintray_api_key | |
repository = 'grysb33r' | |
package = 'gnumake-gradle-plugin' | |
description = 'This is an example to simplifying bintray publishing' | |
descUrl = 'https://github.com/ysb33r/Gradle/blob/master/buildSrc/src/main/groovy/BintrayPackage.groovy' | |
tags = ['gradle'] | |
// Listing version here, but should really be determined from project version | |
version = '0.0.3' | |
} | |
} | |
} | |
// Proposal #3 | |
// This one is slightly simpler | |
// It might actually be the easiest to implement, although it will | |
// still require to call package metadata creation first | |
uploadArchives { | |
repositories { | |
bintrayIvyDeployer { | |
username = 'ysb33r' | |
password = bintray_api_key | |
repository = 'grysb33r' | |
package = 'gnumake-gradle-plugin' | |
description = 'This is an example to simplifying bintray publishing' | |
descUrl = 'https://github.com/ysb33r/Gradle/blob/master/buildSrc/src/main/groovy/BintrayPackage.groovy' | |
tags = ['gradle'] | |
// Listing version here, but should really be determined from project version | |
version = '0.0.3' | |
} | |
} | |
} | |
// Final solution as it has been implemented in | |
// https://github.com/ysb33r/Gradle/tree/RELEASE_0_0_9/bintray/src/main/groovy/org/ysb33r/gradle/bintray | |
// and available as a plugin | |
uploadArchives { | |
repositories { | |
// Publishing as ivy | |
bintrayIvyDeployer { | |
username 'someBintrayUser' | |
apiKey 'SomeBinTrayUsersApiKey' | |
repoOwner 'ysb33r' | |
repoName 'grysb33r' | |
packageName 'someNewPackageToBePublished' | |
description 'This is an example to simplifying bintray publishing' | |
descUrl 'https://github.com/ysb33r/Gradle/blob/master/buildSrc/src/main/groovy/BintrayPackage.groovy' | |
tags 'gradle','bintray' | |
} | |
// Publishing as maven | |
bintrayMavenDeployer { | |
username 'someBintrayUser' | |
apiKey 'SomeBinTrayUsersApiKey' | |
repoOwner 'ysb33r' | |
repoName 'grysb33r' | |
packageName 'someNewPackageToBePublished' | |
description 'This is an example to simplifying bintray publishing' | |
descUrl 'https://github.com/ysb33r/Gradle/blob/master/buildSrc/src/main/groovy/BintrayPackage.groovy' | |
tags 'gradle','bintray' | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment