Skip to content
Closed
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
157 changes: 91 additions & 66 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,90 +1,115 @@
plugins {
id 'java'
id 'maven-publish'
id 'jacoco'
id "io.freefair.lombok" version "5.3.0"
id "com.github.hierynomus.license" version "0.15.0"
}

jacoco {
// Use JaCoCo 0.8.6 for (experimental) support for Java 15 class files.
toolVersion = "0.8.6"
// 'java', 'maven-publish' and 'jacoco' do not have 'apply false' tags here since they are core gradle plugins.
// Plugins defined here with "apply false"; to be used in subprojects
id "io.freefair.lombok" version "5.3.0" apply false
id "com.github.hierynomus.license" version "0.15.0" apply false

// Plugins used in the root project
id "java"
id "maven-publish"
id "com.github.johnrengelman.shadow" version "6.1.0"
}

group = 'com.dumbdogdiner'

version = '2.0.0'

// License Plugin Options
license { header = file('LICENSE_HEADER') }
// Run the license formatter before compiling the source code.
tasks.compileJava.dependsOn licenseFormatMain, licenseFormatTest
dependencies {
// Shadow: subproject as a 'compile' dependency
compile project(":core")
}

// Shadow: removed classifier from output filename
shadowJar { archiveClassifier.set('') }

configurations {
jaxDoclet
// give test dependencies access to compileOnly dependencies to emulate providedCompile
testImplementation.extendsFrom compileOnly
// Shadow: Reproducible Builds
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

repositories {
mavenCentral()
jcenter()
// Shadow: run with build
tasks.build.dependsOn shadowJar

allprojects {
repositories {
mavenCentral()
jcenter()

maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://papermc.io/repo/repository/maven-public/' }
}

maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://papermc.io/repo/repository/maven-public/' }
}

dependencies {
compileOnly 'org.projectlombok:lombok:1.18.16'
annotationProcessor 'org.projectlombok:lombok:1.18.16'

compileOnly 'com.destroystokyo.paper:paper-api:1.16.4-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-api:1.16-R0.4-SNAPSHOT'
implementation 'org.jetbrains:annotations:20.1.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'io.github.classgraph:classgraph:4.8.92'
implementation 'com.github.seancfoley:ipaddress:5.3.3'
subprojects {
apply plugin: "java"
apply plugin: "jacoco"
apply plugin: "io.freefair.lombok"
apply plugin: "com.github.hierynomus.license"

// JUnit 5 Testing
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")

// Mocking
testImplementation("org.powermock:powermock-module-junit4:2.0.9")
testImplementation("org.powermock:powermock-api-mockito2:2.0.9")
testImplementation("org.powermock:powermock-module-junit4-rule:2.0.9")
testImplementation("org.powermock:powermock-classloading-xstream:2.0.9")
testImplementation("org.mockito:mockito-core:3.6.28")
}
// jacoco opts here TODO

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
// Show System.out for code ran by tests
showStandardStreams = true
}
finalizedBy jacocoTestReport // report is always generated after tests run
}
// License Plugin Options
license { header = file('../LICENSE_HEADER') }
// Run the license formatter before compiling the source code.
tasks.compileJava.dependsOn licenseFormatMain, licenseFormatTest

jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.enabled true
html.enabled true
configurations {
jaxDoclet
// give test dependencies access to compileOnly dependencies to emulate providedCompile
testImplementation.extendsFrom compileOnly
}

dependencies {
compileOnly 'org.projectlombok:lombok:1.18.16'
annotationProcessor 'org.projectlombok:lombok:1.18.16'

compileOnly 'com.destroystokyo.paper:paper-api:1.16.4-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-api:1.16-R0.4-SNAPSHOT'
compileOnly 'org.jetbrains:annotations:20.1.0'
compileOnly 'com.github.seancfoley:ipaddress:5.3.3'

// JUnit 5 Testing
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")

// Mocking
testImplementation("org.powermock:powermock-module-junit4:2.0.9")
testImplementation("org.powermock:powermock-api-mockito2:2.0.9")
testImplementation("org.powermock:powermock-module-junit4-rule:2.0.9")
testImplementation("org.powermock:powermock-classloading-xstream:2.0.9")
testImplementation("org.mockito:mockito-core:3.6.28")
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
// Show System.out for code ran by tests
showStandardStreams = true
}
finalizedBy jacocoTestReport // report is always generated after tests run
}

jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.enabled true
html.enabled true
}
}
}

task sources(type: Jar, dependsOn: classes) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
// Use source code from all subprojects for sources.
// TODO: Use certain subprojects only to allow for multiple jar outputs
from subprojects.sourceSets.main.allSource
}


tasks.publish.dependsOn build, sources



// We *probably* don't need this anymore.
tasks.publish.dependsOn build, shadowJar, sources

publishing {
repositories {
Expand All @@ -99,8 +124,8 @@ publishing {
}
publications {
gpr(MavenPublication) {
from(components.java)
artifact shadowJar // Use shadow jar instead of components.java
artifact sources // Publish the output of the sources task
}
}
}
}
4 changes: 4 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jacoco {
// Use JaCoCo 0.8.6 for (experimental) support for Java 15 class files.
toolVersion = "0.8.6"
}
3 changes: 3 additions & 0 deletions core/lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is generated by the 'io.freefair.lombok' Gradle plugin
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rootProject.name = 'stickyapi'
rootProject.name = 'stickyapi'
include "core"