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 nightly build #174

Open
wants to merge 6 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
55 changes: 55 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Nightly

on:
workflow_dispatch:
schedule:
- cron: '13 12 * * *'

jobs:
nightly:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact-name: Linux
build-options: "-PlinuxBuild"
- os: macos-latest
artifact-name: macOS
build-options: "-PmacBuild"
- os: windows-latest
artifact-name: Win64
build-options: ""

name: "Build - ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-java@v1
with:
java-version: 11

- uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100

- uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Setup Development Artifacts
shell: bash
run: ./automation/nightly_setup.sh

- name: Build Installer
shell: bash
run: ./gradlew generateInstallers -PjenkinsBuild ${{ matrix.build-options }}

- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact-name }}
path: build/pubOutputs/
6 changes: 3 additions & 3 deletions WPILibShortcutCreator/ShortcutData.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"IsAdmin": false,
"DesktopShortcuts": [
{
"Path": "C:\\Users\\Public\\wpilib\\2021\\vscode\\Code.exe",
"Name": "FRC 2021\\FRC VS Code 2021",
"Path": "C:\\Users\\Public\\wpilib\\2022\\vscode\\Code.exe",
"Name": "FRC 2022\\FRC VS Code 2022",
"Description": "Shortcut for FRC VS Code"
}
],
Expand All @@ -15,5 +15,5 @@
"AddToPath": [

],
"IconLocation": "C:\\Users\\Public\\wpilib\\2021\\frccode\\wpilib-256.ico"
"IconLocation": "C:\\Users\\Public\\wpilib\\2022\\frccode\\wpilib-256.ico"
}
78 changes: 78 additions & 0 deletions automation/nightly_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

# This script sets up the nightly build, including building development
# artifacts for GradleRIO and VS Code Extension from their respective main
# branches.

set -e

# Detect the operating system and store OS-specific commands in variables
# to be evaluated later.
NPM_PACKAGE_CMD=""
NPM_PACKAGE_LOC=""
SED_CMD="sed -i"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
NPM_PACKAGE_CMD="npm run packageLinux && tar -C build/wpilibutility-linux-x64 -pcvzf wpilibutility-linux.tar.gz ."
NPM_PACKAGE_LOC="wpilibutility-linux.tar.gz"
elif [[ "$OSTYPE" == "darwin"* ]]; then
NPM_PACKAGE_CMD="npm run packageMac && tar -C build/wpilibutility-darwin-x64 -pcvzf wpilibutility-mac.tar.gz ."
NPM_PACKAGE_LOC="wpilibutility-mac.tar.gz"
SED_CMD="sed -i {}"
else
NPM_PACKAGE_CMD="npm run packageWindows && powershell -Command \"Compress-Archive -Path build\wpilibutility-win32-ia32\* -DestinationPath wpilibutility-windows.zip\""
NPM_PACKAGE_LOC="wpilibutility-windows.zip"
fi

# First, a version number for the nightly is generated.
LATEST_TAG=$(git describe --abbrev=0)
LATEST_TAG_TRIMMED=${LATEST_TAG:1}
DATE=$(date +"%Y%m%d")
VERSION="$LATEST_TAG_TRIMMED-$DATE"

# Next, we will clone the latest versions of GradleRIO and VS Code
# Extension repositories.
function clone() {
if [ ! -d $1 ]; then
git clone "https://github.com/wpilibsuite/$1"
else
cd $1
git reset --hard
git pull
cd ..
fi
}
clone "GradleRIO"
clone "vscode-wpilib"

# Publish a development version of GradleRIO.
cd GradleRIO

# Temporarily use 2020 ni-libraries while 2022 runtime is still not available.
# eval "$SED_CMD \"13s/+/2020.+/\"" versionupdates.gradle

./gradlew updateVersions -PuseDevelopment
./gradlew publishToMavenLocal -x patchExamples -PpublishVersion=$VERSION
cd ..

# Publish a development version of the VS Code Extension.
cd vscode-wpilib
echo "$VERSION" > vscode-wpilib/resources/gradle/version.txt
./gradlew updateVersions updateAllDependencies -PbuildServer -PpublishVersion=$VERSION

cd vscode-wpilib
npm install
npm run gulp
npm run webpack
npm run vscePackage

cd ../wpilib-utility-standalone
npm install
npm run compile
eval "$NPM_PACKAGE_CMD"
cd ../..

# Update the version numbers in the installer and set the VS Code Extension
# and Standalone Utility location.
echo "gradleRioVersion: $VERSION" >gradle.properties
echo "vscodeLoc: vscode-wpilib/vscode-wpilib/vscode-wpilib-$VERSION.vsix" >>gradle.properties
echo "standaloneLoc: vscode-wpilib/wpilib-utility-standalone/$NPM_PACKAGE_LOC" >> gradle.properties
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ buildscript {
plugins {
id 'java'
id 'cpp'
id "de.undercouch.download" version "4.1.1" apply false
id "com.github.johnrengelman.shadow" version "6.0.0" apply false
id "de.undercouch.download" version "4.1.2" apply false
id "com.github.johnrengelman.shadow" version "7.0.0" apply false
}

apply from: "automation/macos_notarization.gradle"
Expand Down Expand Up @@ -71,7 +71,7 @@ if (project.hasProperty('linuxBuild')) {
project.ext.dotnetRuntime = 'win-x64'
}

ext.frcYear = '2021'
ext.frcYear = '2022'

apply from: 'scripts/gradlew.gradle'
apply from: 'scripts/installer.gradle'
Expand Down Expand Up @@ -411,5 +411,5 @@ tasks.register('generateInstallers', Task) {
}

wrapper {
gradleVersion = '6.6.1'
gradleVersion = '7.1.1'
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
gradleRioVersion: 2021.3.1
gradleRioVersion: 2022.0.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
85 changes: 48 additions & 37 deletions gradleriobase/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier
import jaci.gradle.nativedeps.NativeDepsSpec
import com.google.gson.GsonBuilder

buildscript {
Expand All @@ -15,78 +14,90 @@ plugins {
id "edu.wpi.first.GradleRIO"
}

wpi.java.debugJni = false

dependencies {
implementation wpi.deps.wpilib()
nativeZip wpi.deps.wpilibJni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop)
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()

nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio)
nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio)

implementation wpi.deps.vendor.java()
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.roborio)
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.roborio)

simulation wpi.deps.sim.gui(wpi.platforms.desktop, false)
simulation wpi.deps.sim.gui(wpi.platforms.desktop, true)
simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false)
simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, true)
simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false)
simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, true)
simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false)
simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, true)
nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop)
nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop)
simulationDebug wpi.sim.enableDebug()

nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop)
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
simulationRelease wpi.sim.enableRelease()

implementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'

// simulation wpi.deps.sim.gui(wpi.platforms.desktop, false)
// simulation wpi.deps.sim.gui(wpi.platforms.desktop, true)
// simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false)
// simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, true)
// simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false)
// simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, true)
// simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false)
// simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, true)

// commands
implementation "edu.wpi.first.wpilibNewCommands:wpilibNewCommands-java:${wpi.wpilibVersion}"
implementation "edu.wpi.first.wpilibOldCommands:wpilibOldCommands-java:${wpi.wpilibVersion}"
implementation "edu.wpi.first.wpilibNewCommands:wpilibNewCommands-java:${wpi.versions.wpilibVersion.get()}"
implementation "edu.wpi.first.wpilibOldCommands:wpilibOldCommands-java:${wpi.versions.wpilibVersion.get()}"
if (project(":").ext.buildClassifier == 'Windows32') {
implementation "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.wpilibVersion}:x86@zip"
implementation "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.versions.wpilibVersion.get()}:x86@zip"
} else if (project(":").ext.buildClassifier == 'Windows64') {
implementation "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.wpilibVersion}:x64@zip"
implementation "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.versions.wpilibVersion.get()}:x64@zip"
}
}

