mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Gradle publishing does not capture all of the source files that are used during a build. This should get most of them, and get it equivalent to what bazel pushes out.
128 lines
3.5 KiB
Groovy
128 lines
3.5 KiB
Groovy
ext {
|
|
addHalDependency = { binary, shared->
|
|
binary.lib project: ':hal', library: 'hal', linkage: shared
|
|
}
|
|
|
|
addHalJniDependency = { binary->
|
|
binary.lib project: ':hal', library: 'halJNIShared', linkage: 'shared'
|
|
}
|
|
|
|
nativeName = 'hal'
|
|
setBaseName = 'wpiHal'
|
|
devMain = 'edu.wpi.first.hal.DevMain'
|
|
generatedHeaders = "src/generated/main/native/include"
|
|
splitSetup = {
|
|
if (it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) {
|
|
it.sources {
|
|
systemCoreCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs = ['src/main/native/systemcore']
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDir 'src/main/native/include'
|
|
srcDir generatedHeaders
|
|
srcDir 'src/mrc/include'
|
|
srcDir 'src/generated/main/native/cpp/mrc/protobuf'
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
it.sources {
|
|
simCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/sim'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDir 'src/main/native/include'
|
|
srcDir generatedHeaders
|
|
srcDir 'src/mrc/include'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
it.sources {
|
|
nanopbCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/generated/main/native/cpp'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/generated/main/native/cpp'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
exeSplitSetup = {
|
|
}
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/jni/setupBuild.gradle"
|
|
|
|
sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java"
|
|
|
|
cppSourcesZip {
|
|
from('src/main/native/athena') {
|
|
into '/athena'
|
|
}
|
|
|
|
from('src/main/native/systemcore') {
|
|
into '/systemcore'
|
|
}
|
|
|
|
from('src/main/native/sim') {
|
|
into '/sim'
|
|
}
|
|
}
|
|
|
|
cppHeadersZip {
|
|
from(generatedHeaders) {
|
|
into '/'
|
|
}
|
|
from('src/mrc/include') {
|
|
into '/'
|
|
}
|
|
}
|
|
|
|
Action<List<String>> symbolFilter = { symbols ->
|
|
symbols.removeIf({ !it.startsWith('HAL_') && !it.startsWith('HALSIM_') })
|
|
} as Action<List<String>>;
|
|
|
|
nativeUtils.exportsConfigs {
|
|
hal {
|
|
}
|
|
halJNI {
|
|
x64SymbolFilter = symbolFilter
|
|
}
|
|
}
|
|
|
|
model {
|
|
components {
|
|
all {
|
|
it.sources.each {
|
|
it.exportedHeaders {
|
|
srcDirs 'src/mrc/include',
|
|
'src/generated/main/native/cpp/mrc/protobuf'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
binaries {
|
|
all {
|
|
if (!it.buildable || !(it instanceof NativeBinarySpec)) {
|
|
return
|
|
}
|
|
if (it.component.name == "${nativeName}JNI") {
|
|
project(':ntcore').addNtcoreDependency(it, 'static')
|
|
lib project: ':wpinet', library: 'wpinet', linkage: 'static'
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
|
|
} else {
|
|
project(':ntcore').addNtcoreDependency(it, 'shared')
|
|
lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
|
}
|
|
}
|
|
}
|
|
}
|