build.gradle 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //apply plugin:'application'
  2. if (!hasProperty('mainClass')) {
  3. ext.mainClass = 'jme3test.TestChooser'
  4. }
  5. task run(dependsOn: 'build', type:JavaExec) {
  6. main = mainClass
  7. classpath = sourceSets.main.runtimeClasspath
  8. if (System.properties['os.name'].toLowerCase().contains('mac')) {
  9. jvmArgs "-XstartOnFirstThread"
  10. jvmArgs "-Djava.awt.headless=true"
  11. }
  12. if (System.properties['java.util.logging.config.file'] != null) {
  13. systemProperty "java.util.logging.config.file", System.properties['java.util.logging.config.file']
  14. }
  15. if( assertions == "true" ){
  16. enableAssertions = true;
  17. }
  18. }
  19. dependencies {
  20. compile project(':jme3-blender')
  21. compile project(':jme3-core')
  22. compile project(':jme3-desktop')
  23. compile project(':jme3-effects')
  24. // compile project(':jme3-bullet')
  25. // compile project(':jme3-bullet-native')
  26. compile project(':jme3-jbullet')
  27. compile project(':jme3-jogg')
  28. compile project(':jme3-jogl')
  29. compile project(':jme3-lwjgl')
  30. compile project(':jme3-networking')
  31. compile project(':jme3-niftygui')
  32. compile project(':jme3-plugins')
  33. compile project(':jme3-terrain')
  34. compile project(':jme3-testdata')
  35. }
  36. jar.doFirst{
  37. manifest {
  38. attributes('Manifest-Version' : '1.0',
  39. // 'Created-By' : vendor,
  40. // 'Specification-Title' : appName,
  41. // 'Specification-Version' : jmeVersion,
  42. // 'Specification-Vendor' : "jMonkeyEngine",
  43. // 'Implementation-Title' : appName,
  44. // 'Implementation-Version' : version,
  45. // 'Implementation-Vendor' : vendor,
  46. 'Main-Class' : getProperty('mainClass'),
  47. // Add dependencies to manifest, remove version
  48. 'Class-Path' : configurations.compile.resolvedConfiguration.resolvedArtifacts.collect {
  49. 'lib/' +
  50. it.name +
  51. (it.classifier != null ? '-' + it.classifier : '') +
  52. '.' + it.extension }.join(' ')
  53. )
  54. }
  55. }
  56. task dist (dependsOn: ['build', ':jme3-jogl:jar', ':jme3-bullet:jar', ':jme3-android:jar', \
  57. ':jme3-android-native:jar', ':jme3-bullet-native-android:jar', \
  58. ':jme3-bullet-native:jar']) {
  59. doLast {
  60. // Copy all dependencies to ../dist/lib, remove versions from jar files
  61. configurations.compile.resolvedConfiguration.resolvedArtifacts.each { artifact ->
  62. copy {
  63. from artifact.file
  64. into '../dist/lib'
  65. if(artifact.classifier != null){
  66. rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" }
  67. } else{
  68. rename { "${artifact.name}.${artifact.extension}" }
  69. }
  70. }
  71. }
  72. copy {
  73. from jar.archivePath
  74. into '../dist'
  75. rename { "jMonkeyEngine3.jar" }
  76. }
  77. // Copy JOGL packages, remove version
  78. def config = project(':jme3-jogl').configurations.runtime.copyRecursive({ !(it instanceof ProjectDependency); })
  79. config.resolvedConfiguration.resolvedArtifacts.each {artifact ->
  80. copy{
  81. from artifact.file
  82. into '../dist/opt/jogl/lib'
  83. if(artifact.classifier != null){
  84. rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" }
  85. } else{
  86. rename { "${artifact.name}.${artifact.extension}" }
  87. }
  88. }
  89. }
  90. copy {
  91. from project(':jme3-jogl').jar.archivePath
  92. into '../dist/opt/jogl'
  93. rename {project(':jme3-jogl').name+".jar"}
  94. }
  95. // Copy bullet packages, remove version
  96. copy {
  97. from project(':jme3-bullet').jar.archivePath
  98. into '../dist/opt/native-bullet'
  99. rename {project(':jme3-bullet').name+".jar"}
  100. }
  101. copy {
  102. from project(':jme3-bullet-native').jar.archivePath
  103. into '../dist/opt/native-bullet'
  104. rename {project(':jme3-bullet-native').name+".jar"}
  105. }
  106. // Copy android packages, remove version
  107. copy {
  108. from project(':jme3-android').jar.archivePath
  109. into '../dist/opt/android'
  110. rename {project(':jme3-android').name+".jar"}
  111. }
  112. copy {
  113. from project(':jme3-android-native').jar.archivePath
  114. into '../dist/opt/android'
  115. rename {project(':jme3-android-native').name+".jar"}
  116. }
  117. copy {
  118. from project(':jme3-bullet-native-android').jar.archivePath
  119. into '../dist/opt/native-bullet'
  120. rename {project(':jme3-bullet-native-android').name+".jar"}
  121. }
  122. }
  123. }