Files
allwpilib/wpilibc/athena.gradle
Thad House 5e3755493d Linking and maven publish location rewrite (#298)
* Links HAL shared instead of static, and doesn't include library in jar

* Strips shared object files, and includes debug in releases

* Zips the HAL libraries into a separate maven artifact

* Switches to shared wpiutil

* Switches wpilibc to shared

* Moves maven artifacts

wpilibc now in edu.wpi.first.wpilibc:athena
wpilibj now in edu.wpi.first.wpilibj:athena
wpilibj jni not in edu.wpi.first.wpilibj:athena-jni
hal now in edu.wpi.first.wpilib:hal
athena runtime added (hal, ntcore, wpiutil) edu.wpi.first.wpilib:athena-runtime

Changes made where wpilibc does NOT include all required artifacts anymore. Dependent on hal, wpiutil and ntcore packages to work correctly.
JNI does NOT include all required artifacts anymore. Dependent on hal and wpiutil packages to work correctly.
2016-10-25 20:46:09 -07:00

173 lines
5.1 KiB
Groovy

defineNetworkTablesProperties()
defineWpiUtilProperties()
debugStripSetup(project)
def ntSourceDir = "$buildDir/ntSources"
model {
components {
wpilibc(NativeLibrarySpec) {
targetPlatform 'arm'
binaries.all {
tasks.withType(CppCompile) {
addNiLibraryLinks(linker, targetPlatform)
addNetworkTablesLibraryLinks(it, linker, targetPlatform)
}
}
sources {
cpp {
source {
srcDirs = ["${project.shared}/src", "${project.athena}/src"]
includes = ['**/*.cpp']
}
exportedHeaders {
srcDirs = ["${project.shared}/include", "${project.athena}/include", netTablesInclude, wpiUtilInclude]
includes = ['**/*.h']
}
lib project: ':hal', library: 'HALAthena', linkage: 'shared'
}
}
}
}
}
task wpilibcZip(type: Zip) {
description = 'Zips all of the libraries for wpilibc'
group = 'WPILib'
baseName = 'wpilibc'
destinationDir = project.buildDir
duplicatesStrategy = 'exclude'
// Include the shared library file and header files from this project
model {
binaries {
withType(SharedLibraryBinarySpec) { spec ->
from(spec.sharedLibraryFile) {
into 'lib'
}
from(new File(spec.sharedLibraryFile.absolutePath + ".debug")) {
into 'lib'
}
}
}
}
from (file("${project.shared}/include")) {
into 'include'
}
from (file("${project.athena}/include")) {
into 'include'
}
// Finally, include all of the shared library objects from the ni directory
from(project.file('../ni-libraries')) {
include 'libwpi.so'
into 'lib'
}
}
// 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.toLowerCase() == 'wpilibcsharedlibrary') {
wpilibcZip.dependsOn task
}
}
// Add the hal static and shared libraries as a dependency
project(':hal').tasks.whenTaskAdded { task ->
if (task.name.toLowerCase() == 'halathenastaticlibrary' || task.name.toLowerCase() == 'halathenasharedlibrary') {
wpilibcZip.dependsOn task
}
}
// Add the generate version file task as a dependency
tasks.whenTaskAdded { task ->
if (task.name.toLowerCase().startsWith('compilewpilib')) {
task.dependsOn generateCppVersion
}
}
if (checkDoxygen()) {
def ntSourcesDependency = project.dependencies.create('edu.wpi.first.wpilib.networktables.cpp:NetworkTables:+:sources@zip')
def ntSourcesConfig = project.configurations.detachedConfiguration(ntSourcesDependency)
ntSourcesDependency.setTransitive(false)
def ntSources = ntSourcesConfig.singleFile
task unzipCppNtSources(type: Copy) {
description = 'Unzips the C++ networktables sources for doc creation'
group = 'WPILib'
from zipTree(ntSources)
exclude 'META-INF/*'
into ntSourceDir
}
doxygen {
def halLocation = '../hal'
source new File("${project.shared}/src")
source new File("${project.shared}/include")
source new File("${project.athena}/src")
source new File("${project.athena}/include")
source new File("$ntSourceDir/src")
source new File("$ntSourceDir/include")
source new File("$halLocation/shared")
source new File("$halLocation/athena")
source new File("$halLocation/include")
// template file('cpp.doxy')
exclude 'nivision.h'
extension_mapping 'inc=C++'
project_name 'WPILibC++'
javadoc_autobrief true
recursive true
quiet true
warnings false
warn_if_doc_error false
warn_no_paramdoc false
warn_format false
warn_logfile false
warn_if_undocumented false
generate_latex false
html_timestamp true
generate_treeview true
outputDir new File("$buildDir/docs")
}
doxygen.dependsOn unzipCppNtSources
task doxygenZip(type: Zip) {
description = 'Generates doxygen zip file for publishing'
group = 'WPILib'
dependsOn doxygen
duplicatesStrategy = 'exclude'
from doxygen.outputDir
}
}
publishing {
publications {
wpilibc(MavenPublication) {
artifact wpilibcZip
if (checkDoxygen()) {
artifact (doxygenZip) {
classifier = 'doxygen'
}
}
groupId 'edu.wpi.first.wpilibc'
artifactId 'athena'
version WPILibVersion.version
}
}
setupWpilibRepo(it)
}
clean {
ntSourceDir
}