build.gradle 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import org.apache.tools.ant.taskdefs.condition.Os
  2. plugins {
  3. id 'java-library'
  4. id 'biz.aQute.bnd.builder' version "$bnd"
  5. id 'com.vanniktech.maven.publish' version "$mavenPublish"
  6. id 'com.github.johnrengelman.shadow' version "$shadowJarPlugin"
  7. }
  8. repositories {
  9. mavenCentral()
  10. flatDir {
  11. dirs "${project(':demo').projectDir}/libs"
  12. }
  13. }
  14. compileJava {
  15. sourceCompatibility = "$jdk"
  16. targetCompatibility = "$jdk"
  17. }
  18. dependencies {
  19. testImplementation "org.junit.jupiter:junit-jupiter-api:$junit"
  20. testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit"
  21. api "io.github.palexdev:virtualizedfx:$vfx"
  22. }
  23. javafx {
  24. configuration = 'compileOnly'
  25. }
  26. javadoc {
  27. excludes = ['**/*.html', 'META-INF/**']
  28. options.use = true
  29. options.splitIndex = true
  30. options.encoding = 'UTF-8'
  31. options.author = true
  32. options.version = true
  33. options.windowTitle = "$project.name $project.version API"
  34. options.docTitle = "$project.name $project.version API"
  35. options.links = ['https://docs.oracle.com/en/java/javase/11/docs/api',
  36. 'https://openjfx.io/javadoc/17']
  37. }
  38. tasks.register('javadocJar', Jar) {
  39. dependsOn javadoc
  40. archiveClassifier.set('javadoc')
  41. from javadoc.destinationDir
  42. }
  43. tasks.register('sourcesJarBuild', Jar) {
  44. dependsOn classes
  45. archiveClassifier.set('sources')
  46. from sourceSets.main.allSource
  47. }
  48. artifacts {
  49. archives javadocJar
  50. archives sourcesJarBuild
  51. archives jar
  52. }
  53. jar {
  54. manifest {
  55. attributes(
  56. 'Bundle-Name': project.name,
  57. 'Bundle-Description': "Material controls for JavaFX",
  58. 'Bundle-SymbolicName': 'io.github.palexdev',
  59. 'Export-Package': 'io.github.palexdev.materialfx.*, io.github.palexdev.materialfx.demo.*'
  60. )
  61. }
  62. }
  63. shadowJar {
  64. mergeServiceFiles()
  65. dependencies {
  66. include(dependency("io.github.palexdev:virtualizedfx:$vfx"))
  67. }
  68. }
  69. tasks.register('copyJar', Copy) {
  70. from jar
  71. if (Os.isFamily(Os.FAMILY_WINDOWS)) {
  72. into System.getenv("APPDATA") + '/Scene Builder/Library'
  73. } else if (Os.isFamily(Os.FAMILY_MAC)) {
  74. into System.getProperty("user.home") + '/Library/Application Support' + '/Scene Builder/Library'
  75. } else if (Os.isFamily(Os.FAMILY_UNIX)) {
  76. into System.getProperty("user.home") + '/.scenebuilder/Library'
  77. }
  78. }
  79. tasks.register('removeBnd', Delete) {
  80. delete fileTree(project.buildDir) {
  81. include '**/*.bnd'
  82. }
  83. }
  84. build {
  85. dependsOn shadowJar, copyJar, removeBnd
  86. }
  87. mavenPublish {
  88. sonatypeHost = "S01"
  89. }