forked from NationalSecurityAgency/ghidra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ghidra-publish.sh
executable file
·52 lines (42 loc) · 2.29 KB
/
ghidra-publish.sh
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
#!/usr/bin/env bash
set -e #stop on error
set -o pipefail
# this script downloads a ghidra release from ghidra-sre and publishes it to
# sonatype, so that we can promote it to maven central:
# https://repo1.maven.org/maven2/io/joern/ghidra/
# see also https://github.com/NationalSecurityAgency/ghidra/issues/799
VERSION=11.2.1_PUBLIC_20241105
VERSION_SHORTER=11.2.1
VERSION_SHORT=${VERSION_SHORTER}_PUBLIC
CUSTOM_RELEASE_VERSION=${VERSION}-7
SONATYPE_URL=https://central.sonatype.com/service/local/staging/deploy/maven2/
# the server id from your local ~/.m2/settings.xml
REPO_ID=sonatype-nexus-staging-joern
DISTRO_URL=https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${VERSION_SHORTER}_build/ghidra_${VERSION}.zip
echo "download and unzip ghidra distribution from $DISTRO_URL"
wget $DISTRO_URL
rm -rf ghidra_${VERSION_SHORT}
unzip ghidra_$VERSION.zip
rm ghidra_$VERSION.zip
cd ghidra_${VERSION_SHORT}
support/buildGhidraJar
mkdir build
# create custom-made maven build just for deploying to maven central
sed s/__VERSION__/$CUSTOM_RELEASE_VERSION/ ../pom.xml.template > build/pom.xml
mkdir -p build/src/main/resources
unzip -d build/src/main/resources ghidra.jar
# add classes from ByteViewer.jar - those are looked up at runtime via reflection
# context: lookup happens transitively by loading classes from _Root/Ghidra/EXTENSION_POINT_CLASSES
# unzip flag `-o` to override and update files without prompting the user
unzip -o -d build/src/main/resources Ghidra/Features/ByteViewer/lib/ByteViewer.jar
# add an empty dummy class in order to generate sources and javadoc jars
mkdir -p build/src/main/java
echo '/** just an empty placeholder to trigger javadoc generation */
public interface Empty {}' > build/src/main/java/Empty.java
# deploy to sonatype central
pushd build
mvn javadoc:jar source:jar package gpg:sign deploy
popd
echo "release is now published to sonatype central and should get promoted to maven central automatically. For more context go to https://central.sonatype.com/publishing/deployments"
echo "once it's synchronised to maven central (https://repo1.maven.org/maven2/io/joern/ghidra/), update the ghidra version in 'joern/project/Versions.scala' to $CUSTOM_RELEASE_VERSION"
echo "don't forget to commit and push the local changes in this repo to https://github.com/joernio/ghidra"