Primitive-Collections/build.gradle

149 lines
3.4 KiB
Groovy

plugins {
id 'java-library'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
repositories {
mavenCentral()
maven {
url = "https://maven.speiger.com/repository/main"
}
}
archivesBaseName = 'Primitive Collections'
version = '0.6.2.10-SNAPSHOT';
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.current();
System.out.println("Java Version: "+compileJava.sourceCompatibility)
javadoc {
options.tags = [ "implSpec", "note" ]
}
eclipse {
classpath {
downloadJavadoc = true
downloadSources = true
}
}
sourceSets {
builder
}
configurations {
builderCompile.extendsFrom compile
}
dependencies {
builderImplementation 'de.speiger:Simple-Code-Generator:1.0.7'
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 = ['false', 'true']
}
task forceGenerateSource(type: JavaExec) {
group = 'internal'
description = 'Builds the sourcecode forceful'
classpath = sourceSets.builder.runtimeClasspath
main = 'speiger.src.builder.PrimitiveCollectionsBuilder'
args = ['true']
}
task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
}
task srcJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
compileJava.dependsOn generateGithubSource
javadoc.failOnError = false
javadoc.options.memberLevel = JavadocMemberLevel.PUBLIC
javadoc.options.quiet()
artifacts {
archives javadocJar
archives srcJar
}
test {
useJUnit()
}
publishing {
Properties props = new Properties()
if(file("$buildDir/credentials.properties").exists()) {
props.load(new FileInputStream("$buildDir/credentials.properties"))
}
publications {
mavenJava(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
artifact tasks.srcJar
artifact tasks.javadocJar
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 {
url version.endsWith('SNAPSHOT') ? "https://maven.speiger.com/repository/debug" : "https://maven.speiger.com/repository/main"
credentials(PasswordCredentials) {
username props.mavenUser
password props.mavenPassword
}
}
}
}