forked from zaproxy/community-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
125 lines (102 loc) · 3.6 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import org.zaproxy.gradle.addon.AddOnStatus
import org.zaproxy.gradle.addon.internal.model.ProjectInfo
import org.zaproxy.gradle.addon.internal.model.ReleaseState
import org.zaproxy.gradle.addon.internal.tasks.GenerateReleaseStateLastCommit
import org.zaproxy.gradle.addon.misc.ConvertMarkdownToHtml
plugins {
`java-library`
id("org.zaproxy.add-on") version "0.6.0"
id("com.diffplug.spotless") version "5.12.1"
}
repositories {
mavenCentral()
}
description = "Useful ZAP scripts written by the ZAP community."
val scriptsDir = layout.buildDirectory.dir("scripts")
zapAddOn {
addOnId.set("communityScripts")
addOnName.set("Community Scripts")
zapVersion.set("2.10.0")
addOnStatus.set(AddOnStatus.ALPHA)
releaseLink.set("https://github.com/zaproxy/community-scripts/compare/v@PREVIOUS_VERSION@...v@CURRENT_VERSION@")
unreleasedLink.set("https://github.com/zaproxy/community-scripts/compare/v@CURRENT_VERSION@...HEAD")
manifest {
author.set("ZAP Community")
url.set("https://www.zaproxy.org/docs/desktop/addons/community-scripts/")
repo.set("https://github.com/zaproxy/community-scripts/")
changesFile.set(tasks.named<ConvertMarkdownToHtml>("generateManifestChanges").flatMap { it.html })
files.from(scriptsDir)
}
}
val jupiterVersion = "5.7.0-M1"
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:$jupiterVersion")
testImplementation("org.junit.jupiter:junit-jupiter-params:$jupiterVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$jupiterVersion")
testImplementation("commons-io:commons-io:2.6")
testImplementation("org.assertj:assertj-core:3.11.0")
testImplementation("org.apache.commons:commons-lang3:3.8")
// The following versions should match the ones of the add-ons.
testImplementation("org.codehaus.groovy:groovy-all:2.4.14")
testImplementation("org.jruby:jruby-complete:1.7.4")
testImplementation("org.mozilla:zest:0.14.0")
testImplementation("org.python:jython-standalone:2.7.1")
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.compilerArgs = listOf("-Xlint:all", "-Xlint:-options", "-Werror")
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
var scriptTypes = listOf(
"active",
"authentication",
"extender",
"httpfuzzerprocessor",
"httpsender",
"passive",
"payloadgenerator",
"payloadprocessor",
"proxy",
"selenium",
"sequence",
"session",
"standalone",
"targeted",
"variant",
"websocketfuzzerprocessor",
"websocketpassive")
val syncScriptsDirTask by tasks.creating(Sync::class) {
into(scriptsDir.get().dir(project.name))
scriptTypes.forEach {
from(it) {
into(it)
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
sourceSets["main"].output.dir(mapOf("builtBy" to syncScriptsDirTask), scriptsDir)
spotless {
java {
licenseHeaderFile("$rootDir/gradle/spotless/license.java")
googleJavaFormat("1.7").aosp()
}
kotlinGradle {
ktlint()
}
}
val projectInfo = ProjectInfo.from(project)
val generateReleaseStateLastCommit by tasks.registering(GenerateReleaseStateLastCommit::class) {
projects.set(listOf(projectInfo))
}
val releaseAddOn by tasks.registering {
if (ReleaseState.read(projectInfo).isNewRelease()) {
dependsOn("createRelease")
dependsOn("handleRelease")
dependsOn("createPullRequestNextDevIter")
}
}