forked from ThadHouse/HALSIM_SocketCAN
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.gradle
175 lines (153 loc) · 6.05 KB
/
config.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import org.gradle.internal.os.OperatingSystem
nativeUtils.addWpiNativeUtils()
nativeUtils.withCrossRoboRIO()
nativeUtils {
wpi {
configureDependencies {
wpiVersion = "2023.+"
niLibVersion = "2023.3.0"
opencvVersion = "4.6.0-3"
googleTestVersion = "1.12.1-1"
}
}
}
nativeUtils.wpi.addWarnings()
nativeUtils.wpi.addWarningsAsErrors()
nativeUtils.setSinglePrintPerPlatform()
model {
// Uncomment this, and remove lines below it to enable builds for just roborio
// components {
// all {
// targetPlatform nativeUtils.wpi.platforms.roborio
// }
// }
components {
all {
nativeUtils.useAllPlatforms(it)
}
}
binaries {
withType(NativeBinarySpec).all {
nativeUtils.usePlatformArguments(it)
}
}
}
ext.appendDebugPathToBinaries = { binaries->
binaries.withType(StaticLibraryBinarySpec) {
if (it.buildType.name.contains('debug')) {
def staticFileDir = it.staticLibraryFile.parentFile
def staticFileName = it.staticLibraryFile.name
def staticFileExtension = staticFileName.substring(staticFileName.lastIndexOf('.'))
staticFileName = staticFileName.substring(0, staticFileName.lastIndexOf('.'))
staticFileName = staticFileName + 'd' + staticFileExtension
def newStaticFile = new File(staticFileDir, staticFileName)
it.staticLibraryFile = newStaticFile
}
}
binaries.withType(SharedLibraryBinarySpec) {
if (it.buildType.name.contains('debug')) {
def sharedFileDir = it.sharedLibraryFile.parentFile
def sharedFileName = it.sharedLibraryFile.name
def sharedFileExtension = sharedFileName.substring(sharedFileName.lastIndexOf('.'))
sharedFileName = sharedFileName.substring(0, sharedFileName.lastIndexOf('.'))
sharedFileName = sharedFileName + 'd' + sharedFileExtension
def newSharedFile = new File(sharedFileDir, sharedFileName)
def sharedLinkFileDir = it.sharedLibraryLinkFile.parentFile
def sharedLinkFileName = it.sharedLibraryLinkFile.name
def sharedLinkFileExtension = sharedLinkFileName.substring(sharedLinkFileName.lastIndexOf('.'))
sharedLinkFileName = sharedLinkFileName.substring(0, sharedLinkFileName.lastIndexOf('.'))
sharedLinkFileName = sharedLinkFileName + 'd' + sharedLinkFileExtension
def newLinkFile = new File(sharedLinkFileDir, sharedLinkFileName)
it.sharedLibraryLinkFile = newLinkFile
it.sharedLibraryFile = newSharedFile
}
}
}
ext.createComponentZipTasks = { components, names, base, type, project, func ->
def stringNames = names.collect {it.toString()}
def configMap = [:]
components.each {
if (it in NativeLibrarySpec && stringNames.contains(it.name)) {
it.binaries.each {
if (!it.buildable) return
def target = nativeUtils.getPublishClassifier(it)
if (configMap.containsKey(target)) {
configMap.get(target).add(it)
} else {
configMap.put(target, [])
configMap.get(target).add(it)
}
}
}
}
def taskList = []
def outputsFolder = file("$project.buildDir/outputs")
configMap.each { key, value ->
def task = project.tasks.create(base + "-${key}", type) {
description = 'Creates component archive for platform ' + key
destinationDirectory = outputsFolder
classifier = key
archiveBaseName = '_M_' + base
duplicatesStrategy = 'exclude'
from(licenseFile) {
into '/'
}
func(it, value)
}
taskList.add(task)
project.build.dependsOn task
project.artifacts {
task
}
addTaskToCopyAllOutputs(task)
}
return taskList
}
ext.createAllCombined = { list, name, base, type, project ->
def outputsFolder = file("$project.buildDir/outputs")
def task = project.tasks.create(base + "-all", type) {
description = "Creates component archive for all classifiers"
destinationDirectory = outputsFolder
classifier = "all"
archiveBaseName = base
duplicatesStrategy = 'exclude'
list.each {
if (it.name.endsWith('debug')) return
from project.zipTree(it.archivePath)
dependsOn it
}
}
project.build.dependsOn task
project.artifacts {
task
}
return task
}
ext.includeStandardZipFormat = { task, value ->
value.each { binary ->
if (binary.buildable) {
if (binary instanceof SharedLibraryBinarySpec) {
task.dependsOn binary.tasks.link
task.from(new File(binary.sharedLibraryFile.absolutePath + ".debug")) {
into nativeUtils.getPlatformPath(binary) + '/shared'
}
def sharedPath = binary.sharedLibraryFile.absolutePath
sharedPath = sharedPath.substring(0, sharedPath.length() - 4)
task.from(new File(sharedPath + '.pdb')) {
into nativeUtils.getPlatformPath(binary) + '/shared'
}
task.from(binary.sharedLibraryFile) {
into nativeUtils.getPlatformPath(binary) + '/shared'
}
task.from(binary.sharedLibraryLinkFile) {
into nativeUtils.getPlatformPath(binary) + '/shared'
}
} else if (binary instanceof StaticLibraryBinarySpec) {
task.dependsOn binary.tasks.createStaticLib
task.from(binary.staticLibraryFile) {
into nativeUtils.getPlatformPath(binary) + '/static'
}
}
}
}
}