diff --git a/build.gradle b/build.gradle
index fe00bc6..2f96037 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,10 @@
buildscript {
repositories {
google()
- jcenter()
+ mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.2.1'
+ classpath 'com.android.tools.build:gradle:8.3.2'
}
}
@@ -12,28 +12,27 @@ allprojects {
repositories {
google()
mavenCentral()
- jcenter()
}
}
ext {
minSdkVersion = 9
- targetSdkVersion = 28
- compileSdkVersion = 28
+ targetSdkVersion = 33
+ compileSdkVersion = 33
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
targetCompatibilityVersion = JavaVersion.VERSION_1_7
}
ext.deps = [
// Compile dependencies
- slf4j : 'org.slf4j:slf4j-api:1.7.25',
- timber : 'com.jakewharton.timber:timber:4.7.1',
+ slf4j : 'org.slf4j:slf4j-api:2.0.13',
+ timber : 'com.jakewharton.timber:timber:5.0.1',
// Test dependencies testImplementation 'org.junit.vintage:junit-vintage-engine:5.3.1'
- junit : 'org.junit.vintage:junit-vintage-engine:5.3.1',
+ junit : 'org.junit.vintage:junit-vintage-engine:5.10.2',
festassert : 'org.easytesting:fest-assert-core:2.0M10',
festandroid: 'com.squareup:fest-android:1.0.8',
mockitocore: 'org.mockito:mockito-core:2.23.0',
- robolectric: 'org.robolectric:robolectric:3.8',
+ robolectric: 'org.robolectric:robolectric:4.12',
]
diff --git a/gradle.properties b/gradle.properties
index 5c9011a..640daa9 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,5 @@
+android.useAndroidX=true
+
GROUP=com.arcao
VERSION_NAME=3.2-SNAPSHOT
diff --git a/gradle/gradle-mvn-push.gradle b/gradle/gradle-mvn-push.gradle
index bc5008b..3a3c81e 100644
--- a/gradle/gradle-mvn-push.gradle
+++ b/gradle/gradle-mvn-push.gradle
@@ -14,101 +14,78 @@
* limitations under the License.
*/
-apply plugin: 'maven'
+apply plugin: 'maven-publish'
apply plugin: 'signing'
-def isReleaseBuild() {
- return VERSION_NAME.contains("SNAPSHOT") == false
-}
-
-def getRepositoryUsername() {
- return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : ""
+android {
+ publishing {
+ singleVariant("release") {
+ withSourcesJar()
+ withJavadocJar()
+ }
+ }
}
-def getRepositoryPassword() {
- return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : ""
+def isReleaseBuild() {
+ return VERSION_NAME.contains("SNAPSHOT") == false
}
-afterEvaluate { project ->
- uploadArchives {
- repositories {
- mavenDeployer {
- beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-
- pom.groupId = GROUP
- pom.artifactId = POM_ARTIFACT_ID
- pom.version = VERSION_NAME
-
- repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
- authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
+publishing {
+ publications {
+ release(MavenPublication) {
+ groupId = GROUP
+ artifactId = POM_ARTIFACT_ID
+ version = VERSION_NAME
+
+ pom {
+ name = POM_NAME
+ description = POM_DESCRIPTION
+ url = POM_URL
+
+ scm {
+ url = POM_SCM_URL
+ connection = POM_SCM_CONNECTION
+ developerConnection = POM_SCM_DEV_CONNECTION
}
- snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
- authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
- }
-
- pom.project {
- name POM_NAME
- packaging POM_PACKAGING
- description POM_DESCRIPTION
- url POM_URL
- scm {
- url POM_SCM_URL
- connection POM_SCM_CONNECTION
- developerConnection POM_SCM_DEV_CONNECTION
- }
-
- licenses {
- license {
- name POM_LICENCE_NAME
- url POM_LICENCE_URL
- distribution POM_LICENCE_DIST
- }
+ licenses {
+ license {
+ name = POM_LICENCE_NAME
+ url = POM_LICENCE_URL
+ distribution = POM_LICENCE_DIST
}
+ }
- developers {
- developer {
- id POM_DEVELOPER_ID
- name POM_DEVELOPER_NAME
- email POM_DEVELOPER_EMAIL
- url POM_DEVELOPER_URL
- }
+ developers {
+ developer {
+ id = POM_DEVELOPER_ID
+ name = POM_DEVELOPER_NAME
+ email = POM_DEVELOPER_EMAIL
+ url = POM_DEVELOPER_URL
}
}
}
- }
- }
-
- signing {
- required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
- sign configurations.archives
- }
- task androidJavadocs(type: Javadoc) {
- source = android.sourceSets.main.java.srcDirs
- classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
-
- if (JavaVersion.current().isJava8Compatible()) {
- allprojects {
- tasks.withType(Javadoc) {
- options.addStringOption('Xdoclint:none', '-quiet')
- }
+ afterEvaluate {
+ from components.release
}
}
}
-
- task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
- classifier = 'javadoc'
- from androidJavadocs.destinationDir
- }
-
- task androidSourcesJar(type: Jar) {
- classifier = 'sources'
- from android.sourceSets.main.java.sourceFiles
- }
-
- artifacts {
- archives androidSourcesJar
- archives androidJavadocsJar
+ repositories {
+ maven {
+ if (isReleaseBuild()) {
+ url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+ } else {
+ url = "https://oss.sonatype.org/content/repositories/snapshots/"
+ }
+ credentials {
+ username hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : ""
+ password hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : ""
+ }
+ }
}
}
+signing {
+ required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
+ sign publishing.publications.release
+}
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e0b3fb8..48c0a02 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/slf4j-timber/build.gradle b/slf4j-timber/build.gradle
index 6198b9c..76c2d3e 100644
--- a/slf4j-timber/build.gradle
+++ b/slf4j-timber/build.gradle
@@ -2,45 +2,49 @@ apply plugin: 'com.android.library'
apply plugin: 'checkstyle'
task checkstyle(type: Checkstyle) {
- configFile rootProject.file('checkstyle.xml')
- source 'src/main/java'
- ignoreFailures false
- showViolations true
- include '**/*.java'
+ configFile rootProject.file('checkstyle.xml')
+ source 'src/main/java'
+ ignoreFailures false
+ showViolations true
+ include '**/*.java'
- classpath = files()
+ classpath = files()
}
afterEvaluate {
- if (project.tasks.findByName('check')) {
- check.dependsOn('checkstyle')
- }
+ if (project.tasks.findByName('check')) {
+ check.dependsOn('checkstyle')
+ }
}
android {
- compileSdkVersion rootProject.ext.compileSdkVersion
-
- defaultConfig {
- minSdkVersion rootProject.ext.minSdkVersion
- consumerProguardFiles 'consumer-proguard-rules.pro'
- }
-
- lintOptions {
- textReport true
- textOutput 'stdout'
- }
+ namespace = 'com.arcao.slf4j.timber'
+ compileSdkVersion = rootProject.ext.compileSdkVersion
+
+ defaultConfig {
+ aarMetadata {
+ minCompileSdk = rootProject.ext.minSdkVersion
+ }
+ minSdkVersion rootProject.ext.minSdkVersion
+ consumerProguardFiles 'consumer-proguard-rules.pro'
+ }
+
+ lintOptions {
+ textReport true
+ textOutput 'stdout'
+ }
}
dependencies {
- compileOnly 'org.jetbrains:annotations:16.0.1'
-
- implementation deps.slf4j
- implementation deps.timber
-
- testImplementation deps.festandroid
- testImplementation deps.festassert
- testImplementation deps.junit
- testImplementation deps.robolectric
+ compileOnly 'org.jetbrains:annotations:16.0.1'
+
+ implementation deps.slf4j
+ implementation deps.timber
+
+ testImplementation deps.festandroid
+ testImplementation deps.festassert
+ testImplementation deps.junit
+ testImplementation deps.robolectric
}
-apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
+apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
\ No newline at end of file
diff --git a/slf4j-timber/src/main/AndroidManifest.xml b/slf4j-timber/src/main/AndroidManifest.xml
deleted file mode 100644
index 9d4db1c..0000000
--- a/slf4j-timber/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/slf4j-timber/src/main/java/com/arcao/slf4j/timber/TimberLoggerServiceProvider.java b/slf4j-timber/src/main/java/com/arcao/slf4j/timber/TimberLoggerServiceProvider.java
new file mode 100644
index 0000000..ecb1ddd
--- /dev/null
+++ b/slf4j-timber/src/main/java/com/arcao/slf4j/timber/TimberLoggerServiceProvider.java
@@ -0,0 +1,51 @@
+package com.arcao.slf4j.timber;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.IMarkerFactory;
+import org.slf4j.helpers.BasicMarkerFactory;
+import org.slf4j.helpers.NOPMDCAdapter;
+import org.slf4j.spi.MDCAdapter;
+import org.slf4j.spi.SLF4JServiceProvider;
+
+/**
+ * The binding of {@link org.slf4j.LoggerFactory} class with an actual instance of
+ * {@link ILoggerFactory} is performed using information returned by this class.
+ *
+ * @author Martin Sloup
+ */
+public class TimberLoggerServiceProvider implements SLF4JServiceProvider {
+ /**
+ * Declare the version of the SLF4J API this implementation is compiled against.
+ * The value of this field is modified with each major release.
+ */
+ public static String REQUESTED_API_VERSION = "2.0.99".intern(); /* avoid constant folding by the compiler */
+
+ private final ILoggerFactory loggerFactory = new TimberLoggerFactory();
+ private final IMarkerFactory markerFactory = new BasicMarkerFactory();
+ private final MDCAdapter mdcAdapter = new NOPMDCAdapter();
+
+ @Override
+ public ILoggerFactory getLoggerFactory() {
+ return loggerFactory;
+ }
+
+ @Override
+ public IMarkerFactory getMarkerFactory() {
+ return markerFactory;
+ }
+
+ @Override
+ public MDCAdapter getMDCAdapter() {
+ return mdcAdapter;
+ }
+
+ @Override
+ public String getRequestedApiVersion() {
+ return REQUESTED_API_VERSION;
+ }
+
+ @Override
+ public void initialize() {
+
+ }
+}
diff --git a/slf4j-timber/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/slf4j-timber/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
deleted file mode 100644
index ed5a77a..0000000
--- a/slf4j-timber/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.slf4j.impl;
-
-import org.slf4j.ILoggerFactory;
-import org.slf4j.spi.LoggerFactoryBinder;
-
-import com.arcao.slf4j.timber.TimberLoggerFactory;
-
-/**
- * The binding of {@link org.slf4j.LoggerFactory} class with an actual instance of
- * {@link ILoggerFactory} is performed using information returned by this class.
- *
- * @author Martin Sloup
- */
-public class StaticLoggerBinder implements LoggerFactoryBinder {
- public static String REQUESTED_API_VERSION = "1.7.7"; // SUPPRESS CHECKSTYLE slf4j
-
- /**
- * The unique instance of this class.
- */
- private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
-
- /**
- * Return the singleton of this class.
- *
- * @return the StaticLoggerBinder singleton
- */
- public static StaticLoggerBinder getSingleton() {
- return SINGLETON;
- }
-
- /**
- * The ILoggerFactory instance returned by the {@link #getLoggerFactory} method
- * should always be the same object
- */
- private final ILoggerFactory loggerFactory;
-
- private StaticLoggerBinder() {
- loggerFactory = new TimberLoggerFactory();
- }
-
- @Override
- public ILoggerFactory getLoggerFactory() {
- return loggerFactory;
- }
-
- @Override
- public String getLoggerFactoryClassStr() {
- return loggerFactory.getClass().getName();
- }
-}
diff --git a/slf4j-timber/src/main/java/org/slf4j/impl/StaticMDCBinder.java b/slf4j-timber/src/main/java/org/slf4j/impl/StaticMDCBinder.java
deleted file mode 100644
index 5c7c687..0000000
--- a/slf4j-timber/src/main/java/org/slf4j/impl/StaticMDCBinder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.slf4j.impl;
-
-import org.slf4j.helpers.NOPMDCAdapter;
-import org.slf4j.spi.MDCAdapter;
-
-
-/**
- * This implementation is bound to {@link NOPMDCAdapter}.
- *
- * @author Martin Sloup
- */
-public class StaticMDCBinder {
-
- /**
- * The unique instance of this class.
- */
- public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
-
- private StaticMDCBinder() {
- }
-
- /**
- * Currently this method always returns an instance of
- * {@link NOPMDCAdapter}.
- */
- public MDCAdapter getMDCA() {
- return new NOPMDCAdapter();
- }
-
- public String getMDCAdapterClassStr() {
- return NOPMDCAdapter.class.getName();
- }
-}
diff --git a/slf4j-timber/src/main/java/org/slf4j/impl/StaticMarkerBinder.java b/slf4j-timber/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
deleted file mode 100644
index 6b6e69b..0000000
--- a/slf4j-timber/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.slf4j.impl;
-
-import org.slf4j.IMarkerFactory;
-import org.slf4j.helpers.BasicMarkerFactory;
-import org.slf4j.spi.MarkerFactoryBinder;
-
-/**
- *
- * The binding of {@link org.slf4j.MarkerFactory} class with an actual instance of
- * {@link IMarkerFactory} is performed using information returned by this class.
- *
- * @author Martin Sloup
- */
-public class StaticMarkerBinder implements MarkerFactoryBinder {
-
- /**
- * The unique instance of this class.
- */
- public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();
-
- final IMarkerFactory markerFactory = new BasicMarkerFactory();
-
- private StaticMarkerBinder() {
- }
-
- /**
- * Currently this method always returns an instance of
- * {@link BasicMarkerFactory}.
- */
- @Override
- public IMarkerFactory getMarkerFactory() {
- return markerFactory;
- }
-
- /**
- * Currently, this method returns the class name of
- * {@link BasicMarkerFactory}.
- */
- @Override
- public String getMarkerFactoryClassStr() {
- return markerFactory.getClass().getName();
- }
-}
diff --git a/slf4j-timber/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider b/slf4j-timber/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider
new file mode 100644
index 0000000..bcd0ec5
--- /dev/null
+++ b/slf4j-timber/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider
@@ -0,0 +1 @@
+com.arcao.slf4j.timber.TimberLoggerServiceProvider
\ No newline at end of file
diff --git a/slf4j-timber/src/test/java/com/arcao/slf4j/timber/TimberLoggerAdapterTest.java b/slf4j-timber/src/test/java/com/arcao/slf4j/timber/TimberLoggerAdapterTest.java
index 9f1afeb..a7a5af4 100644
--- a/slf4j-timber/src/test/java/com/arcao/slf4j/timber/TimberLoggerAdapterTest.java
+++ b/slf4j-timber/src/test/java/com/arcao/slf4j/timber/TimberLoggerAdapterTest.java
@@ -40,4 +40,4 @@ public class TimberLoggerAdapterTest {
assertThat(log.msg).isEqualTo("Hello, world!");
assertThat(log.throwable).isNull();
}
-}
+}
\ No newline at end of file