Skip to content

Commit 67c1438

Browse files
authored
Update settings.gradle
Closes gh-16322 Signed-off-by: guesshe <[email protected]>
1 parent cb16f48 commit 67c1438

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Diff for: settings.gradle

+12-8
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,24 @@ buildFiles.each { File buildFile ->
3434
boolean isKotlin = buildFile.name.endsWith(".kts")
3535
if(isDefaultName) {
3636
String buildFilePath = buildFile.parentFile.absolutePath
37-
String projectPath = buildFilePath.replace(rootDirPath, '').replace(File.separator, ':')
38-
include projectPath
37+
String projectName = buildFilePath.tokenize(File.separator)[-1]
38+
configureProject(':' + projectName, projectName, buildFile)
3939
} else {
4040
String projectName
4141
if (isKotlin) {
4242
projectName = buildFile.name.replace('.gradle.kts', '')
4343
} else {
4444
projectName = buildFile.name.replace('.gradle', '')
4545
}
46-
String projectPath = ':' + projectName;
47-
include projectPath
48-
def project = findProject("${projectPath}")
49-
project.name = projectName
50-
project.projectDir = buildFile.parentFile
51-
project.buildFileName = buildFile.name
46+
configureProject(':' + projectName, projectName, buildFile)
5247
}
5348
}
49+
50+
def configureProject(String projectPath, String projectName, File buildFile) {
51+
include(projectPath)
52+
53+
def project = findProject(projectPath)
54+
project.name = projectName
55+
project.projectDir = buildFile.parentFile
56+
project.buildFileName = buildFile.name
57+
}

0 commit comments

Comments
 (0)