Skip to content

Commit

Permalink
+ Migrated to th2 gradle plugin: 0.0.5 (bom: 4.6.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Smirnov-Exactpro committed Apr 17, 2024
1 parent 40c0478 commit 29a0a2b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 158 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ Test events have mandatory parameters that are verified when storing an event. T

## Release notes

### 5.3.0
+ Migrated to th2 gradle plugin: `0.0.5` (bom: `4.6.1`)
+ Updated bom: `4.6.1`

### 5.2.0
* Added page cache for each book to avoid memory leak

Expand Down
144 changes: 2 additions & 142 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
plugins {
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
id "org.owasp.dependencycheck" version "9.0.9"
id 'signing'
}

ext {
sharedDir = file("${project.rootDir}/shared")
id "com.exactpro.th2.gradle.base" version "0.0.5"
id "com.exactpro.th2.gradle.publish" version "0.0.5"
}

allprojects {
version = release_version
group = 'com.exactpro.th2'

dependencyCheck {
formats = ['SARIF', 'JSON', 'HTML']
failBuildOnCVSS = 5
suppressionFile = "${rootDir}/suppressions.xml"
analyzers {
assemblyEnabled = false
nugetconfEnabled = false
nodeEnabled = false
}
}

}

subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.owasp.dependencycheck'

repositories {
mavenCentral()
Expand All @@ -48,132 +29,11 @@ subprojects {
}
}


defaultTasks 'build'

sourceCompatibility = JavaVersion.VERSION_11 //Java version compatibility to use when compiling Java source.
targetCompatibility = JavaVersion.VERSION_11 //Java version to generate classes for.
compileJava.options.debugOptions.debugLevel = 'source,lines,vars' // Include debug information

dependencies {
implementation 'io.prometheus:simpleclient_dropwizard:0.16.0'
}

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,
'Implementation-Version-Date': getDate()
)
}
}

java {
withJavadocJar()
withSourcesJar()
}

// conditionals for publications
tasks.withType(PublishToMavenRepository).configureEach {
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'))
}
}
tasks.withType(Sign).configureEach {
onlyIf {
project.hasProperty('signingKey') &&
project.hasProperty('signingPassword')
}
}
// disable running task 'initializeSonatypeStagingRepository' on a gitlab
tasks.configureEach { task ->
if (task.name == 'initializeSonatypeStagingRepository' &&
!(project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword'))
) {
task.enabled = false
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
pom {
name = project.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 = '[email protected]'
}
}
scm {
url = vcs_url
}
}
}
}
repositories {
//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')
}
}
}

signing {
String signingKey = findProperty("signingKey")
String signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}

}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
tasks.register("listProjects") {
doLast {
subprojects.forEach { println(it.name) }
}
}

static def getDate() {
def date = new Date()
def formattedDate = date.format('yyyyMMdd-HH:mm:ss.SSS')
return formattedDate
}
15 changes: 4 additions & 11 deletions cradle-cassandra/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,16 @@ dependencies {
implementation 'com.google.guava:guava'

// this section is required to bypass failing vulnerability check caused by cassandra driver's transitive dependencies
annotationProcessor platform('com.exactpro.th2:bom:4.5.0')
annotationProcessor platform('com.exactpro.th2:bom:4.6.1')
annotationProcessor "com.datastax.oss:java-driver-mapper-processor"
// ---

testImplementation 'org.testng:testng:7.9.0'
testImplementation 'org.testng:testng:7.10.1'
testImplementation 'org.assertj:assertj-core:3.25.3'
testImplementation "org.apache.logging.log4j:log4j-slf4j2-impl"
testImplementation 'org.apache.logging.log4j:log4j-core'
testImplementation 'org.mockito:mockito-core:5.10.0'
testImplementation 'org.testcontainers:cassandra:1.19.6'
}

def gen_dir = 'build/generated/sources/annotationProcessor/main'
sourceSets.main.java.srcDirs += [gen_dir]

compileJava {
options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/${gen_dir}")
testImplementation 'org.mockito:mockito-core:5.11.0'
testImplementation 'org.testcontainers:cassandra:1.19.7'
}

test {
Expand Down
2 changes: 0 additions & 2 deletions cradle-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
dependencies {
api platform('com.exactpro.th2:bom:4.5.0')

implementation "com.fasterxml.jackson.core:jackson-databind"
implementation "org.apache.commons:commons-lang3"

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
release_version=5.2.0
release_version=5.3.0
description='Cradle API'
vcs_url=https://github.com/th2-net/cradleapi
vcs_url=https://github.com/th2-net/cradleapi
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ include 'cradle-cassandra'
// Defined names will be used for jar and artifact names
project(':cradle-core').name = 'cradle-core'
project(':cradle-cassandra').name = 'cradle-cassandra'
startParameter.setWriteDependencyLocks(true)

0 comments on commit 29a0a2b

Please sign in to comment.