EventsBus-Java/build.gradle
2024-09-12 15:01:25 -07:00

104 lines
2.3 KiB
Groovy

/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java library project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/8.0.2/userguide/building_java_projects.html
*/
plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
id 'idea'
id 'eclipse'
id 'maven-publish'
}
group = "dev.zontreck"
archivesBaseName = "EventsBus"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java {
withSourcesJar()
withJavadocJar()
}
configurations {
provided
implementation.extendsFrom(provided)
runtime.extendsFrom(provided)
compile.extendsFrom(provided)
}
def determinePatchVersion = {
// get the name of the last tag
def tagInfo = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = tagInfo
}
tagInfo = tagInfo.toString()
if (!tagInfo.contains('-')) {
return 0
}
return tagInfo.split("-")[1]
}
version = determinePatchVersion()
version = "${apiVer}.${version}"
println("Compile for version : ${version}")
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
provided "com.google.guava:guava:31.1-jre"
}
jar {
manifest {
attributes (
'Multi-Release': 'true'
)
}
duplicatesStrategy = "exclude"
from { configurations.provided.collect { it.isDirectory() ? it : zipTree(it) } }
exclude 'META-INF/*'
exclude 'META-INF/*'
exclude 'META-INF/*'
}
jar.dependsOn(sourcesJar, javadocJar)
def MAVEN_PASSWORD = "AriasCreationsMavenPassword"
def MAVEN_USER = "AriasCreationsMavenUser"
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact sourcesJar
artifact javadocJar
}
}
repositories {
maven {
url = "https://git.zontreck.com/api/packages/AriasCreations/maven"
name = "ariascreations"
credentials {
username = project.findProperty(MAVEN_USER)
password = project.findProperty(MAVEN_PASSWORD)
}
}
}
}