forked from Electrostat-Lab/JmeCarPhysicsTestRPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·88 lines (76 loc) · 3.01 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
plugins {
id 'java'
}
group 'com.scrappers'
version '3.0-TestCase'
sourceCompatibility = 1.8
mainClassName = 'GPIOJmeCarTest'
String dependenciesString = ""
repositories {
mavenCentral()
/*add repositories of jcenter,bintray,jtpack.io*/
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
/**jme3 core libraries from jcenter & Miniev3.1.0 for arm32 or armhf or armv7l or cortex-A(application)72 that runs on raspiberry pi4 model b*/
implementation "org.jmonkeyengine:jme3-core:3.3.2-stable"
implementation "org.jmonkeyengine:jme3-lwjgl3:3.3.2-stable"
implementation "org.jmonkeyengine:jme3-desktop:3.3.2-stable"
implementation 'com.github.stephengold:Minie:3.1.0'
/**don't forget this in order to extract the native library lwjgllib-arm32 for arm32 linux raspiOS*/
implementation "org.lwjgl:lwjgl:3.2.3:natives-linux-arm32"
/** if you encounter any problem w/ extraction of .so object files or native libraries of other lwjgl component please add what's missing from lwjgl repositories
* implementation "org.lwjgl:lwjgl-glfw:3.2.3:natives-linux-arm32"
* implementation "org.lwjgl:lwjgl-opengl:3.2.3:natives-linux-arm32"
* implementation "org.lwjgl:lwjgl-openal:3.2.3:natives-linux-arm32"
* implementation "org.lwjgl:lwjgl-jemalloc:3.2.3:natives-linux-arm32"
*/
/**if you will use GPIO Joystick module to control anything */
implementation 'com.github.Scrappers-glitch:JoystickModule:1.0.9R'
/**or if you will use Pi4J gradle implemented from wPi native library
*
* implementation "com.pi4j:pi4j-core:1.2"
* implementation "com.pi4j:pi4j-gpio-extension:1.2"
* implementation "com.pi4j:pi4j-device:1.2"
*
* */
}
task copyJars(type: Copy) {
from (sourceSets.main.runtimeClasspath){
include '**/*.jar'
}
from(sourceSets.main.compileClasspath){
include '**/*.jar'
}
into('build/libs/dependencies')
includeEmptyDirs = false
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
/**
* Better approach described below, but the 2 of them are vial ones
*/
task createJar(type : Jar, dependsOn : copyJars){
//get the copied jars
final String project = rootDir.getPath()
final File dependencies = new File(project + "/build/libs/dependencies/")
if(dependencies.exists()) {
if (dependencies.listFiles().length > 0) {
final File[] files = dependencies.listFiles()
for (int i = 0; i < files.length; i++) {
final String fileName = files[i].getName()
if (fileName.contains(".jar")) {
dependenciesString += "dependencies/" + fileName + " "
}
}
}
}
manifest{
attributes('Main-Class': mainClassName)
//pass the jars to the manifest
attributes('Class-Path' : dependenciesString)
attributes('Created-By' : 'JmeCarPhysics')
}
with jar
}