Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] remove unnecessary jar generation from gradle-publish.gradle (
Browse files Browse the repository at this point in the history
  • Loading branch information
Guardiola31337 authored Dec 5, 2017
1 parent 784b71a commit 1ce3d2e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 47 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,12 @@ apackage: platform/android/configuration.gradle
# Uploads the compiled Android SDK to Maven
.PHONY: run-android-upload-archives
run-android-upload-archives: platform/android/configuration.gradle
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDK:uploadArchives
cd platform/android && export IS_LOCAL_DEVELOPMENT=false && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDK:uploadArchives

# Uploads the compiled Android SDK to ~/.m2/repository/com/mapbox/mapboxsdk
.PHONY: run-android-upload-archives-local
run-android-upload-archives-local: platform/android/configuration.gradle
cd platform/android && export IS_LOCAL_DEVELOPMENT=true && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=all :MapboxGLAndroidSDK:uploadArchives

# Dump system graphics information for the test app
.PHONY: android-gfxinfo
Expand Down
74 changes: 29 additions & 45 deletions platform/android/MapboxGLAndroidSDK/gradle-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,17 @@ repositories {
mavenCentral()
}

// From https://raw.github.com/mcxiaoke/gradle-mvn-push/master/jar.gradle
android.libraryVariants.all { variant ->
def jarTask = project.tasks.create(name: "jar${variant.name.capitalize()}", type: Jar) {
from variant.javaCompile.destinationDir
exclude "**/R.class"
exclude "**/BuildConfig.class"
}
jarTask.dependsOn variant.javaCompile
artifacts.add('archives', jarTask);
}

// From https://raw.github.com/mcxiaoke/gradle-mvn-push/master/gradle-mvn-push.gradle
def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}

def isLocalBuild() {
if (System.getenv('IS_LOCAL_DEVELOPMENT') != null) {
return System.getenv('IS_LOCAL_DEVELOPMENT').toBoolean()
}
return true
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL :
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"
Expand All @@ -40,6 +35,10 @@ def getSnapshotRepositoryUrl() {
"https://oss.sonatype.org/content/repositories/snapshots/"
}

def obtainMavenLocalUrl() {
return getRepositories().mavenLocal().getUrl()
}

def getRepositoryUsername() {
return hasProperty('USERNAME') ? USERNAME :
(hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "")
Expand All @@ -50,22 +49,6 @@ def getRepositoryPassword() {
(hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "")
}

task apklib(type: Zip) {
appendix = extension = 'apklib'

from 'AndroidManifest.xml'
into('res') {
from 'res'
}
into('src') {
from 'src'
}
}

artifacts {
archives apklib
}

afterEvaluate { project ->
uploadArchives {
repositories {
Expand All @@ -76,24 +59,16 @@ afterEvaluate { project ->
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(),
password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(),
password: getRepositoryPassword())
}

/*
// Leaving out as artifact was incorrectly named when found
addFilter('aar') { artifact, file ->
artifact.name == archivesBaseName
}
addFilter('apklib') { artifact, file ->
artifact.name == archivesBaseName + '-apklib'
if (isLocalBuild()) {
repository(url: obtainMavenLocalUrl())
} else {
repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
}
*/

pom.project {
name POM_NAME
Expand Down Expand Up @@ -151,3 +126,12 @@ afterEvaluate { project ->
archives androidJavadocsJar
}
}

// See: https://github.com/chrisbanes/gradle-mvn-push/issues/43#issuecomment-84140513
afterEvaluate { project ->
android.libraryVariants.all { variant ->
tasks.androidJavadocs.doFirst {
classpath += files(variant.javaCompile.classpath.files)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.mapbox.mapboxsdk.utils;

/**
* Comparisons from std sdk, which aren't available in API level <= 15
* Comparisons from std sdk, which aren't available in API level 15 and below
*/
public class Compare {

Expand Down

0 comments on commit 1ce3d2e

Please sign in to comment.