Skip to content

Instantly share code, notes, and snippets.

@vvlevchenko
Created January 17, 2019 14:15
Show Gist options
  • Save vvlevchenko/6a3e30f721d8a8634045956fb9471fe1 to your computer and use it in GitHub Desktop.
Save vvlevchenko/6a3e30f721d8a8634045956fb9471fe1 to your computer and use it in GitHub Desktop.
publishing libcurl example with bintray/maven-publish
diff --git a/samples/gradle/wrapper/gradle-wrapper.properties b/samples/gradle/wrapper/gradle-wrapper.properties
index e6a30918e..d76b502e2 100644
--- a/samples/gradle/wrapper/gradle-wrapper.properties
+++ b/samples/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/samples/libcurl/build.gradle b/samples/libcurl/build.gradle
index 99d386ed7..9bc30a78e 100644
--- a/samples/libcurl/build.gradle
+++ b/samples/libcurl/build.gradle
@@ -1,24 +1,27 @@
import java.nio.file.Paths
+buildscript {
+ repositories {
+ jcenter()
+ maven { url "https://plugins.gradle.org/m2/" }
+ maven { url 'https://dl.bintray.com/jetbrains/kotlin-native-dependencies' }
+ }
+
+ dependencies {
+ classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4-jetbrains-3"
+ }
+}
+
+
plugins {
id 'kotlin-multiplatform'
id 'maven-publish'
}
-group 'org.jetbrains.kotlin.sample.native'
-version '1.0'
-
-def localRepo = rootProject.file('build/.m2-local')
+apply plugin : 'com.jfrog.bintray'
-publishing {
- repositories {
- maven { url = "file://$localRepo" }
- }
-}
-
-task cleanLocalRepo(type: Delete) {
- delete localRepo
-}
+group 'org.jetbrains.kotlin.sample.native'
+version '1.0-alpha2'
// Determine host preset.
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64, kotlin.presets.mingwX64])
@@ -54,3 +57,51 @@ kotlin {
}
}
}
+
+/*
+apply plugin: 'maven-publish'
+
+publishing {
+ repositories {
+ maven {
+ name = 'bintray'
+ def bintrayUsername = 'minamoto-test'
+ def bintrayRepoName = 'repository-test-1'
+ def bintrayPackageName = 'libcurl'
+ url = "https://api.bintray.com/maven/$bintrayUsername/$bintrayRepoName/$bintrayPackageName/;publish=0"
+ credentials {
+ username = project.property('bintrayUser')
+ password = project.property('bintrayApiKey')
+ }
+ }
+ }
+}
+*/
+
+bintray {
+ pkg {
+ user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
+ key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
+ override = true // for multi-platform Kotlin/Native publishing
+
+
+ userOrg = 'minamoto-test'
+ repo = 'repository-test-1'
+ name = 'libcurl-1'
+ version {
+ name = project.version
+ vcsTag = project.version
+ released = new Date()
+ }
+ }
+}
+
+bintrayUpload.dependsOn publishToMavenLocal
+
+// This is for easier debugging of bintray uploading problems
+bintrayUpload.doFirst {
+ publications = project.publishing.publications.findAll { !it.name.contains('-test') }.collect {
+ println("Uploading artifact '$it.groupId:$it.artifactId:$it.version' from publication '$it.name'")
+ it
+ }
+}
\ No newline at end of file
diff --git a/samples/libcurl/src/libcurlMain/kotlin/CUrl.kt b/samples/libcurl/src/libcurlMain/kotlin/CUrl.kt
index 0ec4ea139..6e502b66d 100644
--- a/samples/libcurl/src/libcurlMain/kotlin/CUrl.kt
+++ b/samples/libcurl/src/libcurlMain/kotlin/CUrl.kt
@@ -6,8 +6,8 @@
package sample.libcurl
import kotlinx.cinterop.*
-import platform.posix.size_t
import libcurl.*
+typealias size_t = ULong
class CUrl(url: String) {
private val stableRef = StableRef.create(this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment