1. shemnon
  2. DeckControl

Commits

shemnon  committed 4a383a9

publish to BinTray.

  • Participants
  • Parent commits 4bc8283
  • Branches master

Comments (0)

Files changed (2)

File build.gradle

View file
  • Ignore whitespace
+import groovyx.net.http.HTTPBuilder
+
+import static groovyx.net.http.ContentType.JSON
+import static groovyx.net.http.Method.GET
+import static groovyx.net.http.Method.POST
+
+buildscript {
+    repositories {
+        mavenRepo(url: 'http://dl.bintray.com/content/bintray/jcenter')
+    }
+    dependencies {
+        classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.6'
+        classpath 'commons-collections:commons-collections:3.2.1'
+    }
+}
+
 apply plugin: 'java'
+apply plugin: 'maven'
+
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+
+group = 'org.bitbucket.shemnon.deckcontrol'
+version = '0.0.0'
 
 repositories {
     mavenCentral()
         main = "com.github.shemnon.deckcontrol.$name"
         classpath = sourceSets.test.runtimeClasspath
     }
+}
+
+// custom tasks for creating source/javadoc jars
+task sourcesJar(type: Jar, dependsOn: classes) {
+    classifier = 'sources'
+    from sourceSets.main.allSource
+}
+
+task javadocJar(type: Jar, dependsOn: javadoc) {
+    classifier = 'javadoc'
+    from javadoc.destinationDir
+}
+
+// add javadoc/source jar tasks as artifacts
+artifacts {
+    archives sourcesJar, javadocJar
+}
+
+repositories {
+    mavenRepo(url: 'http://dl.bintray.com/content/bintray/jcenter')
+}
+
+task createBintrayPackage << {
+    def http = getHttpBuilder()
+    http.request(GET, JSON) {
+        uri.path = '/packages/' + bintray_username + '/' + bintray_repo + '/' + bintray_package
+        response.'404' = {
+            http = getHttpBuilder()
+            http.request(POST, JSON) {
+                uri.path = '/packages/' + bintray_username + '/' + bintray_repo
+                body = [name: bintray_package, desc: 'auto', desc_url: 'auto', labels: ['gradle', 'example']]
+
+                response.success = { resp ->
+                    println 'Created!!!'
+                }
+            }
+        }
+    }
+}
+
+uploadArchives() {
+    repositories {
+        ivy {
+            url = bintray_api_base_url + '/content/' + bintray_username + '/' + bintray_repo + '/' + bintray_package + '/' + version
+            credentials {
+                username bintray_username
+                password bintray_api_key
+            }
+        }
+    }
+}
+
+uploadArchives.dependsOn createBintrayPackage
+
+def getHttpBuilder() {
+    def http = new HTTPBuilder(bintray_api_base_url)
+    http.auth.basic bintray_username, bintray_api_key
+    return http
 }

File gradle.properties

View file
  • Ignore whitespace
-sourceCompatibility = 1.7
-version=0.0
+bintray_api_base_url=https://api.bintray.com
+bintray_username=shemnon
+#bintray_api_key = 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
+bintray_repo=javafx
+bintray_package=DeckControl