Skip to content

Commit

Permalink
Allow use of TOML file in settings.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
ronanbrowne committed Dec 18, 2023
1 parent dfe053d commit 8254d30
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,28 @@ pluginManagement {
}
gradlePluginPortal()
}
}

// Manually parse the Toml file to workaround issues with version catalog
// not supporting direct use in settings.gradle
def tomlFile = new File(rootDir, 'gradle/libs.versions.toml')
def tomlContent = tomlFile.text
def extractVersion = { String name ->
def pattern = java.util.regex.Pattern.compile("${name}\\s*=\\s*\"([^\"]+)\"")
def matcher = pattern.matcher(tomlContent)
if (matcher.find()) {
return matcher.group(1)
} else {
return null
}
}

def gradleEnterpriseVersion = extractVersion('gradleEnterpriseVersion')
def gradleDataPluginVersion = extractVersion('gradleDataVersion')

plugins {
id 'com.gradle.enterprise' version gradleEnterpriseVersion
id 'com.gradle.common-custom-user-data-gradle-plugin' version gradleDataPlugin
id 'com.gradle.common-custom-user-data-gradle-plugin' version gradleDataPluginVersion
}
}
plugins {
Expand Down

0 comments on commit 8254d30

Please sign in to comment.