build.gradle 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import org.gradle.api.artifacts.*
  2. apply plugin: 'base' // To add "clean" task to the root project.
  3. //apply plugin: 'java-library-distribution'
  4. // This is applied to all sub projects
  5. subprojects {
  6. // Don't add to native builds
  7. // if(!project.name.endsWith('native')){
  8. apply from: rootProject.file('common.gradle')
  9. // }
  10. }
  11. task(run, dependsOn: ':jme3-examples:build', type: JavaExec) {
  12. main = 'jme3test.TestChooser'
  13. classpath = files(subprojects.collect {project ->
  14. project.sourceSets*.compileClasspath})
  15. // classpath = sourceSets.main.runtimeClasspath
  16. // args 'mrhaki'
  17. // systemProperty 'simple.message', 'Hello '
  18. }
  19. defaultTasks 'run'
  20. task libDist(dependsOn: subprojects.build) << {
  21. // description 'Builds and copies the engine binaries, sources and javadoc to build/libDist'
  22. File libFolder = mkdir("$buildDir/libDist/lib")
  23. File sourceFolder = mkdir("$buildDir/libDist/sources")
  24. File javadocFolder = mkdir("$buildDir/libDist/javadoc")
  25. subprojects.each {project ->
  26. if(project.ext.mainClass == ''){
  27. project.tasks.withType(Jar).each {archiveTask ->
  28. if(archiveTask.classifier == "sources"){
  29. copy {
  30. from archiveTask.archivePath
  31. into sourceFolder
  32. }
  33. } else if(archiveTask.classifier == "javadoc"){
  34. copy {
  35. from archiveTask.archivePath
  36. into javadocFolder
  37. }
  38. } else{
  39. copy {
  40. from archiveTask.archivePath
  41. into libFolder
  42. }
  43. }
  44. }
  45. }
  46. }
  47. }
  48. task copyLibs(type: Copy){
  49. // description 'Copies the engine dependencies to build/libDist'
  50. from {
  51. subprojects*.configurations*.compile*.copyRecursive({ !(it instanceof ProjectDependency); })*.resolve()
  52. }
  53. into "$buildDir/libDist/lib-ext" //buildDir.path + '/' + libsDirName + '/lib'
  54. }
  55. task dist{
  56. description 'Creates a distribution of all jme3 binaries, sources, javadoc and external libraries under build/libDist'
  57. }
  58. dist.dependsOn libDist
  59. dist.dependsOn copyLibs
  60. task mergedJavadoc(type: Javadoc, description: 'Creates Javadoc from all the projects.') {
  61. title = 'All modules'
  62. destinationDir = new File(project.buildDir, 'merged-javadoc')
  63. // Note: The closures below are executed lazily.
  64. source subprojects.collect {project ->
  65. project.sourceSets*.allJava
  66. }
  67. classpath = files(subprojects.collect {project ->
  68. project.sourceSets*.compileClasspath})
  69. // source {
  70. // subprojects*.sourceSets*.main*.allSource
  71. // }
  72. // classpath.from {
  73. // subprojects*.configurations*.compile*.copyRecursive({ !(it instanceof ProjectDependency); })*.resolve()
  74. // }
  75. }
  76. task wrapper(type: Wrapper, description: 'Creates and deploys the Gradle wrapper to the current directory.') {
  77. gradleVersion = '1.10'
  78. }