-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TH2-5267] Migrated to th2 gradle plugin
- Loading branch information
1 parent
825a9c6
commit 8177171
Showing
7 changed files
with
60 additions
and
162 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
updates: | ||
# Enable version updates for Gradle | ||
- package-ecosystem: "gradle" | ||
# Look for `build.gradle` file in the `root` directory | ||
directory: "/" | ||
# Check for updates every day (weekdays) | ||
schedule: | ||
interval: "daily" | ||
allow: | ||
# Allow updates for Exactpro packages | ||
- dependency-name: "com.exactpro*" | ||
# Allow up to 10 open pull requests | ||
open-pull-requests-limit: 10 |
14 changes: 5 additions & 9 deletions
14
.github/workflows/java-publish-sonatype.yml → .github/workflows/build-dev-release.yml
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 |
---|---|---|
@@ -1,21 +1,17 @@ | ||
name: Build and release Java distributions to sonatype. | ||
name: Build and publish dev release jar to sonatype repository | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- version-* | ||
paths: | ||
- gradle.properties | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
build: | ||
uses: th2-net/.github/.github/workflows/compound-java.yml@main | ||
with: | ||
build-target: 'Sonatype' | ||
runsOn: ubuntu-latest | ||
devRelease: true | ||
createTag: true | ||
secrets: | ||
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | ||
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | ||
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }} | ||
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} | ||
nvd-api-key: ${{ secrets.NVD_APIKEY }} |
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,17 @@ | ||
name: Build and publish release jar to sonatype repository | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
build: | ||
uses: th2-net/.github/.github/workflows/compound-java.yml@main | ||
with: | ||
build-target: 'Sonatype' | ||
devRelease: false | ||
createTag: true | ||
secrets: | ||
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | ||
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | ||
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }} | ||
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} | ||
nvd-api-key: ${{ secrets.NVD_APIKEY }} |
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
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 |
---|---|---|
@@ -1,163 +1,37 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'signing' | ||
id 'maven-publish' | ||
id "io.github.gradle-nexus.publish-plugin" version "1.0.0" | ||
id "org.owasp.dependencycheck" version "8.1.0" | ||
id "com.exactpro.th2.gradle.publish" version "0.1.8" | ||
} | ||
|
||
group = 'com.exactpro.th2' | ||
version = release_version | ||
|
||
ext { | ||
sharedDir = file("${project.rootDir}/shared") | ||
} | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
|
||
repositories { | ||
mavenCentral() | ||
configurations.all { | ||
maven { | ||
name 'Sonatype_snapshots' | ||
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' | ||
} | ||
maven { | ||
name 'Sonatype_releases' | ||
url 'https://s01.oss.sonatype.org/content/repositories/releases/' | ||
} | ||
mavenLocal() | ||
configurations.configureEach { | ||
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' | ||
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds' | ||
} | ||
} | ||
|
||
dependencies { | ||
testImplementation 'org.assertj:assertj-core:3.24.2' | ||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2' | ||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' | ||
} | ||
|
||
dependencyCheck { | ||
formats=['SARIF', 'JSON', 'HTML'] | ||
failBuildOnCVSS=5 | ||
|
||
analyzers { | ||
assemblyEnabled = false | ||
nugetconfEnabled = false | ||
nodeEnabled = false | ||
} | ||
testImplementation 'org.assertj:assertj-core:3.27.3' | ||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4' | ||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.4' | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
|
||
tasks.named("jar") { | ||
manifest { | ||
attributes( | ||
'Created-By': "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})", | ||
'Specification-Title': '', | ||
'Specification-Vendor': 'Exactpro Systems LLC', | ||
'Implementation-Title': project.archivesBaseName, | ||
'Implementation-Vendor': 'Exactpro Systems LLC', | ||
'Implementation-Vendor-Id': 'com.exactpro', | ||
'Implementation-Version': project.version | ||
) | ||
} | ||
} | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
// conditionals for publications | ||
tasks.withType(PublishToMavenRepository) { | ||
onlyIf { | ||
(repository == publishing.repositories.nexusRepository && | ||
project.hasProperty('nexus_user') && | ||
project.hasProperty('nexus_password') && | ||
project.hasProperty('nexus_url')) || | ||
(repository == publishing.repositories.sonatype && | ||
project.hasProperty('sonatypeUsername') && | ||
project.hasProperty('sonatypePassword')) || | ||
(repository == publishing.repositories.localRepo) | ||
} | ||
} | ||
tasks.withType(Sign) { | ||
onlyIf { project.hasProperty('signingKey') && | ||
project.hasProperty('signingPassword') | ||
} | ||
} | ||
// disable running task 'initializeSonatypeStagingRepository' on a gitlab | ||
tasks.whenTaskAdded {task -> | ||
if(task.name.equals('initializeSonatypeStagingRepository') && | ||
!(project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) | ||
) { | ||
task.enabled = false | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from(components.java) | ||
pom { | ||
name = rootProject.name | ||
packaging = 'jar' | ||
description = rootProject.description | ||
url = vcs_url | ||
scm { | ||
url = vcs_url | ||
} | ||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'developer' | ||
name = 'developer' | ||
email = 'developer@exactpro.com' | ||
} | ||
} | ||
scm { | ||
url = vcs_url | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
name = 'localRepo' | ||
url = sharedDir | ||
} | ||
//Nexus repo to publish from gitlab | ||
maven { | ||
name = 'nexusRepository' | ||
credentials { | ||
username = project.findProperty('nexus_user') | ||
password = project.findProperty('nexus_password') | ||
} | ||
url = project.findProperty('nexus_url') | ||
} | ||
} | ||
} | ||
|
||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
def signingKey = findProperty("signingKey") | ||
def signingPassword = findProperty("signingPassword") | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign publishing.publications.mavenJava | ||
} | ||
|
||
clean { | ||
delete sharedDir | ||
} | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
dependencyLocking { | ||
lockAllConfigurations() | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |