library/build.gradle
/*
* Copyright (C) 2016-2021 Samuel Wall
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'com.android.library'
apply plugin: 'com.hiya.jacoco-android'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
// Maven Group ID for the artifact
group = 'uk.co.samuelwall'
version rootProject.versionName
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion = rootProject.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode rootProject.versionCode
versionName rootProject.versionName
}
buildTypes {
debug {
testCoverageEnabled true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
testOptions.unitTests.includeAndroidResources true
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
configurations {
javadocCompile
}
dependencies {
implementation 'androidx.annotation:annotation:[1.1.0,)'
testImplementation 'androidx.test:core:1.4.0'
implementation 'androidx.lifecycle:lifecycle-extensions:[2.2.0,)'
compileOnly 'androidx.fragment:fragment:[1.1.0,)'
testImplementation 'androidx.test.ext:junit:1.1.3'
testImplementation 'androidx.fragment:fragment-testing:1.3.5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.7.2'
testImplementation 'org.robolectric:robolectric:4.6'
testImplementation 'org.mockito:mockito-core:3.11.2'
javadocCompile 'androidx.annotation:annotation:1.1.0'
javadocCompile 'androidx.fragment:fragment:1.2.5'
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
source += files(["$buildDir/generated/source/r/release"])
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.javadocCompile
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
signing {
sign publishing.publications
}
jacoco {
toolVersion = "0.8.6"
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
//gradlew clean jacocoTestReport
project.afterEvaluate {
publishing {
publications {
maven(MavenPublication) {
from components.release
artifact(sourcesJar)
artifact(javadocJar)
pom {
name = 'material-tap-target-prompt'
description = 'A Tap Target implementation in Android based on Material Design Onboarding guidelines.'
url = 'https://github.com/sjwall/MaterialTapTargetPrompt'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'sjwall'
name = 'Samuel Wall'
email = 'oss@samuelwall.co.uk'
}
}
scm {
connection = 'https://github.com/sjwall/MaterialTapTargetPrompt.git'
developerConnection = 'https://github.com/sjwall/MaterialTapTargetPrompt.git'
url = 'https://github.com/sjwall/MaterialTapTargetPrompt'
}
}
}
}
repositories {
Properties properties = new Properties()
File propertiesFile = project.rootProject.file('local.properties')
if (propertiesFile.exists()) {
properties.load(propertiesFile.newDataInputStream())
}
maven {
name = "ossrh"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = properties.get("sona.usr")
password = properties.get("sona.key")
}
}
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/sjwall/MaterialTapTargetPrompt")
// Github Package
credentials {
//Fetch these details from the properties file or from Environment variables
username = properties.get("gpr.usr")
password = properties.get("gpr.key")
}
}
}
}
javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompileProvider.get().classpath.files
})
}