1- import com.github.jk1.license.filter.LicenseBundleNormalizer
2- import com.github.jk1.license.render.JsonReportRenderer
3-
41plugins {
5- id ' java'
6- id " io.github.gradle-nexus.publish-plugin" version " 1.3.0"
7- id ' maven-publish'
8- id ' signing'
9- id ' java-library'
10- id ' application'
11- id ' com.palantir.docker' version ' 0.25.0'
12- id " org.owasp.dependencycheck" version " 9.0.9"
13- id ' com.github.jk1.dependency-license-report' version ' 2.5'
14- id " de.undercouch.download" version " 5.4.0"
2+ id " application"
3+ id " com.exactpro.th2.gradle.component" version " 0.0.6"
154}
165
176ext {
18- cradleVersion = ' 5.2 .0-dev'
19- commonVersion = ' 5.9.1 -dev'
20- commonUtilsVersion = ' 2.2.2 -dev'
7+ cradleVersion = ' 5.3 .0-dev'
8+ commonVersion = ' 5.11.0 -dev'
9+ commonUtilsVersion = ' 2.2.0 -dev'
2110}
2211
2312group = ' com.exactpro.th2'
@@ -46,119 +35,11 @@ repositories {
4635 }
4736}
4837
49- java {
50- withJavadocJar()
51- withSourcesJar()
52- }
53-
5438javadoc {
5539 options. addStringOption(' Xdoclint:none' , ' -quiet' )
5640}
5741
58- jar {
59- manifest {
60- attributes(
61- ' Created-By' : " ${ System.getProperty('java.version')} (${ System.getProperty('java.vendor')} )" ,
62- ' Specification-Title' : ' ' ,
63- ' Specification-Vendor' : ' Exactpro Systems LLC' ,
64- ' Implementation-Title' : project. archivesBaseName,
65- ' Implementation-Vendor' : ' Exactpro Systems LLC' ,
66- ' Implementation-Vendor-Id' : ' com.exactpro' ,
67- ' Implementation-Version' : project. version
68- )
69- }
70- }
71-
72- // conditionals for publications
73- tasks. withType(PublishToMavenRepository ). configureEach {
74- onlyIf {
75- (repository == publishing. repositories. nexus &&
76- project. hasProperty(' nexus_user' ) &&
77- project. hasProperty(' nexus_password' ) &&
78- project. hasProperty(' nexus_url' )) ||
79- (repository == publishing. repositories. sonatype &&
80- project. hasProperty(' sonatypeUsername' ) &&
81- project. hasProperty(' sonatypePassword' ))
82- }
83- }
84- tasks. withType(Sign ). configureEach {
85- onlyIf {
86- project. hasProperty(' signingKey' ) &&
87- project. hasProperty(' signingPassword' )
88- }
89- }
90- // disable running task 'initializeSonatypeStagingRepository' on a gitlab
91- tasks. configureEach { task ->
92- if (task. name == ' initializeSonatypeStagingRepository' &&
93- ! (project. hasProperty(' sonatypeUsername' ) && project. hasProperty(' sonatypePassword' ))
94- ) {
95- task. enabled = false
96- }
97- }
98-
99- publishing {
100- publications {
101- mavenJava(MavenPublication ) {
102- from(components. java)
103- pom {
104- name = rootProject. name
105- packaging = ' jar'
106- description = rootProject. description
107- url = vcs_url
108- scm {
109- url = vcs_url
110- }
111- licenses {
112- license {
113- name = ' The Apache License, Version 2.0'
114- url = ' http://www.apache.org/licenses/LICENSE-2.0.txt'
115- }
116- }
117- developers {
118- developer {
119- id = ' developer'
120- name = ' developer'
121- email = ' developer@exactpro.com'
122- }
123- }
124- scm {
125- url = vcs_url
126- }
127- }
128- }
129- }
130- repositories {
131- // Nexus repo to publish from gitlab
132- maven {
133- name = ' nexus'
134- credentials {
135- username = project. findProperty(' nexus_user' )
136- password = project. findProperty(' nexus_password' )
137- }
138- url = project. findProperty(' nexus_url' )
139- }
140- }
141- }
142-
143- nexusPublishing {
144- repositories {
145- sonatype {
146- nexusUrl. set(uri(" https://s01.oss.sonatype.org/service/local/" ))
147- snapshotRepositoryUrl. set(uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" ))
148- }
149- }
150- }
151-
152- signing {
153- String signingKey = findProperty(" signingKey" )
154- String signingPassword = findProperty(" signingPassword" )
155- useInMemoryPgpKeys(signingKey, signingPassword)
156- sign publishing. publications. mavenJava
157- }
158-
15942dependencies {
160- api platform(' com.exactpro.th2:bom:4.6.0' )
161-
16243 implementation " com.exactpro.th2:common:$commonVersion "
16344 implementation(" com.exactpro.th2:common-utils:$commonUtilsVersion " ) {
16445 because(" executor service utils is used" )
@@ -196,59 +77,6 @@ application {
19677 mainClassName = ' com.exactpro.th2.mstore.MessageStore'
19778}
19879
199- applicationName = ' service'
200-
201- distTar {
202- archiveName " ${ applicationName} .tar"
203- }
204-
205- dockerPrepare {
206- dependsOn distTar
207- }
208-
209- docker {
210- copySpec. from(tarTree(" $buildDir /distributions/${ applicationName} .tar" ))
211- }
212-
213- licenseReport {
214- def licenseNormalizerBundlePath = " $buildDir /license-normalizer-bundle.json"
215-
216- if (! file(licenseNormalizerBundlePath). exists()) {
217- download. run {
218- src ' https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/license-normalizer-bundle.json'
219- dest " $buildDir /license-normalizer-bundle.json"
220- overwrite false
221- }
222- }
223-
224- filters = [
225- new LicenseBundleNormalizer (licenseNormalizerBundlePath, false )
226- ]
227- renderers = [
228- new JsonReportRenderer (' licenses.json' , false ),
229- ]
230- excludeOwnGroup = false
231- allowedLicensesFile = new URL (" https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/allowed-licenses.json" )
232- }
233-
234- dependencyLocking {
235- lockAllConfigurations()
236- }
237-
23880dependencyCheck {
239- formats = [' SARIF' , ' JSON' , ' HTML' ]
240- failBuildOnCVSS = 5
24181 suppressionFile = file(' suppressions.xml' )
242- analyzers {
243- assemblyEnabled = false
244- nugetconfEnabled = false
245- nodeEnabled = false
246- }
247- }
248-
249- configurations. configureEach {
250- resolutionStrategy {
251- force " com.exactpro.th2:cradle-core:$cradleVersion "
252- force " com.exactpro.th2:cradle-cassandra:$cradleVersion "
253- }
254- }
82+ }
0 commit comments