Skip to content

Commit

Permalink
Have Datadog API provide a JVM module for Android consumers (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
twyatt authored Aug 30, 2023
1 parent 689df25 commit cd7adca
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 30 deletions.
2 changes: 1 addition & 1 deletion bundled/api/bundled.api
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public final class com/juul/datadog/DatadogInitializer : com/juul/datadog/Initia
public fun setTrackingConsent (Lcom/juul/datadog/TrackingConsent;)V
}

public final class com/juul/datadog/DatadogLogger : com/juul/datadog/AndroidLogger {
public final class com/juul/datadog/DatadogLogger : com/juul/datadog/JvmLogger {
public fun <init> (Ljava/lang/String;Lcom/juul/datadog/Logger$Level;Lcom/juul/datadog/LoggerConfiguration;)V
public synthetic fun <init> (Ljava/lang/String;Lcom/juul/datadog/Logger$Level;Lcom/juul/datadog/LoggerConfiguration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun debug (Ljava/lang/String;Ljava/util/Map;Ljava/lang/Throwable;)V
Expand Down
2 changes: 1 addition & 1 deletion bundled/src/androidMain/kotlin/DatadogLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public actual class DatadogLogger actual constructor(
name: String,
level: Logger.Level?,
configuration: LoggerConfiguration?,
) : AndroidLogger {
) : JvmLogger {

private val logger: DatadogLogger = DatadogLogger.Builder()
.setName(name)
Expand Down
2 changes: 1 addition & 1 deletion bundled/src/androidMain/kotlin/PlatformLogger.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package com.juul.datadog

public actual typealias PlatformLogger = AndroidLogger
public actual typealias PlatformLogger = JvmLogger
16 changes: 8 additions & 8 deletions datadog/api/datadog.api
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
public abstract interface class com/juul/datadog/AndroidLogger : com/juul/datadog/Logger {
public abstract fun verbose (Ljava/lang/String;Ljava/util/Map;Ljava/lang/Throwable;)V
}

public final class com/juul/datadog/AndroidLogger$DefaultImpls {
public static synthetic fun verbose$default (Lcom/juul/datadog/AndroidLogger;Ljava/lang/String;Ljava/util/Map;Ljava/lang/Throwable;ILjava/lang/Object;)V
}

public final class com/juul/datadog/Configuration {
public fun <init> (Ljava/lang/String;Lcom/juul/datadog/Site;Ljava/lang/String;Ljava/lang/String;Lcom/juul/datadog/Configuration$Features;Lcom/juul/datadog/Configuration$UploadFrequency;)V
public synthetic fun <init> (Ljava/lang/String;Lcom/juul/datadog/Site;Ljava/lang/String;Ljava/lang/String;Lcom/juul/datadog/Configuration$Features;Lcom/juul/datadog/Configuration$UploadFrequency;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
Expand Down Expand Up @@ -59,6 +51,14 @@ public final class com/juul/datadog/Initializer$DefaultImpls {
public static synthetic fun initialize$default (Lcom/juul/datadog/Initializer;Lcom/juul/datadog/TrackingConsent;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V
}

public abstract interface class com/juul/datadog/JvmLogger : com/juul/datadog/Logger {
public abstract fun verbose (Ljava/lang/String;Ljava/util/Map;Ljava/lang/Throwable;)V
}

public final class com/juul/datadog/JvmLogger$DefaultImpls {
public static synthetic fun verbose$default (Lcom/juul/datadog/JvmLogger;Ljava/lang/String;Ljava/util/Map;Ljava/lang/Throwable;ILjava/lang/Object;)V
}

public abstract interface class com/juul/datadog/Logger {
public abstract fun debug (Ljava/lang/String;Ljava/util/Map;Ljava/lang/Throwable;)V
public abstract fun error (Ljava/lang/String;Ljava/util/Map;Ljava/lang/Throwable;)V
Expand Down
24 changes: 6 additions & 18 deletions datadog/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
plugins {
// Android plugin must be before multiplatform plugin until https://youtrack.jetbrains.com/issue/KT-34038 is fixed.
alias(libs.plugins.android.library)
kotlin("multiplatform")
alias(libs.plugins.kotlinter)
`maven-publish`
Expand All @@ -12,16 +10,16 @@ kotlin {

/* common
* |-- js
* |-- mobile
* | |-- android
* | '-- ios
* '-- macos
* |-- macos
* '-- mobile
* |-- ios
* '-- jvm
*/

androidTarget().publishAllLibraryVariants()
iosArm64()
iosSimulatorArm64()
js().browser()
jvm()
macosArm64()
macosX64()

Expand All @@ -32,7 +30,7 @@ kotlin {
dependsOn(commonMain)
}

val androidMain by getting {
val jvmMain by getting {
dependsOn(mobileMain)
}

Expand Down Expand Up @@ -61,13 +59,3 @@ kotlin {
}
}
}

android {
compileSdk = libs.versions.android.compile.get().toInt()
defaultConfig.minSdk = libs.versions.android.min.get().toInt()
namespace = "com.juul.datadog"
lint {
abortOnError = true
warningsAsErrors = true
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.juul.datadog

public interface AndroidLogger : Logger {
public interface JvmLogger : Logger {
public fun verbose(message: String, attributes: Map<String, Any?>? = null, throwable: Throwable? = null)
}
File renamed without changes.

0 comments on commit cd7adca

Please sign in to comment.