From 5350c2fa73ca994e007c2d4e3d81eb9ebe2763d5 Mon Sep 17 00:00:00 2001 From: guesshe <42242590+guesshe@users.noreply.github.com> Date: Thu, 9 Jan 2025 08:45:27 -0500 Subject: [PATCH] Update settings.gradle issue#16322 Signed-off-by: guesshe <42242590+guesshe@users.noreply.github.com> --- settings.gradle | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/settings.gradle b/settings.gradle index 6ebece46a87..74cb46b16be 100644 --- a/settings.gradle +++ b/settings.gradle @@ -34,8 +34,8 @@ buildFiles.each { File buildFile -> boolean isKotlin = buildFile.name.endsWith(".kts") if(isDefaultName) { String buildFilePath = buildFile.parentFile.absolutePath - String projectPath = buildFilePath.replace(rootDirPath, '').replace(File.separator, ':') - include projectPath + String projectName = buildFilePath.tokenize(File.separator)[-1] + configureProject(':' + projectName, projectName, buildFile) } else { String projectName if (isKotlin) { @@ -43,11 +43,15 @@ buildFiles.each { File buildFile -> } else { projectName = buildFile.name.replace('.gradle', '') } - String projectPath = ':' + projectName; - include projectPath - def project = findProject("${projectPath}") - project.name = projectName - project.projectDir = buildFile.parentFile - project.buildFileName = buildFile.name + configureProject(':' + projectName, projectName, buildFile) } } + +def configureProject(String projectPath, String projectName, File buildFile) { + include(projectPath) + + def project = findProject(projectPath) + project.name = projectName + project.projectDir = buildFile.parentFile + project.buildFileName = buildFile.name +}