Skip to content

Commit

Permalink
Only shadow required fastutil classes into web jar
Browse files Browse the repository at this point in the history
Reduces web jar size by about 24MiB
  • Loading branch information
booky10 committed Jul 29, 2023
1 parent ebed3d3 commit e4351db
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions web/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,31 @@ tasks {
}

shadowJar {
// this may seem like some unnecessary exclusions, but this saves about 24MiB of disk space...
// fastutil is very big, and this project only requires the Int2Object maps
val fastutilPkg = "it/unimi/dsi/fastutil"
sequenceOf("booleans", "bytes", "chars", "doubles", "floats", "io", "longs", "shorts")
.forEach { exclude("$fastutilPkg/$it/*") }
sequenceOf("A", "B", "I", "P", "S")
.forEach { exclude("$fastutilPkg/$it*") }
sequenceOf(
"Abstract", "ObjectA", "ObjectB", "ObjectCh", "ObjectCom", "Object2",
"ObjectD", "ObjectF", "ObjectH", "ObjectIm", "ObjectIn", "ObjectIterat", "ObjectL",
"ObjectO", "ObjectR", "ObjectR", "ObjectSem", "ObjectSh", "ObjectSo", "ObjectSp", "Ref"
).forEach { exclude("$fastutilPkg/objects/$it*") }
sequenceOf(
"AbstractInt2B", "AbstractInt2C", "AbstractInt2D", "AbstractInt2F", "AbstractInt2I",
"AbstractInt2L", "AbstractInt2ObjectS", "AbstractInt2R", "AbstractInt2S", "AbstractIntB",
"AbstractIntC", "AbstractIntI", "AbstractIntL", "AbstractIntP", "AbstractIntS", "Int2B",
"Int2C", "Int2D", "Int2F", "Int2I", "Int2L", "Int2ObjectA", "Int2ObjectL", "Int2ObjectOpenC",
"Int2ObjectR", "Int2ObjectS", "Int2R", "Int2S", "IntA", "IntB", "IntCh", "IntCom", "IntCon",
"IntD", "IntF", "IntH", "IntIm", "IntIn", "IntIterator", "IntL", "IntM", "IntO", "IntP",
"IntR", "IntSem", "IntSh", "IntSo", "IntSp", "IntSt", "IntU"
).forEach { exclude("$fastutilPkg/ints/$it*") }

// rebuild shadowjar when exclusions change
inputs.properties("excludes" to excludes)

// merges log4j plugin files
transform(Log4j2PluginsCacheFileTransformer::class.java)
}
Expand Down

0 comments on commit e4351db

Please sign in to comment.