build.gradle 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. plugins {
  2. id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
  3. id 'ferritecore.subproject-conventions'
  4. }
  5. sourceSets {
  6. // Only defines classes that override the package-private Google methods as public, to allow access from other
  7. // packages. Loaded on the app classloader
  8. googleaccess {
  9. java
  10. }
  11. // Defines custom implementations of ImmutableMap (and related classes). These classes live on the transforming/knot
  12. // classloader, but need to be loaded after googleaccess
  13. googleimpl {
  14. java {
  15. compileClasspath += googleaccess.output + main.compileClasspath + main.output
  16. }
  17. }
  18. main {
  19. java {
  20. runtimeClasspath += googleimpl.output
  21. }
  22. }
  23. test {
  24. java {
  25. runtimeClasspath += googleaccess.output + googleimpl.output
  26. }
  27. }
  28. }
  29. minecraft {
  30. version(minecraft_version)
  31. }
  32. dependencies {
  33. compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
  34. implementation group: 'org.ow2.asm', name: 'asm-tree', version: '9.3'
  35. googleaccessCompileOnly group: 'com.google.guava', name: 'guava', version: '31.0.1-jre'
  36. testImplementation(platform group: 'org.junit', name: 'junit-bom', version: '5.7.1')
  37. testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter'
  38. }
  39. processResources {
  40. def buildProps = project.properties.clone()
  41. filesMatching(['pack.mcmeta']) {
  42. expand buildProps
  43. }
  44. // Move googleaccess to a directory that does not match the package to prevent accidental loads
  45. into('googleaccess') {
  46. from sourceSets.googleaccess.output
  47. rename { String filename ->
  48. // Add suffix to stop parts of the toolchain from moving these classes to the "correct" package
  49. filename + "_manual"
  50. }
  51. }
  52. }