Build CI against Ghidra 12 via build.sh

- The workflow downloads a Ghidra 12 release (12.1.3 by default, any
  version via manual dispatch), runs ./build.sh (libraries, unit tests,
  package) and uploads the extension zip. It previously targeted Ghidra
  11.3.2 with an incomplete library set and copied the removed bridge.
- extension.properties gets the Ghidra version the package is built
  against instead of a hard-coded 12.1.2.
This commit is contained in:
Kirill Zhumarin 2026-11-24 01:34:08 +03:00
parent a328bb2ec7
commit 10142233e1
5 changed files with 41 additions and 38 deletions

View file

@ -1,29 +1,27 @@
name: Build with Maven
name: Build
on:
push:
branches: [ "main" ]
tags: [ "*" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
ghidra_version:
description: "Ghidra release to build against (e.g. 12.1.3)"
required: false
default: "12.1.3"
jobs:
build:
runs-on: ubuntu-latest
env:
GHIDRA_VERSION: 11.3.2
GHIDRA_DATE: 20250415
GHIDRA_LIBS: >-
Features/Base/lib/Base.jar
Features/Decompiler/lib/Decompiler.jar
Framework/Docking/lib/Docking.jar
Framework/Generic/lib/Generic.jar
Framework/Project/lib/Project.jar
Framework/SoftwareModeling/lib/SoftwareModeling.jar
Framework/Utility/lib/Utility.jar
Framework/Gui/lib/Gui.jar
GHIDRA_VERSION: ${{ github.event.inputs.ghidra_version || '12.1.3' }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
@ -32,29 +30,20 @@ jobs:
cache: maven
- name: Download Ghidra
env:
GH_TOKEN: ${{ github.token }}
run: |
wget --no-verbose -O ghidra.zip https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${{ env.GHIDRA_VERSION }}_build/ghidra_${{ env.GHIDRA_VERSION }}_PUBLIC_${{ env.GHIDRA_DATE }}.zip
7z x -bd ghidra.zip
gh release download "Ghidra_${GHIDRA_VERSION}_build" \
--repo NationalSecurityAgency/ghidra --pattern "ghidra_${GHIDRA_VERSION}_PUBLIC_*.zip" \
--output ghidra.zip
unzip -q ghidra.zip -d "${RUNNER_TEMP}/ghidra"
echo "GHIDRA_HOME=$(echo "${RUNNER_TEMP}"/ghidra/ghidra_*_PUBLIC)" >> "${GITHUB_ENV}"
- name: Copy Ghidra libs
run: |
mkdir -p ./lib
for libfile in ${{ env.GHIDRA_LIBS }}
do echo "Copying ${libfile} to lib/"
cp ghidra_${{ env.GHIDRA_VERSION }}_PUBLIC/Ghidra/${libfile} ./lib/
done
- name: Build and test
run: ./build.sh -B
- name: Build with Maven
run: mvn clean package assembly:single
- name: Assemble release directory
run: |
mkdir release
cp target/GhidraMCP-*-SNAPSHOT.zip release/
- name: Upload artifact
- name: Upload extension
uses: actions/upload-artifact@v4
with:
name: GhidraMCP-artifact
path: |
release/*
name: GhidraMCP-ghidra${{ env.GHIDRA_VERSION }}
path: target/GhidraMCP-*.zip

View file

@ -67,6 +67,6 @@ copy_jar "${GHIDRA_DIR}/Framework/Gui/lib/Gui.jar" Gui.jar
copy_versioned_jar "${GHIDRA_DIR}/Framework/Generic/lib" 'gson-*.jar' gson.jar
echo "Building GhidraMCP for Ghidra ${GHIDRA_VERSION} from ${GHIDRA_HOME}"
mvn -f "${ROOT_DIR}/pom.xml" clean package "$@"
mvn -f "${ROOT_DIR}/pom.xml" clean package -Dghidra.version="${GHIDRA_VERSION}" "$@"
echo "Extension package: ${ROOT_DIR}/target/GhidraMCP-1.0-SNAPSHOT.zip"

View file

@ -10,6 +10,11 @@
<name>GhidraMCP</name>
<url>http://maven.apache.org</url>
<properties>
<!-- Ghidra version stamped into extension.properties; build.sh passes the installed one -->
<ghidra.version>12.1.2</ghidra.version>
</properties>
<dependencies>
<!-- Ghidra JARs as system-scoped dependencies -->
<dependency>
@ -151,6 +156,7 @@
<!-- Exclude the App class -->
<excludes>
<exclude>**/App.class</exclude>
<exclude>extension.properties</exclude>
</excludes>
<!-- Make sure output directory is target for consistency -->
<outputDirectory>${project.build.directory}</outputDirectory>

View file

@ -21,11 +21,19 @@
<fileSet>
<directory>src/main/resources</directory>
<includes>
<include>extension.properties</include>
<include>Module.manifest</include>
</includes>
<outputDirectory>GhidraMCP</outputDirectory>
</fileSet>
<!-- extension.properties gets the Ghidra version it was built against -->
<fileSet>
<directory>src/main/resources</directory>
<includes>
<include>extension.properties</include>
</includes>
<outputDirectory>GhidraMCP</outputDirectory>
<filtered>true</filtered>
</fileSet>
<!-- 2) Copy your built plugin JAR into GhidraMCP/lib -->
<fileSet>

View file

@ -1,6 +1,6 @@
name=GhidraMCP
description=A plugin that runs an embedded HTTP server to expose program data.
description=MCP server for Ghidra: reverse engineering, project and program management for AI agents.
author=LaurieWired
createdOn=2025-03-22
version=12.1.2
ghidraVersion=12.1.2
version=${ghidra.version}
ghidraVersion=${ghidra.version}