Skip to content

Commit

Permalink
Merge pull request #1115 from embrace-io/setup-api-module
Browse files Browse the repository at this point in the history
Setup api module
  • Loading branch information
fractalwrench authored Jul 17, 2024
2 parents 9f5b3b8 + 4e20cfa commit 7b21006
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository -Dorg.gradle.parallel=false --stacktrace
- name: Generate Documentation
run: ./gradlew dokkaHtml
run: ./gradlew dokkaHtmlMultiModule

- name: Configure git
run: |
Expand All @@ -59,7 +59,7 @@ jobs:
- name: Publish gh-pages
run: |
mv docs .docs-newly-generated # new docs generated by previous step
mv embrace-android-sdk/build/dokka/html .docs-newly-generated # new docs generated by previous step
git checkout gh-pages
git rm -rf docs # old docs on gh-pages branch
mv .docs-newly-generated docs
Expand Down
28 changes: 27 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
import java.io.FileInputStream
import java.util.Properties
import org.jetbrains.dokka.gradle.DokkaTaskPartial

buildscript {
repositories {
Expand All @@ -19,10 +20,11 @@ plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("com.android.library") apply false
id("org.jetbrains.kotlin.android") apply false
id("org.jetbrains.dokka") version "1.9.20"
}

group = "io.embrace"
version = project.version//.properties.getVersion()
version = project.version

// load credentials from local properties if present
val localProperties = Properties()
Expand All @@ -47,3 +49,27 @@ allprojects {
maven(url = "https://plugins.gradle.org/m2/")
}
}

// You can apply and configure Dokka in each subproject
// individially or configure all subprojects at once
subprojects {
if (project.name == "embrace-android-sdk" || project.name == "embrace-android-api") {
apply(plugin = "org.jetbrains.dokka")
}

tasks.withType<DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
perPackageOption {
skipDeprecated.set(false)
reportUndocumented.set(true) // Emit warnings about not documented members
includeNonPublic.set(false)

// Suppress files in the internal package
matchingRegex.set(".*.internal.*?")
suppress.set(true)
}
suppressObviousFunctions.set(true)
noAndroidSdkLink.set(false)
}
}
}
8 changes: 8 additions & 0 deletions embrace-android-api/api/embrace-android-api.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public final class io/embrace/android/embracesdk/Severity : java/lang/Enum {
public static final field ERROR Lio/embrace/android/embracesdk/Severity;
public static final field INFO Lio/embrace/android/embracesdk/Severity;
public static final field WARNING Lio/embrace/android/embracesdk/Severity;
public static fun valueOf (Ljava/lang/String;)Lio/embrace/android/embracesdk/Severity;
public static fun values ()[Lio/embrace/android/embracesdk/Severity;
}

14 changes: 14 additions & 0 deletions embrace-android-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id("embrace-defaults")
}

description = "Embrace Android SDK: API"

android {
namespace = "io.embrace.android.embracesdk.api"
}

dependencies {
compileOnly(platform(libs.opentelemetry.bom))
compileOnly(libs.opentelemetry.api)
}
15 changes: 15 additions & 0 deletions embrace-android-api/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.5.1" type="baseline" client="gradle" dependencies="false" name="AGP (8.5.1)" variant="all" version="8.5.1">

<issue
id="EmbracePublicApiPackageRule"
message="Don&apos;t put classes in the io.embrace.android.embracesdk package unless they&apos;re part of the public API. Please move the new class to an appropriate package or (if you&apos;re adding to the public API) suppress this error via the lint baseline file."
errorLine1="public enum Severity {"
errorLine2=" ~~~~~~~~">
<location
file="src/main/java/io/embrace/android/embracesdk/Severity.java"
line="6"
column="13"/>
</issue>

</issues>
1 change: 1 addition & 0 deletions embrace-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ apiValidation.validationDisabled = true

dependencies {
implementation(project(":embrace-android-payload"))
compileOnly(project(":embrace-android-api"))
compileOnly(platform(libs.opentelemetry.bom))
compileOnly(libs.opentelemetry.api)
compileOnly(libs.opentelemetry.semconv)
Expand Down
8 changes: 0 additions & 8 deletions embrace-android-sdk/api/embrace-android-sdk.api
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,6 @@ public abstract interface class io/embrace/android/embracesdk/ReactNativeInterna
public abstract fun setReactNativeVersionNumber (Ljava/lang/String;)V
}

