Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,28 @@ public class GradleProperties(private val lines: MutableList<String>) {

public const val NON_TRANSITIVE_R: String = "android.nonTransitiveRClass=true"

/** Enable the build cache. */
public const val BUILD_CACHE: String = "org.gradle.caching=true"

/** Enable the configuration cache, pre-Gradle 8. */
public const val CONFIGURATION_CACHE_UNSTABLE: String = "org.gradle.unsafe.configuration-cache=true"

/** Enable the configuration cache, Gradle 8+. */
public const val CONFIGURATION_CACHE_STABLE: String = "org.gradle.configuration-cache=true"

/** Enable parallel store and load for configuration cache entries, from Gradle 8.11. */
public const val CONFIGURATION_CACHE_PARALLEL: String = "org.gradle.configuration-cache.parallel=true"

/**
* Enable isolated projects, pre-Gradle 9.
*
* @see <a href="https://docs.gradle.org/nightly/userguide/isolated_projects.html">Isolated Projects</a>
*/
public const val ISOLATED_PROJECTS_UNSTABLE: String = "org.gradle.unsafe.isolated-projects=true"

/** Enable parallel builds. */
public const val PARALLEL: String = "org.gradle.parallel=true"

/**
* Disable the behavior of the Kotlin Gradle Plugin that adds the stdlib as an `api` dependency by default.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,22 @@ public sealed class Repository : Element.Line {
}

private data class Url(private val repoUrl: String) : Repository() {
override fun render(scribe: Scribe): String = scribe.line { s ->
s.append("maven { url = ")
override fun render(scribe: Scribe): String = when (scribe.dslKind) {
DslKind.GROOVY -> renderGroovy(scribe)
DslKind.KOTLIN -> renderKotlin(scribe)
}

// TODO(tsr): model
if (scribe.dslKind == DslKind.KOTLIN) {
s.append("uri(")
}
private fun renderGroovy(scribe: Scribe): String = scribe.line { s ->
s.append("maven { url = ")
s.appendQuoted(repoUrl)
if (scribe.dslKind == DslKind.KOTLIN) {
s.append(")")
}

s.append(" }")
}

private fun renderKotlin(scribe: Scribe): String = scribe.line { s ->
s.append("maven(url = ")
s.appendQuoted(repoUrl)
s.append(")")
}
}

private data class FlatDir(private val repoUrl: String) : Repository() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,18 @@ public class VersionCatalogs(
public fun of(vararg versionCatalogs: VersionCatalog): VersionCatalogs {
return VersionCatalogs(versionCatalogs.toList())
}

/**
* ```
* VersionCatalogs.of(
* "myLibs" to "gradle/my-libs.versions.toml",
* "myOtherLibs" to "gradle/my-other-libs.versions.toml"
* )
* ```
*/
@JvmStatic
public fun of(vararg versionCatalogs: Pair<String, String>): VersionCatalogs {
return VersionCatalogs(versionCatalogs.map { VersionCatalog(it.first, it.second) })
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal class ScribeTestKotlin {
repositories {
google()
mavenCentral()
maven { url = uri("https://central.sonatype.com/repository/maven-snapshots/") }
maven(url = "https://central.sonatype.com/repository/maven-snapshots/")
}

""".trimIndent()
Expand Down Expand Up @@ -125,7 +125,7 @@ internal class ScribeTestKotlin {

pluginManagement {
repositories {
maven { url = uri("") }
maven(url = "")
gradlePluginPortal()
mavenCentral()
google()
Expand Down Expand Up @@ -409,7 +409,7 @@ internal class ScribeTestKotlin {
"""
buildscript {
repositories {
maven { url = uri("") }
maven(url = "")
gradlePluginPortal()
mavenCentral()
google()
Expand Down Expand Up @@ -503,7 +503,7 @@ internal class ScribeTestKotlin {

buildscript {
repositories {
maven { url = uri("") }
maven(url = "")
gradlePluginPortal()
mavenCentral()
google()
Expand Down