From 356b3d67260737701c3e861fa64b0079c63260d9 Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Thu, 24 Nov 2016 15:31:15 -0500 Subject: [PATCH] build: fix gradle 3.2.1 deprecations --- build.gradle | 51 +++++----- jme3-bullet-native-android/build.gradle | 102 ++++++++++---------- jme3-bullet-native/build.gradle | 2 +- jme3-examples/build.gradle | 118 ++++++++++++------------ 4 files changed, 139 insertions(+), 134 deletions(-) diff --git a/build.gradle b/build.gradle index 3711ffe41..9b3a7c3f9 100644 --- a/build.gradle +++ b/build.gradle @@ -29,31 +29,32 @@ task run(dependsOn: ':jme3-examples:run') { defaultTasks 'run' -task libDist(dependsOn: subprojects.build) << { -// description 'Builds and copies the engine binaries, sources and javadoc to build/libDist' - File libFolder = mkdir("$buildDir/libDist/lib") - File sourceFolder = mkdir("$buildDir/libDist/sources") - File javadocFolder = mkdir("$buildDir/libDist/javadoc") - subprojects.each {project -> - if(project.ext.mainClass == ''){ - project.tasks.withType(Jar).each {archiveTask -> - if(archiveTask.classifier == "sources"){ - copy { - from archiveTask.archivePath - into sourceFolder - rename {project.name + '-' + archiveTask.classifier +'.'+ archiveTask.extension} - } - } else if(archiveTask.classifier == "javadoc"){ - copy { - from archiveTask.archivePath - into javadocFolder - rename {project.name + '-' + archiveTask.classifier +'.'+ archiveTask.extension} - } - } else{ - copy { - from archiveTask.archivePath - into libFolder - rename {project.name + '.' + archiveTask.extension} +task libDist(dependsOn: subprojects.build, description: 'Builds and copies the engine binaries, sources and javadoc to build/libDist') { + doLast { + File libFolder = mkdir("$buildDir/libDist/lib") + File sourceFolder = mkdir("$buildDir/libDist/sources") + File javadocFolder = mkdir("$buildDir/libDist/javadoc") + subprojects.each {project -> + if(project.ext.mainClass == ''){ + project.tasks.withType(Jar).each {archiveTask -> + if(archiveTask.classifier == "sources"){ + copy { + from archiveTask.archivePath + into sourceFolder + rename {project.name + '-' + archiveTask.classifier +'.'+ archiveTask.extension} + } + } else if(archiveTask.classifier == "javadoc"){ + copy { + from archiveTask.archivePath + into javadocFolder + rename {project.name + '-' + archiveTask.classifier +'.'+ archiveTask.extension} + } + } else{ + copy { + from archiveTask.archivePath + into libFolder + rename {project.name + '.' + archiveTask.extension} + } } } } diff --git a/jme3-bullet-native-android/build.gradle b/jme3-bullet-native-android/build.gradle index 958d2b094..4d5df83da 100644 --- a/jme3-bullet-native-android/build.gradle +++ b/jme3-bullet-native-android/build.gradle @@ -102,56 +102,58 @@ task copyJmeAndroid(type: Copy, dependsOn:copyJmeCpp) { into outputDir } -task generateNativeHeaders(dependsOn: copyJmeAndroid) << { - String destDirPath = jniPath - String classes = " \ - com.jme3.bullet.PhysicsSpace, \ - \ - com.jme3.bullet.collision.PhysicsCollisionEvent, \ - com.jme3.bullet.collision.PhysicsCollisionObject,\ - com.jme3.bullet.objects.PhysicsCharacter, \ - com.jme3.bullet.objects.PhysicsGhostObject, \ - com.jme3.bullet.objects.PhysicsRigidBody, \ - com.jme3.bullet.objects.PhysicsVehicle, \ - com.jme3.bullet.objects.VehicleWheel, \ - com.jme3.bullet.objects.infos.RigidBodyMotionState, \ - \ - com.jme3.bullet.collision.shapes.CollisionShape, \ - com.jme3.bullet.collision.shapes.BoxCollisionShape, \ - com.jme3.bullet.collision.shapes.CapsuleCollisionShape, \ - com.jme3.bullet.collision.shapes.CompoundCollisionShape, \ - com.jme3.bullet.collision.shapes.ConeCollisionShape, \ - com.jme3.bullet.collision.shapes.CylinderCollisionShape, \ - com.jme3.bullet.collision.shapes.GImpactCollisionShape, \ - com.jme3.bullet.collision.shapes.HeightfieldCollisionShape, \ - com.jme3.bullet.collision.shapes.HullCollisionShape, \ - com.jme3.bullet.collision.shapes.MeshCollisionShape, \ - com.jme3.bullet.collision.shapes.PlaneCollisionShape, \ - com.jme3.bullet.collision.shapes.SimplexCollisionShape, \ - com.jme3.bullet.collision.shapes.SphereCollisionShape, \ - \ - com.jme3.bullet.joints.PhysicsJoint, \ - com.jme3.bullet.joints.ConeJoint, \ - com.jme3.bullet.joints.HingeJoint, \ - com.jme3.bullet.joints.Point2PointJoint, \ - com.jme3.bullet.joints.SixDofJoint, \ - com.jme3.bullet.joints.SixDofSpringJoint, \ - com.jme3.bullet.joints.SliderJoint, \ - com.jme3.bullet.joints.motors.RotationalLimitMotor, \ - com.jme3.bullet.joints.motors.TranslationalLimitMotor, \ - \ - com.jme3.bullet.util.NativeMeshUtil, \ - com.jme3.bullet.util.DebugShapeFactory" - - String projectClassPath = configurations.runtime.asFileTree.matching { - exclude ".gradle" - }.asPath - - exec { - executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah') - args '-d', destDirPath - args '-classpath', projectClassPath - args classes.split(",").collect { it.trim() } +task generateNativeHeaders(dependsOn: copyJmeAndroid) { + doLast { + String destDirPath = jniPath + String classes = " \ + com.jme3.bullet.PhysicsSpace, \ + \ + com.jme3.bullet.collision.PhysicsCollisionEvent, \ + com.jme3.bullet.collision.PhysicsCollisionObject,\ + com.jme3.bullet.objects.PhysicsCharacter, \ + com.jme3.bullet.objects.PhysicsGhostObject, \ + com.jme3.bullet.objects.PhysicsRigidBody, \ + com.jme3.bullet.objects.PhysicsVehicle, \ + com.jme3.bullet.objects.VehicleWheel, \ + com.jme3.bullet.objects.infos.RigidBodyMotionState, \ + \ + com.jme3.bullet.collision.shapes.CollisionShape, \ + com.jme3.bullet.collision.shapes.BoxCollisionShape, \ + com.jme3.bullet.collision.shapes.CapsuleCollisionShape, \ + com.jme3.bullet.collision.shapes.CompoundCollisionShape, \ + com.jme3.bullet.collision.shapes.ConeCollisionShape, \ + com.jme3.bullet.collision.shapes.CylinderCollisionShape, \ + com.jme3.bullet.collision.shapes.GImpactCollisionShape, \ + com.jme3.bullet.collision.shapes.HeightfieldCollisionShape, \ + com.jme3.bullet.collision.shapes.HullCollisionShape, \ + com.jme3.bullet.collision.shapes.MeshCollisionShape, \ + com.jme3.bullet.collision.shapes.PlaneCollisionShape, \ + com.jme3.bullet.collision.shapes.SimplexCollisionShape, \ + com.jme3.bullet.collision.shapes.SphereCollisionShape, \ + \ + com.jme3.bullet.joints.PhysicsJoint, \ + com.jme3.bullet.joints.ConeJoint, \ + com.jme3.bullet.joints.HingeJoint, \ + com.jme3.bullet.joints.Point2PointJoint, \ + com.jme3.bullet.joints.SixDofJoint, \ + com.jme3.bullet.joints.SixDofSpringJoint, \ + com.jme3.bullet.joints.SliderJoint, \ + com.jme3.bullet.joints.motors.RotationalLimitMotor, \ + com.jme3.bullet.joints.motors.TranslationalLimitMotor, \ + \ + com.jme3.bullet.util.NativeMeshUtil, \ + com.jme3.bullet.util.DebugShapeFactory" + + String projectClassPath = configurations.runtime.asFileTree.matching { + exclude ".gradle" + }.asPath + + exec { + executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah') + args '-d', destDirPath + args '-classpath', projectClassPath + args classes.split(",").collect { it.trim() } + } } } diff --git a/jme3-bullet-native/build.gradle b/jme3-bullet-native/build.gradle index cf42e17f6..b497b86fc 100644 --- a/jme3-bullet-native/build.gradle +++ b/jme3-bullet-native/build.gradle @@ -215,7 +215,7 @@ unzipBullet.dependsOn { } } -task unzipBulletIfNeeded << { +task unzipBulletIfNeeded { } unzipBulletIfNeeded.dependsOn { diff --git a/jme3-examples/build.gradle b/jme3-examples/build.gradle index 47ee94c72..dde857609 100644 --- a/jme3-examples/build.gradle +++ b/jme3-examples/build.gradle @@ -63,69 +63,71 @@ jar.doFirst{ task dist (dependsOn: ['build', ':jme3-jogl:jar', ':jme3-bullet:jar', ':jme3-android:jar', \ ':jme3-android-native:jar', ':jme3-bullet-native-android:jar', \ - ':jme3-bullet-native:jar']) << { - // Copy all dependencies to ../dist/lib, remove versions from jar files - configurations.compile.resolvedConfiguration.resolvedArtifacts.each { artifact -> - copy { - from artifact.file - into '../dist/lib' - if(artifact.classifier != null){ - rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" } - } else{ - rename { "${artifact.name}.${artifact.extension}" } + ':jme3-bullet-native:jar']) { + doLast { + // Copy all dependencies to ../dist/lib, remove versions from jar files + configurations.compile.resolvedConfiguration.resolvedArtifacts.each { artifact -> + copy { + from artifact.file + into '../dist/lib' + if(artifact.classifier != null){ + rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" } + } else{ + rename { "${artifact.name}.${artifact.extension}" } + } } } - } - copy { - from jar.archivePath - into '../dist' - rename { "jMonkeyEngine3.jar" } - } - // Copy JOGL packages, remove version - def config = project(':jme3-jogl').configurations.runtime.copyRecursive({ !(it instanceof ProjectDependency); }) - config.resolvedConfiguration.resolvedArtifacts.each {artifact -> - copy{ - from artifact.file - into '../dist/opt/jogl/lib' - if(artifact.classifier != null){ - rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" } - } else{ - rename { "${artifact.name}.${artifact.extension}" } + copy { + from jar.archivePath + into '../dist' + rename { "jMonkeyEngine3.jar" } + } + // Copy JOGL packages, remove version + def config = project(':jme3-jogl').configurations.runtime.copyRecursive({ !(it instanceof ProjectDependency); }) + config.resolvedConfiguration.resolvedArtifacts.each {artifact -> + copy{ + from artifact.file + into '../dist/opt/jogl/lib' + if(artifact.classifier != null){ + rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" } + } else{ + rename { "${artifact.name}.${artifact.extension}" } + } } } - } - copy { - from project(':jme3-jogl').jar.archivePath - into '../dist/opt/jogl' - rename {project(':jme3-jogl').name+".jar"} - } + copy { + from project(':jme3-jogl').jar.archivePath + into '../dist/opt/jogl' + rename {project(':jme3-jogl').name+".jar"} + } - // Copy bullet packages, remove version - copy { - from project(':jme3-bullet').jar.archivePath - into '../dist/opt/native-bullet' - rename {project(':jme3-bullet').name+".jar"} - } - copy { - from project(':jme3-bullet-native').jar.archivePath - into '../dist/opt/native-bullet' - rename {project(':jme3-bullet-native').name+".jar"} - } + // Copy bullet packages, remove version + copy { + from project(':jme3-bullet').jar.archivePath + into '../dist/opt/native-bullet' + rename {project(':jme3-bullet').name+".jar"} + } + copy { + from project(':jme3-bullet-native').jar.archivePath + into '../dist/opt/native-bullet' + rename {project(':jme3-bullet-native').name+".jar"} + } - // Copy android packages, remove version - copy { - from project(':jme3-android').jar.archivePath - into '../dist/opt/android' - rename {project(':jme3-android').name+".jar"} - } - copy { - from project(':jme3-android-native').jar.archivePath - into '../dist/opt/android' - rename {project(':jme3-android-native').name+".jar"} - } - copy { - from project(':jme3-bullet-native-android').jar.archivePath - into '../dist/opt/native-bullet' - rename {project(':jme3-bullet-native-android').name+".jar"} + // Copy android packages, remove version + copy { + from project(':jme3-android').jar.archivePath + into '../dist/opt/android' + rename {project(':jme3-android').name+".jar"} + } + copy { + from project(':jme3-android-native').jar.archivePath + into '../dist/opt/android' + rename {project(':jme3-android-native').name+".jar"} + } + copy { + from project(':jme3-bullet-native-android').jar.archivePath + into '../dist/opt/native-bullet' + rename {project(':jme3-bullet-native-android').name+".jar"} + } } }