diff --git a/build.gradle b/build.gradle index bf839316a..fccaa9b68 100644 --- a/build.gradle +++ b/build.gradle @@ -12,11 +12,22 @@ plugins { // Apply the application plugin to add support for building a CLI application id 'application' + + id 'maven-publish' + id 'signing' } +group = 'tech.xigam' +version = '1.0.0-dev' + sourceCompatibility = 17 targetCompatibility = 17 +java { + withJavadocJar() + withSourcesJar() +} + repositories { mavenCentral() } @@ -64,3 +75,68 @@ jar { destinationDir = file(".") } +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = 'grasscutter' + from components.java + versionMapping { + usage('java-api') { + fromResolutionOf('runtimeClasspath') + } + usage('java-runtime') { + fromResolutionResult() + } + } + pom { + name = 'Grasscutter' + description = 'A server software reimplementation for an anime game.' + url = 'https://github.com/Grasscutters/Grasscutter' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'melledy' + name = 'Melledy' + email = 'melledy@xigam.tech' // not a real email kek + } + developer { + id = 'magix' + name = 'Magix' + email = 'magix@xigam.tech' + } + } + scm { + connection = 'scm:git:git@github.com:Grasscutters/Grasscutter.git' + developerConnection = 'scm:git:ssh://github.com:Grasscutters/Grasscutter.git' + url = 'https://github.com/Grasscutters/Grasscutter' + } + } + } + } + repositories { + maven { + // change URLs to point to your repos, e.g. http://my.org/repo + def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/' + def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + + name = 'sonatype' + credentials(PasswordCredentials) + } + } +} + +signing { + sign publishing.publications.mavenJava +} + +javadoc { + if(JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } +} \ No newline at end of file