// TODO add the rest of simulation
wpi.sim.addGui()
wpi.sim.addDriverstation()

model {
components {
frcUserProgram(NativeExecutableSpec) {
targetPlatform wpi.platforms.roborio
targetPlatform wpi.platforms.desktop

// Defining the dependencies.
wpi.deps.wpilib(it)
wpi.deps.googleTest(it)
wpi.cpp.deps.wpilib(it)
wpi.cpp.deps.googleTest(it)

wpi.useLibrary(it, 'wpilib_new_commands_shared')
wpi.useLibrary(it, 'wpilib_old_commands_shared')
wpi.cpp.deps.useLibrary(it, 'wpilib_new_commands_shared')
wpi.cpp.deps.useLibrary(it, 'wpilib_old_commands_shared')
}
frcUserProgramStatic(NativeExecutableSpec) {
targetPlatform wpi.platforms.roborio
targetPlatform wpi.platforms.desktop

// Defining the dependencies.
wpi.deps.wpilibStatic(it)
wpi.deps.googleTest(it)
wpi.cpp.deps.wpilibStatic(it)
wpi.cpp.deps.googleTest(it)
}
}
}

class WPIDepsGrabber implements Plugin<Project> {
void apply(Project project) {
// class WPIDepsGrabber implements Plugin<Project> {
// void apply(Project project) {

}
// }

static class WPIDepGrabberRules extends RuleSource {
// static class WPIDepGrabberRules extends RuleSource {

@Mutate
void triggerDeps(ModelMap<Task> tasks, NativeDepsSpec deps) {
System.out.println('Model triggered')
}
}
}
// @Mutate
// void triggerDeps(ModelMap<Task> tasks, NativeDepsSpec deps) {
// System.out.println('Model triggered')
// }
// }
// }

apply plugin: WPIDepsGrabber
// apply plugin: WPIDepsGrabber

tasks.register('modelEvaluationTrigger') {

Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
Expand Down
4 changes: 2 additions & 2 deletions scripts/jdk.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ configurations {

dependencies {
if (project.ext.buildClassifier == 'Windows32') {
runtimex86 "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.wpilibVersion}:x86@zip"
runtimex86 "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.versions.wpilibVersion}:x86@zip"
} else if (project.ext.buildClassifier == 'Windows64') {
runtimex64 "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.wpilibVersion}:x64@zip"
runtimex64 "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.versions.wpilibVersion}:x64@zip"
}
}

Expand Down
8 changes: 4 additions & 4 deletions scripts/maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ def cppToolsArtifacts = [
]

dependencies {
documentationCpp "edu.wpi.first.wpilibc:documentation:${project(':gradleriobase').wpi.wpilibVersion}@zip"
documentationJava "edu.wpi.first.wpilibj:documentation:${project(':gradleriobase').wpi.wpilibVersion}@zip"
documentationCpp "edu.wpi.first.wpilibc:documentation:${project(':gradleriobase').wpi.versions.wpilibVersion.get()}@zip"
documentationJava "edu.wpi.first.wpilibj:documentation:${project(':gradleriobase').wpi.versions.wpilibVersion.get()}@zip"
if (project.ext.buildClassifier == 'Windows32') {
runtimex86 "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.wpilibVersion}:x86@zip"
runtimex86 "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.versions.wpilibVersion.get()}:x86@zip"
} else if (project.ext.buildClassifier == 'Windows64') {
runtimex64 "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.wpilibVersion}:x64@zip"
runtimex64 "edu.wpi.first.msvc:runtime:${project(':gradleriobase').wpi.versions.wpilibVersion.get()}:x64@zip"
}
}

Expand Down
Loading