I have project A with SubProjects
A/B A/C
(B and C subprojects). B and C are compiled into A into one Jar file. Using the below code.
gradle.taskGraph.whenReady {
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes("Main-Class": "brut.apktool.Main")
}
}
}
That works fine, but I have a prebuilt JAR in /a/b/src/main/resources/prebuilt.jar. This jar just encapsulates some random files I need during the program. There isn't any java or anything. I grab them from inputStream, but after building with Gradle it converts binary newline data and then messes up the archive.
I tried copying the jar using a CopyTask post built, but I never could get a Task to run prior to the gradle.TaskGraph.whenReady.
Back in Maven. I would just disable filtering for that file, but cannot find the same expression in Gradle.
EDIT: This is what I do currently, and it filters my changes into the properties files, but doesn't do my newline filtering.
processResources {
ext.fullrev = ''
ant.loadfile(srcFile: "../../.git/refs/heads/master", property: ext.fullrev)
filter(FixCrLfFilter)
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [version: apktoolversion, gitrev: ant.properties[ext.fullrev].substring(0,10)])
}