Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 070c3c6

Browse files
author
Akos Kitta
committed
exposed build path.
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent d3cf0d2 commit 070c3c6

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

‎arduino-ide-extension/src/browser/contributions/verify-sketch.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class VerifySketch extends CoreServiceContribution {
115115
const verbose = this.preferences.get('arduino.compile.verbose');
116116
const compilerWarnings = this.preferences.get('arduino.compile.warnings');
117117
this.outputChannelManager.getChannel('Arduino').clear();
118-
await this.coreService.compile({
118+
constresult=await this.coreService.compile({
119119
sketch,
120120
board,
121121
optimizeForDebug: this.editorMode.compileForDebug,
@@ -124,6 +124,7 @@ export class VerifySketch extends CoreServiceContribution {
124124
sourceOverride,
125125
compilerWarnings,
126126
});
127+
console.log('THE BUILD CACHE IS AT ' + result.buildOutputUri);
127128
this.messageService.info(
128129
nls.localize('arduino/sketch/doneCompiling', 'Done compiling.'),
129130
{ timeout: 3000 }

‎arduino-ide-extension/src/common/protocol/core-service.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export namespace CoreService {
9595
* For example: file:///private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-10078B54BD22497263B8DA67E0BFC260
9696
*/
9797
readonly buildOutputUri: string;
98+
// TODO: do we need the fqbn here? so that IDE2 can track the boards
9899
}
99100
}
100101

‎arduino-ide-extension/src/node/core-service-impl.ts‎

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,19 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
5050
): Promise<CoreService.Compile.Result> {
5151
const coreClient = await this.coreClient();
5252
const { client, instance } = coreClient;
53-
const handler = this.createOnDataHandler();
53+
let buildPath: string | undefined = undefined;
54+
const handler = this.createOnDataHandler<CompileResponse>((response) => {
55+
const currentBuildPath = response.getBuildPath();
56+
if (!buildPath) {
57+
buildPath = currentBuildPath;
58+
} else {
59+
if (!!currentBuildPath && currentBuildPath !== buildPath) {
60+
throw new Error(
61+
`The CLI has already provided a build path: <${buildPath}>, and there is a new build path value: <${currentBuildPath}>.`
62+
);
63+
}
64+
}
65+
});
5466
const request = this.compileRequest(options, instance);
5567
return new Promise<CoreService.Compile.Result>((resolve, reject) => {
5668
client
@@ -83,7 +95,17 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
8395
reject(CoreError.VerifyFailed(message, compilerErrors));
8496
}
8597
})
86-
.on('end', resolve);
98+
.on('end', () => {
99+
if (!buildPath) {
100+
reject(
101+
new Error(
102+
`Have not received the build path from the CLI while running the compilation.`
103+
)
104+
);
105+
} else {
106+
resolve({ buildOutputUri: FileUri.create(buildPath).toString() });
107+
}
108+
});
87109
}).finally(() => handler.dispose());
88110
}
89111

@@ -289,7 +311,9 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
289311
return request;
290312
}
291313

292-
private createOnDataHandler<R extends StreamingResponse>(): Disposable & {
314+
private createOnDataHandler<R extends StreamingResponse>(
315+
onResponse?: (response: R) => void
316+
): Disposable & {
293317
stderr: Buffer[];
294318
onData: (response: R) => void;
295319
} {
@@ -301,10 +325,14 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
301325
}
302326
});
303327
});
304-
const onData = StreamingResponse.createOnDataHandler(stderr, (out, err) => {
305-
buffer.addChunk(out);
306-
buffer.addChunk(err, OutputMessage.Severity.Error);
307-
});
328+
const onData = StreamingResponse.createOnDataHandler(
329+
stderr,
330+
(out, err) => {
331+
buffer.addChunk(out);
332+
buffer.addChunk(err, OutputMessage.Severity.Error);
333+
},
334+
onResponse
335+
);
308336
return {
309337
dispose: () => buffer.dispose(),
310338
stderr,
@@ -373,13 +401,17 @@ namespace StreamingResponse {
373401
// eslint-disable-next-line @typescript-eslint/no-explicit-any
374402
export function createOnDataHandler<R extends StreamingResponse>(
375403
stderr: Uint8Array[],
376-
onData: (out: Uint8Array, err: Uint8Array) => void
404+
onData: (out: Uint8Array, err: Uint8Array) => void,
405+
onResponse?: (response: R) => void
377406
): (response: R) => void {
378407
return (response: R) => {
379408
const out = response.getOutStream_asU8();
380409
const err = response.getErrStream_asU8();
381410
stderr.push(err);
382411
onData(out, err);
412+
if (onResponse) {
413+
onResponse(response);
414+
}
383415
};
384416
}
385417
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /