From 9f9f28561dafe2e32fce5fb8be72d5882e04b035 Mon Sep 17 00:00:00 2001 From: Andre Weber Date: Thu, 18 Jan 2024 08:48:51 +0100 Subject: [PATCH 1/2] fix: VSS Specification Generation fails for specific Folder Structure --- .../org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vss-processor/src/main/kotlin/org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt b/vss-processor/src/main/kotlin/org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt index 237a97f9..4c6be3db 100644 --- a/vss-processor/src/main/kotlin/org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt +++ b/vss-processor/src/main/kotlin/org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt @@ -100,7 +100,7 @@ class VssDefinitionProcessor( private fun loadAssetFile(fileName: String): File? { val generatedFile = codeGenerator.generatedFile.firstOrNull() ?: return null val generationPath = generatedFile.absolutePath - val buildPath = generationPath.replaceAfter(BUILD_FOLDER_NAME, "") + val buildPath = generationPath.replaceAfterLast(BUILD_FOLDER_NAME, "") val assetsFilePath = "$buildPath/$ASSETS_BUILD_DIRECTORY" val assetsFolder = File(assetsFilePath) @@ -141,7 +141,7 @@ class VssDefinitionProcessor( private const val PACKAGE_NAME = "org.eclipse.kuksa.vss" private const val FILE_NAME_PROCESSOR_POSTFIX = "Processor" private const val ASSETS_BUILD_DIRECTORY = "intermediates/assets/" - private const val BUILD_FOLDER_NAME = "build/" + private const val BUILD_FOLDER_NAME = "/build/" } } From e62686ad55e0a8314b774ba985bfad698363cc2e Mon Sep 17 00:00:00 2001 From: Andre Weber Date: Thu, 18 Jan 2024 09:03:55 +0100 Subject: [PATCH 2/2] chore: Use System-specific FileSeparator for Paths in VssProcessor --- .../kuksa/vssprocessor/VssDefinitionProcessor.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vss-processor/src/main/kotlin/org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt b/vss-processor/src/main/kotlin/org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt index 4c6be3db..6b9d239d 100644 --- a/vss-processor/src/main/kotlin/org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt +++ b/vss-processor/src/main/kotlin/org/eclipse/kuksa/vssprocessor/VssDefinitionProcessor.kt @@ -100,8 +100,8 @@ class VssDefinitionProcessor( private fun loadAssetFile(fileName: String): File? { val generatedFile = codeGenerator.generatedFile.firstOrNull() ?: return null val generationPath = generatedFile.absolutePath - val buildPath = generationPath.replaceAfterLast(BUILD_FOLDER_NAME, "") - val assetsFilePath = "$buildPath/$ASSETS_BUILD_DIRECTORY" + val buildPath = generationPath.replaceAfterLast(buildDir, "") + val assetsFilePath = buildPath + fileSeparator + assetsDir val assetsFolder = File(assetsFilePath) return assetsFolder.walk().firstOrNull { it.name == fileName } @@ -137,11 +137,13 @@ class VssDefinitionProcessor( } } - companion object { + private companion object { private const val PACKAGE_NAME = "org.eclipse.kuksa.vss" private const val FILE_NAME_PROCESSOR_POSTFIX = "Processor" - private const val ASSETS_BUILD_DIRECTORY = "intermediates/assets/" - private const val BUILD_FOLDER_NAME = "/build/" + + private val fileSeparator = File.separator + private val assetsDir = "intermediates" + fileSeparator + "assets" + fileSeparator + private val buildDir = fileSeparator + "build" + fileSeparator } }