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
5 changes: 3 additions & 2 deletions apps/flipcash/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fun gitVersionCode(): Int {
return result.toInt().also { println("VersionCode $it") }
}

val contributorsSigningConfig = ContributorsSignatory(rootProject)
val contributorsSigningConfig = ContributorsSignatory(rootDir)
val appNamespace = "${Gradle.flipcashNamespace}.app.android"

android {
Expand Down Expand Up @@ -125,8 +125,9 @@ bugsnag {
}

composeCompiler {
// Isolated Projects-safe root access (see AndroidLibraryComposeConventionPlugin).
stabilityConfigurationFile.set(
rootProject.layout.projectDirectory.file("compose_compiler_config.conf")
isolated.rootProject.projectDirectory.file("compose_compiler_config.conf")
)
}

Expand Down
2 changes: 1 addition & 1 deletion apps/flipcash/benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id("com.android.test")
}

val contributorsSigningConfig = ContributorsSignatory(rootProject)
val contributorsSigningConfig = ContributorsSignatory(rootDir)

android {
namespace = "com.flipcash.benchmark"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ class AndroidLibraryComposeConventionPlugin : Plugin<Project> {
}

extensions.configure<ComposeCompilerGradlePluginExtension> {
// Use the Isolated Projects-safe accessor for the root directory.
// `rootProject.layout` reaches into another project's model, which
// Isolated Projects forbids; `isolated.rootProject` is the blessed
// read-only view that exposes the root project directory safely.
stabilityConfigurationFile.set(
rootProject.layout.projectDirectory.file("compose_compiler_config.conf")
isolated.rootProject.projectDirectory.file("compose_compiler_config.conf")
)
}

Expand Down
27 changes: 15 additions & 12 deletions buildSrc/src/main/java/ContributorsSignatory.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import org.gradle.api.Project
import java.io.File
import java.util.Properties


class ContributorsSignatory(project: Project) {
private val signingProperties: Properties

init {
val propertiesFile = project.file("contributors.properties")
signingProperties = Properties().apply {
load(propertiesFile.inputStream())
}
/**
* Reads the contributor signing config from `contributors.properties` at the
* given [rootDir].
*
* Takes the root directory as a [File] rather than a [org.gradle.api.Project] so
* callers don't reach into another project (`rootProject.file(...)`), which
* Isolated Projects forbids. Paths resolve as `Project.file` did: relative
* entries against [rootDir], absolute entries as-is.
*/
class ContributorsSignatory(rootDir: File) {
private val signingProperties: Properties = Properties().apply {
rootDir.resolve("contributors.properties").inputStream().use { load(it) }
}

val keystore = project.file(signingProperties.getProperty("KEYSTORE_FILE"))
val keystore: File = rootDir.resolve(signingProperties.getProperty("KEYSTORE_FILE"))
val keystorePassword: String = signingProperties.getProperty("KEYSTORE_PASS")
val keyAlias: String = signingProperties.getProperty("KEY_ALIAS")
val keyPassword: String = signingProperties.getProperty("KEY_PASS")
}
}
10 changes: 6 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ org.gradle.parallel=true
# Improves build performance by avoiding redundant task execution
# More details: https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true
# Enables configuration on demand, making Gradle configure only necessary projects
# Speeds up builds in multi-project setups by skipping unneeded configurations
# More details: https://docs.gradle.org/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true
# Enables the configuration cache: caches the result of the configuration phase
# and reuses it across builds, configuring projects in parallel and in isolation.
# This supersedes configuration-on-demand (which is incompatible with it).
# Problems fail the build by default, so CI enforces a clean configuration phase.
# More details: https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
Expand Down
Loading