Skip to content

Commit

Permalink
Embed the java script in gradle instead
Browse files Browse the repository at this point in the history
  • Loading branch information
serivesmejia committed Nov 20, 2024
1 parent e2a29a1 commit 0bad51e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
12 changes: 6 additions & 6 deletions EOCVSimPlugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ tasks.register('sourcesJar', Jar) {
archiveClassifier = "sources"
}

tasks.matching { it.name in ['jar', 'shadowJar'] }.configureEach {
tasks.matching { it.name == "jar" || it.name == "shadowJar"}.configureEach {
doLast {
def script = System.getProperty('os.name').toLowerCase().contains('win') ? 'sign_output.bat' : 'sign_output.sh'
def scriptPath = rootDir.absolutePath + File.separator + "tools" + File.separator + script
println "Running signing script: $scriptPath"

// Get the key from an environment variable
def signingKey = System.getenv('DELTACV_PLUGINSIGNING_PRIVATE')
if (!signingKey) {
println("Environment variable 'DELTACV_PLUGINSIGNING_PRIVATE' is not set.")
return
}

def script = """
java -classpath "${rootDir.absolutePath}/tools/Common.jar" io.github.deltacv.eocvsim.plugin.security.PluginSigningTool --plugin=${it.archiveFile.get().asFile.absolutePath} --authority=deltacv --key=${signingKey}
"""

// Execute the script with the key
project.exec {
commandLine scriptPath, rootDir.absolutePath, signingKey
commandLine script
}.assertNormalExitValue()
}
}
Expand Down
11 changes: 0 additions & 11 deletions tools/sign_output.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# Check if required arguments are provided
if [ -z "$1" ]; then
echo "Error: The path to the root project is required as the first argument."
exit 1
fi

if [ -z "$2" ]; then
echo "Error: The signing key is required as the second argument."
exit 1
fi

for i in EOCVSimPlugin/build/libs/*.jar; do
java -classpath "$1/tools/Common.jar" io.github.deltacv.eocvsim.plugin.security.PluginSigningTool --plugin=$i --authority=deltacv --key=$2
done

0 comments on commit 0bad51e

Please sign in to comment.