forked from gitlab4j/gitlab4j-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes gitlab4j#1166
- Loading branch information
Showing
9 changed files
with
517 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
|
||
plugins { | ||
id 'java-library' | ||
id 'signing' | ||
id 'maven-publish' | ||
id 'de.marcphilipp.nexus-publish' version '0.4.0' | ||
id 'net.researchgate.release' version '3.0.2' | ||
id 'io.codearte.nexus-staging' version '0.22.0' | ||
} | ||
|
||
wrapper { | ||
gradleVersion = '7.6.2' | ||
} | ||
|
||
group = 'org.gitlab4j' | ||
|
||
dependencies { | ||
api 'jakarta.activation:jakarta.activation-api:1.2.2' | ||
api 'org.glassfish.jersey.inject:jersey-hk2:2.39.1' | ||
api 'org.glassfish.jersey.core:jersey-client:2.39.1' | ||
api 'org.glassfish.jersey.connectors:jersey-apache-connector:2.39.1' | ||
api 'org.glassfish.jersey.media:jersey-media-multipart:2.39.1' | ||
api 'org.glassfish.jersey.media:jersey-media-json-jackson:2.39.1' | ||
api 'jakarta.servlet:jakarta.servlet-api:4.0.4' | ||
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2' | ||
testImplementation 'org.mockito:mockito-core:4.4.0' | ||
testImplementation 'org.mockito:mockito-junit-jupiter:4.4.0' | ||
testImplementation 'org.hamcrest:hamcrest-all:1.3' | ||
testImplementation 'uk.org.webcompere:system-stubs-jupiter:1.2.0' | ||
} | ||
|
||
signing { | ||
useGpgCmd() | ||
sign(publishing.publications) | ||
} | ||
|
||
tasks.withType(Sign) { | ||
onlyIf { | ||
project.hasProperty('signing.gnupg.keyName') | ||
} | ||
} | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
|
||
compileJava.options.encoding = "UTF-8" | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(8) | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
nexusUrl.set(uri("https://oss.sonatype.org/service/local/")) | ||
username = project.findProperty('sonatypeUser') ?: '' | ||
password = project.findProperty('sonatypePassword') ?: '' | ||
} | ||
} | ||
} | ||
|
||
nexusStaging { | ||
serverUrl = "https://oss.sonatype.org/service/local/" | ||
packageGroup = 'org.gitlab4j' | ||
username = project.findProperty('sonatypeUser') ?: '' | ||
password = project.findProperty('sonatypePassword') ?: '' | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
pom { | ||
name = 'GitLab4J-API - GitLab API Java Client' | ||
description = 'GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.' | ||
packaging = 'jar' | ||
url = 'https://' + "$githubRepositoryOwner" + '.github.io/' + "$githubRepositoryName" + '/' | ||
licenses { | ||
license { | ||
name = 'The MIT License (MIT)' | ||
url = 'http://opensource.org/licenses/MIT' | ||
distribution = 'repo' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'gmessner' | ||
name = 'Greg Messner' | ||
email = '[email protected]' | ||
} | ||
developer { | ||
id = 'gdesaintmartinlacaze' | ||
name = 'Gautier de Saint Martin Lacaze' | ||
email = '[email protected]' | ||
} | ||
developer { | ||
url = 'https://github.com/orgs/' + "$githubRepositoryOwner" + '/people' | ||
} | ||
} | ||
scm { | ||
connection = 'scm:git:https://github.com/' + "$githubRepositoryOwner" + '/' + "$githubRepositoryName" + '.git' | ||
developerConnection = 'scm:git:https://github.com/' + "$githubRepositoryOwner" + '/' + "$githubRepositoryName" + '.git' | ||
url = 'https://github.com/' + "$githubRepositoryOwner" + '/' + "$githubRepositoryName" + '/' | ||
} | ||
} | ||
from components.java | ||
} | ||
} | ||
} | ||
|
||
release { | ||
buildTasks = ['releaseBuild'] | ||
git { | ||
requireBranch.set('main') | ||
} | ||
} | ||
|
||
task releaseBuild { | ||
dependsOn( | ||
'checkLastVersionValue', | ||
'clean', | ||
'build', | ||
project.getTasksByName('publishToSonatype', true) | ||
) | ||
} | ||
|
||
tasks.register('checkLastVersionValue') { | ||
doLast { | ||
if(version.endsWith('SNAPSHOT')) { | ||
throw new GradleException("version '$version' ends with SNAPSHOT, this is not a release build!") | ||
} | ||
if(lastVersion != version) { | ||
throw new GradleException("lastVersion '$lastVersion' does not match version '$version', fix it in the 'gradle.properties' file.") | ||
} | ||
} | ||
} | ||
|
||
def updateLastVersionValueTask = tasks.register('updateLastVersionValue') { | ||
doLast { | ||
def propertiesFile = file('gradle.properties') | ||
def content = propertiesFile.text | ||
content = content.replaceAll("lastVersion=[0-9\\.]+", "lastVersion=" + version.replace('-SNAPSHOT', '')) | ||
propertiesFile.text = content | ||
} | ||
} | ||
|
||
model { | ||
tasks.unSnapshotVersion { | ||
dependsOn updateLastVersionValueTask | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version=5.7.0-SNAPSHOT | ||
lastVersion=5.6.0 | ||
|
||
githubRepositoryOwner=gitlab4j | ||
githubRepositoryName=gitlab4j-api |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.