Skip to content

Commit b1a630a

Browse files
author
Scott Sandler
authored
add devcontainer support by default to support local debugging (#91)
1 parent c230ddd commit b1a630a

File tree

4 files changed

+87
-2
lines changed

4 files changed

+87
-2
lines changed

.devcontainer/devcontainer.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// For format details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "Hack",
4+
"image": "hhvm/hhvm:4.153-latest",
5+
6+
// Set *default* container specific settings.json values on container create.
7+
"userEnvProbe": "loginShell",
8+
9+
// Add the IDs of extensions you want installed when the container is created.
10+
"extensions": [
11+
"pranayagarwal.vscode-hack"
12+
],
13+
14+
"mounts": [],
15+
16+
"remoteEnv": {},
17+
18+
// Use 'postCreateCommand' to run commands after the container is created.
19+
"postCreateCommand": "bin/setup-devcontainer"
20+
21+
}

.gitignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ www.pid
44
*.orig
55
*~
66
composer.lock
7-
.vscode
7+
/.vscode/*
8+
!/.vscode/launch.json
9+
/.idea
810
**/*hhast.parser-cache
911
.var
10-
composer.phar
12+
composer.phar

.vscode/launch.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "HHVM: Run tests in debugger",
9+
"type": "hhvm",
10+
"request": "launch",
11+
"cwd":"${workspaceFolder}",
12+
// 'hhvmargs' come before 'script' when invoking HHVM, so the actual script
13+
// is hacktest, with 'script' passed as the final arg, as an arg to hacktest
14+
"script": "${file}",
15+
"hhvmArgs": ["${workspaceFolder}/vendor/hhvm/hacktest/bin/hacktest.hack", "--"]
16+
}
17+
]
18+
}

bin/setup-devcontainer

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Set up this repository for running bin/health-score
6+
# This is similar to build-docker.sh, but that is optimized for production
7+
# See also bin/setup-dev
8+
9+
hhvm_version="4.153"
10+
11+
if ! hhvm --version | grep -q "$hhvm_version"; then
12+
echo "HHVM $hhvm_version is required"
13+
echo "Current version:" $(hhvm --version | grep "HipHop VM")
14+
exit 1
15+
fi
16+
17+
if [[ $# -gt 0 && "$1" == "--reset" ]]; then
18+
echo "Resetting all existing setup..."
19+
rm -rf .bundle composer.phar vendor
20+
fi
21+
22+
# From https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
23+
echo "Installing composer..."
24+
ls composer.phar >/dev/null 2>/dev/null || (curl -O https://getcomposer.org/download/2.1.5/composer.phar
25+
EXPECTED_SIGNATURE="be95557cc36eeb82da0f4340a469bad56b57f742d2891892dcb2f8b0179790ec"
26+
if ! shasum --algorithm 256 composer.phar | grep -q "$EXPECTED_SIGNATURE"; then
27+
>&2 echo 'ERROR: Invalid installer signature'
28+
rm composer.phar
29+
exit 1
30+
fi)
31+
chmod a+x composer.phar
32+
echo ""
33+
34+
# Show versions
35+
echo "VERSIONS"
36+
hhvm --version
37+
php composer.phar --version
38+
echo ""
39+
40+
# Install dependencies
41+
echo "Installing dependencies..."
42+
php composer.phar install
43+
echo ""
44+

0 commit comments

Comments
 (0)