public final class io/embrace/android/embracesdk/Severity : java/lang/Enum {
public static final field ERROR Lio/embrace/android/embracesdk/Severity;
public static final field INFO Lio/embrace/android/embracesdk/Severity;
public static final field WARNING Lio/embrace/android/embracesdk/Severity;
public static fun valueOf (Ljava/lang/String;)Lio/embrace/android/embracesdk/Severity;
public static fun values ()[Lio/embrace/android/embracesdk/Severity;
}

public abstract interface class io/embrace/android/embracesdk/UnityInternalInterface : io/embrace/android/embracesdk/internal/EmbraceInternalInterface {
public abstract fun installUnityThreadSampler ()V
public abstract fun logHandledUnityException (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
Expand Down
35 changes: 3 additions & 32 deletions embrace-android-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import io.embrace.gradle.Versions
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.DokkaBaseConfiguration
import org.jetbrains.dokka.gradle.DokkaTask

plugins {
id("embrace-defaults")
id("org.jetbrains.kotlin.kapt")
id("org.jetbrains.dokka")
}

description = "Embrace Android SDK: Core"
Expand Down Expand Up @@ -48,6 +44,8 @@ dependencies {
kover(project(":embrace-android-okhttp3"))
kover(project(":embrace-android-core"))
kover(project(":embrace-android-features"))
kover(project(":embrace-android-payload"))
kover(project(":embrace-android-api"))
}

kover {
Expand All @@ -65,6 +63,7 @@ kover {
}

dependencies {
api(project(":embrace-android-api"))
implementation(project(":embrace-android-core"))
implementation(project(":embrace-android-features"))
implementation(project(":embrace-android-payload"))
Expand All @@ -90,34 +89,6 @@ dependencies {
testImplementation(libs.protobuf.java)
testImplementation(libs.protobuf.java.util)
testImplementation(libs.kotlin.reflect)

dokkaHtmlPlugin(libs.dokka.convert)
dokkaHtmlPlugin(libs.dokka.docs)
}

tasks.withType<DokkaTask>().configureEach {
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
outputDirectory.set(rootProject.file("docs"))
dokkaSourceSets {
configureEach {
perPackageOption {
skipDeprecated.set(false)
reportUndocumented.set(true) // Emit warnings about not documented members
includeNonPublic.set(false)

// Suppress files in the internal package
perPackageOption {
matchingRegex.set(".*.internal.*?")
suppress.set(true)
}
}
}
named("main") {
noAndroidSdkLink.set(false)
}
}
suppressObviousFunctions.set(true)
}
}

project.tasks.register("publishLocal") { dependsOn("publishMavenPublicationToMavenLocal") }
Expand Down
21 changes: 5 additions & 16 deletions embrace-android-sdk/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.5.0" type="baseline" client="gradle" dependencies="false" name="AGP (8.5.0)" variant="all" version="8.5.0">
<issues format="6" by="lint 8.5.1" type="baseline" client="gradle" dependencies="false" name="AGP (8.5.1)" variant="all" version="8.5.1">

<issue
id="DefaultLocale"
Expand Down Expand Up @@ -52,7 +52,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/embrace/android/embracesdk/FlutterInternalInterface.kt"
line="11"
line="12"
column="18"/>
</issue>

Expand Down Expand Up @@ -85,29 +85,18 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/embrace/android/embracesdk/ReactNativeInternalInterface.kt"
line="12"
line="13"
column="18"/>
</issue>

<issue
id="EmbracePublicApiPackageRule"
message="Don&apos;t put classes in the io.embrace.android.embracesdk package unless they&apos;re part of the public API. Please move the new class to an appropriate package or (if you&apos;re adding to the public API) suppress this error via the lint baseline file."
errorLine1="public enum Severity {"
errorLine2=" ~~~~~~~~">
<location
file="src/main/java/io/embrace/android/embracesdk/Severity.java"
line="6"
column="13"/>
</issue>

<issue
id="EmbracePublicApiPackageRule"
message="Don&apos;t put classes in the io.embrace.android.embracesdk package unless they&apos;re part of the public API. Please move the new class to an appropriate package or (if you&apos;re adding to the public API) suppress this error via the lint baseline file."
errorLine1="public interface UnityInternalInterface : EmbraceInternalInterface {"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/embrace/android/embracesdk/UnityInternalInterface.kt"
line="11"
line="12"
column="18"/>
</issue>

Expand Down Expand Up @@ -195,7 +184,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="build.gradle.kts"
line="77"
line="81"
column="5"/>
</issue>

Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include(
":embrace-android-api",
":embrace-android-sdk",
":embrace-android-core",
":embrace-android-features",
Expand Down

0 comments on commit 7b21006

Please sign in to comment.