Skip to content
Draft
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
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,12 @@ plugins {
// Settings here apply on a per-project basis. See below for available settings; all properties
// are optional, and you don't need to include this block at all if you are fine with defaults.
elide {
// Use Elide's Maven resolver and downloader instead of Gradle's. Defaults to `true` when an
// `elide.pkl` file is present in the project root.
enableInstall = true

// Use Elide to compile Java instead of the stock Compiler API facilities used by Gradle.
// Defaults to `true` if the plugin is active in the project at all.
enableJavaCompiler = true

// Enable Elide project awareness for Gradle. For example, build scripts can show up as runnable
// exec tasks within the Gradle build.
enableProjectIntegration = true

// Set the path to the project manifest, expressed in Pkl format. Elide project manifests can
// specify dependencies, build scripts, and other project metadata. Defaults to `elide.pkl` and
// automatically finds any present `elide.pkl` in the active project.
manifest = layout.projectDirectory.file("elide.pkl")
// specifies to use only locally installed Elide
binary.useLocalOnly()
// specifies to use a local version if version is the same
binary.useLocalIfApplicable(version = "1.0.0-beta6")
// or
binary.useProjectOnly(version = null)
}
```

Expand Down
58 changes: 0 additions & 58 deletions elide-gradle-catalog/build.gradle.kts

This file was deleted.

101 changes: 24 additions & 77 deletions elide-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import de.undercouch.gradle.tasks.download.Download

plugins {
`maven-publish`
`kotlin-dsl`
`java-gradle-plugin`
signing
id("com.gradle.plugin-publish") version "1.2.1"
id("de.undercouch.download") version "5.6.0"
alias(libs.plugins.gradle.publish)
alias(libs.plugins.undercouch.download)
}

val elideVersion = findProperty("elide.version")?.toString() ?: error(
"Please provide the 'elide.version' property in the gradle.properties file or as a command line argument."
)

group = "dev.elide.gradle"
version = findProperty("version")?.toString() ?: error(
"Please provide the 'version' property in the gradle.properties file."
Expand All @@ -25,94 +20,46 @@ publishing {
}
}

val elideArch = when (System.getProperty("os.arch").lowercase()) {
"x86_64", "amd64" -> "amd64"
"arm64", "aarch64" -> "arm64"
else -> error("Unsupported architecture: ${System.getProperty("os.arch")}")
}
val elidePlatform = when (System.getProperty("os.name").lowercase()) {
"linux" -> "linux-$elideArch"
"mac os x" -> "darwin-$elideArch"
"windows" -> "windows-$elideArch"
else -> error("Unsupported OS: ${System.getProperty("os.name")}")
}

repositories {
mavenCentral()
}

val elideRuntime: Configuration by configurations.creating {
isCanBeResolved = true
}

dependencies {
elideRuntime(files(zipTree(rootProject.layout.buildDirectory.dir("elide-runtime"))))
implementation(libs.pluginClasspath.undercouch.download)
implementation(libs.sigstore)

// Use JUnit test framework for unit tests
testImplementation("junit:junit:4.13.1")
testImplementation(gradleTestKit())
testImplementation(libs.kotlin.test.junit5)
}

gradlePlugin {
website = "https://elide.dev"
vcsUrl = "https://github.com/elide-dev/gradle"

val elide by plugins.creating {
id = "dev.elide"
displayName = "Elide Gradle Plugin"
implementationClass = "dev.elide.gradle.ElideGradlePlugin"
description = "Use the Elide runtime and build tools from Gradle"
tags.set(listOf("elide", "graalvm", "java", "javac", "maven", "dependencies", "resolver"))
}
kotlin {
explicitApi()
}

// Add a source set and a task for a functional test suite
val functionalTest: SourceSet by sourceSets.creating
gradlePlugin.testSourceSets(functionalTest)

configurations[functionalTest.implementationConfigurationName].extendsFrom(configurations.testImplementation.get())

val runtimeHome = layout.buildDirectory.dir("elide-runtime/elide-$elideVersion-$elidePlatform")
val functionalTest: SourceSet by sourceSets.creating {
configurations[implementationConfigurationName].extendsFrom(configurations.testImplementation.get())
}

val functionalTestTask = tasks.register<Test>("functionalTest") {
val functionalTestTask by tasks.register<Test>("functionalTest") {
testClassesDirs = functionalTest.output.classesDirs
classpath = configurations[functionalTest.runtimeClasspathConfigurationName] + functionalTest.output
}

val downloadElide by tasks.registering(Download::class) {
src("https://elide.zip/cli/v1/snapshot/$elidePlatform/$elideVersion/elide.tgz")
dest(layout.buildDirectory.dir("elide-runtime"))
outputs.file(layout.buildDirectory.file("elide-runtime/elide.tgz"))
}

val extractElide by tasks.registering(Copy::class) {
from(tarTree(layout.buildDirectory.file("elide-runtime/elide.tgz")))
into(layout.buildDirectory.dir("elide-runtime"))
inputs.file(layout.buildDirectory.file("elide-runtime/elide.tgz"))
dependsOn(downloadElide)
}

val prepareElide by tasks.registering {
group = "build"
description = "Prepare the Elide runtime"
dependsOn(downloadElide, extractElide)
}
gradlePlugin {
website = "https://elide.dev"
vcsUrl = "https://github.com/elide-dev/gradle"

val checkElide by tasks.registering(Exec::class) {
executable = runtimeHome.get().file("elide").asFile.absolutePath
args("--version")
dependsOn(downloadElide, extractElide, prepareElide)
}
testSourceSets(sourceSets.test.get(), functionalTest)

listOf(
tasks.build,
tasks.test,
tasks.check,
).forEach {
it.configure {
dependsOn(downloadElide, extractElide, prepareElide, checkElide)
plugins.register("elide") {
id = "dev.elide"
displayName = "Elide Gradle Plugin"
implementationClass = "dev.elide.gradle.ElideGradlePlugin"
description = "Use the Elide runtime and build tools from Gradle"
tags.set(listOf("elide", "graalvm", "java", "javac", "kotlin", "kotlinc", "javadoc", "maven", "dependencies", "resolver"))
}
}

tasks.check {
dependsOn(functionalTestTask)
}
}

This file was deleted.

Loading