From: will-v-pi <108662275+will-v-pi@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:37:58 +0000 (+0100) Subject: Merge branch 'main' into main X-Git-Url: https://repo.jachan.dev/pico-vscode.git/commitdiff_plain/HEAD?hp=-c Merge branch 'main' into main --- 3ab15ce6870e2a6fd09bd1867f0f3b75f7c16ac7 diff --combined scripts/pico_project.py index d8713ec,fb96f65..cb120a6 --- a/scripts/pico_project.py +++ b/scripts/pico_project.py @@@ -577,10 -577,7 +577,10 @@@ def GenerateCMake(folder, params) f"set(sdkVersion {params['sdkVersion']})\n" f"set(toolchainVersion {params['toolchainVersion']})\n" f"set(picotoolVersion {params['picotoolVersion']})\n" - f"include({cmakeIncPath()})\n" + f"set(picoVscode {cmakeIncPath()})\n" + "if (EXISTS ${picoVscode})\n" + " include(${picoVscode})\n" + "endif()\n" "# ====================================================================================\n" ) @@@ -822,7 -819,7 +822,7 @@@ def generateProjectFiles(projectPath, p "gdbTarget": "localhost:3333", "gdbPath": "${{command:raspberry-pi-pico.getGDBPath}}", "device": "${{command:raspberry-pi-pico.getChipUppercase}}", - "svdFile": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChipUppercase}}.svd" + "svdFile": "{codeSdkPath(sdkVersion)}/src/${{command:raspberry-pi-pico.getChip}}/hardware_regs/${{command:raspberry-pi-pico.getChipUppercase}}.svd", "runToEntryPoint": "main", // Give restart the same functionality as runToEntryPoint - main "postRestartCommands": [ diff --combined src/utils/cmakeUtil.mts index 0062f5e,a1e4e88..4a4c7fb --- a/src/utils/cmakeUtil.mts +++ b/src/utils/cmakeUtil.mts @@@ -11,10 -11,12 +11,12 @@@ import { rimraf, windows as rimrafWindo import { homedir } from "os"; import which from "which"; import { compareLtMajor } from "./semverUtil.mjs"; - import { picotoolVersion } from "../webview/newProjectPanel.mjs"; - import { CMAKE_DO_NOT_EDIT_HEADER_PREFIX } from "../extension.mjs"; import { buildCMakeIncPath } from "./download.mjs"; + export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX = + // eslint-disable-next-line max-len + "== DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work =="; + export async function getPythonPath(): Promise { const settings = Settings.getInstance(); if (settings === undefined) { @@@ -304,6 -306,7 +306,7 @@@ export async function cmakeUpdateSDK folder: Uri, newSDKVersion: string, newToolchainVersion: string, + newPicotoolVersion: string, reconfigure: boolean = true ): Promise { // TODO: support for scaning for seperate locations of the CMakeLists.txt file in the project @@@ -337,11 -340,8 +340,11 @@@ "endif()\n" + `set(sdkVersion ${newSDKVersion})\n` + `set(toolchainVersion ${newToolchainVersion})\n` + - `set(picotoolVersion ${picotoolVersion})\n` + + `set(picotoolVersion ${newPicotoolVersion})\n` + - `include(${buildCMakeIncPath(false)}/pico-vscode.cmake)\n` + + `set(picoVscode ${buildCMakeIncPath(false)}/pico-vscode.cmake)\n` + + "if (EXISTS ${picoVscode})\n" + + " include(${picoVscode})\n" + + "endif()\n" + // eslint-disable-next-line max-len "# ====================================================================================" ); @@@ -402,7 -402,7 +405,7 @@@ * Extracts the sdk and toolchain versions from the CMakeLists.txt file. * * @param cmakeFilePath The path to the CMakeLists.txt file. - * @returns An tupple with the [sdk, toolchain] versions or null if the file could not + * @returns An tupple with the [sdk, toolchain, picotool] versions or null if the file could not * be read or the versions could not be extracted. */ export async function cmakeGetSelectedToolchainAndSDKVersions( @@@ -440,10 -440,12 +443,12 @@@ } Logger.log("Updating extension lines in CMake file"); - await cmakeUpdateSDK(folder, versionMatch[1], versionMatch2[1]); + await cmakeUpdateSDK( + folder, versionMatch[1], versionMatch2[1], versionMatch[1] + ); Logger.log("Extension lines updated"); - return [versionMatch[1], versionMatch2[1], picotoolVersion]; + return [versionMatch[1], versionMatch2[1], versionMatch[1]]; } else { return null; }