Skip to content

Instantly share code, notes, and snippets.

@vvlevchenko
Last active April 26, 2018 07:04
Show Gist options
  • Save vvlevchenko/e5fe6ca4d6705dc74053044353fa639f to your computer and use it in GitHub Desktop.
Save vvlevchenko/e5fe6ca4d6705dc74053044353fa639f to your computer and use it in GitHub Desktop.
/Users/minamoto/ws/native-samples/cpp/simple-library/build/headers/cpp-api-headers.zip -> list
/Users/minamoto/ws/native-samples/cpp/simple-library/build/publications/main/pom-default.xml -> list
>>> missed: module.json
list-1.6.module module.json
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/minamoto/ws/native-samples/cpp/simple-library/build.gradle' line: 113
* What went wrong:
Execution failed for task ':bintrayUpload'.
> Cannot cast object 'true' with class 'java.lang.Boolean' to class 'java.io.File'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
diff --git a/cpp/simple-library/build.gradle b/cpp/simple-library/build.gradle
index d193f53..6b85982 100644
--- a/cpp/simple-library/build.gradle
+++ b/cpp/simple-library/build.gradle
@@ -1,3 +1,13 @@
+buildscript {
+ repositories {
+ maven { url 'https://dl.bintray.com/minamoto-test/maven'}
+ }
+
+ dependencies {
+ classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0"
+ }
+}
+
plugins {
id 'cpp-library'
id 'xcode'
@@ -6,8 +16,10 @@ plugins {
id 'cpp-unit-test'
}
+
+
group = 'org.gradle.cpp-samples'
-version = '1.5'
+version = '1.6'
repositories {
maven {
@@ -57,7 +69,58 @@ tasks.withType(LinkSharedLibrary) {
publishing {
repositories {
maven {
- url = '../repo'
+ url = url 'https://dl.bintray.com/minamoto-test/kotlinx/maven'
+ }
+ }
+}
+
+apply plugin: 'com.jfrog.bintray'
+
+bintray {
+ user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
+ key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
+ pkg {
+ userOrg = 'minamoto-test'
+ repo = 'kotlinx'
+ name = 'maven'
+ version {
+ name = project.version
+ vcsTag = project.version
+ released = new Date()
+ }
+ }
+}
+
+import org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal
+bintrayUpload.doFirst {
+ project.publishing.publications.collect{
+ def p = (MavenPublicationInternal)it
+
+ def artifacts = collectArtifacts(it)
+ artifacts.each{
+ println("${it.file} -> ${it.name}")
+ }
+ p.getPublishableFiles().each{
+ def publishable = it
+ if (!artifacts.any{it.file == publishable}) {
+ println(">>> missed: ${it.name}")
+ if (it.name == 'module.json') {
+ def identity = p.getMavenProjectIdentity()
+ println("${identity.getArtifactId()}-${identity.getVersion()}.module ${it.name}")
+ artifacts += new com.jfrog.bintray.gradle.Artifact(
+ name: "${identity.getArtifactId()}-${identity.getVersion()}.module",
+ groupId: identity.getGroupId(),
+ version: identity.getVersion(),
+ extension: ".module",
+ type: "module",
+ classifier: "json",
+ file: publishable.file,
+ signedExtension: null)
+ }
}
+ }
}
+ //project.publishing.publications.each{
+ // println(((MavenPublicationInternal)it).asNormalisaedPublication())
+ //}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment