Skip to content

Commit

Permalink
Add package task, close #13
Browse files Browse the repository at this point in the history
  • Loading branch information
kotcrab committed Oct 24, 2021
1 parent 2091c1a commit c44c027
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ and set image base.

- `./gradlew ghidraInstall` - build and install into Ghidra (warning: contents of `GHIDRA_INSTALL_DIR/Ghidra/Processors/Allegrex` will be deleted before installing)
- `./gradlew ghidraInstallThenRun` - run `ghidraInstall` task then start Ghidra, useful for development
- `./gradlew ghidraInstallThenDebug` - run `ghidraInstall` task then start Ghidra in debug mode, useful for development
- `./gradlew ghidraInstallThenPackage` - run `ghidraInstall` task then create release zip
- `./gradlew shadowJar` - create single library jar file with all external dependencies included

After running `./gradlew shadowJar` you can manually install extension by copying:
Expand Down
26 changes: 25 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ if (System.env.GHIDRA_INSTALL_DIR) {
if (!ghidraInstallDir) {
throw new GradleException("GHIDRA_INSTALL_DIR is not defined!")
}
def allegrexOut = ghidraInstallDir + '/Ghidra/Processors/Allegrex'

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
Expand Down Expand Up @@ -75,7 +76,6 @@ jar {
task ghidraInstall {
dependsOn 'shadowJar'
doLast {
def allegrexOut = ghidraInstallDir + '/Ghidra/Processors/Allegrex'
delete allegrexOut
copy {
from "data"
Expand Down Expand Up @@ -128,3 +128,27 @@ task ghidraInstallThenDebug {
}
}
}

task ghidraInstallThenCompile {
dependsOn 'ghidraInstall'
doLast {
exec {
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine 'cmd', '/c', 'support\\sleigh.bat', '-a', 'Ghidra\\Processors\\Allegrex\\data\\languages'
} else {
commandLine './support/sleigh.sh', '-a', './Ghidra/Processors/Allegrex/data/languages'
}
workingDir ghidraInstallDir
ignoreExitValue false
}
}
}

task ghidraInstallThenPackage(type: Zip) {
dependsOn 'ghidraInstallThenCompile'
archiveFileName = "Allegrex.zip"
destinationDirectory = file("$buildDir/dist")

from allegrexOut
into "Allegrex"
}

0 comments on commit c44c027

Please sign in to comment.