Skip to content

Commit

Permalink
Merge pull request #156 from BrenekH/release-2024.1.1
Browse files Browse the repository at this point in the history
Release 2024.1.1
  • Loading branch information
BrenekH authored Jan 4, 2024
2 parents eb783d6 + fb9a444 commit e082f8e
Show file tree
Hide file tree
Showing 21 changed files with 654 additions and 515 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Kotlin for FRC Changelog

## [2024.1.1](https://github.com/BrenekH/kotlin-for-frc/releases/2024.1.1)

**Enhancements:**

- Update templates for 2024
- Add Command Based Skeleton template and remove Robot Base template
- Report projects as Kotlin instead of Java ([#151](https://github.com/BrenekH/kotlin-for-frc/issues/151))

## [2023.5.1](https://github.com/BrenekH/kotlin-for-frc/releases/2023.5.1)

**Fixed Bugs:**
Expand Down
8 changes: 5 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Kotlin for FRC Changelog

## [2023.5.1](https://github.com/BrenekH/kotlin-for-frc/releases/2023.5.1)
## [2024.1.1](https://github.com/BrenekH/kotlin-for-frc/releases/2024.1.1)

**Fixed Bugs:**
**Enhancements:**

- Fix simulate command on Windows ([#145](https://github.com/BrenekH/kotlin-for-frc/issues/145)
- Update templates for 2024
- Add Command Based Skeleton template and remove Robot Base template
- Report projects as Kotlin instead of Java ([#151](https://github.com/BrenekH/kotlin-for-frc/issues/151))
718 changes: 341 additions & 377 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "kotlin-for-frc",
"displayName": "Kotlin for FRC",
"description": "Kotlin support for WPILib, unofficially",
"version": "2023.5.1",
"version": "2024.1.1",
"publisher": "Brenek",
"engines": {
"vscode": "^1.66.0"
Expand Down Expand Up @@ -143,27 +143,29 @@
"@types/glob": "^8.1.0",
"@types/mocha": "^10.0.4",
"@types/node": "^16.11.7",
"@types/semver": "^7.5.5",
"@types/vscode": "1.66.0",
"@types/semver": "^7.3.10",
"@types/vscode": "1.56.0",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@vscode/test-electron": "^2.3.6",
"acorn": "^7.4.1",
"cross-spawn": "^7.0.3",
"eslint": "^8.53.0",
"glob": "^10.3.10",
"mocha": "^10.2.0",
"ts-loader": "^9.5.0",
"typescript": "^5.2.0",
"@vscode/test-electron": "^2.3.6",
"typescript": "^5.3.3",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"axios": "^1.6.1",
"semver": "^7.5.4"
"axios": "^1.6.3",
"semver": "^7.3.7"
},
"extensionDependencies": [],
"repository": {
"type": "git",
"url": "https://github.com/BrenekH/kotlin-for-frc.git"
},
"license": "MIT"
}
}
10 changes: 5 additions & 5 deletions src/commands/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ITemplateProvider } from "../template/models"
import { showChangelog } from "../util/changelog"
import updateGradleRioVersion from "../util/gradleRioUpdate"
import { getJavaHomeGradleArg, } from "../util/util"
import { writeCommandTemplate, writeRobotBaseSkeleton, writeRomiCommand, writeRomiTimed, writeTimed, writeTimedSkeleton } from "./conversion"
import { writeCommandBased, writeRomiCommandBased, writeRomiTimed, writeTimed, writeTimedSkeleton, writeCommandBasedSkeleton } from "./conversion"
import { RobotType } from "./models"
import { createFileWithContent, determineRobotType, parseTemplate } from "./util"
import { TemplateType } from "../template/models"
Expand Down Expand Up @@ -80,13 +80,13 @@ export async function registerCommands(context: vscode.ExtensionContext, templat
// Add new files with parsed template contents
switch (projectRobotType) {
case RobotType.command:
writeCommandTemplate(workspaceDir, templateProvider)
writeCommandBased(workspaceDir, templateProvider)
break
case RobotType.robotBaseSkeleton:
writeRobotBaseSkeleton(workspaceDir, templateProvider)
case RobotType.commandSkeleton:
writeCommandBasedSkeleton(workspaceDir, templateProvider)
break
case RobotType.romiCommand:
writeRomiCommand(workspaceDir, templateProvider)
writeRomiCommandBased(workspaceDir, templateProvider)
break
case RobotType.romiTimed:
writeRomiTimed(workspaceDir, templateProvider)
Expand Down
14 changes: 9 additions & 5 deletions src/commands/conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createFileWithContent, parseTemplate } from "./util";
* @param workspaceDir The workspace folder to create the new project in
* @param templateProvider The provider to pull templates from
*/
export async function writeCommandTemplate(workspaceDir: vscode.WorkspaceFolder, templateProvider: ITemplateProvider) {
export async function writeCommandBased(workspaceDir: vscode.WorkspaceFolder, templateProvider: ITemplateProvider) {
await vscode.workspace.fs.createDirectory(vscode.Uri.joinPath(workspaceDir.uri, "src", "main", "kotlin", "frc", "robot", "commands"))
await vscode.workspace.fs.createDirectory(vscode.Uri.joinPath(workspaceDir.uri, "src", "main", "kotlin", "frc", "robot", "subsystems"))

Expand Down Expand Up @@ -48,12 +48,12 @@ export async function writeCommandTemplate(workspaceDir: vscode.WorkspaceFolder,
}

/**
* writeRobotBaseSkeleton creates the necessary directories and files for a Robot Base Skeleton Kotlin project.
* writeCommandBasedSkeleton creates the necessary directories and files for a Command-based skeleton Kotlin project.
*
* @param workspaceDir The workspace folder to create the new project in
* @param templateProvider The provider to pull templates from
*/
export async function writeRobotBaseSkeleton(workspaceDir: vscode.WorkspaceFolder, templateProvider: ITemplateProvider) {
export async function writeCommandBasedSkeleton(workspaceDir: vscode.WorkspaceFolder, templateProvider: ITemplateProvider) {
await vscode.workspace.fs.createDirectory(vscode.Uri.joinPath(workspaceDir.uri, "src", "main", "kotlin", "frc", "robot"))

const buildGradle = await templateProvider.getTemplate(TemplateType.buildGradle, workspaceDir.uri) as string
Expand All @@ -62,12 +62,16 @@ export async function writeRobotBaseSkeleton(workspaceDir: vscode.WorkspaceFolde
const main = await templateProvider.getTemplate(TemplateType.main, workspaceDir.uri) as string
nullTemplateCheck(main)

const robot = await templateProvider.getTemplate(TemplateType.robotBaseRobot, workspaceDir.uri) as string
const robot = await templateProvider.getTemplate(TemplateType.commandSkeletonRobot, workspaceDir.uri) as string
nullTemplateCheck(robot)

const robotContainer = await templateProvider.getTemplate(TemplateType.commandSkeletonRobotContainer, workspaceDir.uri) as string
nullTemplateCheck(robotContainer)

createFileWithContent(vscode.Uri.joinPath(workspaceDir.uri, "build.gradle"), parseTemplate(buildGradle, "", "", TARGET_GRADLE_RIO_VER))
createFileWithContent(vscode.Uri.joinPath(workspaceDir.uri, "src", "main", "kotlin", "frc", "robot", "Main.kt"), parseTemplate(main, "Main", "frc.robot", TARGET_GRADLE_RIO_VER))
createFileWithContent(vscode.Uri.joinPath(workspaceDir.uri, "src", "main", "kotlin", "frc", "robot", "Robot.kt"), parseTemplate(robot, "Robot", "frc.robot", TARGET_GRADLE_RIO_VER))
createFileWithContent(vscode.Uri.joinPath(workspaceDir.uri, "src", "main", "kotlin", "frc", "robot", "RobotContainer.kt"), parseTemplate(robotContainer, "RobotContainer", "frc.robot", TARGET_GRADLE_RIO_VER))
}

/**
Expand All @@ -76,7 +80,7 @@ export async function writeRobotBaseSkeleton(workspaceDir: vscode.WorkspaceFolde
* @param workspaceDir The workspace folder to create the new project in
* @param templateProvider The provider to pull templates from
*/
export async function writeRomiCommand(workspaceDir: vscode.WorkspaceFolder, templateProvider: ITemplateProvider) {
export async function writeRomiCommandBased(workspaceDir: vscode.WorkspaceFolder, templateProvider: ITemplateProvider) {
await vscode.workspace.fs.createDirectory(vscode.Uri.joinPath(workspaceDir.uri, "src", "main", "kotlin", "frc", "robot", "commands"))
await vscode.workspace.fs.createDirectory(vscode.Uri.joinPath(workspaceDir.uri, "src", "main", "kotlin", "frc", "robot", "subsystems"))

Expand Down
2 changes: 1 addition & 1 deletion src/commands/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
export enum RobotType {
command = "command",
robotBaseSkeleton = "robot_base_skeleton",
commandSkeleton = "command_skeleton",
romiCommand = "romi_command",
romiTimed = "romi_timed",
timed = "timed",
Expand Down
9 changes: 5 additions & 4 deletions src/commands/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as vscode from "vscode"
import { RobotType } from "./models"
import {
CMD_ROBOT_SEARCH_TERM, TIMED_ROBOT_USED_SEARCH_TERM, TIMED_ROBOT_SEARCH_TERM,
ROBOT_BASE_SKELE_SEARCH_TERM, ROMI_CMD_VARIANT_SEARCH_TERM, ROMI_TIMED_VARIANT_SEARCH_TERM
ROMI_CMD_VARIANT_SEARCH_TERM, ROMI_TIMED_VARIANT_SEARCH_TERM, CMD_ROBOT_NON_SKELE_SEARCH_TERM
} from "../constants"

/**
Expand All @@ -19,9 +19,12 @@ export function determineRobotType(robotJava: string, buildGradle: string): Robo
if (buildGradle.includes(ROMI_CMD_VARIANT_SEARCH_TERM)) {
currentRobotType = RobotType.romiCommand
}
else {
else if (robotJava.includes(CMD_ROBOT_NON_SKELE_SEARCH_TERM)) {
currentRobotType = RobotType.command
}
else {
currentRobotType = RobotType.commandSkeleton
}
} else if (robotJava.includes(TIMED_ROBOT_USED_SEARCH_TERM)) {
if (robotJava.includes(ROMI_TIMED_VARIANT_SEARCH_TERM)) {
currentRobotType = RobotType.romiTimed
Expand All @@ -32,8 +35,6 @@ export function determineRobotType(robotJava: string, buildGradle: string): Robo
else {
currentRobotType = RobotType.timedSkeleton
}
} else if (robotJava.includes(ROBOT_BASE_SKELE_SEARCH_TERM)) {
currentRobotType = RobotType.robotBaseSkeleton
}

return currentRobotType
Expand Down
6 changes: 3 additions & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export const SIMULATE_CODE_TASK_NAME = "Simulate FRC Code"
export const TARGET_GRADLE_RIO_YEAR = "2023"
export const TARGET_GRADLE_RIO_VER = "2023.1.1"
export const TARGET_GRADLE_RIO_YEAR = "2024"
export const TARGET_GRADLE_RIO_VER = "2024.1.1"

export const ROMI_CMD_VARIANT_SEARCH_TERM = `wpi.sim.envVar("HALSIMWS_HOST"`
export const ROMI_TIMED_VARIANT_SEARCH_TERM = "new RomiDrivetrain()"
export const CMD_ROBOT_SEARCH_TERM = "edu.wpi.first.wpilibj2.command.Command"
export const CMD_ROBOT_NON_SKELE_SEARCH_TERM = "The VM is configured"
export const TIMED_ROBOT_USED_SEARCH_TERM = "edu.wpi.first.wpilibj.TimedRobot"
export const TIMED_ROBOT_SEARCH_TERM = "edu.wpi.first.wpilibj.smartdashboard.SendableChooser"
export const ROBOT_BASE_SKELE_SEARCH_TERM = "edu.wpi.first.hal.HAL"
9 changes: 9 additions & 0 deletions src/template/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export enum TemplateType {
PIDSubsystem = "PID Subsystem",
profiledPIDSubsystem = "Profiled PID Subsystem",
trapezoidProfileSubsystem = "Trapezoid Profile Subsystem",
// Skeleton
commandSkeletonRobot = "Command Based Skeleton Robot",
commandSkeletonRobotContainer = "Command Based Skeleton Robot Container",


// Romi
romiTimedRobot = "Romi Timed Robot",
Expand Down Expand Up @@ -107,6 +111,11 @@ export function parseStringToTemplateType(input: string): TemplateType {
return TemplateType.profiledPIDSubsystem
case "trapezoidProfileSubsystem":
return TemplateType.trapezoidProfileSubsystem
// Skeleton
case "commandSkeletonRobot":
return TemplateType.commandSkeletonRobot
case "commandSkeletonRobotContainer":
return TemplateType.commandSkeletonRobotContainer

// Misc
case "buildGradle":
Expand Down
5 changes: 5 additions & 0 deletions src/template/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ function templateTypeToString(t: TemplateType): string {
return "profiledPIDSubsystem"
case TemplateType.trapezoidProfileSubsystem:
return "trapezoidProfileSubsystem"
// Skeleton
case TemplateType.commandSkeletonRobot:
return "commandSkeletonRobot"
case TemplateType.commandSkeletonRobotContainer:
return "commandSkeletonRobotContainer"

// Romi
case TemplateType.romiBuildGradle:
Expand Down
Loading

0 comments on commit e082f8e

Please sign in to comment.