|
| 1 | +plugins { |
| 2 | + id 'com.android.library' |
| 3 | + id 'de.mannodermaus.android-junit5' |
| 4 | + id 'maven-publish' |
| 5 | + id 'signing' |
| 6 | +} |
| 7 | + |
| 8 | +def libraryGroup = 'io.github.neboskreb' |
| 9 | +def libraryArtifact = 'android-log4j2-migration' |
| 10 | +def libraryVersion = '2.0-SNAPSHOT' |
| 11 | + |
| 12 | +afterEvaluate { |
| 13 | + publishing { |
| 14 | + repositories { |
| 15 | + maven { |
| 16 | + name = "github-packages" |
| 17 | + url = uri("https://maven.pkg.github.com/neboskreb/android-log4j2") |
| 18 | + credentials { |
| 19 | + username = project.findProperty("github_packages_user") ?: System.getenv("PACKAGES_USERNAME") |
| 20 | + password = project.findProperty("github_packages_token") ?: System.getenv("PACKAGES_TOKEN") |
| 21 | + } |
| 22 | + } |
| 23 | + maven { |
| 24 | + name "MavenCentral" |
| 25 | + if (version.endsWith('SNAPSHOT')) { |
| 26 | + url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") |
| 27 | + } else { |
| 28 | + url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") |
| 29 | + } |
| 30 | + credentials { |
| 31 | + username = project.findProperty("mavenCentralUser") ?: System.getenv("MAVEN_USERNAME") |
| 32 | + password = project.findProperty("mavenCentralPass") ?: System.getenv("MAVEN_PASSWORD") |
| 33 | + } |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + publications { |
| 38 | + release(MavenPublication) { |
| 39 | + group = libraryGroup |
| 40 | + artifactId = libraryArtifact |
| 41 | + version = libraryVersion |
| 42 | + |
| 43 | + afterEvaluate { |
| 44 | + from components.release |
| 45 | + } |
| 46 | + |
| 47 | + pom { |
| 48 | + name = 'Migration from default Log to SLF4J' |
| 49 | + description = 'This package contains utility classes for easy migration to SLF4J on Android' |
| 50 | + url = 'https://github.com/neboskreb/android-log4j2' |
| 51 | + licenses { |
| 52 | + license { |
| 53 | + name = 'The Apache License, Version 2.0' |
| 54 | + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| 55 | + } |
| 56 | + } |
| 57 | + developers { |
| 58 | + developer { |
| 59 | + id = 'JBM' |
| 60 | + name = 'John Y. Pazekha' |
| 61 | + |
| 62 | + } |
| 63 | + } |
| 64 | + scm { |
| 65 | + connection = 'scm:git:[email protected]:neboskreb/android-log4j2.git' |
| 66 | + developerConnection = 'scm:git:ssh://github.com:neboskreb/android-log4j2.git' |
| 67 | + url = 'https://github.com/neboskreb/android-log4j2' |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + signing { |
| 75 | + sign publishing.publications.release |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +android { |
| 80 | + namespace = 'com.github.neboskreb.log4j2' |
| 81 | + compileSdk = 35 |
| 82 | + |
| 83 | + defaultConfig { |
| 84 | + minSdk = 26 |
| 85 | + |
| 86 | + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| 87 | + consumerProguardFiles "consumer-rules.pro" |
| 88 | + } |
| 89 | + |
| 90 | + buildTypes { |
| 91 | + release { |
| 92 | + minifyEnabled false |
| 93 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + compileOptions { |
| 98 | + sourceCompatibility JavaVersion.VERSION_17 |
| 99 | + targetCompatibility JavaVersion.VERSION_17 |
| 100 | + } |
| 101 | + |
| 102 | + packagingOptions { |
| 103 | + exclude 'META-INF/DEPENDENCIES' |
| 104 | + } |
| 105 | + |
| 106 | + publishing { |
| 107 | + singleVariant("release") { |
| 108 | + withJavadocJar() |
| 109 | + withSourcesJar() |
| 110 | + } |
| 111 | + } |
| 112 | +} |
| 113 | + |
| 114 | +dependencies { |
| 115 | + implementation 'androidx.annotation:annotation:1.9.1' |
| 116 | + compileOnly 'org.slf4j:slf4j-api:[2.0.17, 3.0)' |
| 117 | + compileOnly 'org.apache.logging.log4j:log4j-core:[2.24.3, 3.0)' |
| 118 | +} |
0 commit comments