-
Notifications
You must be signed in to change notification settings - Fork 112
/
build.gradle
154 lines (128 loc) · 4.36 KB
/
build.gradle
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.6.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
final def extensionName = 'burp-rest-api'
version = '2.2.0'
def updateVersion() {
def configFile = new File('src/main/resources/application.yml')
println "Updating version to '${version}' in ${configFile}"
String configContent = configFile.getText('UTF-8')
configContent = configContent.replaceAll(/build\.version: .*/, "build.version: ${version}")
configFile.write(configContent, 'UTF-8')
}
sourceSets {
entrypoint {
java {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
}
test.onlyIf { file('./lib/burpsuite_pro.jar').exists() }
allprojects {
//Display warning
println " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
println " !! Make sure that no other Burp instances are running !!"
println " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
//Update version in application file
updateVersion()
}
jar {
archiveBaseName = extensionName
manifest {
attributes('Implementation-Title': 'Burp REST API',
'Implementation-Version': archiveVersion)
}
}
repositories {
mavenCentral()
flatDir {
dirs 'lib'
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
File schemaTargetDir = new File('build/generated-schema')
configurations {
jaxb
compile.exclude module: "spring-boot-starter-tomcat"
testCompile.extendsFrom entrypointCompile
testRuntime.extendsFrom entrypointRuntime
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE')
implementation("org.springframework.boot:spring-boot-starter-jetty:2.2.6.RELEASE")
implementation group: 'org.springframework.boot', name: 'spring-boot-loader', version: '2.2.6.RELEASE'
implementation "io.springfox:springfox-swagger2:2.8.+"
implementation "io.springfox:springfox-swagger-ui:2.8.+"
implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.3'
compileOnly "net.portswigger.burp.extender:burp-extender-api:2.+"
entrypointCompileOnly "net.portswigger.burp.extender:burp-extender-api:2.+"
testImplementation fileTree(dir: 'lib', include: '**/*.jar')
testImplementation('org.springframework.boot:spring-boot-starter-test:2.2.6.RELEASE')
testImplementation('org.apache.httpcomponents:httpclient:4.5.2')
testImplementation('net.portswigger.burp.extender:burp-extender-api:2.+')
jaxb 'org.glassfish.jaxb:jaxb-jxc:2.+'
jaxb 'org.glassfish.jaxb:jaxb-xjc:2.+'
}
task createschemaTargetDir () {
schemaTargetDir.mkdirs()
}
bootRun {
// support passing -Dsystem.property=value to bootRun task
//support passing -PappArgs="['arg1']" ex : gradlew bootRun -PappArgs="['--project-file=/test/tes.burp']"
if (project.hasProperty("appArgs")) {
args Eval.me(appArgs)
}
systemProperties = System.properties
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-Xdebug',
'-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'
}
}
task entrypointJar(type: Jar) {
destinationDirectory = file("src/main/resources/static/")
from(sourceSets.entrypoint.output) {
include '**/*.class'
}
archiveFileName = 'rest-api.jar'
}
jar.dependsOn entrypointJar
task deleteEntrypointOriginalJar(type: Delete) {
delete entrypointJar.archivePath.toString() + '.original'
}
assemble.dependsOn deleteEntrypointOriginalJar
task extractApi(type: Copy) {
from(zipTree('build/libs/' + extensionName + '-' + version + '.jar'))
into 'build/libs'
}
task schemagen () {
doLast {
ant.taskdef(name: 'schemagen', classname: 'com.sun.tools.jxc.SchemaGenTask', classpath: configurations.jaxb.asPath)
ant.schemagen(
srcdir:'src/main/java/com/vmware/burp/extension/domain',
destdir:schemaTargetDir,
includeAntRuntime:'false'
){
classpath {
fileset(dir: 'build/libs', includes: '**/*.jar')
}
}
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:deprecation'
options.deprecation = true
}
compileJava.dependsOn createschemaTargetDir
schemagen.dependsOn extractApi