Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vendor library example #278

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions examples/vendor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Created by https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode

### C++ ###
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### Gradle ###
.gradle
/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

# # VS Code Specific Java Settings
.classpath
.project
.settings/
bin/


# End of https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode
6 changes: 6 additions & 0 deletions examples/vendor/.wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"enableCppIntellisense": true,
"currentLanguage": "cpp",
"projectYear": "2019",
"teamNumber": 0
}
6 changes: 6 additions & 0 deletions examples/vendor/azure-init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Azure has a gradle init file that doesn't work in Gradle 5.0, so we have to delete it.
steps:
- task: DeleteFiles@1
inputs:
sourceFolder: '/Users/vsts/.gradle/init.d/'
contents: 'log-gradle-version-plugin.gradle'
26 changes: 26 additions & 0 deletions examples/vendor/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resources:
containers:
- container: wpilib
image: wpilib/roborio-cross-ubuntu:2019-18.04

jobs:
- job: Windows
pool:
vmImage: 'VS2017-Win2016'
steps:
- template: azure-init.yml
- template: azure-steps.yml

- job: macOS
pool:
vmImage: 'macOS-10.13'
steps:
- template: azure-init.yml
- template: azure-steps.yml

- job: Linux
pool:
vmImage: 'Ubuntu-16.04'
container: wpilib
steps:
- template: azure-steps.yml
22 changes: 22 additions & 0 deletions examples/vendor/azure-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
steps:
- task: Gradle@2
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
tasks: 'clean build doxygen javadoc publish'
# WPILib docker image has roborio image, all other platforms need not build it.
options: --stacktrace -Ptoolchain-optional-roboRio

- task: CopyFiles@2
inputs:
sourceFolder: 'build/mvnDistRepo'
contents: '**/*'
targetFolder: $(Build.ArtifactStagingDirectory)/mvnDistRepo

- task: PublishBuildArtifacts@1
inputs:
artifactName: 'maven'
pathtoPublish: $(Build.ArtifactStagingDirectory)/mvnDistRepo
25 changes: 25 additions & 0 deletions examples/vendor/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
plugins {
id 'org.ysb33r.doxygen' version '0.5'
id 'maven-publish'
id "edu.wpi.first.GradleRIO" version "2019.1.1-beta-4c"
}

ext.uuid = 'YOUR_UUID_HERE'
ext.mavenUrl = 'YOUR_MAVEN_SERVER_HERE'
ext.jsonUrl = 'YOUR_VENDORDEPS_JSON_URL_HERE'

group = 'my.vendor'
ext.vendorLibraryName = 'MyVendorLibrary'
version = '2019.1.1'

ext.libraryJavaName = "${ext.vendorLibraryName}-Java"
ext.libraryCppName = "${ext.vendorLibraryName}-cpp"

apply from: 'publishingtools.gradle'
apply from: 'cpp.gradle'
apply from: 'java.gradle'
apply from: 'vendordeps.gradle'

wrapper {
gradleVersion = 5.0
}
88 changes: 88 additions & 0 deletions examples/vendor/cpp.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apply plugin: 'cpp'
apply plugin: 'google-test-test-suite'

model {
components {
"${vendorLibraryName}"(NativeLibrarySpec) {
targetPlatform wpi.platforms.roborio
targetPlatform wpi.platforms.desktop

binaries.all {
sources {
cpp(CppSourceSet) {
def target = targetPlatform.name == wpi.platforms.roborio ? 'robot' : 'simulation'
source {
srcDir 'src/main/cpp_common'
srcDir "src/main/cpp_${target}"
include '**/*.cpp'
}
exportedHeaders {
srcDir 'src/main/include' // Only src/main/include is included in the final maven package.
srcDir "src/main/cpp_${target}"
include '**/*.h', '**/*.hpp', '**/*.inc'
}
}
}
}

useLibrary(it, "wpilib")
}
}
testSuites {
"${vendorLibraryName}Test"(GoogleTestTestSuiteSpec) {
testing $.components.get(vendorLibraryName)

sources.cpp {
source {
srcDir 'src/test/cpp'
include '**/*.cpp'
}
}

useLibrary(it, "wpilib", "googletest")
}
}
}

doxygen {
executables {
doxygen version : '1.8.13'
}

generate_html true
javadoc_autobrief true
source project.file('src/main/include')
}

// Maven Publishing

task zipHeaders(type: Zip) {
from fileTree('src/main/include')

classifier = 'headers'
}

task zipDoxygen(type: Zip) {
from doxygen

classifier = 'doxygen'
}

publishing {
publications {
"${libraryCppName}"(MavenPublication) {
artifactId libraryCppName

artifact zipHeaders {
classifier 'headers'
}

artifact zipDoxygen {
classifier 'doxygen'
}

binaryArtifacts(it, vendorLibraryName)
}
}
}

Binary file added examples/vendor/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions examples/vendor/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=permwrapper/dists
Loading