Skip to content
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
2 changes: 1 addition & 1 deletion src/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export interface SerializedProjectEvent {
project: ProjectState;
}
export const serializeProjectEvent = (project: ProjectEvent): SerializedProjectEvent => {
return {path: project.getUri().path, project: Project.serialize(project)};
return {path: project.getUri().toString(), project: Project.serialize(project)};
};
export const deserializeProjectEvent = (
value: SerializedProjectEvent,
Expand Down
43 changes: 29 additions & 14 deletions src/extension/tasks/toolprovider.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {type ProjectTarget, type WorkerStep} from 'edacation';
import { type ProjectTarget, type WorkerStep } from 'edacation';
import path from 'path';
import * as vscode from 'vscode';

import type {ExtensionMessage, MessageFile} from '../../common/messages.js';
import type { ExtensionMessage, MessageFile } from '../../common/messages.js';
import * as node from '../../common/node-modules.js';
import {UniversalWorker} from '../../common/universal-worker.js';
import {type Project} from '../projects/index.js';
import {type NativeToolExecutionOptions, ToolRepository} from '../tools';
import { UniversalWorker } from '../../common/universal-worker.js';
import { type Project } from '../projects/index.js';
import { type NativeToolExecutionOptions, ToolRepository } from '../tools';

import {type TaskOutputFile, TerminalMessageEmitter} from './messaging.js';
import type {TaskIOFile} from './task.js';
import { type TaskOutputFile, TerminalMessageEmitter } from './messaging.js';
import type { TaskIOFile } from './task.js';

interface ToolInfoStatusOk {
status: 'ok';
Expand Down Expand Up @@ -81,9 +81,17 @@ export class WebAssemblyToolProvider extends ToolProvider {

await stepCallback('start', step);

let rawInputFiles: MessageFile[];
try {
rawInputFiles = await this.readFiles(ctx.project, ctx.inputFiles);
} catch {
await stepCallback('end', step);
return;
}

// build input files
const fileMap = new Map<string, MessageFile>();
for (const file of await this.readFiles(ctx.project, ctx.inputFiles)) {
for (const file of rawInputFiles) {
// files from workspace
fileMap.set(file.path, file);
}
Expand Down Expand Up @@ -141,14 +149,21 @@ export class WebAssemblyToolProvider extends ToolProvider {
for (const file of inputFiles) {
if (file.data) {
files.push({path: file.path, data: file.data});
} else {
const data = await vscode.workspace.fs.readFile(project.getFileUri(file.path));
continue;
}

files.push({
path: file.path,
data
});
let data: Uint8Array;
try {
data = await vscode.workspace.fs.readFile(project.getFileUri(file.path));
} catch {
this.error(`Failed to read input file: ${file.path}`);
continue;
}

files.push({
path: file.path,
data
});
}

return files;
Expand Down
2 changes: 1 addition & 1 deletion src/workers/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class WorkerTool {
'nextpnr-ecp5': '@yowasp/nextpnr-ecp5',
'nextpnr-ice40': '@yowasp/nextpnr-ice40',
ecppack: '@yowasp/nextpnr-ecp5',
openFPGALoader: '@yowasp/openfpgaloader'
openFPGALoader: '@yowasp/openfpgaloader@1.0.0-16.156'
};

constructor() {
Expand Down
Loading