mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
35 lines
807 B
Groovy
35 lines
807 B
Groovy
/*
|
|
* Validation of output artifacts to make sure they can be published.
|
|
*/
|
|
|
|
import java.util.jar.JarFile
|
|
|
|
def checkDuplicateEntries = { archive ->
|
|
def uniqueEntries = new HashSet()
|
|
def jarFile = new JarFile(archive)
|
|
def entries = jarFile.entries()
|
|
while (entries.hasMoreElements()) {
|
|
def entry = entries.nextElement()
|
|
if (!uniqueEntries.add(entry.name))
|
|
throw new GradleException("Duplicate entry ${entry} in archive ${archive.name}")
|
|
}
|
|
jarFile.close()
|
|
}
|
|
|
|
task validateJar {
|
|
dependsOn(jar)
|
|
inputs.file(jar.archivePath)
|
|
doLast {
|
|
checkDuplicateEntries(jar.archivePath)
|
|
}
|
|
}
|
|
check.dependsOn(validateJar)
|
|
|
|
task validateSourcesJar {
|
|
dependsOn(sourcesJar)
|
|
inputs.file(sourcesJar.archivePath)
|
|
doLast {
|
|
checkDuplicateEntries(sourcesJar.archivePath)
|
|
}
|
|
}
|
|
check.dependsOn(validateSourcesJar)
|