From e07a40a16da4dc1599f53910f24feca2a72c23a1 Mon Sep 17 00:00:00 2001 From: Thad House Date: Sat, 5 Nov 2016 12:01:16 -0700 Subject: [PATCH] Adds an UberZip that preincludes the opencv libraries Helps eclipse a lot --- cameraserver.gradle | 58 +++++++++++++++++++++++++++++++++++++++++++++ publish.gradle | 8 ++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/cameraserver.gradle b/cameraserver.gradle index 4b1be9e272..30ee3797cb 100644 --- a/cameraserver.gradle +++ b/cameraserver.gradle @@ -175,6 +175,63 @@ def cameraserverZipTask = { project -> } } +def cameraserverUberZipTask = { project -> + if (project.isArm) { + project.ext.cameraserverUberZip = project.tasks.create("armCameraserverUberZip", Zip) { + description = 'Create platform-specific zip of cameraserver libraries including opencv' + group = 'WPILib' + destinationDir = project.buildDir + baseName = 'cameraserver' + classifier= "uber${project.buildPlatform}" + duplicatesStrategy = 'exclude' + + from(file('include')) { + into 'include' + } + + if (!project.hasProperty('skipJava')) { + project.jniHeadersCameraServer.outputs.each { + from(it) { + into 'include' + } + } + } + + project.model { + def openCvPlatform = project.getOpenCvPlatformPackage(targetPlatform) + from(file("${project.openCv}/${openCvPlatform}")) { + exclude 'META-INF' + into 'lib' + } + binaries { + withType(StaticLibraryBinarySpec) { binary -> + from(binary.staticLibraryFile) { + into 'lib' + } + } + withType(SharedLibraryBinarySpec) { binary -> + from(binary.sharedLibraryFile) { + into 'lib' + } + from (new File(binary.sharedLibraryFile.absolutePath + ".debug")) { + into 'lib' + } + } + } + } + } + + project.build.dependsOn project.cameraserverUberZip + + project.tasks.whenTaskAdded { task -> + def name = task.name.toLowerCase() + if (name.contains("cameraserversharedlibrary") || name.contains("cameraserverstaticlibrary") || name.contains("cameraservertest")) { + project.cameraserverUberZip.dependsOn task + } + } + } +} + if (buildArm) { project(':arm') { apply plugin: 'cpp' @@ -189,6 +246,7 @@ if (buildArm) { cameraserverZipTask(project) useWpiUtil(project) useOpenCv(project) + cameraserverUberZipTask(project) } } diff --git a/publish.gradle b/publish.gradle index d16425a50a..28e0ee594e 100644 --- a/publish.gradle +++ b/publish.gradle @@ -50,7 +50,10 @@ publishing { // If the library is not embedded include it in the repo if (!project.hasProperty('compilerPrefix')) { artifact camArm.cameraserverZip - } + } + artifact camArm.armCameraserverUberZip { + classifier = 'uberzip' + } } if (!OperatingSystem.current().isWindows()) { if (project.hasProperty('makeDesktop')) { @@ -72,6 +75,9 @@ publishing { artifact cameraserverSourceZip if (project.buildArm) { artifact project(':arm').cameraserverZip + artifact project(':arm').armCameraserverUberZip { + classifier = 'uberzip' + } } if (!OperatingSystem.current().isWindows()) { if (project.hasProperty('makeDesktop')) {