Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion vscode-wpilib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Features

This extension provides the WPILib support for FRC teams in VS Code. For documentation on how to program FRC robots using the WPILib libraries, see the [WPILib documentation website](https://docs.wpilib.org/en/stable/).
This extension provides the WPILib support for FIRST teams in VS Code. For documentation on how to program FIRST robots using the WPILib libraries, see the [WPILib documentation website](https://docs.wpilib.org/en/stable/).

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion vscode-wpilib/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"wpilibcore.importGradle2025Project.title": "Import a WPILib 2025 Gradle project",
"wpilibcore.createNewProject.title": "Create a new project",
"wpilibcore.manageVendorLibs.title": "Manage Vendor Libraries",
"wpilibcore.setJavaHome.title": "Set VS Code Java Home to FRC Home",
"wpilibcore.setJavaHome.title": "Set VS Code Java Home to WPILib Home",
"wpilibcore.checkForUpdates.title": "Check for WPILib Updates",
"wpilibcore.installGradleTools.title": "Install tools from GradleRIO",
"wpilibcore.showLogFolder.title": "Show Log Folder",
Expand Down
19 changes: 11 additions & 8 deletions vscode-wpilib/resources/gradle/c/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ deploy {
// or from command line. If not found an exception will be thrown.
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
// want to store a team number in this file.
team = project.frc.getTeamNumber()
debug = project.frc.getDebugOrDefault(false)
team = project.first.getTeamNumber()
// Use the default systemcore host name. This must be called after setting team
// as happens on the line above
useDefaultSystemcoreHostName()
debug = project.first.getDebugOrDefault(false)

artifacts {
// First part is artifact name, 2nd is artifact type
// getTargetTypeClass is a shortcut to get the class type using a string

frcCpp(getArtifactTypeClass('FRCNativeArtifact')) {
firstCpp(getArtifactTypeClass('FIRSTNativeArtifact')) {
}

// Static files artifact
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
firstStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
files = project.fileTree('src/main/deploy')
directory = '/home/systemcore/deploy'
deleteOldFiles = false // Change to true to delete files on SystemCore that no
Expand All @@ -36,7 +39,7 @@ deploy {
}
}

def deployArtifact = deploy.targets.systemcore.artifacts.frcCpp
def deployArtifact = deploy.targets.systemcore.artifacts.firstCpp

// Set this to true to enable desktop support.
def includeDesktopSupport = false
Expand All @@ -51,7 +54,7 @@ wpi.sim.addDriverstation()

model {
components {
frcUserProgram(NativeExecutableSpec) {
firstUserProgram(NativeExecutableSpec) {
targetPlatform wpi.platforms.systemcore
if (includeDesktopSupport) {
targetPlatform wpi.platforms.desktop
Expand Down Expand Up @@ -91,8 +94,8 @@ model {
}
}
testSuites {
frcUserProgramTest(GoogleTestTestSuiteSpec) {
testing $.components.frcUserProgram
firstUserProgramTest(GoogleTestTestSuiteSpec) {
testing $.components.firstUserProgram

sources.cpp {
source {
Expand Down
19 changes: 11 additions & 8 deletions vscode-wpilib/resources/gradle/cpp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@ deploy {
// or from command line. If not found an exception will be thrown.
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
// want to store a team number in this file.
team = project.frc.getTeamNumber()
debug = project.frc.getDebugOrDefault(false)
team = project.first.getTeamNumber()
// Use the default systemcore host name. This must be called after setting team
// as happens on the line above
useDefaultSystemcoreHostName()
debug = project.first.getDebugOrDefault(false)

artifacts {
// First part is artifact name, 2nd is artifact type
// getTargetTypeClass is a shortcut to get the class type using a string

frcCpp(getArtifactTypeClass('FRCNativeArtifact')) {
firstCpp(getArtifactTypeClass('FIRSTNativeArtifact')) {
}

// Static files artifact
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
firstStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
files = project.fileTree('src/main/deploy')
directory = '/home/systemcore/deploy'
deleteOldFiles = false // Change to true to delete files on SystemCore that no
Expand All @@ -35,7 +38,7 @@ deploy {
}
}

def deployArtifact = deploy.targets.systemcore.artifacts.frcCpp
def deployArtifact = deploy.targets.systemcore.artifacts.firstCpp

// Set this to true to enable desktop support.
def includeDesktopSupport = false
Expand All @@ -50,7 +53,7 @@ wpi.sim.addDriverstation()

model {
components {
frcUserProgram(NativeExecutableSpec) {
firstUserProgram(NativeExecutableSpec) {
targetPlatform wpi.platforms.systemcore
if (includeDesktopSupport) {
targetPlatform wpi.platforms.desktop
Expand Down Expand Up @@ -80,8 +83,8 @@ model {
}
}
testSuites {
frcUserProgramTest(GoogleTestTestSuiteSpec) {
testing $.components.frcUserProgram
firstUserProgramTest(GoogleTestTestSuiteSpec) {
testing $.components.firstUserProgram

sources.cpp {
source {
Expand Down
6 changes: 3 additions & 3 deletions vscode-wpilib/resources/gradle/cppromi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ wpi.sim.addWebsocketsClient().defaultEnabled = true

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

sources.cpp {
Expand All @@ -38,8 +38,8 @@ model {
}
}
testSuites {
frcUserProgramTest(GoogleTestTestSuiteSpec) {
testing $.components.frcUserProgram
firstUserProgramTest(GoogleTestTestSuiteSpec) {
testing $.components.firstUserProgram

sources.cpp {
source {
Expand Down
6 changes: 3 additions & 3 deletions vscode-wpilib/resources/gradle/cppxrp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ wpi.sim.addXRPClient().defaultEnabled = true

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

sources.cpp {
Expand All @@ -37,8 +37,8 @@ model {
}
}
testSuites {
frcUserProgramTest(GoogleTestTestSuiteSpec) {
testing $.components.frcUserProgram
firstUserProgramTest(GoogleTestTestSuiteSpec) {
testing $.components.firstUserProgram

sources.cpp {
source {
Expand Down
13 changes: 8 additions & 5 deletions vscode-wpilib/resources/gradle/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@ deploy {
// or from command line. If not found an exception will be thrown.
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
// want to store a team number in this file.
team = project.frc.getTeamNumber()
debug = project.frc.getDebugOrDefault(false)
team = project.first.getTeamNumber()
// Use the default systemcore host name. This must be called after setting team
// as happens on the line above
useDefaultSystemcoreHostName()
debug = project.first.getDebugOrDefault(false)

artifacts {
// First part is artifact name, 2nd is artifact type
// getTargetTypeClass is a shortcut to get the class type using a string

frcJava(getArtifactTypeClass('FRCJavaArtifact')) {
firstJava(getArtifactTypeClass('FIRSTJavaArtifact')) {
}

// Static files artifact
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
firstStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
files = project.fileTree('src/main/deploy')
directory = '/home/systemcore/deploy'
deleteOldFiles = false // Change to true to delete files on systemcore that no
Expand All @@ -41,7 +44,7 @@ deploy {
}
}

def deployArtifact = deploy.targets.systemcore.artifacts.frcJava
def deployArtifact = deploy.targets.systemcore.artifacts.firstJava

// Set to true to use debug for all targets including JNI, which will drastically impact
// performance.
Expand Down
14 changes: 7 additions & 7 deletions vscode-wpilib/resources/gradle/shared/settings.gradle
Comment thread
sciencewhiz marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
String frcYear = '2027_alpha4'
File frcHome
String firstYear = '2027_alpha4'
File wpilibHome
if (OperatingSystem.current().isWindows()) {
String publicFolder = System.getenv('PUBLIC')
if (publicFolder == null) {
publicFolder = "C:\\Users\\Public"
}
def homeRoot = new File(publicFolder, "wpilib")
frcHome = new File(homeRoot, frcYear)
wpilibHome = new File(homeRoot, firstYear)
} else {
def userFolder = System.getProperty("user.home")
def homeRoot = new File(userFolder, "wpilib")
frcHome = new File(homeRoot, frcYear)
wpilibHome = new File(homeRoot, firstYear)
}
def frcHomeMaven = new File(frcHome, 'maven')
def wpilibHomeMaven = new File(wpilibHome, 'maven')
maven {
name = 'frcHome'
url = frcHomeMaven
name = 'wpilibHome'
url = wpilibHomeMaven
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion vscode-wpilib/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export interface IPreferencesAPI {
}

export interface IUtilitiesAPI {
getFrcYear(): string;
getWPILibYear(): string;
getWPILibHomeDir(): string;
}

Expand Down
4 changes: 2 additions & 2 deletions vscode-wpilib/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,9 @@ export async function activate(context: vscode.ExtensionContext) {
// That file can be copied to another project.
const externalApi = await ExternalAPI.Create(extensionResourceLocation);

const frcHomeDir = externalApi.getUtilitiesAPI().getWPILibHomeDir();
const wpilibHomeDir = externalApi.getUtilitiesAPI().getWPILibHomeDir();

const logPath = path.join(frcHomeDir, 'logs');
const logPath = path.join(wpilibHomeDir, 'logs');
try {
await mkdir(logPath, { recursive: true });
setLoggerDirectory(logPath);
Expand Down
10 changes: 5 additions & 5 deletions vscode-wpilib/src/jdkdetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export async function findJdkPath(api: IExternalAPI): Promise<string | undefined
if (await checkJavaPath(vscodeOldJavaHome, 'java.home')) {
return vscodeOldJavaHome;
}
// Then check the FRC home directory for the FRC jdk
const frcHome = api.getUtilitiesAPI().getWPILibHomeDir();
const frcHomeJava = path.join(frcHome, 'jdk');
if (await checkJavaPath(frcHomeJava, 'FRC Home JDK')) {
return frcHomeJava;
// Then check the WPILib home directory for the WPILib jdk
const wpilibHome = api.getUtilitiesAPI().getWPILibHomeDir();
const wpilibHomeJava = path.join(wpilibHome, 'jdk');
if (await checkJavaPath(wpilibHomeJava, 'WPILib Home JDK')) {
return wpilibHomeJava;
}
// Check for java home
const javaHome = process.env.JAVA_HOME;
Expand Down
4 changes: 2 additions & 2 deletions vscode-wpilib/src/shared/utilitiesapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { getIsWindows } from '../utilities';
export class UtilitiesAPI implements IUtilitiesAPI {
private wpilibHome: string | undefined;

public getFrcYear(): string {
public getWPILibYear(): string {
return '2027_alpha4';
}
public getWPILibHomeDir(): string {
if (this.wpilibHome) {
return this.wpilibHome;
}
const year = this.getFrcYear();
const year = this.getWPILibYear();
if (getIsWindows()) {
let publicFolder = process.env.PUBLIC;
if (!publicFolder) {
Expand Down
8 changes: 4 additions & 4 deletions vscode-wpilib/src/wpilibupdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ export class WPILibUpdates {
return undefined;
}
let newestVersion = '0';
const frcYear = this.externalApi.getUtilitiesAPI().getFrcYear();
const wpilibYear = this.externalApi.getUtilitiesAPI().getWPILibYear();
for (const v of versions) {
if (v.startsWith(frcYear) && isNewerVersion(v, newestVersion)) {
if (v.startsWith(wpilibYear) && isNewerVersion(v, newestVersion)) {
newestVersion = v;
}
}
Expand All @@ -264,8 +264,8 @@ export class WPILibUpdates {
}

private async checkForLocalGradleRIOUpdate(currentVersion: string): Promise<string | undefined> {
const frcHome = this.externalApi.getUtilitiesAPI().getWPILibHomeDir();
const gradleRioPath = path.join(frcHome, 'maven', 'edu', 'wpi', 'first', 'GradleRIO');
const wpilibHome = this.externalApi.getUtilitiesAPI().getWPILibHomeDir();
const gradleRioPath = path.join(wpilibHome, 'maven', 'edu', 'wpi', 'first', 'GradleRIO');
try {
const files = await readdir(gradleRioPath);
const versions = [];
Expand Down