Generate jars for maven

This commit is contained in:
Marvin W 2020-07-08 22:18:59 +02:00
parent 16d8fd5096
commit 9d2d56ab03
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
8 changed files with 61 additions and 3 deletions

View file

@ -23,6 +23,8 @@ android {
} }
} }
apply from: "../gradle/androidJars.gradle"
afterEvaluate { afterEvaluate {
publishing { publishing {
publications { publications {
@ -55,6 +57,8 @@ afterEvaluate {
} }
from components.release from components.release
artifact androidSourcesJar
artifact androidJavadocsJar
} }
} }
if (project.hasProperty('sonatype.username')) { if (project.hasProperty('sonatype.username')) {

View file

@ -28,9 +28,8 @@ android {
targetCompatibility = 1.8 targetCompatibility = 1.8
} }
} }
repositories {
mavenCentral() apply from: "../gradle/androidJars.gradle"
}
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
@ -69,6 +68,8 @@ afterEvaluate {
} }
from components.release from components.release
artifact androidSourcesJar
artifact androidJavadocsJar
} }
} }
if (project.hasProperty('sonatype.username')) { if (project.hasProperty('sonatype.username')) {

View file

@ -23,6 +23,8 @@ android {
} }
} }
apply from: "../gradle/androidJars.gradle"
dependencies { dependencies {
implementation project(':client') implementation project(':client')
compileOnly project(':compat') compileOnly project(':compat')
@ -60,6 +62,8 @@ afterEvaluate {
} }
from components.release from components.release
artifact androidSourcesJar
artifact androidJavadocsJar
} }
} }
if (project.hasProperty('sonatype.username')) { if (project.hasProperty('sonatype.username')) {

33
gradle/androidJars.gradle Normal file
View file

@ -0,0 +1,33 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
}
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
excludes = ["**/*.aidl", "**/*.kt"]
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}

View file

@ -23,6 +23,8 @@ android {
} }
} }
apply from: "../gradle/androidJars.gradle"
dependencies { dependencies {
implementation project(':client') implementation project(':client')
compileOnly project(':compat') compileOnly project(':compat')
@ -60,6 +62,8 @@ afterEvaluate {
} }
from components.release from components.release
artifact androidSourcesJar
artifact androidJavadocsJar
} }
} }
if (project.hasProperty('sonatype.username')) { if (project.hasProperty('sonatype.username')) {

View file

@ -23,6 +23,8 @@ android {
} }
} }
apply from: "../gradle/androidJars.gradle"
dependencies { dependencies {
implementation project(':location-v2') implementation project(':location-v2')
} }
@ -59,6 +61,8 @@ afterEvaluate {
} }
from components.release from components.release
artifact androidSourcesJar
artifact androidJavadocsJar
} }
} }
if (project.hasProperty('sonatype.username')) { if (project.hasProperty('sonatype.username')) {

View file

@ -30,6 +30,8 @@ android {
} }
} }
apply from: "../gradle/androidJars.gradle"
dependencies { dependencies {
implementation project(':api') implementation project(':api')
implementation project(':client') implementation project(':client')
@ -71,6 +73,8 @@ afterEvaluate {
} }
from components.release from components.release
artifact androidSourcesJar
artifact androidJavadocsJar
} }
} }
if (project.hasProperty('sonatype.username')) { if (project.hasProperty('sonatype.username')) {

View file

@ -38,6 +38,8 @@ android {
} }
} }
apply from: "../gradle/androidJars.gradle"
dependencies { dependencies {
implementation project(':api') implementation project(':api')
implementation project(':client') implementation project(':client')
@ -95,6 +97,8 @@ afterEvaluate {
} }
from components.release from components.release
artifact androidSourcesJar
artifact androidJavadocsJar
} }
} }
if (project.hasProperty('sonatype.username')) { if (project.hasProperty('sonatype.username')) {