diff --git a/.github/workflows/android-publish-artifact.yml b/.github/workflows/android-publish-artifact.yml
new file mode 100644
index 0000000..527492d
--- /dev/null
+++ b/.github/workflows/android-publish-artifact.yml
@@ -0,0 +1,44 @@
+name: android-publish-artifact
+
+on:
+ push:
+ branches: [ develop ]
+ pull_request:
+ branches:
+ - develop
+ paths-ignore:
+ - "app/src/main/**"
+
+permissions:
+ checks: write
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: gradle/wrapper-validation-action@v3
+ - name: set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ java-version: '17'
+ distribution: 'adopt'
+ - name: Wait for tests to succeed
+ uses: lewagon/wait-on-check-action@v1.3.3
+ with:
+ ref: ${{ github.ref }}
+ running-workflow-name: android-publish-artifact
+ check-name: android-unit-test
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ wait-interval: 20
+ - uses: gradle/actions/setup-gradle@v3
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+ - name: Publish to local maven
+ run: |
+ ./gradlew build publishMavenPublicationToMavenLocal
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v3
+ with:
+ name: publications
+ path: ~/.m2/repository/io/wax911/emoji/
diff --git a/.github/workflows/android-test.yml b/.github/workflows/android-unit-test.yml
similarity index 50%
rename from .github/workflows/android-test.yml
rename to .github/workflows/android-unit-test.yml
index 5043599..e4e41aa 100644
--- a/.github/workflows/android-test.yml
+++ b/.github/workflows/android-unit-test.yml
@@ -1,4 +1,4 @@
-name: android-test
+name: android-unit-test
on:
push:
@@ -17,6 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ - uses: gradle/actions/setup-gradle@v3
- uses: gradle/wrapper-validation-action@v3
- name: set up JDK 17
uses: actions/setup-java@v4
@@ -35,31 +36,3 @@ jobs:
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
-
- instrumented:
- runs-on: macos-latest
- strategy:
- fail-fast: false
- matrix:
- api-level:
- - 23
- steps:
- - uses: actions/checkout@v4
- - uses: gradle/wrapper-validation-action@v3
- - uses: actions/setup-java@v4
- with:
- java-version: '17'
- distribution: 'adopt'
- - uses: gradle/gradle-build-action@v3
- - name: Run Tests
- uses: reactivecircus/android-emulator-runner@v2
- with:
- api-level: ${{ matrix.api-level }}
- script: ./gradlew connectedCheck
- env:
- API_LEVEL: ${{ matrix.api-level }}
- - name: Publish Integrated Test Report
- uses: mikepenz/action-junit-report@v4
- if: always() # always run even if the previous step fails
- with:
- report_paths: '**/build/androidTest-results/**/TEST-*.xml'
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 4e086b5..e47aa85 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -24,7 +24,6 @@
-
diff --git a/.idea/modules.xml b/.idea/modules.xml
index eedc221..53fdf99 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -18,10 +18,6 @@
-
-
-
-
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index aab2a75..8040c76 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -7,7 +7,6 @@ plugins {
dependencies {
implementation(project(Libraries.AniTrend.Emojify.emojify))
implementation(project(Libraries.AniTrend.Emojify.contract))
- implementation(project(Libraries.AniTrend.Emojify.initializer))
implementation(project(Libraries.AniTrend.Emojify.serializerKotlinx))
implementation(libs.google.android.material)
diff --git a/app/src/main/java/io/wax911/emojifysample/EmojiInitializer.kt b/app/src/main/java/io/wax911/emojifysample/EmojiInitializer.kt
index c5f5576..80f689f 100644
--- a/app/src/main/java/io/wax911/emojifysample/EmojiInitializer.kt
+++ b/app/src/main/java/io/wax911/emojifysample/EmojiInitializer.kt
@@ -1,9 +1,27 @@
package io.wax911.emojifysample
+import android.content.Context
+import androidx.startup.Initializer
+import io.wax911.emojify.EmojiManager
import io.wax911.emojify.contract.serializer.IEmojiDeserializer
-import io.wax911.emojify.initializer.AbstractEmojiInitializer
import io.wax911.emojify.serializer.kotlinx.KotlinxDeserializer
-class EmojiInitializer : AbstractEmojiInitializer() {
- override val serializer: IEmojiDeserializer = KotlinxDeserializer()
+class EmojiInitializer : Initializer {
+ private val serializer: IEmojiDeserializer = KotlinxDeserializer()
+
+ /**
+ * Initializes and a component given the application [Context]
+ *
+ * @param context The application context.
+ */
+ override fun create(context: Context) = EmojiManager.create(context, serializer)
+
+ /**
+ * @return A list of dependencies that this [Initializer] depends on. This is
+ * used to determine initialization order of [Initializer]s.
+ *
+ * For e.g. if a [Initializer] `B` defines another
+ * [Initializer] `A` as its dependency, then `A` gets initialized before `B`.
+ */
+ override fun dependencies() = emptyList>>()
}
diff --git a/build.gradle.kts b/build.gradle.kts
index 7986ce1..7e29485 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
+import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
+
+plugins {
+ id("org.jetbrains.dokka")
+}
buildscript {
repositories {
@@ -18,3 +23,8 @@ allprojects {
mavenCentral()
}
}
+
+tasks.withType(DokkaMultiModuleTask::class.java) {
+ outputDirectory.set(rootProject.file("dokka-docs"))
+ failOnWarning.set(false)
+}
diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/Libraries.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/Libraries.kt
index ebb594d..65ffe12 100644
--- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/Libraries.kt
+++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/Libraries.kt
@@ -8,7 +8,6 @@ object Libraries {
object Emojify {
val emojify = Modules.Library.Emojify.path()
val contract = Modules.Library.Contract.path()
- val initializer = Modules.Library.Initializer.path()
val serializerKotlinx = Modules.Library.SerializerKotlinX.path()
val serializerGson = Modules.Library.SerializerGson.path()
val serializerMoshi = Modules.Library.SerializerMoshi.path()
diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/module/Modules.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/module/Modules.kt
index 7c007ad..a0f0a1b 100644
--- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/module/Modules.kt
+++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/module/Modules.kt
@@ -18,7 +18,6 @@ internal object Modules {
enum class Library(override val id: String) : Module {
Emojify("emojify"),
Contract("contract"),
- Initializer("initializer"),
SerializerKotlinX("serializer:kotlinx"),
SerializerGson("serializer:gson"),
SerializerMoshi("serializer:moshi"),
diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidConfiguration.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidConfiguration.kt
index 02402fa..c8c3637 100644
--- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidConfiguration.kt
+++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidConfiguration.kt
@@ -19,7 +19,7 @@ internal fun Project.configureSpotless() {
spotlessExtension().run {
kotlin {
target("**/kotlin/**/*.kt")
- targetExclude("${layout.buildDirectory}/**/*.kt", "**/test/**/*.kt", "bin/**/*.kt")
+ targetExclude("${layout.buildDirectory.get()}/**/*.kt", "**/test/**/*.kt", "bin/**/*.kt")
ktlint(libs.versions.ktlint.get())
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
}
diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidOptions.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidOptions.kt
index eb114c2..28a17bc 100644
--- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidOptions.kt
+++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidOptions.kt
@@ -18,10 +18,6 @@ import java.net.URL
private fun Project.dependenciesOfProject(): List {
return when (project.name) {
- Modules.Library.Initializer.id -> listOf(
- Modules.Library.Contract,
- Modules.Library.Emojify,
- )
Modules.Library.Emojify.id -> listOf(
Modules.Library.Contract,
)
@@ -46,7 +42,7 @@ private fun Project.createMavenPublicationUsing(sourcesJar: Jar) {
version = props[PropertyTypes.VERSION]
artifact(sourcesJar)
- artifact("${project.layout.buildDirectory}/outputs/aar/${project.name}-release.aar")
+ artifact("${project.layout.buildDirectory.get()}/outputs/aar/${project.name}-release.aar")
from(component)
pom {
@@ -185,7 +181,6 @@ private fun Project.createDokkaTaskProvider() = tasks.named("dokkaHtm
}
}
-
internal fun Project.configureOptions() {
if (isLibraryModule()) {
println("Applying additional tasks options for dokka and javadoc on ${project.path}")
@@ -198,7 +193,7 @@ internal fun Project.configureOptions() {
}
val classesJar by tasks.register("classesJar", Jar::class.java) {
- from("${project.layout.buildDirectory}/intermediates/classes/release")
+ from("${project.layout.buildDirectory.get()}/intermediates/classes/release")
}
artifacts {
diff --git a/initializer/.gitignore b/initializer/.gitignore
deleted file mode 100644
index 42afabf..0000000
--- a/initializer/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/initializer/build.gradle.kts b/initializer/build.gradle.kts
deleted file mode 100644
index 01d5a59..0000000
--- a/initializer/build.gradle.kts
+++ /dev/null
@@ -1,15 +0,0 @@
-import io.wax911.emoji.buildSrc.Libraries
-
-plugins {
- id("io.wax911.emojify")
-}
-
-android {
- namespace = "io.wax911.emojify.initializer"
-}
-
-dependencies {
- implementation(project(Libraries.AniTrend.Emojify.contract))
- implementation(project(Libraries.AniTrend.Emojify.emojify))
- api(libs.androidx.startup.runtime)
-}
diff --git a/initializer/src/main/AndroidManifest.xml b/initializer/src/main/AndroidManifest.xml
deleted file mode 100644
index 87c00b7..0000000
--- a/initializer/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/initializer/src/main/kotlin/io/wax911/emojify/initializer/AbstractEmojiInitializer.kt b/initializer/src/main/kotlin/io/wax911/emojify/initializer/AbstractEmojiInitializer.kt
deleted file mode 100644
index 0fbe9bd..0000000
--- a/initializer/src/main/kotlin/io/wax911/emojify/initializer/AbstractEmojiInitializer.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2021 AniTrend
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.wax911.emojify.initializer
-
-import android.content.Context
-import androidx.startup.Initializer
-import io.wax911.emojify.EmojiManager
-import io.wax911.emojify.contract.serializer.IEmojiDeserializer
-
-/**
- * Abstract the logic of Initializer so that
- */
-abstract class AbstractEmojiInitializer : Initializer {
- abstract val serializer: IEmojiDeserializer
-
- /**
- * Initializes and a component given the application [Context]
- *
- * @param context The application context.
- */
- override fun create(context: Context) = EmojiManager.create(context, serializer)
-
- /**
- * @return A list of dependencies that this [Initializer] depends on. This is
- * used to determine initialization order of [Initializer]s.
- *
- * For e.g. if a [Initializer] `B` defines another
- * [Initializer] `A` as its dependency, then `A` gets initialized before `B`.
- */
- override fun dependencies() = emptyList>>()
-}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 65cc4f1..f97aa85 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,7 +1,6 @@
rootProject.name = "android-emojify"
include(":emojify")
include(":contract")
-include(":initializer")
include(":serializer:kotlinx")
include(":serializer:gson")
include(":serializer:moshi")