***NO_CI***
This commit is contained in:
José Simões 2021-11-25 15:51:38 +00:00 коммит произвёл GitHub
Родитель 822b4f9c31
Коммит 613953e48e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 30 добавлений и 30 удалений

Просмотреть файл

@ -13,19 +13,19 @@ export class Dotnet {
/**
* Builds the nanoFramework solution in a Terminal using MSBuild.exe (win32) or msbuild from mono (linux/macOS)
* @param fileUri absolute path to *.sln
* @param nanoFrameworkExtensionPath absolute path to root of nanoFramework extension
* @param toolPath absolute path to root of nanoFramework extension
*/
public static build(fileUri: string, nanoFrameworkExtensionPath: String) {
public static build(fileUri: string, toolPath: String) {
if (fileUri) {
// using dynamicly-solved MSBuild.exe when ran from win32
if(os.platform() === "win32") {
Executor.runInTerminal('$path = & "${env:ProgramFiles(x86)}\\microsoft visual studio\\installer\\vswhere.exe" -latest -prerelease -requires Microsoft.Component.MSBuild -find MSBuild\\**\\Bin\\MSBuild.exe | select-object -first 1; ' +
nanoFrameworkExtensionPath + '/nuget/nuget.exe restore ' + fileUri + '; ' +
'& $path ' + fileUri + ' -p:NanoFrameworkProjectSystemPath=' + nanoFrameworkExtensionPath + '/nanoFramework/v1.0/');
toolPath + '/nuget/nuget.exe restore ' + fileUri + '; ' +
'& $path ' + fileUri + ' -p:NanoFrameworkProjectSystemPath=' + toolPath + '/nanoFramework/v1.0/');
}
// using msbuild (comes with mono-complete) on unix
else {
Executor.runInTerminal(`nuget restore "${fileUri}" && msbuild "${fileUri}" -p:NanoFrameworkProjectSystemPath=${nanoFrameworkExtensionPath}/nanoFramework/v1.0/`);
Executor.runInTerminal(`nuget restore "${fileUri}" && msbuild "${fileUri}" -p:NanoFrameworkProjectSystemPath=${toolPath}/nanoFramework/v1.0/`);
}
}
}
@ -34,17 +34,17 @@ export class Dotnet {
* First builds nanoFramework solution, then deploys this built solution to selected device
* @param fileUri absolute path to *.sln
* @param serialPath path to connected nanoFramework device (e.g. COM4 or /dev/tty.usbserial*)
* @param nanoFrameworkExtensionPath absolute path to root of nanoFramework extension
* @param toolPath absolute path to root of nanoFramework extension
*/
public static deploy(fileUri: string, serialPath: string, nanoFrameworkExtensionPath: String) {
public static deploy(fileUri: string, serialPath: string, toolPath: String) {
if (fileUri) {
const outputDir = path.dirname(fileUri) + '/OutputDir/';
const cliBuildArguments = `/p:NanoFrameworkProjectSystemPath=${nanoFrameworkExtensionPath}/nanoFramework/v1.0/ /p:OutDir=${outputDir}`;
const cliDeployArguments = `${nanoFrameworkExtensionPath}/nanoFrameworkDeployer/nanoFrameworkDeployer.exe -v ${serialPath ? '-c '+ serialPath : ''} -d ${outputDir}`;
const cliBuildArguments = `/p:NanoFrameworkProjectSystemPath=${toolPath}/nanoFramework/v1.0/ /p:OutDir=${outputDir}`;
const cliDeployArguments = `${toolPath}/nanoFrameworkDeployer/nanoFrameworkDeployer.exe -v ${serialPath ? '-c '+ serialPath : ''} -d ${outputDir}`;
if(os.platform() === "win32") {
Executor.runInTerminal('$path = & "${env:ProgramFiles(x86)}\\microsoft visual studio\\installer\\vswhere.exe" -latest -prerelease -requires Microsoft.Component.MSBuild -find MSBuild\\**\\Bin\\MSBuild.exe | select-object -first 1; ' +
nanoFrameworkExtensionPath + '/nuget/nuget.exe restore ' + fileUri + '; ' +
toolPath + '/nuget/nuget.exe restore ' + fileUri + '; ' +
'& $path ' + fileUri + ' ' + cliBuildArguments + '; '+
cliDeployArguments);
}
@ -62,18 +62,18 @@ export class Dotnet {
* @param fileUri absolute path to *.sln
* @param serialPath path to connected nanoFramework device (e.g. COM4 or /dev/tty.usbserial*)
* @param targetImage the type of device connected (e.g. ESP32_REV0, ESP32_PICO)
* @param nanoFrameworkExtensionPath absolute path to root of nanoFramework extension
* @param toolPath absolute path to root of nanoFramework extension
*/
public static deployAlternative(fileUri: string, serialPath: string, targetImage: string, nanoFrameworkExtensionPath: String) {
public static deployAlternative(fileUri: string, serialPath: string, targetImage: string, toolPath: String) {
if (fileUri && targetImage) {
const outputDir = path.dirname(fileUri) + '/OutputDir/';
const cliBuildArguments = `/p:NanoFrameworkProjectSystemPath=${nanoFrameworkExtensionPath}/nanoFramework/v1.0/ /p:OutDir=${outputDir}`;
const cliBuildBin = `${nanoFrameworkExtensionPath}/nanoFrameworkDeployer/nanoFrameworkDeployer.exe -v -d ${outputDir} -b`;
const cliDeploy = `dotnet ${nanoFrameworkExtensionPath}/nanoFirmwareFlasher/nanoff.dll --target ${targetImage} --serialport ${serialPath} --deploy --image ${outputDir}deploy.bin`;
const cliBuildArguments = `/p:NanoFrameworkProjectSystemPath=${toolPath}/nanoFramework/v1.0/ /p:OutDir=${outputDir}`;
const cliBuildBin = `${toolPath}/nanoFrameworkDeployer/nanoFrameworkDeployer.exe -v -d ${outputDir} -b`;
const cliDeploy = `dotnet ${toolPath}/nanoFirmwareFlasher/nanoff.dll --target ${targetImage} --serialport ${serialPath} --deploy --image ${outputDir}deploy.bin`;
if(os.platform() === "win32") {
Executor.runInTerminal('$path = & "${env:ProgramFiles(x86)}\\microsoft visual studio\\installer\\vswhere.exe" -latest -prerelease -requires Microsoft.Component.MSBuild -find MSBuild\\**\\Bin\\MSBuild.exe | select-object -first 1; ' +
nanoFrameworkExtensionPath + '/nuget/nuget.exe restore ' + fileUri + '; ' +
toolPath + '/nuget/nuget.exe restore ' + fileUri + '; ' +
'& $path ' + fileUri + ' ' + cliBuildArguments + '; '+
cliBuildBin + '; ' +
cliDeploy);
@ -89,12 +89,12 @@ export class Dotnet {
/**
* Flashes the selected device to new firmware using nanoFirmwareFlasher
* @param nanoFrameworkExtensionPath absolute path to root of nanoFramework extension
* @param toolPath absolute path to root of nanoFramework extension
* @param cliArguments CLI arguments passed to nanoff.dll
*/
public static flash(nanoFrameworkExtensionPath: String, cliArguments: String) {
if(nanoFrameworkExtensionPath && cliArguments) {
Executor.runInTerminal(`dotnet ${nanoFrameworkExtensionPath}/nanoFirmwareFlasher/nanoff.dll --update ${cliArguments}`);
public static flash(toolPath: String, cliArguments: String) {
if(toolPath && cliArguments) {
Executor.runInTerminal(`dotnet ${toolPath}/nanoFirmwareFlasher/nanoff.dll --update ${cliArguments}`);
}
}
}

Просмотреть файл

@ -17,7 +17,7 @@ export async function activate(context: vscode.ExtensionContext) {
console.log('The "vscode-nanoframework" is now active!');
const workspaceFolder = getDocumentWorkspaceFolder() || '';
const nanoFrameworkExtensionPath = context.extensionPath + '/dist/utils/';
const nanoFrameworkExtensionPath = context.extensionPath + '/dist/utils';
context.subscriptions.push(vscode.commands.registerCommand("vscode-nanoframework.nfbuild", async (fileUri: vscode.Uri, ) => {
const path = await solvePath(fileUri, workspaceFolder);

Просмотреть файл

@ -13,9 +13,9 @@ const axios = require('axios');
/**
* A multi-step input using window.createQuickPick() and window.createInputBox().
* @param context
* @param nanoFrameworkExtensionPath
* @param toolPath
*/
export async function multiStepInput(context: ExtensionContext, nanoFrameworkExtensionPath: String) {
export async function multiStepInput(context: ExtensionContext, toolPath: String) {
const dfuJtagOptions: QuickPickItem[] = ['DFU mode','JTAG mode']
.map(label => ({ label }));
@ -226,7 +226,7 @@ export async function multiStepInput(context: ExtensionContext, nanoFrameworkExt
* @returns QuickPickItem[] with list of serial devices available
*/
async function getDevices() {
let ports = await SerialPortCtrl.list(nanoFrameworkExtensionPath);
let ports = await SerialPortCtrl.list(toolPath);
const devicePaths: QuickPickItem[] = ports
.map((label) => ({ label: label.port, description: label.desc }));
@ -260,7 +260,7 @@ export async function multiStepInput(context: ExtensionContext, nanoFrameworkExt
cliArguments += " --preview";
}
Dotnet.flash(nanoFrameworkExtensionPath, cliArguments);
Dotnet.flash(toolPath, cliArguments);
}
// -------------------------------------------------------

Просмотреть файл

@ -38,11 +38,11 @@ export async function chooseSolution(workspaceFolder: string) {
/**
* Dynamically gets all connected serial ports and lets the user select the port they would like to flash
* @param nanoFrameworkExtensionPath absolute path to nanoFramework extension
* @param toolPath absolute path to nanoFramework extension
* @returns selected serial port to flash
*/
export async function chooseSerialPort(nanoFrameworkExtensionPath: string) {
const ports = await SerialPortCtrl.list(nanoFrameworkExtensionPath);
export async function chooseSerialPort(toolPath: string) {
const ports = await SerialPortCtrl.list(toolPath);
const devicePaths = ports
.map((label) => ({ label: label.port, description: label.desc }));
@ -56,10 +56,10 @@ export async function chooseSerialPort(nanoFrameworkExtensionPath: string) {
/**
* Dynamically fetches all possible types of target boards and lets user select the appropriate one
* @param nanoFrameworkExtensionPath absolute path to nanoFramework extension
* @param toolPath absolute path to nanoFramework extension
* @returns selected target board
*/
export async function chooseTarget(nanoFrameworkExtensionPath: string) {
export async function chooseTarget(toolPath: string) {
const apiUrl = 'https://api.cloudsmith.io/v1/packages/net-nanoframework/';
const apiRepos = ['nanoframework-images-dev', 'nanoframework-images', 'nanoframework-images-community-targets']