Repository: apple/pkl
File: pkl-cli/pkl-cli.gradle.kts (Kotlin)

Code before:
        //,"-J:-esa"
        // for use with https://www.graalvm.org/docs/tools/dashboard/
        //,"-H:DashboardDump=dashboard.dump", "-H:+DashboardAll"
        // native-image rejects non-existing class path entries -> filter
        ,"--class-path"
        ,((sourceSets.main.get().output + configurations.runtimeClasspath.get())
            .filter { it.exists() && !exclusions.any { exclude -> it.name.contains(exclude) }})
            .asPath
        // make sure dev machine stays responsive (15% slowdown on my laptop)
        ,"-J-XX:ActiveProcessorCount=${
          Runtime.getRuntime().availableProcessors() / (if (buildInfo.os.isMacOsX && !buildInfo.isCiBuild) 4 else 1)
        }"
    ) + extraArgs
  })
}

/**
 * Builds the pkl CLI for macOS/amd64.
 */
val macExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
  dependsOn(":installGraalVmAmd64")
  configureExecutable(
    buildInfo.os.isMacOsX,
    buildInfo.graalVmAmd64,
    layout.buildDirectory.file("executable/pkl-macos-amd64")
  )
}

/**
 * Builds the pkl CLI for macOS/aarch64.
 */
val macExecutableAarch64: TaskProvider<Exec> by tasks.registering(Exec::class) {
  dependsOn(":installGraalVmAarch64")
  configureExecutable(
    buildInfo.os.isMacOsX,
    buildInfo.graalVmAarch64,
    layout.buildDirectory.file("executable/pkl-macos-aarch64"),
    listOf(
      "-H:+AllowDeprecatedBuilderClassesOnImageClasspath"
    )
  )
}

/**
 * Builds the pkl CLI for linux/amd64.
 */
val linuxExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
  dependsOn(":installGraalVmAmd64")
  configureExecutable(
    buildInfo.os.isLinux && buildInfo.arch == "amd64",
    buildInfo.graalVmAmd64,

Review comment (suggestion):
Shouldn't this just be
```suggestion
  enabled = buildInfo.os.isMacOsX
  dependsOn(":installGraalVmAmd64")
  configureExecutable(
    buildInfo.graalVmAmd64,
    layout.buildDirectory.file("executable/pkl-macos-amd64")
  )
```

? [throughout]

Surely, if `!enabled`, tasks this one `dependsOn` are not executed.

Code after:
        // native-image rejects non-existing class path entries -> filter
        ,"--class-path"
        ,((sourceSets.main.get().output + configurations.runtimeClasspath.get())
            .filter { it.exists() && !exclusions.any { exclude -> it.name.contains(exclude) }})
            .asPath
        // make sure dev machine stays responsive (15% slowdown on my laptop)
        ,"-J-XX:ActiveProcessorCount=${
          Runtime.getRuntime().availableProcessors() / (if (buildInfo.os.isMacOsX && !buildInfo.isCiBuild) 4 else 1)
        }"
    ) + extraArgs
  })
}

/**
 * Builds the pkl CLI for macOS/amd64.
 */
val macExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
  if (buildInfo.os.isMacOsX) {
    dependsOn(":installGraalVmAmd64")
    configureExecutable(
      buildInfo.graalVmAmd64,
      layout.buildDirectory.file("executable/pkl-macos-amd64")
    )
  } else {
    enabled = false
  }
}

/**
 * Builds the pkl CLI for macOS/aarch64.
 */
val macExecutableAarch64: TaskProvider<Exec> by tasks.registering(Exec::class) {
  if (buildInfo.os.isMacOsX) {
    dependsOn(":installGraalVmAarch64")
    configureExecutable(
      buildInfo.graalVmAarch64,
      layout.buildDirectory.file("executable/pkl-macos-aarch64"),
      listOf(
        "-H:+AllowDeprecatedBuilderClassesOnImageClasspath"
      )
    )
  } else {
    enabled = false
  }
}

/**
 * Builds the pkl CLI for linux/amd64.
 */
val linuxExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
  if (buildInfo.os.isLinux && buildInfo.arch == "amd64") {