Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
Grabs Example Vendordep from WPILIB
  • Loading branch information
Modular-Holmes committed May 7, 2024
0 parents commit a36ece8
Show file tree
Hide file tree
Showing 23 changed files with 1,385 additions and 0 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI

on: [push, pull_request]

jobs:
build-docker:
strategy:
fail-fast: false
matrix:
include:
- container: wpilib/roborio-cross-ubuntu:2024-22.04
artifact-name: Athena
build-options: "-Ponlylinuxathena"
# - container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
# artifact-name: Arm32
# build-options: "-Ponlylinuxarm32"
# - container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
# artifact-name: Arm64
# build-options: "-Ponlylinuxarm64"
- container: wpilib/ubuntu-base:22.04
artifact-name: Linux
build-options: ""
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ubuntu-latest
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Fetch all history and metadata
run: |
git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
- name: Build with Gradle
run: ./gradlew build --max-workers 1 ${{ matrix.build-options }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs

build-host:
env:
MACOSX_DEPLOYMENT_TARGET: 12
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
artifact-name: Win64
architecture: x64
- os: macos-12
artifact-name: macOS
architecture: x64
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Fetch all history and metadata
run: git fetch --prune --unshallow
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
architecture: ${{ matrix.architecture }}
- name: Build with Gradle
run: ./gradlew build -Pbuildalldesktop
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs

combine:
name: Combine
needs: [build-docker, build-host]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: wpilibsuite/build-tools
- uses: actions/download-artifact@v3
with:
path: combiner/products/build/allOutputs
- name: Flatten Artifacts
run: rsync -a --delete combiner/products/build/allOutputs/*/* combiner/products/build/allOutputs/
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Combine
# if: |
# !startsWith(github.ref, 'refs/tags/v')
run: ./gradlew publish -Pthirdparty
working-directory: combiner
# - name: Combine (Release)
# if: |
# github.repository_owner == 'wpilibsuite' &&
# startsWith(github.ref, 'refs/tags/v')
# run: |
# ./gradlew publish -Pthirdparty
# working-directory: combiner
# env:
# RUN_AZURE_ARTIFACTORY_RELEASE: 'TRUE'
# ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
# ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v3
with:
name: Maven
path: ~/releases
160 changes: 160 additions & 0 deletions .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
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"java.configuration.updateBuildConfiguration": "automatic",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"C_Cpp.default.configurationProvider": "vscode-wpilib"
}
6 changes: 6 additions & 0 deletions .wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"enableCppIntellisense": true,
"currentLanguage": "cpp",
"projectYear": "intellisense",
"teamNumber": 9999
}
74 changes: 74 additions & 0 deletions ExampleVendorJson.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"fileName": "ExampleVendorJson.json",
"name": "ExampleVendorDep",
"version": "0.0.1",
"frcYear": "2024",
"uuid": "Generate A Unique GUID https://guidgenerator.com/online-guid-generator.aspx and insert it here", This line is to purposely make this fail to parse
"mavenUrls": [
"ThisNeedsToBeTheRootMavenUrl"
],
"jsonUrl": "InsertSomeUrlHere",
"javaDependencies": [
{
"groupId": "com.vendor.frc",
"artifactId": "Vendor-java",
"version": "0.0.1"
}
],
"jniDependencies": [
{
"groupId": "com.vendor.frc",
"artifactId": "Vendor-driver",
"version": "0.0.1",
"skipInvalidPlatforms": true,
"isJar": false,
"validPlatforms": [
"windowsx86-64",
"windowsx86",
"linuxarm64",
"linuxx86-64",
"linuxathena",
"linuxarm32",
"osxuniversal"
]
}
],
"cppDependencies": [
{
"groupId": "com.vendor.frc",
"artifactId": "Vendor-cpp",
"version": "0.0.1",
"libName": "Vendor",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"windowsx86",
"linuxarm64",
"linuxx86-64",
"linuxathena",
"linuxarm32",
"osxuniversal"
]
},
{
"groupId": "com.vendor.frc",
"artifactId": "Vendor-driver",
"version": "0.0.1",
"libName": "VendorDriver",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"windowsx86",
"linuxarm64",
"linuxx86-64",
"linuxathena",
"linuxarm32",
"osxuniversal"
]
}
]
}
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# WPILib Vendor Template

This is the base WPILib vendor template for 2023.

## Layout

The build is split into 3 libraries. A java library is built. This has access to all of wpilib, and also can JNI load the driver library.

A driver library is built. This should contain all low level code you want to access from both C++, Java and any other text based language. This will not work with LabVIEW. This library has access to the WPILib HAL and wpiutil. This library can only export C symbols. It cannot export C++ symbols at all, and all C symbols must be explicitly listed in the symbols.txt file in the driver folder. JNI symbols must be listed in this file as well. This library however can be written in C++. If you attempt to change this library to have access to all of wpilib, you will break JNI access and it will no longer work.

A native C++ library is built. This has access to all of wpilib, and access to the driver library. This should implment the standard wpilib interfaces.

## Customizing
For Java, the library name will be the folder name the build is started from, so rename the folder to the name of your choosing.

For the native impl, you need to change the library name in the exportsConfigs block of build.gradle, the components block of build.gradle, and the taskList input array name in publish.gradle.

For the driver, change the library name in privateExportsConfigs, the driver name in components, and the driverTaskList input array name. In addition, you'll need to change the `lib library` in the native C++ impl component, and the JNI library name in the JNI java class.

For the maven artifact names, those are all in publish.gradle about 40 lines down.

## Building and editing
This uses gradle, and uses the same base setup as a standard GradleRIO robot project. This means you build with `./gradlew build`, and can install the native toolchain with `./gradlew installRoboRIOToolchain`. If you open this project in VS Code with the wpilib extension installed, you will get intellisense set up for both C++ and Java.

By default, this template builds against the latest WPILib development build. To build against the last WPILib tagged release, build with `./gradlew build -PreleaseMode`.
Loading

0 comments on commit a36ece8

Please sign in to comment.