From a4186d12b7d32bfb52880133d9170f50142941be Mon Sep 17 00:00:00 2001 From: Andrzej Zabost <5508894+azabost@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:49:36 +0200 Subject: [PATCH] Configure Maven Central publishing --- .github/workflows/build.yml | 4 +-- README.md | 14 ++++----- build.gradle | 4 +-- core/build.gradle | 22 +------------- core/gradle.properties | 3 ++ gradle.properties | 22 +++++++++++++- gradle/wrapper/gradle-wrapper.properties | 2 +- handler-file-log/build.gradle | 22 +------------- handler-file-log/gradle.properties | 3 ++ handler-notify-developer/build.gradle | 34 ++++++---------------- handler-notify-developer/gradle.properties | 3 ++ jitpack.yml | 4 +-- 12 files changed, 54 insertions(+), 83 deletions(-) create mode 100644 core/gradle.properties create mode 100644 handler-file-log/gradle.properties create mode 100644 handler-notify-developer/gradle.properties diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4031db5..e31fed6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,10 +9,10 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - - name: set up JDK 17 + - name: set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' cache: gradle diff --git a/README.md b/README.md index b148620..7dbd12a 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,25 @@ slf4android =========== -A simple implementation of [slf4j api](http://www.slf4j.org/) using android `java.util.logging.*`. This means you can **easily hook in any existing** `java.util.logging.Handler` implementations. +A simple implementation of [SLF4J API](http://www.slf4j.org/) using Android `java.util.logging.*`. This means you can **easily hook in any existing** `java.util.logging.Handler` implementations. -To use this little gem you'll need to add `https://jitpack.io` to your repositories: +To use this little gem, make sure you have Maven Central in your repositories: ```groovy repositories { - maven { - url "https://jitpack.io" - } + mavenCentral() } ``` and then declare a dependency inside a module: ```groovy dependencies { // just SLF4J binding - implementation("com.github.bright.slf4android:slf4android:$slf4androidVersion") + implementation("dev.bright.slf4android:slf4android:$slf4androidVersion") // (optional) a handler for file logging - implementation("com.github.bright.slf4android:slf4android-handler-file-log:$slf4androidVersion") + implementation("dev.bright.slf4android:handler-file-log:$slf4androidVersion") // (optional) a handler for notifying the developer in case of an error - implementation("com.github.bright.slf4android:slf4android-handler-notify-developer:$slf4androidVersion") + implementation("dev.bright.slf4android:handler-notify-developer:$slf4androidVersion") } ``` As with any slf4j compatible implementation using slf4android looks like this: diff --git a/build.gradle b/build.gradle index d0caab2..d00ba02 100644 --- a/build.gradle +++ b/build.gradle @@ -5,8 +5,8 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:8.4.0' - //classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.android.tools.build:gradle:8.5.1' + classpath 'com.vanniktech:gradle-maven-publish-plugin:0.29.0' } } diff --git a/core/build.gradle b/core/build.gradle index f11ccd2..081653c 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,6 +1,6 @@ plugins { id 'com.android.library' - id 'maven-publish' + id 'com.vanniktech.maven.publish' } android { @@ -21,12 +21,6 @@ android { } } - publishing { - singleVariant('release') { - withSourcesJar() - } - } - java { toolchain { languageVersion = JavaLanguageVersion.of(17) @@ -48,17 +42,3 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } - -publishing { - publications { - release(MavenPublication) { - groupId = 'com.github.bright.slf4android' - artifactId = 'slf4android' - version = '1.0' - - afterEvaluate { - from components.release - } - } - } -} diff --git a/core/gradle.properties b/core/gradle.properties new file mode 100644 index 0000000..a07393f --- /dev/null +++ b/core/gradle.properties @@ -0,0 +1,3 @@ +POM_ARTIFACT_ID=slf4android +POM_NAME=slf4android +POM_DESCRIPTION=A simple implementation of SLF4J API using Android java.util.logging \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 3e4d073..e7d7476 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,4 +13,24 @@ #Fri Dec 29 13:06:46 CET 2023 android.enableJetifier=true android.useAndroidX=true -org.gradle.jvmargs=-Xmx4g -Xms1g \ No newline at end of file +org.gradle.jvmargs=-Xmx4g -Xms1g + +GROUP=dev.bright.slf4android +VERSION_NAME=0.1.8 + +POM_URL=https://github.com/bright/slf4android/ + +POM_LICENSE_NAME=MIT License +POM_LICENSE_URL=https://opensource.org/license/mit +POM_LICENSE_DIST=repo + +POM_SCM_URL=https://github.com/bright/slf4android/ +POM_SCM_CONNECTION=scm:git:git://github.com/bright/slf4android.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com:bright/slf4android.git + +POM_DEVELOPER_ID=bright +POM_DEVELOPER_NAME=Bright Inventions +POM_DEVELOPER_URL=https://github.com/bright/ + +SONATYPE_HOST=S01 +RELEASE_SIGNING_ENABLED=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 09e0043..66d7204 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Dec 29 11:11:03 CET 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/handler-file-log/build.gradle b/handler-file-log/build.gradle index 8584ac7..4878c1a 100644 --- a/handler-file-log/build.gradle +++ b/handler-file-log/build.gradle @@ -1,6 +1,6 @@ plugins { id 'com.android.library' - id 'maven-publish' + id 'com.vanniktech.maven.publish' } android { @@ -21,12 +21,6 @@ android { } } - publishing { - singleVariant('release') { - withSourcesJar() - } - } - java { toolchain { languageVersion = JavaLanguageVersion.of(17) @@ -48,17 +42,3 @@ dependencies { androidTestImplementation 'androidx.test:rules:1.5.0' androidTestImplementation 'org.easytesting:fest-util:1.2.5' } - -publishing { - publications { - release(MavenPublication) { - groupId = 'com.github.bright.slf4android' - artifactId = 'slf4android-handler-file-log' - version = '1.0' - - afterEvaluate { - from components.release - } - } - } -} diff --git a/handler-file-log/gradle.properties b/handler-file-log/gradle.properties new file mode 100644 index 0000000..b6687e7 --- /dev/null +++ b/handler-file-log/gradle.properties @@ -0,0 +1,3 @@ +POM_ARTIFACT_ID=handler-file-log +POM_NAME=File logging handler +POM_DESCRIPTION=A handler for file logging \ No newline at end of file diff --git a/handler-notify-developer/build.gradle b/handler-notify-developer/build.gradle index 7b72347..6b4fcc5 100644 --- a/handler-notify-developer/build.gradle +++ b/handler-notify-developer/build.gradle @@ -1,6 +1,6 @@ plugins { id 'com.android.library' - id 'maven-publish' + id 'com.vanniktech.maven.publish' } android { @@ -13,17 +13,15 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } - publishing { - singleVariant('release') { - withSourcesJar() - } - } - packagingOptions { - exclude 'LICENSE.txt' - exclude 'META-INF/LICENSE.txt' - exclude 'META-INF/LICENSE' - exclude 'META-INF/NOTICE' + resources { + excludes += [ + 'LICENSE.txt', + 'META-INF/LICENSE.txt', + 'META-INF/LICENSE', + 'META-INF/NOTICE' + ] + } } useLibrary 'android.test.runner' @@ -53,17 +51,3 @@ dependencies { androidTestImplementation 'androidx.test:rules:1.5.0' androidTestImplementation 'org.easytesting:fest-util:1.2.5' } - -publishing { - publications { - release(MavenPublication) { - groupId = 'com.github.bright.slf4android' - artifactId = 'slf4android-handler-notify-developer' - version = '1.0' - - afterEvaluate { - from components.release - } - } - } -} diff --git a/handler-notify-developer/gradle.properties b/handler-notify-developer/gradle.properties new file mode 100644 index 0000000..55db218 --- /dev/null +++ b/handler-notify-developer/gradle.properties @@ -0,0 +1,3 @@ +POM_ARTIFACT_ID=handler-notify-developer +POM_NAME=Notify developer handler +POM_DESCRIPTION=A handler that notifies the app developer about an error when the device is shaked \ No newline at end of file diff --git a/jitpack.yml b/jitpack.yml index d572981..2319196 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,3 +1,3 @@ before_install: - - sdk install java 17.0.9-tem - - sdk use java 17.0.9-tem \ No newline at end of file + - sdk install java 21.0.3-tem + - sdk use java 21.0.3-tem \ No newline at end of file