plugins { id 'java-library' id 'maven-publish' id 'idea' id "com.github.hierynomus.license" version "0.16.1" // Used to ensure that licence headers are applied consistently id "com.github.ben-manes.versions" version "0.49.0" // Used to check for new plugin / dependency versions. } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } javadoc { options.setEncoding 'UTF-8' if(JavaVersion.current().isJava9Compatible()) { options.addBooleanOption('html5', true) } } repositories { mavenCentral() } dependencies { implementation 'commons-io:commons-io:2.14.0' } sourceSets { main { java { srcDir 'src' } } } java { toolchain { languageVersion = JavaLanguageVersion.of(11) } } idea { module { downloadJavadoc = true downloadSources = true } } compileJava { options.compilerArgs << "-Xlint:all" } group "de.uni_passau.fim.seibt" if (System.getenv("GITLAB_CI") != null) { tasks.register('sourcesJar', Jar) { from sourceSets.main.allJava archiveClassifier = 'sources' } tasks.register('javadocJar', Jar) { from javadoc archiveClassifier = 'javadoc' } final CI_COMMIT_TAG = System.getenv('CI_COMMIT_TAG') final CI_JOB_MANUAL = System.getenv('CI_JOB_MANUAL') != null if (!CI_JOB_MANUAL && CI_COMMIT_TAG != null) { // Match tags like '2022.1' // If we are not building a manual snapshot the short SHA of the commit being built is used. final VERSION_MATCHER = (CI_COMMIT_TAG =~ /[1-9]\d{3,}\.(?:0|[1-9]\d*)/) if (VERSION_MATCHER.matches()) { project.version = CI_COMMIT_TAG } else { throw new GradleScriptException('Invalid version tag \'' + CI_COMMIT_TAG + '\'') } } else { project.version = System.getenv('CI_COMMIT_SHORT_SHA') } publishing { publications { GitWrapper(MavenPublication) { final BASE_ID = 'gitwrapper' if (CI_JOB_MANUAL) { artifactId = BASE_ID + '-snapshot' } else { artifactId = BASE_ID } from components.java artifact sourcesJar artifact javadocJar pom { name = 'GitWrapper' description = 'A Java library wrapping system calls to a natively installed git executable.' url = 'https://gitlab.infosun.fim.uni-passau.de/seibt/GitWrapper' licenses { license { name = 'GNU Lesser General Public License V3' url = 'https://www.gnu.org/licenses/lgpl-3.0.de.html' } } developers { developer { id = 'seibt' name = 'Georg Seibt' email = 'seibt@fim.uni-passau.de' } } scm { connection = 'scm:git:https://gitlab.infosun.fim.uni-passau.de/seibt/GitWrapper.git' developerConnection = 'scm:git:ssh://git@gitlab.infosun.fim.uni-passau.de:seibt/GitWrapper.git' url = 'https://gitlab.infosun.fim.uni-passau.de/seibt/GitWrapper' } } } } repositories { maven { name 'GitLab' url "${System.getenv('CI_API_V4_URL')}/projects/${System.getenv('CI_PROJECT_ID')}/packages/maven" credentials(HttpHeaderCredentials) { name "Job-Token" value System.getenv('CI_JOB_TOKEN') } authentication { header(HttpHeaderAuthentication) } } } } } license { header = file('LICENSE_HEADER') strictCheck = true }