Skip to content

Commit 2f159d7

Browse files
committed
"Ensures that the directory exists:" + dirtobecreate,
1 parent 17673f8 commit 2f159d7

File tree

2 files changed

+70
-58
lines changed

2 files changed

+70
-58
lines changed

.github/workflows/msbuild.yml

Lines changed: 46 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,65 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
61
name: MSBuild
72

83
on:
9-
push:
10-
branches: [ "master" ]
11-
pull_request:
12-
branches: [ "master" ]
4+
push:
5+
branches: ["master"]
6+
pull_request:
7+
branches: ["master"]
138

149
env:
15-
# Path to the solution file relative to the root of the project.
16-
SOLUTION_FILE_PATH: .
10+
SOLUTION_FILE_PATH: .
1711

18-
# Configuration type to build.
19-
# You can convert this to a build matrix if you need coverage of multiple configuration types.
20-
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
21-
BUILD_CONFIGURATION: Release
12+
BUILD_CONFIGURATION: Release
2213

2314
permissions:
24-
contents: read
15+
contents: read
2516

2617
jobs:
27-
build:
28-
runs-on: windows-latest
18+
build:
19+
runs-on: windows-latest
20+
21+
steps:
22+
- uses: actions/checkout@v3
2923

30-
steps:
31-
- uses: actions/checkout@v3
32-
- run: powershell -command New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
33-
- uses: actions/cache@v3
34-
with:
35-
key: ${{ runner.os }}-deno-${{ hashFiles('**/deps.ts') }}-${{ hashFiles('**/import_map.json') }}
36-
path: |
24+
- uses: actions/cache@v3
25+
with:
26+
key: ${{ runner.os }}-deno-${{ hashFiles('**/deps.ts') }}-${{ hashFiles('**/import_map.json') }}
27+
path: |
3728
~\.deno
3829
~\AppData\Local\deno
39-
- uses: actions/cache@v3
40-
with:
41-
path: |
42-
C:\vcpkg
30+
- uses: actions/cache@v3
31+
with:
32+
path: |
33+
C:\vcpkg
4334
44-
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/xmake.lua') }}
45-
- uses: actions/cache@v3
46-
with:
47-
path: |
48-
C:\Users\runneradmin\AppData\Local\.xmake
35+
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/xmake.lua') }}
36+
- uses: actions/cache@v3
37+
with:
38+
path: |
39+
C:\Users\runneradmin\AppData\Local\.xmake
4940
50-
key: ${{ runner.os }}-xmake-${{ hashFiles('**/xmake.lua') }}
51-
- name: Add MSBuild to PATH
52-
uses: microsoft/[email protected]
53-
with:
54-
vs-prerelease: true
41+
key: ${{ runner.os }}-xmake-${{ hashFiles('**/xmake.lua') }}
42+
- name: Add MSBuild to PATH
43+
uses: microsoft/[email protected]
44+
with:
45+
vs-prerelease: true
5546

56-
- name: vcpkg-action
47+
- name: vcpkg-action
5748

58-
uses: johnwason/vcpkg-action@v4
59-
with:
60-
triplet: x64-windows-release
61-
pkgs: "gtest cppunit"
49+
uses: johnwason/vcpkg-action@v4
50+
with:
51+
triplet: x64-windows-release
52+
pkgs: "gtest cppunit"
6253

63-
token: ${{ github.token }}
64-
- name: Setup Deno
54+
token: ${{ github.token }}
55+
- name: Setup Deno
6556

66-
uses: denoland/[email protected]
67-
with:
68-
deno-version: v1.33.1
69-
- run: deno task cache
70-
- uses: xmake-io/github-action-setup-xmake@v1
71-
with:
72-
xmake-version: branch@dev
73-
actions-cache-folder: ".xmake-cache"
74-
- run: deno run -A xmake.ts
57+
uses: denoland/[email protected]
58+
with:
59+
deno-version: v1.33.1
60+
- run: deno task cache
61+
- uses: xmake-io/github-action-setup-xmake@v1
62+
with:
63+
xmake-version: branch@dev
64+
actions-cache-folder: ".xmake-cache"
65+
- run: deno run -A xmake.ts

xmake.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { join, resolve } from "https://deno.land/[email protected]/path/mod.ts";
44

55
import { assertEquals } from "asserts";
66
import { dirname } from "https://deno.land/x/[email protected]/mod.ts";
7+
import { ensureDir } from "https://deno.land/[email protected]/fs/mod.ts";
78
import parse from "npm:@masx200/[email protected]";
89
import { retry } from "./retry.ts";
910

@@ -40,10 +41,30 @@ async function RunXmake(file: string, toolchain: string, sdk: string) {
4041
await RunXmakeConfig(file, toolchain, sdk);
4142
await retry(RunXmakeBuild.bind(null, file), {
4243
maxAttempts: os === "windows" ? 10 : 1,
43-
retryOnError: (e) => {
44-
return Boolean(
45-
e?.stdout?.match(/error:.*cannot open file:.*, Unknown/g),
44+
retryOnError: async (e) => {
45+
const regexp = /error:.*cannot open file:(.*), Unknown/g;
46+
const matched = e?.stdout?.match(
47+
regexp,
4648
);
49+
const filepathmatched = regexp.exec(matched[0])?.[1]?.trim();
50+
51+
if (
52+
filepathmatched && (
53+
matched
54+
)
55+
) {
56+
const cwd = path.dirname(file);
57+
const dirtobecreate = path.join(
58+
cwd,
59+
path.dirname(filepathmatched),
60+
);
61+
62+
console.log(
63+
"Ensures that the directory exists:" + dirtobecreate,
64+
);
65+
await ensureDir(dirtobecreate);
66+
return true;
67+
} else return false;
4768
},
4869
});
4970
await RunXmakeTest(file);

0 commit comments

Comments
 (0)