diff --git a/EOCVSimPlugin/build.gradle b/EOCVSimPlugin/build.gradle index 10f7a21..f984e2e 100644 --- a/EOCVSimPlugin/build.gradle +++ b/EOCVSimPlugin/build.gradle @@ -11,12 +11,8 @@ 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) { @@ -24,9 +20,13 @@ tasks.matching { it.name in ['jar', 'shadowJar'] }.configureEach { 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() } } diff --git a/tools/sign_output.sh b/tools/sign_output.sh index e53158a..288c2e3 100644 --- a/tools/sign_output.sh +++ b/tools/sign_output.sh @@ -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 \ No newline at end of file