Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Build
if: steps.filter.outputs.code == 'true' || github.event_name == 'release' || github.event_name == 'workflow_dispatch'
working-directory: CTNH-Modules
run: ./gradlew :modules:CTNH-Core:build --stacktrace
run: ./gradlew :modules:CTNH-Core:build --init-script gradle/strip-forge-signatures.init.gradle --stacktrace

- name: Version Suffix
if: github.event_name != 'release' && (steps.filter.outputs.code == 'true' || github.event_name == 'workflow_dispatch')
Expand Down
22 changes: 0 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -134,26 +134,4 @@ configure(ctnhSubprojects) {
lombok {
version = "1.18.38"
}

// Strip JAR signatures from Forge JARs before lang injection tasks,
// otherwise JarFile verification throws SecurityException when
// ModDevGradle artifact transforms modify signed JAR entries.
tasks.configureEach {
if (it.name.startsWith('injectLangBytecode')) {
it.doFirst {
it.compileClasspath.files.each { file ->
if (file.name.contains('forge') && file.name.endsWith('.jar') && file.exists()) {
project.ant.exec(executable: 'zip', resultproperty: 'zipResult',
failonerror: false) {
arg(value: '-d')
arg(value: file.absolutePath)
arg(value: 'META-INF/*.SF')
arg(value: 'META-INF/*.RSA')
arg(value: 'META-INF/*.DSA')
}
}
}
}
}
}
}
26 changes: 26 additions & 0 deletions gradle/strip-forge-signatures.init.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Strip JAR signatures from Forge JARs before lang injection tasks.
// JarFile verification throws SecurityException when ModDevGradle
// artifact transforms modify signed JAR entries (SHA-384 digest mismatch).
// Only used on CI — Windows developers don't have the 'zip' command.
allprojects {
afterEvaluate {
tasks.configureEach {
if (it.name.startsWith('injectLangBytecode')) {
it.doFirst {
it.compileClasspath.files.each { file ->
if (file.name.contains('forge') && file.name.endsWith('.jar') && file.exists()) {
ant.exec(executable: 'zip', resultproperty: 'zipResult',
failonerror: false) {
arg(value: '-d')
arg(value: file.absolutePath)
arg(value: 'META-INF/*.SF')
arg(value: 'META-INF/*.RSA')
arg(value: 'META-INF/*.DSA')
}
}
}
}
}
}
}
}
Loading