1+ import nl.javadude.gradle.plugins.license.DownloadLicensesExtension.license
2+ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
3+ import org.gradle.api.tasks.testing.logging.TestLogEvent.*
4+
15plugins {
2- id(" java" )
3- id(" com.github.sgtsilvio.gradle.utf8" )
4- id(" com.github.johnrengelman.shadow" )
5- id(" com.github.hierynomus.license" )
6- id(" org.owasp.dependencycheck" )
6+ java
7+ alias(libs.plugins.defaults)
8+ alias(libs.plugins.shadow)
9+ alias(libs.plugins.license)
10+ id(" com.hivemq.edge-version-updater" )
11+ id(" com.hivemq.third-party-license-generator" )
712}
813
914
1015group = " com.hivemq"
1116version = " 2024.9-ALPHA"
1217
1318repositories {
14- mavenLocal()
1519 mavenCentral()
1620}
1721
18-
1922dependencies {
2023 compileOnly(" com.hivemq:hivemq-edge-adapter-sdk:${property(" hivemq-edge-adapter-sdk.version" )} " )
2124 compileOnly(" commons-io:commons-io:${property(" commons-io.version" )} " )
@@ -38,9 +41,155 @@ dependencies {
3841
3942tasks.test {
4043 useJUnitPlatform()
44+ testLogging {
45+ events = setOf (STARTED , PASSED , FAILED , SKIPPED , STANDARD_ERROR )
46+ exceptionFormat = TestExceptionFormat .FULL
47+ }
48+ }
49+
50+ tasks.register<Copy >(" copyAllDependencies" ) {
51+ shouldRunAfter(" assemble" )
52+ from(configurations.runtimeClasspath)
53+ into(" ${buildDir} /deps/libs" )
54+ }
55+
56+ tasks.named(" assemble" ) { finalizedBy(" copyAllDependencies" ) }
57+
58+ /* ******************** artifacts ******************** */
59+
60+ val releaseBinary: Configuration by configurations.creating {
61+ isCanBeConsumed = true
62+ isCanBeResolved = false
63+ attributes {
64+ attribute(Category .CATEGORY_ATTRIBUTE , objects.named(" binary" ))
65+ attribute(Usage .USAGE_ATTRIBUTE , objects.named(" release" ))
66+ }
67+ }
68+
69+ val thirdPartyLicenses: Configuration by configurations.creating {
70+ isCanBeConsumed = true
71+ isCanBeResolved = false
72+ attributes {
73+ attribute(Category .CATEGORY_ATTRIBUTE , objects.named(" third-party-licenses" ))
74+ }
4175}
4276
77+ artifacts {
78+ add(releaseBinary.name, tasks.shadowJar)
79+ add(thirdPartyLicenses.name, tasks.updateThirdPartyLicenses.flatMap { it.outputDirectory })
80+ }
81+ /* ******************** compliance ******************** */
82+
4383license {
4484 header = file(" HEADER" )
4585 mapping(" java" , " SLASHSTAR_STYLE" )
46- }
86+ }
87+
88+ downloadLicenses {
89+ aliases = mapOf (
90+ license(" Apache License, Version 2.0" , " https://opensource.org/licenses/Apache-2.0" ) to listOf (
91+ " Apache 2" ,
92+ " Apache 2.0" ,
93+ " Apache-2.0" ,
94+ " Apache License 2.0" ,
95+ " Apache License, 2.0" ,
96+ " Apache License v2.0" ,
97+ " Apache License, Version 2" ,
98+ " Apache License Version 2.0" ,
99+ " Apache License, Version 2.0" ,
100+ " Apache License, version 2.0" ,
101+ " The Apache License, Version 2.0" ,
102+ " Apache Software License - Version 2.0" ,
103+ " Apache Software License, version 2.0" ,
104+ " The Apache Software License, Version 2.0"
105+ ),
106+ license(" MIT License" , " https://opensource.org/licenses/MIT" ) to listOf (
107+ " MIT License" ,
108+ " MIT license" ,
109+ " The MIT License" ,
110+ " The MIT License (MIT)"
111+ ),
112+ license(" CDDL, Version 1.0" , " https://opensource.org/licenses/CDDL-1.0" ) to listOf (
113+ " CDDL, Version 1.0" ,
114+ " Common Development and Distribution License 1.0" ,
115+ " COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0" ,
116+ license(" CDDL" , " https://glassfish.dev.java.net/public/CDDLv1.0.html" )
117+ ),
118+ license(" CDDL, Version 1.1" , " https://oss.oracle.com/licenses/CDDL+GPL-1.1" ) to listOf (
119+ " CDDL 1.1" ,
120+ " CDDL, Version 1.1" ,
121+ " Common Development And Distribution License 1.1" ,
122+ " CDDL+GPL License" ,
123+ " CDDL + GPLv2 with classpath exception" ,
124+ " Dual license consisting of the CDDL v1.1 and GPL v2" ,
125+ " CDDL or GPLv2 with exceptions" ,
126+ " CDDL/GPLv2+CE"
127+ ),
128+ license(" LGPL, Version 2.0" , " https://opensource.org/licenses/LGPL-2.0" ) to listOf (
129+ " LGPL, Version 2.0" ,
130+ " GNU General Public License, version 2"
131+ ),
132+ license(" LGPL, Version 2.1" , " https://opensource.org/licenses/LGPL-2.1" ) to listOf (
133+ " LGPL, Version 2.1" ,
134+ " LGPL, version 2.1" ,
135+ " GNU Lesser General Public License version 2.1 (LGPLv2.1)" ,
136+ license(" GNU Lesser General Public License" , " http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" )
137+ ),
138+ license(" LGPL, Version 3.0" , " https://opensource.org/licenses/LGPL-3.0" ) to listOf (
139+ " LGPL, Version 3.0" ,
140+ " Lesser General Public License, version 3 or greater"
141+ ),
142+ license(" EPL, Version 1.0" , " https://opensource.org/licenses/EPL-1.0" ) to listOf (
143+ " EPL, Version 1.0" ,
144+ " Eclipse Public License - v 1.0" ,
145+ " Eclipse Public License - Version 1.0" ,
146+ license(" Eclipse Public License" , " http://www.eclipse.org/legal/epl-v10.html" )
147+ ),
148+ license(" EPL, Version 2.0" , " https://opensource.org/licenses/EPL-2.0" ) to listOf (
149+ " EPL 2.0" ,
150+ " EPL, Version 2.0"
151+ ),
152+ license(" EDL, Version 1.0" , " https://www.eclipse.org/org/documents/edl-v10.php" ) to listOf (
153+ " EDL 1.0" ,
154+ " EDL, Version 1.0" ,
155+ " Eclipse Distribution License - v 1.0"
156+ ),
157+ license(" BSD 3-Clause License" , " https://opensource.org/licenses/BSD-3-Clause" ) to listOf (
158+ " BSD 3-clause" ,
159+ " BSD-3-Clause" ,
160+ " BSD 3-Clause License" ,
161+ " 3-Clause BSD License" ,
162+ " New BSD License" ,
163+ license(" BSD" , " http://asm.ow2.org/license.html" ),
164+ license(" BSD" , " http://asm.objectweb.org/license.html" ),
165+ license(" BSD" , " LICENSE.txt" )
166+ ),
167+ license(" Bouncy Castle License" , " https://www.bouncycastle.org/licence.html" ) to listOf (
168+ " Bouncy Castle Licence"
169+ ),
170+ license(" W3C License" , " https://opensource.org/licenses/W3C" ) to listOf (
171+ " W3C License" ,
172+ " W3C Software Copyright Notice and License" ,
173+ " The W3C Software License"
174+ ),
175+ license(" CC0" , " https://creativecommons.org/publicdomain/zero/1.0/" ) to listOf (
176+ " CC0" ,
177+ " Public Domain"
178+ )
179+ )
180+
181+ dependencyConfiguration = " runtimeClasspath"
182+ }
183+
184+ tasks.updateThirdPartyLicenses {
185+ dependsOn(tasks.downloadLicenses)
186+ projectName.set(project.name)
187+ group = " license"
188+ dependencyLicense.set(tasks.downloadLicenses.get().xmlDestination.resolve(" dependency-license.xml" ))
189+ outputDirectory.set(layout.buildDirectory.dir(" distribution/third-party-licenses" ))
190+ }
191+
192+ val javaComponent = components[" java" ] as AdhocComponentWithVariants
193+ javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements.get()) {
194+ skip()
195+ }
0 commit comments