mirror of
https://github.com/apple/pkl.git
synced 2026-04-25 01:38:34 +02:00
Use Gradle typed project accessors
This change activates the `TYPESAFE_PROJECT_ACCESSORS` feature preview in Gradle, and switches to such accessors instead of string-based project references, where possible Relates-To: apple/pkl#204 Signed-off-by: Sam Gammon <sam@elide.ventures>
This commit is contained in:
committed by
Philip K.F. Hölzenspies
parent
cb33a7cdb0
commit
1e50200969
@@ -10,7 +10,7 @@ val graal: Configuration by configurations.creating
|
|||||||
|
|
||||||
@Suppress("UnstableApiUsage")
|
@Suppress("UnstableApiUsage")
|
||||||
dependencies {
|
dependencies {
|
||||||
jmh(project(":pkl-core"))
|
jmh(projects.pklCore)
|
||||||
// necessary because antlr4-runtime is declared as implementation dependency in pkl-core.gradle
|
// necessary because antlr4-runtime is declared as implementation dependency in pkl-core.gradle
|
||||||
jmh(libs.antlrRuntime)
|
jmh(libs.antlrRuntime)
|
||||||
truffle(libs.truffleApi)
|
truffle(libs.truffleApi)
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation(project(":pkl-core"))
|
testImplementation(projects.pklCore)
|
||||||
testImplementation(project(":pkl-config-java"))
|
testImplementation(projects.pklConfigJava)
|
||||||
testImplementation(project(":pkl-config-kotlin"))
|
testImplementation(projects.pklConfigKotlin)
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
testImplementation(libs.junitEngine)
|
testImplementation(libs.junitEngine)
|
||||||
testImplementation(libs.antlrRuntime)
|
testImplementation(libs.antlrRuntime)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,23 +38,23 @@ dependencies {
|
|||||||
compileOnly(libs.svm)
|
compileOnly(libs.svm)
|
||||||
|
|
||||||
// CliEvaluator exposes PClass
|
// CliEvaluator exposes PClass
|
||||||
api(project(":pkl-core"))
|
api(projects.pklCore)
|
||||||
// CliEvaluatorOptions exposes CliBaseOptions
|
// CliEvaluatorOptions exposes CliBaseOptions
|
||||||
api(project(":pkl-commons-cli"))
|
api(projects.pklCommonsCli)
|
||||||
|
|
||||||
implementation(project(":pkl-commons"))
|
implementation(projects.pklCommons)
|
||||||
implementation(libs.jansi)
|
implementation(libs.jansi)
|
||||||
implementation(libs.jlineReader)
|
implementation(libs.jlineReader)
|
||||||
implementation(libs.jlineTerminal)
|
implementation(libs.jlineTerminal)
|
||||||
implementation(libs.jlineTerminalJansi)
|
implementation(libs.jlineTerminalJansi)
|
||||||
implementation(project(":pkl-server"))
|
implementation(projects.pklServer)
|
||||||
implementation(libs.clikt) {
|
implementation(libs.clikt) {
|
||||||
// force clikt to use our version of the kotlin stdlib
|
// force clikt to use our version of the kotlin stdlib
|
||||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
|
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
|
||||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
|
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
|
||||||
}
|
}
|
||||||
|
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
|
|
||||||
stagedMacAmd64Executable(files("$buildDir/executable/pkl-macos-amd64"))
|
stagedMacAmd64Executable(files("$buildDir/executable/pkl-macos-amd64"))
|
||||||
stagedMacAarch64Executable(files("$buildDir/executable/pkl-macos-aarch64"))
|
stagedMacAarch64Executable(files("$buildDir/executable/pkl-macos-aarch64"))
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ plugins {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// CliJavaCodeGeneratorOptions exposes CliBaseOptions
|
// CliJavaCodeGeneratorOptions exposes CliBaseOptions
|
||||||
api(project(":pkl-commons-cli"))
|
api(projects.pklCommonsCli)
|
||||||
|
|
||||||
implementation(project(":pkl-commons"))
|
implementation(projects.pklCommons)
|
||||||
implementation(project(":pkl-core"))
|
implementation(projects.pklCore)
|
||||||
implementation(libs.javaPoet)
|
implementation(libs.javaPoet)
|
||||||
|
|
||||||
testImplementation(project(":pkl-config-java"))
|
testImplementation(projects.pklConfigJava)
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
}
|
}
|
||||||
|
|
||||||
// with `org.gradle.parallel=true` and without the line below, `test` strangely runs into:
|
// with `org.gradle.parallel=true` and without the line below, `test` strangely runs into:
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ tasks.jar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":pkl-commons"))
|
implementation(projects.pklCommons)
|
||||||
api(project(":pkl-commons-cli"))
|
api(projects.pklCommonsCli)
|
||||||
api(project(":pkl-core"))
|
api(projects.pklCore)
|
||||||
|
|
||||||
implementation(libs.kotlinPoet)
|
implementation(libs.kotlinPoet)
|
||||||
implementation(libs.kotlinReflect)
|
implementation(libs.kotlinReflect)
|
||||||
|
|
||||||
testImplementation(project(":pkl-config-kotlin"))
|
testImplementation(projects.pklConfigKotlin)
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
testImplementation(libs.kotlinCompilerEmbeddable)
|
testImplementation(libs.kotlinCompilerEmbeddable)
|
||||||
testRuntimeOnly(libs.kotlinScriptingCompilerEmbeddable)
|
testRuntimeOnly(libs.kotlinScriptingCompilerEmbeddable)
|
||||||
testRuntimeOnly(libs.kotlinScriptUtil)
|
testRuntimeOnly(libs.kotlinScriptUtil)
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":pkl-core"))
|
api(projects.pklCore)
|
||||||
api(libs.clikt) {
|
api(libs.clikt) {
|
||||||
// force clikt to use our version of the kotlin stdlib
|
// force clikt to use our version of the kotlin stdlib
|
||||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
|
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
|
||||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
|
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation(project(":pkl-commons"))
|
implementation(projects.pklCommons)
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dependencies {
|
|||||||
api(libs.junitApi)
|
api(libs.junitApi)
|
||||||
api(libs.junitEngine)
|
api(libs.junitEngine)
|
||||||
api(libs.junitParams)
|
api(libs.junitParams)
|
||||||
api(project(":pkl-commons")) // for convenience
|
api(projects.pklCommons) // for convenience
|
||||||
implementation(libs.assertj)
|
implementation(libs.assertj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ sourceSets.getByName("test") {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// "api" because ConfigEvaluator extends Evaluator
|
// "api" because ConfigEvaluator extends Evaluator
|
||||||
api(project(":pkl-core"))
|
api(projects.pklCore)
|
||||||
|
|
||||||
implementation(libs.geantyref)
|
implementation(libs.geantyref)
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ dependencies {
|
|||||||
|
|
||||||
firstPartySourcesJars(project(":pkl-core", "sourcesJar"))
|
firstPartySourcesJars(project(":pkl-core", "sourcesJar"))
|
||||||
|
|
||||||
pklCodegenJava(project(":pkl-codegen-java"))
|
pklCodegenJava(projects.pklCodegenJava)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.shadowJar {
|
tasks.shadowJar {
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ val pklCodegenKotlin: Configuration by configurations.creating
|
|||||||
configurations.api.get().extendsFrom(pklConfigJava)
|
configurations.api.get().extendsFrom(pklConfigJava)
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
pklConfigJava(project(":pkl-config-java"))
|
pklConfigJava(projects.pklConfigJava)
|
||||||
|
|
||||||
pklConfigJavaAll(project(":pkl-config-java", "fatJar"))
|
pklConfigJavaAll(project(":pkl-config-java", "fatJar"))
|
||||||
|
|
||||||
pklCodegenKotlin(project(":pkl-codegen-kotlin"))
|
pklCodegenKotlin(projects.pklCodegenKotlin)
|
||||||
|
|
||||||
implementation(libs.kotlinReflect)
|
implementation(libs.kotlinReflect)
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ dependencies {
|
|||||||
|
|
||||||
compileOnly(libs.jsr305)
|
compileOnly(libs.jsr305)
|
||||||
// pkl-core implements pkl-executor's ExecutorSpi, but the SPI doesn't ship with pkl-core
|
// pkl-core implements pkl-executor's ExecutorSpi, but the SPI doesn't ship with pkl-core
|
||||||
compileOnly(project(":pkl-executor"))
|
compileOnly(projects.pklExecutor)
|
||||||
|
|
||||||
implementation(libs.antlrRuntime)
|
implementation(libs.antlrRuntime)
|
||||||
implementation(libs.truffleApi)
|
implementation(libs.truffleApi)
|
||||||
@@ -57,7 +57,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation(libs.snakeYaml)
|
implementation(libs.snakeYaml)
|
||||||
|
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
|
|
||||||
add("generatorImplementation", libs.javaPoet)
|
add("generatorImplementation", libs.javaPoet)
|
||||||
add("generatorImplementation", libs.truffleApi)
|
add("generatorImplementation", libs.truffleApi)
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ plugins {
|
|||||||
val graalVmBaseDir = buildInfo.graalVm.baseDir
|
val graalVmBaseDir = buildInfo.graalVm.baseDir
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":pkl-core"))
|
implementation(projects.pklCore)
|
||||||
implementation(project(":pkl-commons-cli"))
|
implementation(projects.pklCommonsCli)
|
||||||
implementation(project(":pkl-commons"))
|
implementation(projects.pklCommons)
|
||||||
implementation(libs.commonMark)
|
implementation(libs.commonMark)
|
||||||
implementation(libs.commonMarkTables)
|
implementation(libs.commonMarkTables)
|
||||||
implementation(libs.kotlinxHtml)
|
implementation(libs.kotlinxHtml)
|
||||||
@@ -24,7 +24,7 @@ dependencies {
|
|||||||
exclude(group = "org.jetbrains.kotlin")
|
exclude(group = "org.jetbrains.kotlin")
|
||||||
}
|
}
|
||||||
|
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
testImplementation(libs.jimfs)
|
testImplementation(libs.jimfs)
|
||||||
|
|
||||||
// Graal.JS
|
// Graal.JS
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ dependencies {
|
|||||||
|
|
||||||
implementation(libs.slf4jApi)
|
implementation(libs.slf4jApi)
|
||||||
|
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
testImplementation(project(":pkl-core"))
|
testImplementation(projects.pklCore)
|
||||||
testImplementation(libs.slf4jSimple)
|
testImplementation(libs.slf4jSimple)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Declare a `compileOnly` dependency on `project(":pkl-tools")`
|
// Declare a `compileOnly` dependency on `projects.pklTools`
|
||||||
// to ensure correct code navigation in IntelliJ.
|
// to ensure correct code navigation in IntelliJ.
|
||||||
compileOnly(project(":pkl-tools"))
|
compileOnly(projects.pklTools)
|
||||||
|
|
||||||
// Declare a `runtimeOnly` dependency on `project(":pkl-tools", "fatJar")`
|
// Declare a `runtimeOnly` dependency on `project(":pkl-tools", "fatJar")`
|
||||||
// to ensure that the published plugin
|
// to ensure that the published plugin
|
||||||
@@ -31,7 +31,7 @@ dependencies {
|
|||||||
runtimeOnly(project(":pkl-tools", "fatJar"))
|
runtimeOnly(project(":pkl-tools", "fatJar"))
|
||||||
}
|
}
|
||||||
|
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":pkl-core"))
|
implementation(projects.pklCore)
|
||||||
implementation(libs.msgpack)
|
implementation(libs.msgpack)
|
||||||
implementation(libs.truffleApi)
|
implementation(libs.truffleApi)
|
||||||
implementation(libs.antlrRuntime)
|
implementation(libs.antlrRuntime)
|
||||||
|
|
||||||
testImplementation(project(":pkl-commons-test"))
|
testImplementation(projects.pklCommonsTest)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ dependencies {
|
|||||||
// can declare a normal project dependency on this project,
|
// can declare a normal project dependency on this project,
|
||||||
// which is desirable for IntelliJ integration.
|
// which is desirable for IntelliJ integration.
|
||||||
// The published fat JAR doesn't declare any dependencies.
|
// The published fat JAR doesn't declare any dependencies.
|
||||||
api(project(":pkl-cli"))
|
api(projects.pklCli)
|
||||||
api(project(":pkl-codegen-java"))
|
api(projects.pklCodegenJava)
|
||||||
api(project(":pkl-codegen-kotlin"))
|
api(projects.pklCodegenKotlin)
|
||||||
api(project(":pkl-config-java"))
|
api(projects.pklConfigJava)
|
||||||
api(project(":pkl-core"))
|
api(projects.pklCore)
|
||||||
api(project(":pkl-doc"))
|
api(projects.pklDoc)
|
||||||
|
|
||||||
// used by `pklFatJar` plugin (ideally this would be inferred automatically)
|
// used by `pklFatJar` plugin (ideally this would be inferred automatically)
|
||||||
firstPartySourcesJars(project(":pkl-cli", "sourcesJar"))
|
firstPartySourcesJars(project(":pkl-cli", "sourcesJar"))
|
||||||
|
|||||||
@@ -47,3 +47,5 @@ if (gradle.startParameter.taskNames.contains("updateDependencyLocks") ||
|
|||||||
for (prj in rootProject.children) {
|
for (prj in rootProject.children) {
|
||||||
prj.buildFileName = "${prj.name}.gradle.kts"
|
prj.buildFileName = "${prj.name}.gradle.kts"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||||
|
|||||||
Reference in New Issue
Block a user