diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..52f6ba6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space + +[*.{kt,kts}] +indent_size = 4 +ij_continuation_indent_size = 4 +ij_kotlin_allow_trailing_comma = true +ij_kotlin_allow_trailing_comma_on_call_site = true +ij_kotlin_name_count_to_use_star_import = 9999 +ij_kotlin_name_count_to_use_star_import_for_members = 9999 + +[*.{yml,yaml}] +indent_size = 2 +ij_yaml_indent_sequence_value = false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8edf58..641b3eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,22 +9,22 @@ jobs: runs-on: macos-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '8' - - - name: Publish artifacts to maven central - run: ./gradlew publishAllPublicationsToMavenCentralRepository - env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USER }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASS }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASS }} + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '8' + + - name: Publish artifacts to maven central + run: ./gradlew publishAllPublicationsToMavenCentralRepository + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USER }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASS }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASS }} release: name: Create github release @@ -32,18 +32,18 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Read version - run: | - version=$(cat trckr.version | tr -d '\n') - echo "version=$version" >> $GITHUB_ENV - - - name: Create release - uses: softprops/action-gh-release@v1 - with: - body_path: ${{ github.workspace }}/changelog.md - name: v${{ env.version }} - tag_name: v${{ env.version }} - token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v3 + + - name: Read version + run: | + version=$(cat trckr.version | tr -d '\n') + echo "version=$version" >> $GITHUB_ENV + + - name: Create release + uses: softprops/action-gh-release@v1 + with: + body_path: ${{ github.workspace }}/changelog.md + name: v${{ env.version }} + tag_name: v${{ env.version }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f6d77e5..9c3c493 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,16 +10,19 @@ jobs: runs-on: macos-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '8' + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '8' - - name: Run tests - # Temporary run tests only for JVM target, because ios/watchos/tvos tests fail. - # TODO: https://youtrack.jetbrains.com/issue/KT-54814 - run: ./gradlew jvmTest + - name: Check public API + run: ./gradlew apiCheck + + - name: Run tests + # Temporary run tests only for JVM target, because ios/watchos/tvos tests fail. + # TODO: https://youtrack.jetbrains.com/issue/KT-54814 + run: ./gradlew jvmTest diff --git a/build.gradle.kts b/build.gradle.kts index 84f179f..e3f3070 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,6 +3,15 @@ plugins { alias(libs.plugins.ksp) apply false alias(libs.plugins.kotlin.jvm) apply false alias(libs.plugins.kotlin.multiplatform) apply false + alias(libs.plugins.binaryvalidator) +} + +apiValidation { + with(ignoredProjects) { + add("trckr-demo") + add("trckr-processor") + } + nonPublicMarkers.add("ru.cookedapp.trckr.core.annotations.internal.TrckrInternal") } allprojects { diff --git a/changelog.md b/changelog.md index 735ec14..34e9d0c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ ### Changelog * Add kotlin multiplatform support. +* Add public API validation. ### Dependencies | Dependency | Version | diff --git a/libs.versions.toml b/libs.versions.toml index 66745cc..fc9c2e4 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -6,6 +6,7 @@ publishing = "0.22.0" mockk = "1.13.2" junit = "5.9.1" compileTesting = "1.4.9" +binaryvalidator = "0.13.1" [libraries] ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" } @@ -28,3 +29,4 @@ kotlinpoet = ["kotlinpoet", "kotlinpoet-ksp"] kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +binaryvalidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryvalidator" } diff --git a/trckr-core/api/trckr-core.api b/trckr-core/api/trckr-core.api new file mode 100644 index 0000000..8fb1fcb --- /dev/null +++ b/trckr-core/api/trckr-core.api @@ -0,0 +1,109 @@ +public final class ru/cookedapp/trckr/core/TrckrBuilder { + public final fun addAdapter (Lru/cookedapp/trckr/core/adapter/TrackerAdapter;)V + public final fun addParameterConverter (Lru/cookedapp/trckr/core/converter/ParameterConverter;)V + public final fun addTypeConverter (Lru/cookedapp/trckr/core/converter/TypeConverter;)V +} + +public abstract interface class ru/cookedapp/trckr/core/TrckrCore { + public abstract fun track (Lru/cookedapp/trckr/core/event/TrckrEvent;)V +} + +public final class ru/cookedapp/trckr/core/TrckrCoreImplKt { + public static final fun createTrckr (Lkotlin/jvm/functions/Function1;)Lru/cookedapp/trckr/core/TrckrCore; +} + +public abstract interface class ru/cookedapp/trckr/core/adapter/TrackerAdapter { + public abstract fun trackEvent (Ljava/lang/String;Ljava/util/Map;)V +} + +public abstract interface annotation class ru/cookedapp/trckr/core/annotations/Event : java/lang/annotation/Annotation { + public static final field Companion Lru/cookedapp/trckr/core/annotations/Event$Companion; + public static final field NAME_PROPERTY_NAME Ljava/lang/String; + public static final field SKIP_ADAPTERS_PROPERTY_NAME Ljava/lang/String; + public abstract fun name ()Ljava/lang/String; + public abstract fun skipAdapters ()[Ljava/lang/Class; +} + +public final class ru/cookedapp/trckr/core/annotations/Event$Companion { +} + +public abstract interface annotation class ru/cookedapp/trckr/core/annotations/Param : java/lang/annotation/Annotation { + public static final field Companion Lru/cookedapp/trckr/core/annotations/Param$Companion; + public static final field NAME_PROPERTY_NAME Ljava/lang/String; + public static final field STRATEGY_PROPERTY_NAME Ljava/lang/String; + public abstract fun name ()Ljava/lang/String; + public abstract fun strategy ()Lru/cookedapp/trckr/core/annotations/data/TrackStrategy; +} + +public final class ru/cookedapp/trckr/core/annotations/Param$Companion { +} + +public abstract interface annotation class ru/cookedapp/trckr/core/annotations/Tracker : java/lang/annotation/Annotation { +} + +public final class ru/cookedapp/trckr/core/annotations/data/TrackStrategy : java/lang/Enum { + public static final field DEFAULT Lru/cookedapp/trckr/core/annotations/data/TrackStrategy; + public static final field SKIP_IF_NULL Lru/cookedapp/trckr/core/annotations/data/TrackStrategy; + public static final field TRACK_NULL Lru/cookedapp/trckr/core/annotations/data/TrackStrategy; + public static fun valueOf (Ljava/lang/String;)Lru/cookedapp/trckr/core/annotations/data/TrackStrategy; + public static fun values ()[Lru/cookedapp/trckr/core/annotations/data/TrackStrategy; +} + +public abstract interface class ru/cookedapp/trckr/core/converter/ParameterConverter { + public abstract fun convert (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; +} + +public abstract interface class ru/cookedapp/trckr/core/converter/TypeConverter { + public abstract fun convert (Ljava/lang/Object;)Ljava/lang/Object; +} + +public final class ru/cookedapp/trckr/core/event/TrckrEvent { + public fun (Ljava/lang/String;Ljava/util/List;Ljava/util/List;)V + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()Ljava/util/List; + public final fun component3 ()Ljava/util/List; + public final fun copy (Ljava/lang/String;Ljava/util/List;Ljava/util/List;)Lru/cookedapp/trckr/core/event/TrckrEvent; + public static synthetic fun copy$default (Lru/cookedapp/trckr/core/event/TrckrEvent;Ljava/lang/String;Ljava/util/List;Ljava/util/List;ILjava/lang/Object;)Lru/cookedapp/trckr/core/event/TrckrEvent; + public fun equals (Ljava/lang/Object;)Z + public final fun getName ()Ljava/lang/String; + public final fun getParameters ()Ljava/util/List; + public final fun getSkipAdapters ()Ljava/util/List; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class ru/cookedapp/trckr/core/exceptions/TrckrBuilderException : ru/cookedapp/trckr/core/exceptions/TrckrException { + public fun (Ljava/lang/String;)V + public fun getMessage ()Ljava/lang/String; +} + +public final class ru/cookedapp/trckr/core/exceptions/TrckrConversionException : ru/cookedapp/trckr/core/exceptions/TrckrException { + public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V + public fun toString ()Ljava/lang/String; +} + +public abstract class ru/cookedapp/trckr/core/exceptions/TrckrException : java/lang/Throwable { + public fun ()V +} + +public final class ru/cookedapp/trckr/core/extensions/TrckrBuilderExtensionsKt { + public static final fun addAdapters (Lru/cookedapp/trckr/core/TrckrBuilder;[Lru/cookedapp/trckr/core/adapter/TrackerAdapter;)V + public static final fun addConverters (Lru/cookedapp/trckr/core/TrckrBuilder;[Lru/cookedapp/trckr/core/converter/ParameterConverter;)V + public static final fun addConverters (Lru/cookedapp/trckr/core/TrckrBuilder;[Lru/cookedapp/trckr/core/converter/TypeConverter;)V +} + +public final class ru/cookedapp/trckr/core/param/TrckrParam { + public fun (Ljava/lang/String;Lru/cookedapp/trckr/core/annotations/data/TrackStrategy;Ljava/lang/Object;)V + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()Lru/cookedapp/trckr/core/annotations/data/TrackStrategy; + public final fun component3 ()Ljava/lang/Object; + public final fun copy (Ljava/lang/String;Lru/cookedapp/trckr/core/annotations/data/TrackStrategy;Ljava/lang/Object;)Lru/cookedapp/trckr/core/param/TrckrParam; + public static synthetic fun copy$default (Lru/cookedapp/trckr/core/param/TrckrParam;Ljava/lang/String;Lru/cookedapp/trckr/core/annotations/data/TrackStrategy;Ljava/lang/Object;ILjava/lang/Object;)Lru/cookedapp/trckr/core/param/TrckrParam; + public fun equals (Ljava/lang/Object;)Z + public final fun getName ()Ljava/lang/String; + public final fun getStrategy ()Lru/cookedapp/trckr/core/annotations/data/TrackStrategy; + public final fun getValue ()Ljava/lang/Object; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + diff --git a/trckr.version b/trckr.version index 3eefcb9..9084fa2 100644 --- a/trckr.version +++ b/trckr.version @@ -1 +1 @@ -1.0.0 +1.1.0