Skip to content

Commit b9592e1

Browse files
committed
Applied gradle publish updates to publish 1.4.10-SNAPSHOT to maven snapshots
1 parent 86136cd commit b9592e1

File tree

4 files changed

+87
-28
lines changed

4 files changed

+87
-28
lines changed

build.gradle

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
buildscript {
22
repositories {
33
jcenter()
4-
mavenCentral()
54
google()
6-
5+
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
6+
maven { url "https://plugins.gradle.org/m2/" }
77
}
88

99
dependencies {
1010
classpath 'com.android.tools.build:gradle:3.4.1'
11+
classpath 'com.vanniktech:gradle-android-javadoc-plugin:0.4.0-SNAPSHOT'
12+
classpath 'digital.wup:android-maven-publish:3.6.2'
13+
classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.4"
1114
}
1215
}
1316

@@ -20,16 +23,18 @@ allprojects {
2023
version = '1.4.10-SNAPSHOT'
2124

2225
repositories {
23-
mavenLocal()
24-
mavenCentral()
2526
google()
2627
jcenter()
28+
mavenCentral()
2729
}
2830

2931
tasks.withType(JavaCompile) {
3032
options.encoding = "UTF-8"
3133
options.compilerArgs << "-Xlint:unchecked"
34+
options.compilerArgs << "-Xlint:deprecation"
3235
}
3336
}
3437

3538
apply plugin: 'android-reporting'
39+
apply plugin: 'com.vanniktech.android.javadoc'
40+
apply plugin: 'com.dorongold.task-tree'

library/build.gradle

+72-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'digital.wup.android-maven-publish'
3+
apply plugin: 'signing'
24

35
android {
46
compileSdkVersion 28
@@ -22,20 +24,78 @@ dependencies {
2224
api 'cz.msebera.android:httpclient:4.5.8'
2325
}
2426

25-
android.libraryVariants.all { variant ->
26-
def name = variant.buildType.name
27-
def task = project.tasks.create "jar${name.capitalize()}", Jar
28-
task.dependsOn variant.javaCompile
29-
task.from variant.javaCompile.destinationDir
30-
artifacts.add('archives', task)
31-
}
32-
33-
apply from: '../maven_push.gradle'
27+
project.afterEvaluate { project ->
3428

35-
afterEvaluate { project ->
3629
android.libraryVariants.all { variant ->
37-
tasks.androidJavadocs.doFirst {
38-
classpath += files(variant.javaCompile.classpath.files)
30+
def name = variant.buildType.name
31+
def task = project.tasks.create "jar${name.capitalize()}", Jar
32+
task.dependsOn variant.javaCompileProvider.get()
33+
task.from variant.javaCompileProvider.get().destinationDir
34+
}
35+
36+
task sourcesJar(type: Jar) {
37+
from android.sourceSets.main.java.srcDirs
38+
archiveClassifier = 'sources'
39+
}
40+
41+
task javadocJar(type: Jar, dependsOn: tasks.findAll { task -> task.name.contains('Javadoc') }) {
42+
archiveClassifier = 'javadoc'
43+
from 'build/docs/javadoc/release/'
44+
}
45+
46+
publishing {
47+
publications {
48+
maven(MavenPublication) {
49+
artifactId = POM_ARTIFACT_ID
50+
artifact javadocJar
51+
artifact sourcesJar
52+
artifact jarRelease
53+
from components.android
54+
55+
pom {
56+
name = POM_NAME
57+
description = POM_DESCRIPTION
58+
packaging = POM_PACKAGING
59+
url = POM_URL
60+
61+
scm {
62+
connection = POM_SCM_CONNECTION
63+
developerConnection = POM_SCM_DEV_CONNECTION
64+
url = POM_SCM_URL
65+
}
66+
67+
licenses {
68+
license {
69+
name = POM_LICENCE_NAME
70+
url = POM_LICENCE_URL
71+
distribution = POM_LICENCE_DIST
72+
}
73+
}
74+
}
75+
76+
pom.name = POM_NAME
77+
pom.description = POM_DESCRIPTION
78+
pom.url = POM_URL
79+
pom.packaging = POM_PACKAGING
80+
}
3981
}
82+
repositories {
83+
maven {
84+
def releaseUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
85+
def snapshotUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
86+
url = version.endsWith('SNAPSHOT') ? snapshotUrl : releaseUrl
87+
credentials {
88+
def NexusUsername = project.hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ''
89+
def NexusPassword = project.hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ''
90+
username NexusUsername
91+
password NexusPassword
92+
}
93+
}
94+
}
95+
}
96+
97+
signing {
98+
sign publishing.publications.maven
4099
}
41100
}
101+

sample/build.gradle

+2-12
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ android {
1919
productFlavors {
2020
standard {
2121
dimension "version"
22-
minSdkVersion 9
23-
targetSdkVersion 28
24-
25-
}
26-
withLeakCanary {
27-
dimension "version"
28-
minSdkVersion 9
29-
targetSdkVersion 28
3022
}
3123
}
3224

@@ -46,8 +38,6 @@ android {
4638
}
4739

4840
dependencies {
49-
api 'com.fasterxml.jackson.core:jackson-databind:2.5.3'
50-
api project(':library')
51-
// LeakCanary
52-
withLeakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:1.3.1'
41+
implementation 'com.fasterxml.jackson.core:jackson-databind:2.5.3'
42+
implementation project(':android-async-http')
5343
}

settings.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
include ':library'
22
include ':sample'
3+
4+
rootProject.name = 'android-async-http-project'
5+
project(':library').name = 'android-async-http'
6+
project(':sample').name = 'android-async-http-sample'

0 commit comments

Comments
 (0)