build.gradle 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. // Copy all dependencies to ../dist/lib, remove versions from jar files
  60. configurations.compile.resolvedConfiguration.resolvedArtifacts.each { artifact ->
  61. copy {
  62. from artifact.file
  63. into '../dist/lib'
  64. if(artifact.classifier != null){
  65. rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" }
  66. } else{
  67. rename { "${artifact.name}.${artifact.extension}" }
  68. }
  69. }
  70. }
  71. copy {
  72. from jar.archivePath
  73. into '../dist'
  74. rename { "jMonkeyEngine3.jar" }
  75. }
  76. // Copy JOGL packages, remove version
  77. def config = project(':jme3-jogl').configurations.runtime.copyRecursive({ !(it instanceof ProjectDependency); })
  78. config.resolvedConfiguration.resolvedArtifacts.each {artifact ->
  79. copy{
  80. from artifact.file
  81. into '../dist/opt/jogl/lib'
  82. if(artifact.classifier != null){
  83. rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" }
  84. } else{
  85. rename { "${artifact.name}.${artifact.extension}" }
  86. }
  87. }
  88. }
  89. copy {
  90. from project(':jme3-jogl').jar.archivePath
  91. into '../dist/opt/jogl'
  92. rename {project(':jme3-jogl').name+".jar"}
  93. }
  94. // Copy bullet packages, remove version
  95. copy {
  96. from project(':jme3-bullet').jar.archivePath
  97. into '../dist/opt/native-bullet'
  98. rename {project(':jme3-bullet').name+".jar"}
  99. }
  100. copy {
  101. from project(':jme3-bullet-native').jar.archivePath
  102. into '../dist/opt/native-bullet'
  103. rename {project(':jme3-bullet-native').name+".jar"}
  104. }
  105. // Copy android packages, remove version
  106. copy {
  107. from project(':jme3-android').jar.archivePath
  108. into '../dist/opt/android'
  109. rename {project(':jme3-android').name+".jar"}
  110. }
  111. copy {
  112. from project(':jme3-android-native').jar.archivePath
  113. into '../dist/opt/android'
  114. rename {project(':jme3-android-native').name+".jar"}
  115. }
  116. copy {
  117. from project(':jme3-bullet-native-android').jar.archivePath
  118. into '../dist/opt/native-bullet'
  119. rename {project(':jme3-bullet-native-android').name+".jar"}
  120. }
  121. }