179 строки
4.8 KiB
Groovy
179 строки
4.8 KiB
Groovy
buildscript {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
maven {
|
|
url "https://oss.sonatype.org/content/repositories/snapshots"
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:3.6.0'
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
apply plugin: 'com.android.library'
|
|
apply from: "${rootDir}/publish.gradle"
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'signing'
|
|
apply plugin: 'maven'
|
|
|
|
android {
|
|
compileSdkVersion 23
|
|
|
|
defaultConfig {
|
|
minSdkVersion 8
|
|
targetSdkVersion 23
|
|
versionCode 1
|
|
versionName "1.0.0"
|
|
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
|
|
}
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
lintOptions {
|
|
disable 'OldTargetApi', 'UnusedResources'
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
|
|
task sourcesJar(type: Jar) {
|
|
afterEvaluate {
|
|
from android.sourceSets.main.java.srcDirs
|
|
classifier = 'sources'
|
|
}
|
|
}
|
|
|
|
task javadoc(type: Javadoc) {
|
|
afterEvaluate {
|
|
source = android.sourceSets.main.java.srcDirs
|
|
classpath += configurations.javadocDeps
|
|
configurations.api.dependencies.withType(ProjectDependency).dependencyProject.buildDir.each { dir -> classpath += files("${dir}/intermediates/classes/release") }
|
|
//noinspection GroovyAssignabilityCheck
|
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
|
android.libraryVariants.all { variant ->
|
|
if (variant.name == 'release') {
|
|
owner.classpath += variant.javaCompile.classpath
|
|
}
|
|
}
|
|
javadoc.dependsOn project.assembleRelease
|
|
}
|
|
}
|
|
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
classifier = 'javadoc'
|
|
//noinspection GroovyAccessibility
|
|
// from javadoc.destinationDir
|
|
from javadoc
|
|
}
|
|
|
|
artifacts {
|
|
archives javadocJar, sourcesJar
|
|
}
|
|
|
|
def ext = rootProject.ext
|
|
|
|
//ext described in publish.gradle
|
|
// Setup signing values.
|
|
ext."signing.keyId" = ext.mavenSigningKeyId
|
|
ext."signing.secretKeyRingFile" = ext.mavenSecretKeyPath
|
|
ext."signing.password" = ext.mavenPublicKeyPassword
|
|
|
|
group = ext.groupId
|
|
archivesBaseName = ext.projectId
|
|
|
|
uploadArchives {
|
|
repositories {
|
|
mavenDeployer {
|
|
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
|
|
|
repository(url: ext.mavenRepoUrl) {
|
|
authentication(userName: ext.mavenUser, password: ext.mavenKey)
|
|
}
|
|
|
|
snapshotRepository(url: ext.mavenSnapshotUrl) {
|
|
authentication(userName: ext.mavenUser, password: ext.mavenKey)
|
|
}
|
|
|
|
|
|
pom.project {
|
|
name ext.projectName
|
|
packaging 'aar'
|
|
// optionally artifactId can be defined here
|
|
description ext.projectDescription
|
|
url ext.projectUrl
|
|
|
|
groupId = ext.groupId
|
|
artifactId = ext.projectId
|
|
|
|
scm {
|
|
connection ext.gitUrl
|
|
developerConnection ext.siteUrl
|
|
url ext.siteUrl
|
|
}
|
|
|
|
licenses {
|
|
license {
|
|
name ext.licenseName
|
|
url ext.licenseSite
|
|
}
|
|
}
|
|
|
|
developers {
|
|
developer {
|
|
name = 'Chris Fuentes'
|
|
email = 'Chris.Fuentes@microsoft.com'
|
|
organization = 'Microsoft'
|
|
organizationUrl = 'http://www.microsoft.com'
|
|
}
|
|
developer {
|
|
name = 'Simon Scharf'
|
|
email = 'sisonder@microsoft.com'
|
|
organization = 'Microsoft'
|
|
organizationUrl = 'http://www.microsoft.com'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
signing {
|
|
required { gradle.taskGraph.hasTask("uploadArchives") }
|
|
sign configurations.archives
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
javadocDeps
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly "androidx.annotation:annotation:1.2.0"
|
|
javadocDeps "androidx.annotation:annotation:1.2.0"
|
|
configurations.all {
|
|
resolutionStrategy {
|
|
force "androidx.annotation:annotation:1.2.0"
|
|
}
|
|
}
|
|
|
|
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
})
|
|
|
|
testImplementation 'junit:junit:4.12'
|
|
testImplementation 'pl.pragmatists:JUnitParams:1.1.1'
|
|
|
|
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
|
|
compileOnly 'com.android.support.test:runner:1.0.2'
|
|
}
|