Skip to content

Instantly share code, notes, and snippets.

@gildor
Created December 21, 2017 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gildor/0265477225f42b4083351a61544eff9d to your computer and use it in GitHub Desktop.
Save gildor/0265477225f42b4083351a61544eff9d to your computer and use it in GitHub Desktop.
import com.github.spotbugs.SpotBugsTask
import com.github.spotbugs.SpotBugsPlugin
import io.spring.gradle.dependencymanagement.DependencyManagementPlugin
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
import io.spring.gradle.dependencymanagement.internal.DependencyManagement
import org.gradle.api.credentials.AwsCredentials
import org.gradle.kotlin.dsl.maven
import org.gradle.kotlin.dsl.repositories
import io.spring.gradle.dependencymanagement.internal.DependencyManagementSettings
import io.spring.gradle.dependencymanagement.internal.dsl.StandardDependencyManagementExtension
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.creating
import org.gradle.kotlin.dsl.support.illegalElementType
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.gradle.plugins.ide.idea.model.IdeaProject
import java.lang.System
plugins {
`java-library`
java
`maven-publish`
checkstyle
id(“com.github.spotbugs”) version “1.6.0"
id(“net.ltgt.errorprone”) version “0.0.13"
id(“net.ltgt.apt”) version “0.13"
id(“net.ltgt.apt-idea”) version “0.13"
// Use 1.0.5.BUILD-SNAPSHOT because dynamic version doesn’t supported by plugins dsl
id(“io.spring.dependency-management”) version “1.0.4.RELEASE”
}
repositories {
maven(System.getenv(“JAR_REPOSITORY_URI”))
jcenter()
}
group = “com.xenoterracide”
version = “0.1.4-SNAPSHOT”
dependencyManagement {
imports {
mavenBom(“com.xenoterracide:bom:0.1.0-SNAPSHOT”)
}
}
// In this section you declare the dependencies for your production and test code
dependencies {
errorprone(“com.google.guava:guava:22.0”)
errorprone(“com.google.errorprone:error_prone_core:latest.release”)
compileOnly(“org.immutables:value”)
implementation(“org.slf4j:slf4j-api”)
implementation(“com.google.guava:guava”)
compileOnly(“org.immutables:value”)
apt(“org.immutables:builder”)
testCompileOnly(“org.immutables:value”)
testImplementation(“junit:junit”)
testImplementation(“org.assertj:assertj-core”)
testImplementation(“org.mockito:mockito-core”)
testImplementation(“org.hamcrest:hamcrest-library”)
}
idea {
module {
isDownloadSources = true
isDownloadJavadoc = true
}
}
checkstyle {
toolVersion = “8.4”
sourceSets = listOf(java.sourceSets[“main”])
}
spotbugs {
toolVersion = “3.1.0”
effort = “max”
reportLevel = “low”
excludeBugsFilter = file(“config/spotbugs/exclude.xml”)
sourceSets.addAll(java.sourceSets.filter { it.name != “test” })
}
val sourcesJar by tasks.creating(Jar::class) {
classifier = “sources”
from(java.sourceSets[“main”].allSource)
}
publishing {
repositories {
maven {
url = uri(System.getenv(“JRS_S3_URI”) ?: uri(“”))
credentials(AwsCredentials::class.java) {
accessKey = System.getenv(“JRS_ACCESSKEYID”)
secretKey = System.getenv(“JRS_SECRETACCESSKEY”)
}
}
}
(publications) {
“mavenJava”(MavenPublication::class) {
from(components[“java”])
artifact(sourcesJar)
}
}
}
tasks {
withType<Checkstyle> {
reports {
xml.isEnabled = false
html.isEnabled = false
}
}
withType<SpotBugsTask> {
reports {
xml.isEnabled = false
}
}
withType<JavaCompile> {
options.compilerArgs.addAll(listOf(
“-XepExcludedPaths:.*/build/classes/.*“,
“-Xep:MissingOverride:ERROR”,
“-Xep:Var:ERROR”
))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment