| apply plugin: 'maven-publish' |
| apply plugin: 'java-library' |
| //apply plugin: 'net.ltgt.errorprone' |
| apply plugin: 'jacoco' |
| |
| def baseArtifactId = project.baseId |
| def artifactGroupId = project.groupId |
| def javaBaseName = "_GROUP_edu_wpi_first_${project.baseId}_ID_${project.baseId}-java_CLS" |
| |
| def outputsFolder = file("$project.buildDir/outputs") |
| |
| task sourcesJar(type: Jar, dependsOn: classes) { |
| classifier = 'sources' |
| from sourceSets.main.allSource |
| } |
| |
| task javadocJar(type: Jar, dependsOn: javadoc) { |
| classifier = 'javadoc' |
| from javadoc.destinationDir |
| } |
| |
| task outputJar(type: Jar, dependsOn: classes) { |
| archiveBaseName = javaBaseName |
| destinationDirectory = outputsFolder |
| from sourceSets.main.output |
| } |
| |
| task outputSourcesJar(type: Jar, dependsOn: classes) { |
| archiveBaseName = javaBaseName |
| destinationDirectory = outputsFolder |
| classifier = 'sources' |
| from sourceSets.main.allSource |
| } |
| |
| task outputJavadocJar(type: Jar, dependsOn: javadoc) { |
| archiveBaseName = javaBaseName |
| destinationDirectory = outputsFolder |
| classifier = 'javadoc' |
| from javadoc.destinationDir |
| } |
| |
| artifacts { |
| archives sourcesJar |
| archives javadocJar |
| archives outputJar |
| archives outputSourcesJar |
| archives outputJavadocJar |
| } |
| |
| addTaskToCopyAllOutputs(outputSourcesJar) |
| addTaskToCopyAllOutputs(outputJavadocJar) |
| addTaskToCopyAllOutputs(outputJar) |
| |
| build.dependsOn outputSourcesJar |
| build.dependsOn outputJavadocJar |
| build.dependsOn outputJar |
| |
| project(':').libraryBuild.dependsOn build |
| |
| publishing { |
| publications { |
| |
| java(MavenPublication) { |
| artifact jar |
| artifact sourcesJar |
| artifact javadocJar |
| |
| artifactId = "${baseArtifactId}-java" |
| groupId artifactGroupId |
| version wpilibVersioning.version.get() |
| } |
| } |
| } |
| |
| test { |
| useJUnitPlatform() |
| systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' |
| testLogging { |
| events "failed" |
| exceptionFormat "full" |
| } |
| finalizedBy jacocoTestReport |
| } |
| |
| if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxraspbian') || project.hasProperty('onlylinuxaarch64bionic')) { |
| test.enabled = false |
| } |
| |
| repositories { |
| mavenCentral() |
| //maven.url "https://oss.sonatype.org/content/repositories/snapshots/" |
| } |
| |
| sourceSets { |
| dev |
| } |
| |
| tasks.withType(JavaCompile).configureEach { |
| options.compilerArgs = ['--release', '11'] |
| } |
| |
| dependencies { |
| testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2' |
| testImplementation 'org.junit.jupiter:junit-jupiter-params:5.4.2' |
| testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2' |
| |
| devImplementation sourceSets.main.output |
| |
| //errorprone 'com.google.errorprone:error_prone_core:2.3.2-SNAPSHOT' |
| //errorproneJavac 'com.google.errorprone:error_prone_core:2.3.1' |
| } |
| |
| task run(type: JavaExec) { |
| classpath = sourceSets.dev.runtimeClasspath |
| |
| main = project.devMain |
| } |
| |
| build.dependsOn devClasses |
| |
| jacoco { |
| toolVersion = "0.8.4" |
| } |
| |
| jacocoTestReport { |
| reports { |
| xml.enabled true |
| html.enabled true |
| } |
| } |