Skip to content

Commit 1e2551b

Browse files
committed
use '.lock' file instead of 'unify_builder.log'
1 parent 9b6e9c7 commit 1e2551b

10 files changed

Lines changed: 23 additions & 18 deletions

File tree

res/tools/darwin/unify_builder/arm64/unify_builder.deps.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"targets": {
88
".NETCoreApp,Version=v6.0": {},
99
".NETCoreApp,Version=v6.0/osx-arm64": {
10-
"unify_builder/3.10.4": {
10+
"unify_builder/3.11.0": {
1111
"dependencies": {
1212
"CommandLineParser": "2.9.1",
1313
"ConsoleTableExt": "3.1.9",
@@ -122,7 +122,7 @@
122122
}
123123
},
124124
"libraries": {
125-
"unify_builder/3.10.4": {
125+
"unify_builder/3.11.0": {
126126
"type": "project",
127127
"serviceable": false,
128128
"sha512": ""
512 Bytes
Binary file not shown.

res/tools/darwin/unify_builder/x86_64/unify_builder.deps.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"targets": {
88
".NETCoreApp,Version=v6.0": {},
99
".NETCoreApp,Version=v6.0/osx-x64": {
10-
"unify_builder/3.10.4": {
10+
"unify_builder/3.11.0": {
1111
"dependencies": {
1212
"CommandLineParser": "2.9.1",
1313
"ConsoleTableExt": "3.1.9",
@@ -122,7 +122,7 @@
122122
}
123123
},
124124
"libraries": {
125-
"unify_builder/3.10.4": {
125+
"unify_builder/3.11.0": {
126126
"type": "project",
127127
"serviceable": false,
128128
"sha512": ""
512 Bytes
Binary file not shown.

res/tools/linux/unify_builder/unify_builder.deps.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"targets": {
88
".NETCoreApp,Version=v6.0": {},
99
".NETCoreApp,Version=v6.0/linux-x64": {
10-
"unify_builder/3.10.4": {
10+
"unify_builder/3.11.0": {
1111
"dependencies": {
1212
"CommandLineParser": "2.9.1",
1313
"ConsoleTableExt": "3.1.9",
@@ -122,7 +122,7 @@
122122
}
123123
},
124124
"libraries": {
125-
"unify_builder/3.10.4": {
125+
"unify_builder/3.11.0": {
126126
"type": "project",
127127
"serviceable": false,
128128
"sha512": ""
512 Bytes
Binary file not shown.

res/tools/win32/unify_builder/unify_builder.deps.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"targets": {
88
".NETCoreApp,Version=v6.0": {},
99
".NETCoreApp,Version=v6.0/win-x64": {
10-
"unify_builder/3.10.4": {
10+
"unify_builder/3.11.0": {
1111
"dependencies": {
1212
"CommandLineParser": "2.9.1",
1313
"ConsoleTableExt": "3.1.9",
@@ -122,7 +122,7 @@
122122
}
123123
},
124124
"libraries": {
125-
"unify_builder/3.10.4": {
125+
"unify_builder/3.11.0": {
126126
"type": "project",
127127
"serviceable": false,
128128
"sha512": ""
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

src/CodeBuilder.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export abstract class CodeBuilder {
115115
protected onlyDumpCompilerInfo?: boolean;
116116
protected otherArgs?: string[];
117117
protected _event: events.EventEmitter;
118-
protected logWatcher: FileWatcher | undefined;
118+
protected lockWatcher: FileWatcher | undefined;
119119

120120
constructor(_project: AbstractProject) {
121121
this.project = _project;
@@ -282,18 +282,23 @@ export abstract class CodeBuilder {
282282
};
283283

284284
const outDir = this.project.ToAbsolutePath(this.project.getOutputDir());
285-
const builderLog = File.fromArray([outDir, 'unify_builder.log']);
286-
if (!builderLog.IsFile()) builderLog.Write('');
287-
if (this.logWatcher) { this.logWatcher.Close(); delete this.logWatcher; };
288-
289-
this.logWatcher = new FileWatcher(builderLog, false);
290-
this.logWatcher.OnChanged = () => {
291-
this.logWatcher?.Close();
292-
setTimeout(() => this.emit('finished', checkBuildDone(builderLog)), 500);
285+
const lockFile = File.from(outDir, '.lock');
286+
if (!lockFile.IsFile())
287+
lockFile.Write('');
288+
if (this.lockWatcher) {
289+
this.lockWatcher.Close();
290+
delete this.lockWatcher;
291+
};
292+
293+
this.lockWatcher = new FileWatcher(lockFile, false);
294+
this.lockWatcher.OnChanged = () => {
295+
this.lockWatcher?.Close();
296+
const builderLogFile = File.from(outDir, 'unify_builder.log');
297+
setTimeout(() => this.emit('finished', checkBuildDone(builderLogFile)), 500);
293298
};
294299

295300
// start watch
296-
this.logWatcher.Watch();
301+
this.lockWatcher.Watch();
297302

298303
} catch (error) {
299304
GlobalEvent.emit('msg', ExceptionToMessage(error, 'Hidden'));

0 commit comments

Comments
 (0)