Skip to content

Commit

Permalink
格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
masx200 committed Apr 27, 2024
1 parent 87a5bc4 commit b45508f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 40 deletions.
19 changes: 9 additions & 10 deletions cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (import.meta.main) {

async function parallel_cache(
entry_iter: AsyncIterableIterator<WalkEntry>,
limiter: AsyncCurrentLimiter
limiter: AsyncCurrentLimiter,
) {
const files: string[] = [];

Expand All @@ -37,21 +37,20 @@ async function parallel_cache(
limiter.run(
function (stack: string[]) {
return runDenocache(stack);
}.bind(null, stack)
}.bind(null, stack),
)
)
),
);
}
async function start() {
const limiter = new AsyncLimiterClass(1);
const args = parse(Deno.args);
console.log(args);
const skip =
typeof args.skip === "string"
? new RegExp(String(args.skip))
: Array.isArray(args.skip)
? args.skip.map((s: string | RegExp) => new RegExp(s))
: undefined;
const skip = typeof args.skip === "string"
? new RegExp(String(args.skip))
: Array.isArray(args.skip)
? args.skip.map((s: string | RegExp) => new RegExp(s))
: undefined;
const entry_iter = searchFilesNames({ skip });
await parallel_cache(entry_iter, limiter);
}
Expand All @@ -73,7 +72,7 @@ async function runDenocache(stack: string[]) {
if (!success) {
throw new Error(
"type cache failed:" +
JSON.stringify({ code, success, stdout: out, stderr: err })
JSON.stringify({ code, success, stdout: out, stderr: err }),
);
}
}
19 changes: 9 additions & 10 deletions check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (import.meta.main) {

async function parallel_check(
entry_iter: AsyncIterableIterator<WalkEntry>,
limiter: AsyncCurrentLimiter
limiter: AsyncCurrentLimiter,
) {
const files: string[] = [];

Expand All @@ -37,21 +37,20 @@ async function parallel_check(
limiter.run(
function (stack: string[]) {
return runDenoCheck(stack);
}.bind(null, stack)
}.bind(null, stack),
)
)
),
);
}
async function start() {
const limiter = new AsyncLimiterClass(navigator.hardwareConcurrency);
const args = parse(Deno.args);
console.log(args);
const skip =
typeof args.skip === "string"
? new RegExp(String(args.skip))
: Array.isArray(args.skip)
? args.skip.map((s: string | RegExp) => new RegExp(s))
: undefined;
const skip = typeof args.skip === "string"
? new RegExp(String(args.skip))
: Array.isArray(args.skip)
? args.skip.map((s: string | RegExp) => new RegExp(s))
: undefined;
const entry_iter = searchFilesNames({ skip });
await parallel_check(entry_iter, limiter);
}
Expand All @@ -73,7 +72,7 @@ async function runDenoCheck(stack: string[]) {
if (!success) {
throw new Error(
"type cache failed:" +
JSON.stringify({ code, success, stdout: out, stderr: err })
JSON.stringify({ code, success, stdout: out, stderr: err }),
);
}
}
28 changes: 18 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" ?>
<project
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
Expand Down Expand Up @@ -93,25 +93,33 @@
<sourceDirs>
<source>add-two-integers</source>
<source>binary-search-tree-iterator</source>
<source>construct-binary-search-tree-from-preorder-traversal</source>
<source
>construct-binary-search-tree-from-preorder-traversal</source>
<source>construct-quad-tree</source>
<source>count-vowel-strings-in-ranges</source>
<source>count-ways-to-build-good-string</source>
<source>design-skiplist</source>
<source>er-cha-shu-ran-se-UGC</source>
<source>er-cha-sou-suo-shu-de-di-kda-jie-dian-lcof</source>
<source>insert-into-a-binary-search-tree</source>
<source
>er-cha-sou-suo-shu-de-di-kda-jie-dian-lcof</source>
<source
>insert-into-a-binary-search-tree</source>
<source>letter-case-permutation</source>
<source>maximum-number-of-weeks-for-which-you-can-work</source>
<source
>maximum-number-of-weeks-for-which-you-can-work</source>
<source>min-cost-to-connect-all-points</source>
<source>minimum-number-of-moves-to-seat-everyone</source>
<source
>minimum-number-of-moves-to-seat-everyone</source>
<source>number-of-distinct-averages</source>
<source>operations-lcci</source>
<source>possible-bipartition</source>
<source>remove-vowels-from-a-string</source>
<source>reveal-cards-in-increasing-order</source>
<source>reverse-nodes-in-even-length-groups</source>
<source>serialize-and-deserialize-binary-tree</source>
<source
>reveal-cards-in-increasing-order</source>
<source
>reverse-nodes-in-even-length-groups</source>
<source
>serialize-and-deserialize-binary-tree</source>
<source>split-message-based-on-limit</source>
<source>three-in-one-lcci</source>
<source>utils</source>
Expand Down Expand Up @@ -268,4 +276,4 @@
</dependencies>

</dependencyManagement>
</project>
</project>
2 changes: 1 addition & 1 deletion retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function retry<T>(
retryOnError?:
| ((error: any) => Promise<boolean>)
| ((error: any) => boolean);
}
},
) {
const retryOnError = opts?.retryOnError ?? (() => true);
const options: Required<RetryOptions> = {
Expand Down
17 changes: 8 additions & 9 deletions xmake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { retry } from "./retry.ts";

async function* findFilesRecursive(
path: string,
name: string
name: string,
): AsyncGenerator<string, void, unknown> {
for await (const entry of Deno.readDir(path)) {
const fullPath = resolve(join(path, entry.name));
Expand Down Expand Up @@ -37,7 +37,7 @@ async function RunXmake(
sdk: string,
executable: string,
group: string,
mode: string
mode: string,
) {
await RunXmakeConfig(file, toolchain, sdk, executable, mode);
await retry(RunXmakeBuild.bind(null, file, executable, group), {
Expand All @@ -50,11 +50,11 @@ async function RunXmake(
const cwd = path.dirname(file);
const dirtobecreate = path.join(
cwd,
path.dirname(filepathmatched)
path.dirname(filepathmatched),
);

console.log(
"Ensures that the directory exists:" + dirtobecreate
"Ensures that the directory exists:" + dirtobecreate,
);
await ensureDir(dirtobecreate);
return true;
Expand All @@ -69,7 +69,7 @@ async function RunXmakeConfig(
toolchain: string,
sdk: string,
executable: string,
mode: string
mode: string,
) {
console.log({ file });
const cwd = path.dirname(file);
Expand All @@ -88,10 +88,9 @@ export async function RunCommandShell(others: string[], cwd?: string) {

const cmd = os === "windows" ? "powershell.exe" : "bash";

const args =
os === "windows"
? ["-command", others.join(" \n ")]
: ["-c", others.join(" && ")];
const args = os === "windows"
? ["-command", others.join(" \n ")]
: ["-c", others.join(" && ")];

console.log(JSON.stringify({ cmd, cwd, args }));
const command = new Deno.Command(cmd, { cwd: cwd, args });
Expand Down

0 comments on commit b45508f

Please sign in to comment.