Files
allwpilib/wpilibc/athena.gradle
Fredric Silberberg 6d854afb0e WPILib Reorganization
This is a major restructuring of the WPILib repository to simply build
procedures and remove the remnants of Maven from everything except the
eclipse plugins. Gradle files have been largely simplified or rewritten,
taking advantage of splitting up parts of the build into separate build
files for ease of reading.

The eclipse plugins are now in a separate project, as is ntcore. All
dependencies are resolved via Maven dependencies, with the
Jenkins-maintained WPILib repo. Project structures have also been
simplified: we no longer have separate subprojects inside wpilibc and
wpilibj. Where possible, these changes hav been done with git renames,
to make sure we still have full history for all repositories. Other
unrelated subprojects have also been broken out: OutlineViewer is now a
separate project.

Change-Id: Ib4e2a6e1a2f66427a14f16612b0e0d69ed661878
2015-11-21 18:26:49 -05:00

121 lines
3.6 KiB
Groovy

defineNetworkTablesProperties()
model {
components {
wpilib_nonshared(NativeLibrarySpec) {
targetPlatform 'arm'
binaries.all {
tasks.withType(CppCompile) {
dependsOn addNiLibraryLinks
dependsOn addNetworkTablesLibraryLinks
}
}
sources {
cpp {
source {
srcDirs = ["${project.shared}/src", "${project.athena}/src"]
includes = ['**/*.cpp']
}
exportedHeaders {
srcDirs = ["${project.shared}/include", "${project.athena}/include", netTablesInclude]
includes = ['**/*.h']
}
lib project: ':hal', library: 'HALAthena', linkage: 'static'
}
}
}
}
}
task wpilibcZip(type: Zip) {
description = 'Zips all of the libraries for wpilibc'
group = 'WPILib'
baseName = 'wpilibc'
destinationDir = project.buildDir
// Include the static library file and header files from this project
binaries.withType(StaticLibraryBinarySpec) { spec ->
spec.headerDirs.each {
from(it) {
into 'include'
}
}
from(spec.staticLibraryFile) {
into 'lib'
}
}
// Include the static library file and shared library object from hal project
def hal = project(':hal')
hal.binaries.withType(StaticLibraryBinarySpec) { spec ->
spec.headerDirs.each {
from(it) {
into 'include'
// We don't want to include any of the .cpp files that are in some of the header directories
exclude '**/*.cpp'
}
}
from(spec.staticLibraryFile) {
into 'lib'
}
}
hal.binaries.withType(SharedLibraryBinarySpec) { spec ->
from(spec.sharedLibraryFile) {
into 'lib'
}
}
// Include the ntcore static and shared libraries
from(netSharedLib) {
into 'lib'
}
from(netStaticLib) {
into 'lib'
}
// We rename the libHALAthena.so object to libHALAthena_shared.so, and the same for libntcore.so
rename('(libHALAthena)(.so)', '$1_shared$2')
rename('(libntcore)(.so)', '$1_shared$2')
// Finally, include all of the shared library objects from the ni directory
from(project.file('../ni-libraries')) {
into 'lib'
exclude 'genlinks'
}
}
// Add the dependency on the wpilib_nonsharedStaticLibrary task to the wpilibc task. Because of the gradle lifecycle,
// this cannot be done purely with dependsOn in the task, as the static library task doesn't exist yet. Same goes for
// the networkTablesStaticLibrary task and the two HAL tasks below
tasks.whenTaskAdded { task ->
if (task.name == 'wpilib_nonsharedStaticLibrary') {
wpilibcZip.dependsOn task
}
}
// Add the hal static and shared libraries as a dependency
project(':hal').tasks.whenTaskAdded { task ->
if (task.name == 'hALAthenaStaticLibrary' || task.name == 'hALAthenaSharedLibrary') {
wpilibcZip.dependsOn task
}
}
publishing {
publications {
wpilibc(MavenPublication) {
artifact wpilibcZip {
// Trim the leading '-' off the classifier if we are using one
if (useExtension) {
classifier = project.getClassifier()[1..-1]
}
}
groupId 'edu.wpi.first.wpilib.cmake'
artifactId 'cpp-root'
version '1.0.0'
}
}
setupWpilibRepo(it)
}