From 7662980101752aaf9d03ecef05f48a074d0d92fd Mon Sep 17 00:00:00 2001 From: 5peak2me <461260911@qq.com> Date: Sat, 4 Jan 2025 13:29:08 +0800 Subject: [PATCH 1/2] Convert Constants from class to object --- .../likethesalad/stem/modules/common/Constants.kt | 12 +++++------- .../common/helpers/files/AndroidXmlResDocument.kt | 4 ++-- .../common/helpers/files/OutputStringFileResolver.kt | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/Constants.kt b/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/Constants.kt index b2cb4a95..684adde9 100644 --- a/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/Constants.kt +++ b/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/Constants.kt @@ -1,10 +1,8 @@ package com.likethesalad.stem.modules.common -class Constants { - companion object { - const val XML_STRING_TAG = "string" - const val XML_RESOURCES_TAG = "resources" - const val RESOLVED_FILE_NAME = "resolved.xml" - const val TEMPLATE_BASE_FILE_NAME = "templates" - } +object Constants { + const val XML_STRING_TAG = "string" + const val XML_RESOURCES_TAG = "resources" + const val RESOLVED_FILE_NAME = "resolved.xml" + const val TEMPLATE_BASE_FILE_NAME = "templates" } \ No newline at end of file diff --git a/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/helpers/files/AndroidXmlResDocument.kt b/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/helpers/files/AndroidXmlResDocument.kt index 46c7fd57..e481b6f0 100644 --- a/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/helpers/files/AndroidXmlResDocument.kt +++ b/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/helpers/files/AndroidXmlResDocument.kt @@ -1,7 +1,7 @@ package com.likethesalad.stem.modules.common.helpers.files -import com.likethesalad.stem.modules.common.Constants.Companion.XML_RESOURCES_TAG -import com.likethesalad.stem.modules.common.Constants.Companion.XML_STRING_TAG +import com.likethesalad.stem.modules.common.Constants.XML_RESOURCES_TAG +import com.likethesalad.stem.modules.common.Constants.XML_STRING_TAG import com.likethesalad.stem.modules.common.helpers.resources.utils.XmlUtils import com.likethesalad.tools.resource.api.android.modules.string.StringAndroidResource import org.w3c.dom.DOMException diff --git a/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/helpers/files/OutputStringFileResolver.kt b/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/helpers/files/OutputStringFileResolver.kt index 7c7b58ec..05f6d84f 100644 --- a/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/helpers/files/OutputStringFileResolver.kt +++ b/stem-plugin/src/main/java/com/likethesalad/stem/modules/common/helpers/files/OutputStringFileResolver.kt @@ -1,7 +1,7 @@ package com.likethesalad.stem.modules.common.helpers.files -import com.likethesalad.stem.modules.common.Constants.Companion.RESOLVED_FILE_NAME -import com.likethesalad.stem.modules.common.Constants.Companion.TEMPLATE_BASE_FILE_NAME +import com.likethesalad.stem.modules.common.Constants.RESOLVED_FILE_NAME +import com.likethesalad.stem.modules.common.Constants.TEMPLATE_BASE_FILE_NAME import java.io.File class OutputStringFileResolver { From 7421ef8ef78f2a1a746983e57cc9cd5c3f14db78 Mon Sep 17 00:00:00 2001 From: 5peak2me <461260911@qq.com> Date: Sat, 4 Jan 2025 13:30:31 +0800 Subject: [PATCH 2/2] Use project.layout.buildDirectory to replace deprecated project.buildDir api --- .../java/com/likethesalad/stem/ResolvePlaceholdersPlugin.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stem-plugin/src/main/java/com/likethesalad/stem/ResolvePlaceholdersPlugin.kt b/stem-plugin/src/main/java/com/likethesalad/stem/ResolvePlaceholdersPlugin.kt index 35b66e20..e657094f 100644 --- a/stem-plugin/src/main/java/com/likethesalad/stem/ResolvePlaceholdersPlugin.kt +++ b/stem-plugin/src/main/java/com/likethesalad/stem/ResolvePlaceholdersPlugin.kt @@ -88,7 +88,7 @@ class ResolvePlaceholdersPlugin : BaseTemplatesProcessorPlugin(), AndroidExtensi } override fun getBuildDir(): File { - return project.buildDir + return project.layout.buildDirectory.get().asFile } @Suppress("UNCHECKED_CAST")