Skip to content

Commit

Permalink
Update settings.gradle
Browse files Browse the repository at this point in the history
issue#16322

Signed-off-by: guesshe <42242590+guesshe@users.noreply.github.com>
  • Loading branch information
guesshe authored Jan 9, 2025
1 parent 9805648 commit 5350c2f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,24 @@ 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) {
projectName = buildFile.name.replace('.gradle.kts', '')
} 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
}

0 comments on commit 5350c2f

Please sign in to comment.