mirror of
https://github.com/tadfisher/gradle2nix.git
synced 2026-01-11 15:30:38 -05:00
Use Gradle Tooling API
This commit is contained in:
@@ -1,26 +1,43 @@
|
||||
buildscript {
|
||||
configurations.classpath {
|
||||
resolutionStrategy.activateDependencyLocking()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
`java-gradle-plugin`
|
||||
`kotlin-dsl`
|
||||
`maven-publish`
|
||||
kotlin("kapt")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("org.ysb33r.gradletest")
|
||||
id("org.ajoberstar.stutter")
|
||||
}
|
||||
apply {
|
||||
plugin("kotlin")
|
||||
}
|
||||
|
||||
group = "org.nixos"
|
||||
version = "1.0.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo.gradle.org/gradle/libs-releases") }
|
||||
}
|
||||
|
||||
dependencyLocking {
|
||||
lockAllConfigurations()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
implementation("org.apache.maven:maven-model:3.6.1")
|
||||
implementation("org.apache.maven:maven-model-builder:3.6.1")
|
||||
implementation("com.squareup.okio:okio:2.2.2")
|
||||
implementation("com.squareup.moshi:moshi:1.8.0")
|
||||
kapt("com.squareup.moshi:moshi-kotlin-codegen:1.8.0")
|
||||
implementation(project(":model"))
|
||||
compileOnly("org.gradle:gradle-tooling-api:${gradle.gradleVersion}")
|
||||
implementation("org.apache.maven:maven-model:latest.release")
|
||||
implementation("org.apache.maven:maven-model-builder:latest.release")
|
||||
implementation("com.squareup.okio:okio:latest.release")
|
||||
|
||||
compatTestImplementation(embeddedKotlin("stdlib-jdk8"))
|
||||
compatTestImplementation(embeddedKotlin("test-junit5"))
|
||||
compatTestImplementation("org.junit.jupiter:junit-jupiter-api:5.4+")
|
||||
compatTestRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4+")
|
||||
compatTestImplementation(gradleTestKit())
|
||||
compatTestImplementation(project(":model"))
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
@@ -28,37 +45,46 @@ gradlePlugin {
|
||||
register("gradle2nix") {
|
||||
id = "org.nixos.gradle2nix"
|
||||
displayName = "gradle2nix"
|
||||
description = "Create Nix configurations suitable for reproducible packaging"
|
||||
description = "Expose Gradle tooling model for the gradle2nix tool"
|
||||
implementationClass = "org.nixos.gradle2nix.Gradle2NixPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
gradleTest {
|
||||
versions("5.0", "5.1.1", "5.2.1", "5.3.1", "5.4.1")
|
||||
kotlinDsl = true
|
||||
kotlinDslPluginOptions {
|
||||
experimentalWarning.set(false)
|
||||
}
|
||||
|
||||
stutter {
|
||||
java(8) {
|
||||
compatibleRange("4.5")
|
||||
}
|
||||
|
||||
gradleTestGenerator {
|
||||
dependsOn(shadowJar)
|
||||
doLast {
|
||||
file(gradleTest.get().initScript).bufferedWriter().use { out ->
|
||||
out.appendln("""
|
||||
initscript {
|
||||
dependencies {
|
||||
classpath fileTree('file:${buildDir.absolutePath}/libs'.toURI()) {
|
||||
include '*.jar'
|
||||
}
|
||||
""".trimIndent())
|
||||
|
||||
out.appendln("""
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: org.nixos.gradle2nix.Gradle2NixPlugin
|
||||
""".trimIndent())
|
||||
}
|
||||
}
|
||||
java(11) {
|
||||
compatibleRange("5.0")
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
// gradleTestGenerator {
|
||||
// dependsOn(shadowJar)
|
||||
// doLast {
|
||||
// file(gradleTest.get().initScript).bufferedWriter().use { out ->
|
||||
// out.append("""
|
||||
// initscript {
|
||||
// dependencies {
|
||||
// classpath fileTree('file:${buildDir.absolutePath}/libs'.toURI()) {
|
||||
// include '*.jar'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// apply plugin: org.nixos.gradle2nix.Gradle2NixPlugin
|
||||
// """.trimIndent())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user