Squashed 'third_party/Phoenix-frc-lib/' content from commit 666d176
Change-Id: Ibaca2fc8ffb1177e786576cc1e4cc9f7a8c98f13
git-subtree-dir: third_party/Phoenix-frc-lib
git-subtree-split: 666d176a08151793044ab74e0005f13d3732ed96
diff --git a/releases.gradle b/releases.gradle
new file mode 100644
index 0000000..47c34ac
--- /dev/null
+++ b/releases.gradle
@@ -0,0 +1,288 @@
+task javaSourceJar(type: Jar) {
+ description = 'Generates the source jar for java'
+ group = ''
+ baseName = libraryName
+ classifier = "sources"
+ duplicatesStrategy = 'exclude'
+ destinationDir = archiveReleaseDir
+
+ dependsOn project(':arm:cpp').classes
+ from project(':arm:cpp').sourceSets.main.allJava
+}
+
+task javaJavadocJar(type: Jar) {
+ description = 'Generates the javadoc jar for java'
+ group = ''
+ baseName = libraryName
+ classifier = "javadoc"
+ duplicatesStrategy = 'exclude'
+ destinationDir = archiveReleaseDir
+
+ dependsOn project(':arm:cpp').javadoc
+ from project(':arm:cpp').javadoc.destinationDir
+}
+
+task cppSources(type: Zip) {
+ description = 'Creates a zip of cpp sources.'
+ group = ''
+ destinationDir = archiveReleaseDir
+ baseName = libraryName
+ classifier = 'cppsources'
+ duplicatesStrategy = 'exclude'
+
+ from(cppSrc) {
+ into 'src'
+ }
+
+ from(cppInclude) {
+ into 'include'
+ }
+}
+
+task copyToEclipse(type: Copy) {
+ description = 'Creates user zip of libraries, with shared c++ libs.'
+ group = ''
+ def userDir = System.getProperty("user.home")
+ destinationDir = file("${userDir}/wpilib/user/")
+
+ // Copy include files from cpp project
+ from(file(cppInclude)) {
+ include '**/*.h'
+ into '/cpp/include'
+ }
+
+ // Copy static binaries from cpp project
+ project(':arm:cpp').model {
+ binaries {
+ withType(StaticLibraryBinarySpec) { binary ->
+ from(binary.staticLibraryFile) {
+ include '*.a'
+ into '/cpp/lib'
+ }
+ }
+ }
+ }
+
+ // copy driver include
+ from (file(driverInclude)) {
+ include '**/*.h'
+ into '/cpp/include'
+ }
+
+ // Copy included driver library headers
+ from(file(driverLibraryInclude)) {
+ include '**/*.h'
+ into '/cpp/include'
+ }
+
+ // Copy included driver library binaries
+ from(file(driverLibraryLib)) {
+ include '*.so*'
+ include '*.a*'
+ into '/cpp/lib'
+ }
+
+ // Copy included driver library headers
+ from(file(cppLibraryInclude)) {
+ include '**/*.h'
+ into '/cpp/include'
+ }
+
+ // Copy included driver library binaries
+ from(file(cppLibraryLib)) {
+ include '*.so*'
+ include '*.a*'
+ into '/cpp/lib'
+ }
+
+ def javaProject = project(':arm:cpp')
+ dependsOn javaProject.jar
+ // Copy project java binary
+ from (file(javaProject.jar.archivePath)) {
+ into '/java/lib'
+ }
+
+
+ // If not embedded java, include java libs
+ if (!embedJavaLibraries) {
+ from(file(javaLibraryLoc)) {
+ include '*.jar'
+ include '*.so'
+ include '*.so.debug'
+ into '/java/lib'
+ }
+ }
+
+ // Include java sources if set
+ if (includeJavaSources) {
+ dependsOn javaSourceJar
+ from (file(javaSourceJar.archivePath)) {
+ into '/java/lib'
+ }
+ }
+
+ // Include java javadoc if set
+ if (includeJavaJavadoc) {
+ dependsOn javaJavadocJar
+ from (file(javaJavadocJar.archivePath)) {
+ into '/java/docs'
+ }
+ }
+
+ // Include cpp sources if set
+ if (includeCppSources) {
+ from(file(cppSrc)) {
+ include '**/*.cpp'
+ include '**/*.h'
+ into "/cpp/src/$libraryName"
+ }
+ }
+
+ // Include driver sources if set
+ if (includeDriverSources) {
+ from(file(driverSrc)) {
+ include '**/*.cpp'
+ include '**/*.h'
+ into "/cpp/src/$libraryName"
+ }
+ }
+}
+
+
+task userStaticArtifacts(type: Copy) {
+ description = 'Creates user zip of libraries, with static c++ libs.'
+ group = ''
+ destinationDir = releaseDir
+ duplicatesStrategy = 'exclude'
+
+ // Copy include files from cpp project
+ from(file(cppInclude)) {
+ include '**/*.h'
+ into '/cpp/include'
+ }
+
+ // Copy static binaries from cpp project
+ project(':arm:cpp').model {
+ binaries {
+ withType(StaticLibraryBinarySpec) { binary ->
+ from(binary.staticLibraryFile) {
+ include '*.a'
+ into '/cpp/lib'
+ }
+ }
+ }
+ }
+
+ // copy driver include
+ from (file(driverInclude)) {
+ include '**/*.h'
+ into '/cpp/include'
+ }
+
+ // Copy included driver library headers
+ from(file(driverLibraryInclude)) {
+ include '**/*.h'
+ into '/cpp/include'
+ }
+
+ // Copy included driver library binaries
+ from(file(driverLibraryLib)) {
+ include '*.so*'
+ include '*.a*'
+ into '/cpp/lib'
+ }
+
+ // Copy included driver library headers
+ from(file(cppLibraryInclude)) {
+ include '**/*.h'
+ into '/cpp/include'
+ }
+
+ // Copy included driver library binaries
+ from(file(cppLibraryLib)) {
+ include '*.so*'
+ include '*.a*'
+ into '/cpp/lib'
+ }
+
+ def javaProject = project(':arm:cpp')
+ dependsOn javaProject.jar
+ // Copy project java binary
+ from (file(javaProject.jar.archivePath)) {
+ into '/java/lib'
+ }
+
+ // If not embedded java, include java libs
+ if (!embedJavaLibraries) {
+ from(file(javaLibraryLoc)) {
+ include '*.jar'
+ include '*.so'
+ include '*.so.debug'
+ into '/java/lib'
+ }
+ }
+
+ // Include java sources if set
+ if (includeJavaSources) {
+ dependsOn javaSourceJar
+ from (file(javaSourceJar.archivePath)) {
+ into '/java/lib'
+ }
+ }
+
+ // Include java javadoc if set
+ if (includeJavaJavadoc) {
+ dependsOn javaJavadocJar
+ from (file(javaJavadocJar.archivePath)) {
+ into '/java/docs'
+ }
+ }
+
+ // Include cpp sources if set
+ if (includeCppSources) {
+ from(file(cppSrc)) {
+ include '**/*.cpp'
+ include '**/*.h'
+ into "/cpp/src/$libraryName"
+ }
+ }
+
+ // Include driver sources if set
+ if (includeDriverSources) {
+ from(file(driverSrc)) {
+ include '**/*.cpp'
+ include '**/*.h'
+ into "/cpp/src/$libraryName"
+ }
+ }
+}
+
+task doc(type: Exec){
+ doFirst{
+ mkdir "${releaseDir}/cpp/docs"
+ }
+ commandLine 'powershell', 'doxygen ctrlib.doxy'
+}
+
+
+project(':arm:cpp').tasks.whenTaskAdded { task ->
+ def name = task.name.toLowerCase()
+ if (name.contains("sharedlibrary") || name.contains("staticlibrary")) {
+ userStaticArtifacts.dependsOn task
+ copyToEclipse.dependsOn task
+ }
+}
+
+
+//build.dependsOn javaSourceJar
+//build.dependsOn javaJavadocJar
+//build.dependsOn cppSources
+
+build.dependsOn userStaticArtifacts
+build.dependsOn doc
+
+doc.mustRunAfter userStaticArtifacts
+
+if (setCopyToEclipse) {
+ build.dependsOn copyToEclipse
+}
\ No newline at end of file