379 lines
9.5 KiB
Groovy
379 lines
9.5 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
id "jacoco"
|
|
// id "com.vanniktech.maven.publish" version "0.28.0"
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
apply plugin: 'java'
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'signing'
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
url = "https://maven.speiger.com/repository/main"
|
|
}
|
|
}
|
|
|
|
archivesBaseName = 'Primitive Collections'
|
|
version = RELEASE_VERSION;
|
|
|
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.current();
|
|
|
|
System.out.println("Java Version: "+compileJava.sourceCompatibility)
|
|
|
|
java {
|
|
withJavadocJar()
|
|
withSourcesJar()
|
|
}
|
|
|
|
javadoc {
|
|
options.tags = [ "implSpec", "note" ]
|
|
}
|
|
|
|
eclipse {
|
|
classpath {
|
|
downloadJavadoc = true
|
|
downloadSources = true
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
builder
|
|
}
|
|
|
|
configurations {
|
|
builderCompile.extendsFrom compile
|
|
}
|
|
|
|
dependencies {
|
|
builderImplementation 'com.google.code.gson:gson:2.10'
|
|
builderImplementation 'de.speiger:Simple-Code-Generator:1.3.0'
|
|
testImplementation 'junit:junit:4.12'
|
|
testImplementation 'com.google.guava:guava-testlib:31.0.1-jre'
|
|
|
|
}
|
|
|
|
task generateSource(type: JavaExec) {
|
|
group = 'internal'
|
|
description = 'Builds the sourcecode'
|
|
classpath = sourceSets.builder.runtimeClasspath
|
|
main = 'speiger.src.builder.PrimitiveCollectionsBuilder'
|
|
}
|
|
|
|
task generateGithubSource(type: JavaExec) {
|
|
group = 'internal'
|
|
description = 'Builds the sourcecode for Github Actions'
|
|
classpath = sourceSets.builder.runtimeClasspath
|
|
main = 'speiger.src.builder.PrimitiveCollectionsBuilder'
|
|
args = ['silent']
|
|
}
|
|
|
|
task forceGenerateSource(type: JavaExec) {
|
|
group = 'internal'
|
|
description = 'Builds the sourcecode forceful'
|
|
classpath = sourceSets.builder.runtimeClasspath
|
|
main = 'speiger.src.builder.PrimitiveCollectionsBuilder'
|
|
args = ['force']
|
|
}
|
|
|
|
task generateTestSource(type: JavaExec) {
|
|
group = 'internal'
|
|
description = 'Builds the sourcecode for the Tests'
|
|
classpath = sourceSets.builder.runtimeClasspath
|
|
main = 'speiger.src.builder.PrimitiveCollectionsBuilder'
|
|
args = ['tests', 'silent']
|
|
}
|
|
|
|
task forceGenerateTestSource(type: JavaExec) {
|
|
group = 'internal'
|
|
description = 'Builds the sourcecode for the Tests'
|
|
classpath = sourceSets.builder.runtimeClasspath
|
|
main = 'speiger.src.builder.PrimitiveCollectionsBuilder'
|
|
args = ['tests', 'silent', 'force']
|
|
}
|
|
|
|
task generateLimitSource(type: JavaExec) {
|
|
group = 'internal'
|
|
description = 'Builds the Sourcecode with the ModuleSettings.json applied'
|
|
classpath = sourceSets.builder.runtimeClasspath
|
|
main = 'speiger.src.builder.PrimitiveCollectionsBuilder'
|
|
args = ['silent', 'load']
|
|
}
|
|
|
|
compileJava.dependsOn generateGithubSource
|
|
|
|
javadoc.failOnError = false
|
|
javadoc.options.memberLevel = JavadocMemberLevel.PUBLIC
|
|
javadoc.options.quiet()
|
|
|
|
|
|
task testBooleans(type: Test) {
|
|
group 'tests'
|
|
description 'Tests all Boolean Collections'
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
includeTestsMatching "speiger.src.tests.booleans.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
}
|
|
|
|
task testBytes(type: Test) {
|
|
group 'tests'
|
|
description 'Tests all Byte Collections'
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
includeTestsMatching "speiger.src.tests.bytes.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
maxParallelForks = testThreads as Integer
|
|
}
|
|
|
|
task testShorts(type: Test) {
|
|
group 'tests'
|
|
description 'Tests all Short Collections'
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
includeTestsMatching "speiger.src.tests.shorts.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
maxParallelForks = testThreads as Integer
|
|
}
|
|
|
|
task testChars(type: Test) {
|
|
group 'tests'
|
|
description 'Tests all Character Collections'
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
includeTestsMatching "speiger.src.tests.chars.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
maxParallelForks = testThreads as Integer
|
|
}
|
|
|
|
task testInts(type: Test) {
|
|
group 'tests'
|
|
description 'Tests all Int Collections'
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
includeTestsMatching "speiger.src.tests.ints.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
maxParallelForks = testThreads as Integer
|
|
}
|
|
|
|
task testLongs(type: Test) {
|
|
group 'tests'
|
|
description 'Tests all Long Collections'
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
includeTestsMatching "speiger.src.tests.longs.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
maxParallelForks = testThreads as Integer
|
|
}
|
|
|
|
task testFloats(type: Test) {
|
|
group 'tests'
|
|
description 'Tests all Float Collections'
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
includeTestsMatching "speiger.src.tests.floats.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
maxParallelForks = testThreads as Integer
|
|
}
|
|
|
|
task testDoubles(type: Test) {
|
|
group 'tests'
|
|
description 'Tests all Double Collections'
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
includeTestsMatching "speiger.src.tests.doubles.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
maxParallelForks = testThreads as Integer
|
|
}
|
|
|
|
task testObjects(type: Test) {
|
|
group 'tests'
|
|
description 'Tests all Object Collections'
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
includeTestsMatching "speiger.src.tests.objects.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
maxParallelForks = testThreads as Integer
|
|
}
|
|
|
|
if(System.getProperty("full_test_suite", "false").toBoolean()) {
|
|
test.dependsOn testBooleans
|
|
test.dependsOn testBytes
|
|
test.dependsOn testShorts
|
|
test.dependsOn testChars
|
|
test.dependsOn testInts
|
|
test.dependsOn testLongs
|
|
test.dependsOn testFloats
|
|
test.dependsOn testDoubles
|
|
test.dependsOn testObjects
|
|
}
|
|
|
|
test {
|
|
filter {
|
|
excludeTestsMatching "speiger.src.testers.**.*"
|
|
excludeTestsMatching "speiger.src.tests.**.*"
|
|
excludeTestsMatching "tests.**.*"
|
|
}
|
|
useJUnit()
|
|
ignoreFailures = true
|
|
maxHeapSize = maxMemory
|
|
}
|
|
|
|
jacocoTestReport {
|
|
executionData fileTree(project.buildDir.absolutePath).include("jacoco/*.exec")
|
|
reports {
|
|
xml.required = true
|
|
html.required = true
|
|
csv.required = true
|
|
}
|
|
}
|
|
|
|
|
|
publishing {
|
|
publications {
|
|
personal(MavenPublication) {
|
|
pom {
|
|
name = 'Primitive Collections'
|
|
description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
|
url = 'https://github.com/Speiger/Primitive-Collections'
|
|
version = project.version
|
|
artifactId = project.archivesBaseName.replace(" ", "-")
|
|
groupId = 'de.speiger'
|
|
from components.java
|
|
licenses {
|
|
license {
|
|
name = 'The Apache License, Version 2.0'
|
|
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id = 'speiger'
|
|
name = 'Speiger'
|
|
}
|
|
}
|
|
scm {
|
|
url = 'https://github.com/Speiger/Primitive-Collections'
|
|
}
|
|
issueManagement {
|
|
system = 'github'
|
|
url = 'https://github.com/Speiger/Primitive-Collections/issues'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
name = "Speiger_Maven"
|
|
def auth = System.getenv("Speiger_Maven_Auth")?.split(';');
|
|
url version.endsWith('SNAPSHOT') ? "https://maven.speiger.com/repository/debug" : "https://maven.speiger.com/repository/main"
|
|
credentials(PasswordCredentials) {
|
|
username auth?[0]
|
|
password auth?[1]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(PublishToMavenRepository) {
|
|
def predicate = provider {
|
|
(repository == publishing.repositories.mavenCentral && publication == publishing.publications.maven) ||
|
|
(repository != publishing.repositories.mavenCentral && publication != publishing.publications.maven)
|
|
}
|
|
onlyIf("publishing binary to the external repository, or binary and sources to the internal one") {
|
|
predicate.get()
|
|
}
|
|
}
|
|
|
|
tasks.withType(PublishToMavenLocal) {
|
|
def predicate = provider {
|
|
publication == publishing.publications.personal
|
|
}
|
|
onlyIf("publishing binary and sources") {
|
|
predicate.get()
|
|
}
|
|
}
|
|
|
|
//Maven central Start
|
|
//Disabling due to java8 incompat, only needed to manually publishing anyways
|
|
|
|
//signing.useGpgCmd()
|
|
//
|
|
//import com.vanniktech.maven.publish.SonatypeHost
|
|
//import com.vanniktech.maven.publish.JavaLibrary
|
|
//import com.vanniktech.maven.publish.JavadocJar
|
|
//
|
|
//mavenPublishing {
|
|
// configure(new JavaLibrary(new JavadocJar.None(), true))
|
|
//}
|
|
//
|
|
//mavenPublishing {
|
|
// publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
|
|
//
|
|
// signAllPublications()
|
|
// pom {
|
|
// name = 'Primitive Collections'
|
|
// description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
|
// url = 'https://github.com/Speiger/Primitive-Collections'
|
|
// version = project.version
|
|
// group = 'io.github.speiger'
|
|
// licenses {
|
|
// license {
|
|
// name = 'The Apache License, Version 2.0'
|
|
// url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
// }
|
|
// }
|
|
//
|
|
// developers {
|
|
// developer {
|
|
// id = 'speiger'
|
|
// name = 'Speiger'
|
|
// }
|
|
// }
|
|
//
|
|
// scm {
|
|
// connection = 'scm:git:git://github.com/Speiger/Primitive-Collections.git'
|
|
// developerConnection = 'scm:git:ssh://github.com:Speiger/Primitive-Collections.git'
|
|
// url = 'https://github.com/Speiger/Primitive-Collections'
|
|
// }
|
|
//
|
|
// issueManagement {
|
|
// system = 'github'
|
|
// url = 'https://github.com/Speiger/Primitive-Collections/issues'
|
|
// }
|
|
// }
|
|
//}
|
|
// |