From 301cf6235969f321df00d24271c93a1f55f3316f Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Thu, 22 Jul 2021 15:41:58 +0200 Subject: [PATCH] fix: android core publish Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- android/bridge/build.gradle | 2 +- android/bridge/publish.gradle | 30 ++++++++++++++++++++++++------ android/build.gradle | 6 +----- android/core/build.gradle | 1 + android/core/publish.gradle | 6 +++--- packages/Manifest.yml | 6 ++++-- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/android/bridge/build.gradle b/android/bridge/build.gradle index 0dc2053d..176965c5 100644 --- a/android/bridge/build.gradle +++ b/android/bridge/build.gradle @@ -33,9 +33,9 @@ android { } dependencies { + implementation fileTree(dir: "${rootDir}/libs/gomobile", include: ['*.aar', '*.jar']) implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'commons-io:commons-io:2.6' - implementation fileTree(dir: "${rootDir}/libs/gomobile", include: ['*.aar', '*.jar']) testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.2' } diff --git a/android/bridge/publish.gradle b/android/bridge/publish.gradle index d0f0565b..3c6dc98f 100644 --- a/android/bridge/publish.gradle +++ b/android/bridge/publish.gradle @@ -14,12 +14,12 @@ afterEvaluate { } task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from javadoc.destinationDir } task sourcesJar(type: Jar) { - classifier = 'sources' + archiveClassifier = 'sources' from android.sourceSets.main.java.srcDirs } @@ -38,7 +38,7 @@ publishing { // local publishing maven { name = "local" - url = layout.buildDirectory.dir('repo') // @MANIFEST + url = "${projectDir}/repo" // @MANIFEST } } @@ -51,8 +51,8 @@ publishing { ] groupId manifest.global.group_id - artifactId manifest.android_bridge.artifact_id - version rootProject.ext.version + artifactId manifest.android_bridge.artifact_id + version rootProject.ext.version pom { name = manifest.android_bridge.name @@ -86,16 +86,34 @@ publishing { developerNode.appendNode('organizationUrl', it.organization_url) } + def repositoriesNode = asNode().appendNode('repositories') + manifest.global.android.repositories.each { id, url -> + def repositoryNode = repositoriesNode.appendNode('repository') + repositoryNode.appendNode('id', id) + repositoryNode.appendNode('url', url) + } + def dependenciesNode = asNode().appendNode('dependencies') configurations.implementation.allDependencies.each { - if (it.name != 'unspecified') { + if (it.name != 'unspecified' && it.version != 'unspecified') { def dependencyNode = dependenciesNode.appendNode('dependency') dependencyNode.appendNode('groupId', it.group) dependencyNode.appendNode('artifactId', it.name) dependencyNode.appendNode('version', it.version) } } + + // add actual core dependencies + def dependencyNode = dependenciesNode.appendNode('dependency') + dependencyNode.appendNode('groupId', manifest.global.group_id) + dependencyNode.appendNode('artifactId', manifest.go_core.android.artifact_id) + dependencyNode.appendNode('version', rootProject.ext.version) } } } } + +tasks.withType(PublishToMavenRepository) { + dependsOn 'build' +} + diff --git a/android/build.gradle b/android/build.gradle index 107d9998..eff1d150 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -15,7 +15,7 @@ task importManifest { rootProject.ext { manifest = new org.yaml.snakeyaml.Yaml().load(ManifestFile.newInputStream()) - version = (EnvVersion != null) ? EnvVersion : '0.0.42-dev' + version = (EnvVersion != null) ? EnvVersion : '0.0.42-dev' } } @@ -24,10 +24,6 @@ task setupAllProjectsRepos(dependsOn: 'importManifest') { repositories { google() jcenter() - // If gomobile-ipfs core is available locally, use it - // maven { url "${rootDir.getPath()}/core/repo" } - // If not available locally, download it from Bintray repo - // maven { url "https://github.com/ipfs-shipyard/gomobile-ipfs.git" } // @MANIFEST } } } diff --git a/android/core/build.gradle b/android/core/build.gradle index b1032f88..9a633a7d 100644 --- a/android/core/build.gradle +++ b/android/core/build.gradle @@ -62,3 +62,4 @@ task extractApi(type: Copy) { assemble.dependsOn extractApi apply from: 'publish.gradle' + diff --git a/android/core/publish.gradle b/android/core/publish.gradle index 6973bb7d..ad9e1ebe 100644 --- a/android/core/publish.gradle +++ b/android/core/publish.gradle @@ -30,7 +30,7 @@ publishing { // local publishing maven { name = "local" - url = layout.buildDirectory.dir("$projectDir/repo") // @MANIFEST + url = "${projectDir}/repo" // @MANIFEST } } @@ -44,8 +44,8 @@ publishing { } groupId manifest.global.group_id - artifactId manifest.go_core.android.artifact_id - version rootProject.ext.version + artifactId manifest.go_core.android.artifact_id + version rootProject.ext.version pom { name = manifest.android_bridge.name diff --git a/packages/Manifest.yml b/packages/Manifest.yml index 599778d9..a6cd78a1 100644 --- a/packages/Manifest.yml +++ b/packages/Manifest.yml @@ -40,11 +40,13 @@ global: compile_sdk_version: &compile_sdk_version 29 min_sdk_version: 21 target_sdk_version: *compile_sdk_version - - bintray_url: https://dl.bintray.com/berty/gomobile-ipfs-android + repo: gomobile-ipfs-android packaging: aar + repositories: + github: https://maven.pkg.github.com/ipfs-shipyard/gomobile-ipfs + scm: connection: scm:git:git://github.com/ipfs-shipyard/gomobile-ipfs.git developer_connection: