Skip to content

Commit

Permalink
fix: android core publish
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Jul 22, 2021
1 parent 76b96e9 commit 301cf62
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 17 deletions.
2 changes: 1 addition & 1 deletion android/bridge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
30 changes: 24 additions & 6 deletions android/bridge/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -38,7 +38,7 @@ publishing {
// local publishing
maven {
name = "local"
url = layout.buildDirectory.dir('repo') // @MANIFEST
url = "${projectDir}/repo" // @MANIFEST
}
}

Expand All @@ -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
Expand Down Expand Up @@ -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'
}

6 changes: 1 addition & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand All @@ -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
}
}
}
Expand Down
1 change: 1 addition & 0 deletions android/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ task extractApi(type: Copy) {
assemble.dependsOn extractApi

apply from: 'publish.gradle'

6 changes: 3 additions & 3 deletions android/core/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ publishing {
// local publishing
maven {
name = "local"
url = layout.buildDirectory.dir("$projectDir/repo") // @MANIFEST
url = "${projectDir}/repo" // @MANIFEST
}
}

Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions packages/Manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 301cf62

Please sign in to comment.