Skip to content

Commit d28a238

Browse files
authored
Temporarily reenable old licence check (#1189)
This allows us to turn off the licence check GitHub Action temporarily until we can merge #1176, which unblocks #1159, allowing us to start using the GitHub Actions CI flow.
1 parent 6f4544b commit d28a238

File tree

4 files changed

+123
-6
lines changed

4 files changed

+123
-6
lines changed

docker/test.sh

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ npm ci
1818
npm run lint
1919
npm run format
2020
npm run package
21+
npm run test-soundness -- --force-run
2122

2223
(xvfb-run -a npm run coverage; echo $? > exitcode) | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels" && rm -rf "${current_directory}/coverage" && (cp -R ./coverage "${current_directory}" || true)
2324
exit "$(<exitcode)"

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,7 @@
12741274
"format": "prettier --check .",
12751275
"pretest": "npm run compile-tests",
12761276
"soundness": "docker compose -f docker/docker-compose.yaml -p swift-vscode-soundness-prb run --rm soundness",
1277+
"test-soundness": "scripts/soundness.sh",
12771278
"test": "vscode-test",
12781279
"test-ci": "docker/test-ci.sh ci",
12791280
"test-nightly": "docker/test-ci.sh nightly",

scripts/soundness.sh

+120-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,122 @@
11
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the VS Code Swift open source project
5+
##
6+
## Copyright (c) 2021 the VS Code Swift project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of VS Code Swift project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
215

3-
# This file is supplanted by the GitHub Actions enabled in
4-
# https://github.com/swiftlang/vscode-swift/pull/1159,
5-
# remove this file once that has been merged.
6-
exit 0
16+
if [[ "$1" != "--force-run" ]]; then
17+
# This file is supplanted by the GitHub Actions enabled in
18+
# https://github.com/swiftlang/vscode-swift/pull/1159,
19+
# Until https://github.com/swiftlang/vscode-swift/pull/1176 is
20+
# merged we still run the licence check here via the docker/test.sh
21+
# with the --force-run flag, and the soundness Jenkins job is skipped
22+
# with this exit 0. This lets us run this licence check in the GitHub Actions
23+
# until the standard licence check in GH Actions can be used.
24+
exit 0
25+
fi
26+
27+
set -eu
28+
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
29+
30+
function replace_acceptable_years() {
31+
# this needs to replace all acceptable forms with 'YEARS'
32+
sed -e 's/20[12][0123456789]-20[12][0123456789]/YEARS/' -e 's/20[12][0123456789]/YEARS/'
33+
}
34+
35+
printf "=> Checking license headers... "
36+
tmp=$(mktemp /tmp/.vscode-swift-soundness_XXXXXX)
37+
38+
for language in typescript-or-javascript bash; do
39+
declare -a matching_files
40+
matching_files=( -name '*' )
41+
case "$language" in
42+
typescript-or-javascript)
43+
matching_files=( -name '*.js' -o -name '*.ts' )
44+
cat > "$tmp" <<"EOF"
45+
//===----------------------------------------------------------------------===//
46+
//
47+
// This source file is part of the VS Code Swift open source project
48+
//
49+
// Copyright (c) YEARS the VS Code Swift project authors
50+
// Licensed under Apache License v2.0
51+
//
52+
// See LICENSE.txt for license information
53+
// See CONTRIBUTORS.txt for the list of VS Code Swift project authors
54+
//
55+
// SPDX-License-Identifier: Apache-2.0
56+
//
57+
//===----------------------------------------------------------------------===//
58+
EOF
59+
;;
60+
bash)
61+
matching_files=( -name '*.sh' )
62+
cat > "$tmp" <<"EOF"
63+
#!/bin/bash
64+
##===----------------------------------------------------------------------===##
65+
##
66+
## This source file is part of the VS Code Swift open source project
67+
##
68+
## Copyright (c) YEARS the VS Code Swift project authors
69+
## Licensed under Apache License v2.0
70+
##
71+
## See LICENSE.txt for license information
72+
## See CONTRIBUTORS.txt for the list of VS Code Swift project authors
73+
##
74+
## SPDX-License-Identifier: Apache-2.0
75+
##
76+
##===----------------------------------------------------------------------===##
77+
EOF
78+
;;
79+
*)
80+
echo >&2 "ERROR: unknown language '$language'"
81+
;;
82+
esac
83+
84+
expected_lines=$(cat "$tmp" | wc -l)
85+
expected_sha=$(cat "$tmp" | shasum)
86+
87+
(
88+
cd "$here/.."
89+
{
90+
find . \
91+
\( \! -path './.build/*' -a \
92+
\( \! -path './node_modules/*' -a \
93+
\( \! -path './out/*' -a \
94+
\( \! -path './.vscode-test/*' -a \
95+
\( \! -path './docker/*' -a \
96+
\( \! -path './dist/*' -a \
97+
\( \! -path './assets/*' -a \
98+
\( \! -path './coverage/*' -a \
99+
\( "${matching_files[@]}" \) \
100+
\) \) \) \) \) \) \) \)
101+
102+
if [[ "$language" = bash ]]; then
103+
# add everything with a shell shebang too
104+
git grep --full-name -l '#!/bin/bash'
105+
git grep --full-name -l '#!/bin/sh'
106+
fi
107+
} | while read line; do
108+
if [[ "$(cat "$line" | replace_acceptable_years | head -n $expected_lines | shasum)" != "$expected_sha" ]]; then
109+
printf "\033[0;31mmissing headers in file '$line'!\033[0m\n"
110+
diff -u <(cat "$line" | replace_acceptable_years | head -n $expected_lines) "$tmp"
111+
exit 1
112+
fi
113+
done
114+
printf "\033[0;32mokay.\033[0m\n"
115+
)
116+
done
117+
118+
rm "$tmp"
119+
120+
# printf "=> Checking for broken links in documentation... "
121+
# find . -name node_modules -prune -o -name \*.md -print0 | xargs -0 -n1 npx markdown-link-check
122+
# printf "\033[0;32mokay.\033[0m\n"

src/utilities/native.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-require-imports */
21
//===----------------------------------------------------------------------===//
32
//
43
// This source file is part of the VS Code Swift open source project
@@ -12,7 +11,7 @@
1211
// SPDX-License-Identifier: Apache-2.0
1312
//
1413
//===----------------------------------------------------------------------===//
15-
14+
/* eslint-disable @typescript-eslint/no-require-imports */
1615
import * as vscode from "vscode";
1716

1817
// To not electron-rebuild for every platform and arch, we want to

0 commit comments

Comments
 (0)