Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.asciidoctor.gradle.AsciidoctorExtension
- import org.asciidoctor.gradle.AsciidoctorTask
- import org.gradle.kotlin.dsl.kotlin
- import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
- import org.springframework.boot.gradle.tasks.bundling.BootJar
- plugins {
- val asciiDoctorVersion = "1.5.7"
- val kotlinVersion = "1.3.10"
- val nebulaKotlinVersion = "1.3.10"
- val nebulaProjectVersion = "5.1.2"
- val springBootVersion = "2.1.0.RELEASE"
- val springDependencyManagementVersion = "1.0.6.RELEASE"
- idea
- java
- jacoco
- kotlin("jvm") version kotlinVersion
- kotlin("plugin.spring") version kotlinVersion
- id("io.spring.dependency-management") version springDependencyManagementVersion
- id("nebula.integtest") version nebulaProjectVersion
- id("nebula.kotlin") version nebulaKotlinVersion
- id("nebula.project") version nebulaProjectVersion
- id("org.asciidoctor.convert") version asciiDoctorVersion
- id("org.springframework.boot") version springBootVersion
- }
- val snippetsDir = file("build/generated-snippets")
- group = "com.dharrigan"
- version = System.getenv("PROJECT_VERSION") ?: "0.0.0-SNAPSHOT"
- description = "FooBar"
- java.sourceCompatibility = JavaVersion.VERSION_1_8
- repositories {
- mavenLocal()
- }
- with(configurations) {
- all { resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) }
- testImplementation.exclude(module = "junit", group = "junit")
- }
- dependencies {
- implementation(kotlin("reflect"))
- asciidoctor("org.springframework.restdocs:spring-restdocs-asciidoctor")
- }
- idea {
- module.isDownloadJavadoc = true
- project {
- vcs = "Git"
- languageLevel = IdeaLanguageLevel(java.sourceCompatibility)
- }
- }
- with(tasks) {
- withType<JavaCompile> {
- with(options) {
- encoding = "UTF-8"
- compilerArgs = mutableListOf("-Xlint", "-parameters")
- setIncremental(true)
- }
- }
- withType<KotlinCompile> {
- kotlinOptions {
- freeCompilerArgs = listOf("-Xjsr305=strict")
- javaParameters = true
- jvmTarget = java.sourceCompatibility.name
- }
- }
- val testTask = withType<Test> {
- outputs.dir(snippetsDir)
- jacocoTestReport.reports.html.isEnabled = true
- jacocoTestReport.executionData(this)
- useJUnitPlatform()
- failFast = true
- }
- val asciiDocTask = withType<AsciidoctorTask> {
- dependsOn(testTask)
- inputs.dir(snippetsDir)
- attributes.putAll(mapOf("snippets" to snippetsDir))
- sourceDir = file("$projectDir/src/main/docs/asciidoc")
- outputDir("$buildDir/asciidoc")
- }
- withType<BootJar> {
- dependsOn(asciiDocTask)
- mainClassName = "com.dharrigan.Foobar"
- from("$buildDir/asciidoc/html5") {
- include("*.html")
- into("BOOT-INF/classes/static")
- }
- rootSpec.exclude("logback.xml")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment