diff --git a/simulation/halsim_print/build.gradle b/simulation/halsim_print/build.gradle index 4ca90a8a0a..f66129dd0a 100644 --- a/simulation/halsim_print/build.gradle +++ b/simulation/halsim_print/build.gradle @@ -11,7 +11,19 @@ if (!project.hasProperty('onlyAthena')) { model { components { - halsim_print(NativeLibrarySpec) + halsim_print(NativeLibrarySpec) { + sources { + cpp { + source { + srcDirs = [ 'src/main/native/cpp' ] + includes = ["**/*.cpp"] + } + exportedHeaders { + srcDirs = ["src/main/native/include"] + } + } + } + } } binaries { diff --git a/simulation/halsim_print/publish.gradle b/simulation/halsim_print/publish.gradle index ceee83e604..62ba4ec20b 100644 --- a/simulation/halsim_print/publish.gradle +++ b/simulation/halsim_print/publish.gradle @@ -17,23 +17,71 @@ if (project.hasProperty("publishVersion")) { def baseArtifactId = 'halsim-print' def artifactGroupId = 'edu.wpi.first.halsim' +def outputsFolder = file("$project.buildDir/outputs") + +task cppSourcesZip(type: Zip) { + destinationDir = outputsFolder + baseName = 'halsim-print' + classifier = "sources" + + from(licenseFile) { + into '/' + } + + from('src/main/native/cpp') { + into '/' + } +} + +task cppHeadersZip(type: Zip) { + destinationDir = outputsFolder + baseName = 'halsim-print' + classifier = "headers" + + from(licenseFile) { + into '/' + } + + from('src/main/native/include') { + into '/' + } +} + model { publishing { - def libSpec - $.components.each { - if (it in NativeLibrarySpec) { - $.binaries.each { - if (it in SharedLibraryBinarySpec) { - libSpec = it.sharedLibraryFile + def pluginTaskList = createComponentZipTasks($.components, 'halsim_print', 'zipcpp', Zip, project, { task, value-> + value.each { binary-> + if (binary.buildable) { + if (binary instanceof SharedLibraryBinarySpec) { + task.dependsOn binary.buildTask + task.from (binary.sharedLibraryFile) { + into getPlatformPath(binary) + '/shared' + } } } } + }) + + def allTask + if (!project.hasProperty('jenkinsBuild')) { + allTask = createAllCombined(pluginTaskList, 'halsim_print', 'zipcpp', Zip, project) } publications { cpp(MavenPublication) { - artifact libSpec + pluginTaskList.each { + artifact it + } + + if (!project.hasProperty('jenkinsBuild')) { + artifact allTask + } + + artifact cppHeadersZip + artifact cppSourcesZip + + artifactId = baseArtifactId groupId artifactGroupId version pubVersion diff --git a/simulation/halsim_print/src/halsim_print/cpp/PrintPWM.cpp b/simulation/halsim_print/src/main/native/cpp/PrintPWM.cpp similarity index 100% rename from simulation/halsim_print/src/halsim_print/cpp/PrintPWM.cpp rename to simulation/halsim_print/src/main/native/cpp/PrintPWM.cpp diff --git a/simulation/halsim_print/src/halsim_print/cpp/main.cpp b/simulation/halsim_print/src/main/native/cpp/main.cpp similarity index 100% rename from simulation/halsim_print/src/halsim_print/cpp/main.cpp rename to simulation/halsim_print/src/main/native/cpp/main.cpp diff --git a/simulation/halsim_print/src/halsim_print/headers/HALSimPrint.h b/simulation/halsim_print/src/main/native/include/HALSimPrint.h similarity index 100% rename from simulation/halsim_print/src/halsim_print/headers/HALSimPrint.h rename to simulation/halsim_print/src/main/native/include/HALSimPrint.h diff --git a/simulation/halsim_print/src/halsim_print/headers/PrintPWM.h b/simulation/halsim_print/src/main/native/include/PrintPWM.h similarity index 100% rename from simulation/halsim_print/src/halsim_print/headers/PrintPWM.h rename to simulation/halsim_print/src/main/native/include/PrintPWM.h