Skip to content

Commit

Permalink
Merge pull request #14 from dzmpr/develop
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
dzmpr authored May 7, 2023
2 parents 1523612 + a7f8855 commit 427ca66
Show file tree
Hide file tree
Showing 58 changed files with 375 additions and 129 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
67 changes: 32 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,44 @@ on:
jobs:
publish:
name: Publish artifacts
runs-on: ubuntu-latest
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: 'adopt'
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
needs: publish
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: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitish: ${{ github.ref }}
tag_name: v${{ env.version }}
release_name: v${{ env.version }}
body: "Will be filled later."
draft: true
- 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 }}
39 changes: 19 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
name: Tests

# Controls when the workflow will run
on:
# Triggers the workflow pull request events but only for the "main" branch
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
tests:
name: Run unit tests
runs-on: macos-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- name: Test with Gradle
run: ./gradlew test
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'

- 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
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/ru.cookedapp.trckr/trckr-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ru.cookedapp.trckr/trckr-core)
[![CI](https://github.com/dzmpr/trckr/actions/workflows/tests.yml/badge.svg)](https://github.com/dzmpr/trckr/actions/workflows/tests.yml)
[![KMM](https://img.shields.io/badge/KMM-supported-orange)](https://kotlinlang.org/docs/multiplatform-mobile-getting-started.html)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Trckr is **Kotlin Symbol Processor** to help you send analytics to multiple destinations (called adapters).
Expand Down Expand Up @@ -62,8 +63,11 @@ dependencies {

To access generated code from KSP, you need to set up the source path into your module's `build.gradle.kts` file:
```kotlin
sourceSets.configureEach {
kotlin.srcDir("$buildDir/generated/ksp/$name/kotlin/")
kotlin {
// ...
sourceSets.configureEach {
kotlin.srcDir("$buildDir/generated/ksp/$name/kotlin/")
}
}
```

Expand Down
2 changes: 0 additions & 2 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ plugins {
}

repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
implementation(libs.kotlin.plugin)
implementation(libs.publishing.plugin)
}
1 change: 0 additions & 1 deletion build-logic/src/main/kotlin/trckr-artifact.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import com.vanniktech.maven.publish.SonatypeHost
import ru.cookedapp.trckr.gradle.isVersionStringValid

plugins {
id("trckr-module")
id("com.vanniktech.maven.publish")
}

Expand Down
13 changes: 0 additions & 13 deletions build-logic/src/main/kotlin/trckr-module.gradle.kts

This file was deleted.

10 changes: 10 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
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 {
Expand Down
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Changelog
* Add kotlin multiplatform support.
* Add public API validation.

### Dependencies
| Dependency | Version |
|------------|:--------------:|
| Kotlin | `1.7.20` |
| KSP | `1.7.20-1.0.7` |
4 changes: 3 additions & 1 deletion libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ 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" }
kotlinpoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinpoet" }
kotlinpoet-ksp = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlinpoet" }
# Compiled plugins
kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
publishing-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "publishing" }
# Test dependencies
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
Expand All @@ -27,4 +27,6 @@ kotlinpoet = ["kotlinpoet", "kotlinpoet-ksp"]

[plugins]
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" }
109 changes: 109 additions & 0 deletions trckr-core/api/trckr-core.api
Original file line number Diff line number Diff line change
@@ -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 <init> (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 <init> (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 <init> (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 <init> ()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 <init> (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;
}

Loading

0 comments on commit 427ca66

Please sign in to comment.