build.gradle 2.5 KB

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