-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
94 lines (81 loc) · 2.76 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
89
90
91
92
93
94
plugins {
id 'java'
id 'com.diffplug.spotless' version '6.25.0'
}
repositories {
mavenLocal()
mavenCentral()
}
apply plugin : 'eclipse'
eclipse.classpath.file {
// instruct eclipse plugin to put everything to module path
whenMerged {
entries.findAll { it.kind == 'lib' }.each { it.entryAttributes['module'] = 'true' }
}
}
dependencies {
implementation "io.github.pinorobotics:jros2control:1.0-SNAPSHOT"
implementation "io.github.pinorobotics:jros2moveit:2.0-SNAPSHOT"
implementation "io.github.pinorobotics:drac:2.0-SNAPSHOT"
implementation "io.opentelemetry:opentelemetry-api:1.43.0"
implementation "io.github.lambdaprime:id.opentelemetry-exporters-pack:4.0"
}
def zzJavaVersion = 22
sourceCompatibility = zzJavaVersion
targetCompatibility = zzJavaVersion
jar {
archiveFileName = "r2d2_control.jar"
manifest {
attributes "Implementation-Version": "${rootProject.version}",
"Main-Class": "pinorobotics.r2d2.control.Dorna2JointTrajectoryControllerApp"
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
task copyReadme(type: Copy) {
from("README.md")
into("$buildDir/resources/main")
rename ("README.md", "README-r2d2.md")
doLast {
assert file("$buildDir/resources/main/README-r2d2.md").exists()
}
}
// overwrite template README which comes from resources folder
jar.dependsOn copyReadme
javadoc.dependsOn copyReadme
// setup spotless config for all subprojects
spotless {
java {
importOrder()
removeUnusedImports()
// Use Android style which has 4 whitespaces instead 2 by default
googleJavaFormat().aosp().reflowLongStrings()
licenseHeader '''/*
* Copyright $YEAR pinorobotics
*
* Website: https://github.com/pinorobotics/r2d2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'''
}
}
// run spotless and format code before the build
classes.dependsOn spotlessApply
// gradlew requires execution of gradle-wrapper.jar which trustworthy needs to
// be checked everytime when it is updated (otherwise it do not seems secure)
// To avoid using it we rely on manual version check
if ("$gradle.gradleVersion" != "8.10.1")
throw new RuntimeException("Running gradle version $gradle.gradleVersion, required 8.10.1");