-
-
Notifications
You must be signed in to change notification settings - Fork 727
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Ant build and set up Gradle build
Remove Ant build files and libraries (`build` directory), the add-ons will be built with Gradle. Remove Eclipse files (`.classpath` and `.project`), they are generated when the project is imported to Eclipse. Remove all main libraries (`lib` directory) except fuzz add-on, they will be obtained from Maven repository (Maven Central by default). Rename the fuzz add-on to have `jar` extension (to be properly consumed by IDEs). Add Gradle wrapper and main build files. Add top level project, `addOns`, to contain and configure the add-ons. Each add-on will be relocated to be under `addOns` and have the following directory layout: - `src/main/java/` for main Java source files; - `src/main/resources/` for main resource files; - `src/main/javahelp/` for JavaHelp files; - `src/main/zapHomeFiles/` for home files; - `src/test/java/` for test Java source files; - `src/test/resources/` for test resource files. Update Travis CI configuration file for Gradle build. Update `.gitignore` for Gradle and common IDE files. Update `README.md` with instructions on how to build the add-ons. Move example add-on manifest (`ZapAddOn.xml`) to top level directory `docs`.
- Loading branch information
Showing
48 changed files
with
491 additions
and
688 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
# Intellij | ||
.idea/ | ||
*.iml | ||
*.iws | ||
*.eml | ||
out/ | ||
/bin/ | ||
build/build/ | ||
build/buildtest/ | ||
build/results/ | ||
build/temp/ | ||
build/zap-exts/ | ||
# Gradle | ||
#------- | ||
.gradle | ||
/build | ||
/buildSrc/build | ||
/addOns/**/build | ||
|
||
# IDEA | ||
# ---- | ||
.idea | ||
.shelf | ||
/*.iml | ||
/*.ipr | ||
/*.iws | ||
/buildSrc/*.iml | ||
/buildSrc/*.ipr | ||
/buildSrc/*.iws | ||
/buildSrc/out | ||
/out | ||
|
||
# Eclipse | ||
# ------- | ||
*.classpath | ||
*.project | ||
*.settings | ||
/bin | ||
/buildSrc/bin | ||
/addOns/**/bin | ||
|
||
# NetBeans | ||
# -------- | ||
.nb-gradle | ||
.nb-gradle-properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
language: java | ||
script: ant -buildfile build/build.xml test | ||
|
||
jdk: | ||
- oraclejdk8 | ||
- openjdk11 | ||
|
||
before_cache: | ||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock | ||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ | ||
|
||
cache: | ||
directories: | ||
- $HOME/.gradle/caches/ | ||
- $HOME/.gradle/wrapper/ | ||
- $HOME/.m2/repository/webdriver/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import org.zaproxy.gradle.addon.AddOnPlugin | ||
import org.zaproxy.gradle.addon.AddOnPluginExtension | ||
import org.zaproxy.gradle.addon.manifest.ManifestExtension | ||
import org.zaproxy.gradle.addon.manifest.tasks.ConvertChangelogToChanges | ||
import org.zaproxy.gradle.addon.wiki.WikiGenExtension | ||
import org.zaproxy.gradle.addon.zapversions.ZapVersionsExtension | ||
|
||
plugins { | ||
id("org.zaproxy.add-on") version "0.1.0" apply false | ||
} | ||
|
||
description = "Common configuration of the add-ons." | ||
|
||
val zapCoreHelpWikiDir = "$rootDir/../zap-core-help-wiki/" | ||
val zapExtensionsWikiDir = "$rootDir/../zap-extensions-wiki/" | ||
|
||
val parentProjects = listOf( | ||
) | ||
|
||
val mainAddOns = listOf( | ||
) | ||
val weeklyAddOns = mainAddOns + listOf( | ||
) | ||
|
||
mapOf("main" to mainAddOns, "weekly" to weeklyAddOns).forEach { entry -> | ||
tasks { | ||
val name = entry.key | ||
val nameCapitalized = name.capitalize() | ||
register("copy${nameCapitalized}AddOns") { | ||
group = "ZAP" | ||
description = "Copies the $name release add-ons to zaproxy project." | ||
subprojects(entry.value) { | ||
dependsOn(it.tasks.named(AddOnPlugin.COPY_ADD_ON_TASK_NAME)) | ||
} | ||
} | ||
|
||
register("list${nameCapitalized}AddOns") { | ||
group = "ZAP" | ||
description = "Lists the $name release add-ons." | ||
doLast { | ||
subprojects(entry.value) { println(it.name) } | ||
} | ||
} | ||
} | ||
} | ||
|
||
subprojects { | ||
if (parentProjects.contains(project.name)) { | ||
return@subprojects | ||
} | ||
|
||
apply(plugin = "java-library") | ||
apply(plugin = "org.zaproxy.add-on") | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
val generateManifestChanges by tasks.registering(ConvertChangelogToChanges::class) { | ||
changelog.set(file("CHANGELOG.md")) | ||
manifestChanges.set(file("$buildDir/zapAddOn/manifest-changes.html")) | ||
} | ||
|
||
zapAddOn { | ||
manifest { | ||
changesFile.set(generateManifestChanges.flatMap { it.manifestChanges }) | ||
} | ||
|
||
wikiGen { | ||
wikiFilesPrefix.set("HelpAddons${zapAddOn.addOnId.get().capitalize()}") | ||
wikiDir.set(project.provider { project.layout.projectDirectory.dir(if (mainAddOns.contains(zapAddOn.addOnId.get())) zapCoreHelpWikiDir else zapExtensionsWikiDir) }) | ||
} | ||
|
||
zapVersions { | ||
downloadUrl.set("https://github.com/zaproxy/zap-extensions/releases/download/2.7") | ||
} | ||
} | ||
} | ||
|
||
fun subprojects(addOns: List<String>, action: (Project) -> Unit) { | ||
subprojects.filter { !parentProjects.contains(it.name) && addOns.contains(it.zapAddOn.addOnId.get()) }.forEach(action) | ||
} | ||
|
||
fun Project.java(configure: JavaPluginExtension.() -> Unit): Unit = | ||
(this as ExtensionAware).extensions.configure("java", configure) | ||
|
||
fun Project.zapAddOn(configure: AddOnPluginExtension.() -> Unit): Unit = | ||
(this as ExtensionAware).extensions.configure("zapAddOn", configure) | ||
|
||
val Project.zapAddOn: AddOnPluginExtension get() = | ||
(this as ExtensionAware).extensions.getByName("zapAddOn") as AddOnPluginExtension | ||
|
||
fun AddOnPluginExtension.manifest(configure: ManifestExtension.() -> Unit): Unit = | ||
(this as ExtensionAware).extensions.configure("manifest", configure) | ||
|
||
fun AddOnPluginExtension.wikiGen(configure: WikiGenExtension.() -> Unit): Unit = | ||
(this as ExtensionAware).extensions.configure("wikiGen", configure) | ||
|
||
fun AddOnPluginExtension.zapVersions(configure: ZapVersionsExtension.() -> Unit): Unit = | ||
(this as ExtensionAware).extensions.configure("zapVersions", configure) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
plugins { | ||
id("com.diffplug.gradle.spotless") version "3.20.0" | ||
} | ||
|
||
allprojects { | ||
apply(plugin = "com.diffplug.gradle.spotless") | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
spotless { | ||
kotlinGradle { | ||
ktlint() | ||
} | ||
} | ||
|
||
tasks.withType<JavaCompile>().configureEach { | ||
options.encoding = "utf-8" | ||
options.compilerArgs = listOf("-Xlint:all", "-Xlint:-path", "-Xlint:-options", "-Werror") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.