Skip to content

Commit

Permalink
Merge pull request #31 from teogor/cleanup/remove-deprecated-elements
Browse files Browse the repository at this point in the history
Remove Deprecated Elements from Codebase
  • Loading branch information
teogor authored Aug 20, 2024
2 parents 9573fa7 + 4afd118 commit bd20a4f
Show file tree
Hide file tree
Showing 22 changed files with 227 additions and 564 deletions.
9 changes: 7 additions & 2 deletions codegen/api/codegen.api
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ public final class dev/teogor/drifter/codegen/CodeGenerator : dev/teogor/drifter
public fun getCodeOutputStreamMaker ()Ldev/teogor/drifter/codegen/facades/CodeOutputStreamMaker;
}

public final class dev/teogor/drifter/codegen/commons/ConstantsKt {
public static final fun getUnityMessageSender ()Lcom/squareup/kotlinpoet/ClassName;
public final class dev/teogor/drifter/codegen/DrifterConstants {
public static final field INSTANCE Ldev/teogor/drifter/codegen/DrifterConstants;
}

public final class dev/teogor/drifter/codegen/DrifterConstants$UnityIntegration {
public static final field INSTANCE Ldev/teogor/drifter/codegen/DrifterConstants$UnityIntegration;
public final fun getUnityMessageSender ()Lcom/squareup/kotlinpoet/ClassName;
}

public final class dev/teogor/drifter/codegen/commons/UtilsKt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,28 @@
* limitations under the License.
*/

package dev.teogor.drifter.codegen.commons
package dev.teogor.drifter.codegen

import com.squareup.kotlinpoet.ClassName

val UnityMessageSender = ClassName(
"dev.teogor.drifter.common",
"UnityMessageSender",
)
/**
* Container for constants and utility objects related to the Drifter library.
*/
object DrifterConstants {

/**
* Contains constants related to Drifter's integration with Unity.
*/
object UnityIntegration {

/**
* Represents the fully qualified class name of the `UnityMessageSender` class within the Drifter core library.
*
* This class is responsible for sending messages between Unity and the native side of the application.
*/
val UnityMessageSender = ClassName(
"dev.teogor.drifter.core",
"UnityMessageSender",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import com.squareup.kotlinpoet.FunSpec
import com.squareup.kotlinpoet.ParameterSpec
import com.squareup.kotlinpoet.TypeName
import com.squareup.kotlinpoet.TypeSpec
import dev.teogor.drifter.codegen.commons.UnityMessageSender
import dev.teogor.drifter.codegen.DrifterConstants
import dev.teogor.drifter.codegen.commons.fileBuilder
import dev.teogor.drifter.codegen.commons.safe
import dev.teogor.drifter.codegen.commons.toTitleCase
Expand All @@ -49,7 +49,7 @@ class UnityMessageSenderOutputWriter(
) {
addType(
TypeSpec.classBuilder(name)
.superclass(UnityMessageSender)
.superclass(DrifterConstants.UnityIntegration.UnityMessageSender)
.addSuperclassConstructorParameter(
"receiver = %S",
actionBridge.receiverGameObject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package dev.teogor.drifter.plugin
import com.android.build.api.dsl.CommonExtension
import dev.teogor.drifter.plugin.models.UnityOptions
import org.gradle.api.Project
import java.util.Locale

@OptIn(InternalDrifterApi::class)
fun Project.unityBuildTask(
Expand Down Expand Up @@ -57,14 +58,18 @@ fun Project.unityBuildTask(
}

afterEvaluate {
if (project(path).tasks.findByName("mergeDebugJniLibFolders") != null) {
project(path).tasks.named("mergeDebugJniLibFolders").get()
.dependsOn(unityNativeBuildTask)
}
if (project(path).tasks.findByName("mergeReleaseJniLibFolders") != null) {
project(path).tasks.named("mergeReleaseJniLibFolders").get()
.dependsOn(unityNativeBuildTask)
val buildTypeTaskNames = commonExtension.buildTypes.map {
val formattedBuildType = it.name.splitCamelCase().toTitleCase()
formattedBuildType
}

buildTypeTaskNames
.mapNotNull { formattedName ->
project(path).tasks.named("merge${formattedName}JniLibFolders").getOrNull()
}
.forEach { task ->
task.dependsOn(unityNativeBuildTask)
}
}

androidResources {
Expand All @@ -86,3 +91,26 @@ fun Project.unityBuildTask(
}
}
}

/**
* Splits a camel case string into separate words.
*/
private fun String.splitCamelCase(): String {
return this.replace(Regex("([a-z])([A-Z])"), "$1 $2")
}

/**
* Converts a string to title case.
*
* Title case means that the first character of each word is capitalized.
*
* @return The string in title case.
*/
private fun String.toTitleCase(): String {
return this.split(" ").joinToString(" ") { word ->
word.replaceFirstChar { char ->
if (char.isLowerCase()) char.titlecase(Locale.getDefault())
else char.toString()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.gradle.api.file.CopySpec
import org.gradle.api.file.DeleteSpec
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskExecutionException
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.register
import org.gradle.process.ExecSpec

Expand Down Expand Up @@ -69,7 +70,7 @@ open class UnityNativeBuildTask : DefaultTask() {
val configuration = options.configuration.value
val staticLibraries = emptyArray<String>()

val android = project.extensions.getByType(AndroidComponents::class.java)
val android = project.extensions.getByType<AndroidComponents>()
val sdkComponents = android.sdkComponents

options.platforms.forEach { architecture ->
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ junit4 = "4.13.2"
hilt = "2.51.1"
hiltExt = "1.2.0"

preference = "1.2.1"
teogor-winds = "1.0.2"
teogor-ceres = "1.0.0-alpha04"

Expand Down Expand Up @@ -86,6 +87,7 @@ ceres-monetisation-admob = { group = "dev.teogor.ceres", name = "monetisation-ad
ceres-monetisation-messaging = { group = "dev.teogor.ceres", name = "monetisation-messaging" }

buildconfig-plugin = { module = "com.github.gmazzo:gradle-buildconfig-pluginn", version.ref = "buildConfig" }
androidx-preference = { module = "androidx.preference:preference", version.ref = "preference" }
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
androidx-startup-runtime = { module = "androidx.startup:startup-runtime", version.ref = "startup-runtime" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
Expand Down
69 changes: 0 additions & 69 deletions integration/api/integration.api
Original file line number Diff line number Diff line change
Expand Up @@ -69,66 +69,16 @@ public final class dev/teogor/drifter/integration/core/PlayerPrefs$Companion {
public final fun getInstance ()Ldev/teogor/drifter/integration/core/PlayerPrefs;
}

public class dev/teogor/drifter/integration/core/SharedElement {
public field content Ljava/lang/Object;
protected fun <init> ()V
public fun <init> (Ljava/lang/Object;)V
public final fun getContent ()Ljava/lang/Object;
public final fun getInstance ()Ldev/teogor/drifter/integration/core/SharedElement;
public final fun getObject (Ljava/lang/String;)Ljava/lang/Object;
public final fun setContent (Ljava/lang/Object;)V
public final fun toJson ()Ljava/lang/String;
}

public class dev/teogor/drifter/integration/core/Storage {
public fun <init> ()V
public final fun getStorageElement (Ljava/lang/String;)Ljava/lang/String;
protected final fun value (Ljava/lang/Object;)Ljava/lang/String;
protected final fun writeElement (Ljava/lang/String;Ljava/lang/String;)V
}

public abstract interface annotation class dev/teogor/drifter/integration/core/UnityCallback : java/lang/annotation/Annotation {
}

public class dev/teogor/drifter/integration/core/UnityControllerBase {
public fun <init> (Ljava/lang/String;)V
public final fun invokeAction (Ljava/lang/String;Lorg/json/JSONObject;)V
}

public final class dev/teogor/drifter/integration/core/UnityDispatcher {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ldev/teogor/drifter/integration/core/Message;)V
public final fun getFunctionName ()Ljava/lang/String;
public final fun getFunctionParameter ()Ldev/teogor/drifter/integration/core/Message;
public final fun getGameObject ()Ljava/lang/String;
}

public class dev/teogor/drifter/integration/core/UnityStorageBase {
public fun <init> ()V
protected fun getStorageElement (Ljava/lang/String;Ljava/lang/Object;Ldev/teogor/drifter/integration/common/TypeConverter;)Ljava/lang/Object;
public static synthetic fun getStorageElement$default (Ldev/teogor/drifter/integration/core/UnityStorageBase;Ljava/lang/String;Ljava/lang/Object;Ldev/teogor/drifter/integration/common/TypeConverter;ILjava/lang/Object;)Ljava/lang/Object;
protected fun writeElement (Ljava/lang/String;Ljava/lang/Object;Ldev/teogor/drifter/integration/common/TypeConverter;)Ljava/lang/Object;
public static synthetic fun writeElement$default (Ldev/teogor/drifter/integration/core/UnityStorageBase;Ljava/lang/String;Ljava/lang/Object;Ldev/teogor/drifter/integration/common/TypeConverter;ILjava/lang/Object;)Ljava/lang/Object;
}

public final class dev/teogor/drifter/integration/core/Validator {
public static final field Companion Ldev/teogor/drifter/integration/core/Validator$Companion;
public fun <init> ()V
public final fun dataChangedRead ()V
public final fun getContext ()Landroid/content/Context;
public final fun getStorageElement (Ljava/lang/String;)Ljava/lang/String;
public final fun getStorageElement (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
public final fun isDataChanged ()Z
public final fun markAsRead (Ljava/lang/String;)V
public final fun setDataChanged ()V
public final fun toast (Ljava/lang/String;)V
public final fun writeElement (Ljava/lang/String;I)V
public final fun writeElement (Ljava/lang/String;Ljava/lang/String;)V
}

public final class dev/teogor/drifter/integration/core/Validator$Companion {
public final fun getInstance ()Ldev/teogor/drifter/integration/core/Validator;
}

public final class dev/teogor/drifter/integration/initializer/ActivityContextProvider {
public static final field INSTANCE Ldev/teogor/drifter/integration/initializer/ActivityContextProvider;
public final fun getApplicationContext ()Landroid/content/Context;
Expand Down Expand Up @@ -159,25 +109,6 @@ public final class dev/teogor/drifter/integration/model/Vector2$Companion {
public final fun asVector (Landroid/view/MotionEvent;)Ldev/teogor/drifter/integration/model/Vector2;
}

public final class dev/teogor/drifter/integration/model/Vector3 {
public fun <init> (FFF)V
public final fun asSharedElement ()Ldev/teogor/drifter/integration/core/SharedElement;
public final fun component1 ()F
public final fun component2 ()F
public final fun component3 ()F
public final fun copy (FFF)Ldev/teogor/drifter/integration/model/Vector3;
public static synthetic fun copy$default (Ldev/teogor/drifter/integration/model/Vector3;FFFILjava/lang/Object;)Ldev/teogor/drifter/integration/model/Vector3;
public fun equals (Ljava/lang/Object;)Z
public final fun getX ()F
public final fun getY ()F
public final fun getZ ()F
public fun hashCode ()I
public final fun setX (F)V
public final fun setY (F)V
public final fun setZ (F)V
public fun toString ()Ljava/lang/String;
}

public final class dev/teogor/drifter/integration/player/UnityPlayerHolder {
public fun <init> (Ldev/teogor/drifter/integration/player/UnityPlayerPauseResumeManager;)V
public final fun isVisible ()Z
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit bd20a4f

Please sign in to comment.