edgedb-java/build.gradle
2023-10-20 13:18:18 -03:00

133 lines
3.5 KiB
Groovy

plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}
ext {
project_version = '0.2.4-SNAPSHOT'
github_org = 'edgedb'
project_name = 'edgedb-java'
artifact_group = 'com.edgedb'
project_description = 'Java binding for the EdgeDB database'
project_url = "https://edgedb.com"
project_jdk = '11'
jdk = JavaVersion.current().majorVersion
jdk_javadoc = "https://docs.oracle.com/javase/$jdk/docs/api/".toString()
if (JavaVersion.current().isJava11Compatible()) {
jdk_javadoc = "https://docs.oracle.com/en/java/javase/$jdk/docs/api/".toString()
}
// dependencies
jackson_version = '2.15.2'
slf4j_version = '2.0.5'
netty_version = '4.1.89.Final'
joou_version = '0.9.4'
reflections_version = '0.10.2'
// test dependencies
junit_version = '5.9.2'
assertj_version = '3.24.2'
logback_version = '1.4.5'
isRelease = !project_version.toString().endsWith('-SNAPSHOT')
}
allprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
if (isRelease) {
apply plugin: 'signing'
}
group = artifact_group
version = project_version
description = project_description
sourceCompatibility = project_jdk
targetCompatibility = project_jdk
dependencies {
implementation platform("io.netty:netty-bom:$netty_version")
}
repositories {
mavenLocal()
mavenCentral()
}
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 60, 'seconds'
}
tasks.withType(Javadoc).configureEach {
options {
encoding = 'UTF-8'
tags = ["apiNote:a:API Note:",
"implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:"]
addStringOption 'Xdoclint:none', '-quiet'
addStringOption 'encoding', 'UTF-8'
}
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.incremental = true
}
tasks.register('downloadDependencies') {
description 'Download all dependencies to the Gradle cache'
doLast {
configurations.findAll { it.canBeResolved }.files
}
}
java {
withJavadocJar()
withSourcesJar()
}
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
}
subprojects {
archivesBaseName = "com.edgedb.$project.name"
tasks.withType(Javadoc).configureEach {
title = "$archivesBaseName ${version} API"
options.windowTitle = "$archivesBaseName ($version)"
}
publishing {
repositories {
maven {
if (isRelease) {
url 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
} else {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}
def sonatypeUsername = findProperty('sonatypeUsername')
def sonatypePassword = findProperty('sonatypePassword')
if (sonatypeUsername != null && sonatypePassword != null) {
credentials {
username sonatypeUsername
password sonatypePassword
}
}
}
}
}
}