1
+ import com.github.jk1.license.filter.LicenseBundleNormalizer
2
+
3
+ buildscript {
4
+ ext {
5
+ besuIdentifier = " besu-${ besuVersion} "
6
+ besuFilename = " ${ besuIdentifier} .tar.gz"
7
+ besuUrl = " ${ distributionBaseUrl}${ besuVersion} /${ besuFilename} "
8
+ besuPluginsIdentifier = " ${ distributionIdentifier} -${ version} "
9
+ besuPluginDir = File . createTempDir(" plugins" )
10
+ }
11
+ }
12
+
13
+ plugins {
14
+ id ' java-library'
15
+ id ' com.github.jk1.dependency-license-report' version ' 2.9'
16
+ }
17
+
18
+ version = project. hasProperty(' releaseVersion' ) ? project. getProperty(' releaseVersion' ) : ' snapshot'
19
+
20
+
21
+ licenseReport {
22
+ // This is for the allowed-licenses-file in checkLicense Task
23
+ // Accepts File, URL or String path to local or remote file
24
+ allowedLicensesFile = rootProject. file(" gradle/allowed-licenses.json" )
25
+
26
+ excludes = []
27
+
28
+ // If set to true, then all boms will be excluded from the report
29
+ excludeBoms = true
30
+
31
+ filters = [
32
+ new LicenseBundleNormalizer (bundlePath : rootProject. file(" gradle/license-normalizer-bundle.json" ))
33
+ ]
34
+ }
35
+
36
+ build {
37
+ dependsOn checkLicense
38
+ }
39
+
40
+ jar {
41
+ enabled = false
42
+ }
43
+
44
+ def imageName = " besu-samba-plugin:latest"
45
+ def containerName = " besu-samba-plugin"
46
+
47
+
48
+
49
+ task runBesu {
50
+ group = " docker"
51
+ description = " Builds the Docker image and runs the container"
52
+
53
+ doLast {
54
+ exec {
55
+ commandLine " docker" , " build" , " -t" , imageName, " -f" , " docker/Dockerfile" , " ."
56
+ }
57
+ exec {
58
+ commandLine " docker" , " rm" , " -f" , containerName
59
+ ignoreExitValue true // Ignore errors if container doesn't exist
60
+ }
61
+ exec {
62
+ commandLine " docker" , " run" , " -d" , " --name" , containerName, " -p" , " 8545:8545" , " -p" , " 9545:9545" , imageName
63
+ }
64
+ }
65
+ }
66
+
67
+ task stopAndRemoveBesu {
68
+ group = " docker"
69
+ description = " Stops and removes the running Docker container"
70
+
71
+ doLast {
72
+ exec {
73
+ commandLine " docker" , " stop" , containerName
74
+ ignoreExitValue true
75
+ }
76
+ exec {
77
+ commandLine " docker" , " rm" , containerName
78
+ ignoreExitValue true
79
+ }
80
+ }
81
+ }
82
+
83
+ // //>>
84
+ // task createDistributionTar(type: Tar) {
85
+ // dependsOn ':core:jar' // Ensure the JAR is built before creating the tar
86
+ //
87
+ // archiveBaseName.set("besu-samba-plugin")
88
+ // archiveVersion.set(rootProject.version)
89
+ // compression = Compression.GZIP
90
+ // destinationDirectory.set(rootProject.layout.buildDirectory.dir("distribution"))
91
+ //
92
+ // from("${rootProject.projectDir}/core/build/libs") {
93
+ // include "*.jar"
94
+ // }
95
+ // }
96
+ //
97
+ // tasks.build.dependsOn createDistributionTar
0 commit comments