
plugins {
	id 'checkstyle'
	id 'java'
}

configurations {
	extensionApi
}

sourceSets {
	main {
		java
	}
}

// Getting an error here? Run the './script/install.sh' script to fix it,
// it will install the target version of Ghidra into a local directory
assert file("./ghidra/install").exists()
project.ext.ghidraPath = project.rootDir.getPath() + "/ghidra/install"
print("Using Ghidra from: " + project.ext.ghidraPath)

checkstyle {
	toolVersion = "11.0.0"
	ignoreFailures = false
	maxWarnings = 0
	sourceSets = [sourceSets.main]
}

task distribute {
	group = "Ghidra"

	apply from: "extension.gradle"
	dependsOn ':buildExtension'
}

// build runs test and checkstyle, distribute just creates the final JAR
build.finalizedBy(distribute)

repositories {
	mavenCentral()
}

dependencies {
	testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
	checkstyle "com.puppycrawl.tools:checkstyle:${checkstyle.toolVersion}"

	implementation 'com.google.code.gson:gson:2.9.0'
	implementation 'org.apache.commons:commons-lang3:3.17.0'
	implementation 'com.google.guava:guava:32.1.3-jre'

	testImplementation 'org.apache.commons:commons-collections4:4.5.0'
}

tasks.named('test', Test) {
	useJUnitPlatform()
	maxHeapSize = '1G'

	testLogging {
		events "passed"
		events "skipped"
	}
}
