Skip to content

Commit bbc6d6d

Browse files
davidhopper2003ycool
authored andcommitted
vscode: add the "clean", "unit test" and "code sytle check" tasks in the file: "./vscode/tasks.json" and improve the corresponding help document file: "docs/howto/how_to_build_and_release.md". A small bug is also fixed in the "start_build_docker" function of the file "apollo_docker.sh" when using vscode to pull the docker image from China. (ApolloAuto#3309)
* vscode: add the "clean" and "code sytle check" tasks in the file: "./vscode/tasks.json" and improve the corresponding help document file: "docs/howto/how_to_build_and_release.md". A small bug is also fixed in the "start_build_docker" function of the file "apollo_docker.sh" when using vscode to pull the docker image from China.
1 parent b8c908e commit bbc6d6d

File tree

3 files changed

+76
-4
lines changed

3 files changed

+76
-4
lines changed

.vscode/tasks.json

+66
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,72 @@
2626
"message": 5
2727
}
2828
}
29+
},
30+
{
31+
"label": "run all unit tests for the apollo project",
32+
"type": "shell",
33+
// you can change the "build" option to others acording to the "apollo.sh" file
34+
"command": "bash apollo_docker.sh test",
35+
// format the error message
36+
"problemMatcher": {
37+
"owner": "cc",
38+
"fileLocation": [
39+
"relative",
40+
"${workspaceFolder}"
41+
],
42+
"pattern": {
43+
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
44+
"file": 1,
45+
"line": 2,
46+
"column": 3,
47+
"severity": 4,
48+
"message": 5
49+
}
50+
}
51+
},
52+
{
53+
"label": "code style check for the apollo project",
54+
"type": "shell",
55+
// you can change the "build" option to others acording to the "apollo.sh" file
56+
"command": "bash apollo_docker.sh lint",
57+
// format the error message
58+
"problemMatcher": {
59+
"owner": "cc",
60+
"fileLocation": [
61+
"relative",
62+
"${workspaceFolder}"
63+
],
64+
"pattern": {
65+
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
66+
"file": 1,
67+
"line": 2,
68+
"column": 3,
69+
"severity": 4,
70+
"message": 5
71+
}
72+
}
73+
},
74+
{
75+
"label": "clean the apollo project",
76+
"type": "shell",
77+
// you can change the "build" option to others acording to the "apollo.sh" file
78+
"command": "bash apollo_docker.sh clean",
79+
// format the error message
80+
"problemMatcher": {
81+
"owner": "cc",
82+
"fileLocation": [
83+
"relative",
84+
"${workspaceFolder}"
85+
],
86+
"pattern": {
87+
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
88+
"file": 1,
89+
"line": 2,
90+
"column": 3,
91+
"severity": 4,
92+
"message": 5
93+
}
94+
}
2995
}
3096
]
3197
}

apollo_docker.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ function start_build_docker() {
4949
docker ps --format "{{.Names}}" | grep apollo_dev 1>/dev/null 2>&1
5050
if [ $? != 0 ]; then
5151
# If Google is reachable, we fetch the docker image directly.
52-
if ping -q -c 1 -W 1 www.google.com >/dev/null; then
52+
if ping -q -c 1 -W 1 www.google.com 1>/dev/null 2>&1; then
5353
opt=""
5454
# If Google is unreachable but Baidu reachable, we fetch the docker image from China.
55-
elif ping -q -c 1 -W 1 www.baidu.com >/dev/null; then
55+
elif ping -q -c 1 -W 1 www.baidu.com 1>/dev/null 2>&1; then
5656
opt="-C"
5757
# If Baidu is unreachable, we use local images.
5858
else

docs/howto/how_to_build_and_release.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The command will push your most recent release docker image to the docker hub.
4848

4949
## <span id="build_in_vscode">Build in Visual Studio Code</span>
5050
### Install VSCode
51-
The easiest way to install for Debian/Ubuntu based distributions is to download in https://code.visualstudio.com and install the .deb package (64-bit) either through the graphical software center if it's available or through the command line with:
51+
The easiest way to install for Debian/Ubuntu based distributions is to download from https://code.visualstudio.com and install the .deb package (64-bit) either through the graphical software center if it's available or through the command line with:
5252
```bash
5353
sudo dpkg -i <file>.deb
5454
sudo apt-get install -f # Install dependencies
@@ -62,8 +62,14 @@ code
6262
Use the keyboard shortcut (Ctrl+K Ctrl+O) to open the Apollo project.
6363
### Build the Apollo project in VSCode
6464
Use the keyboard shortcut (Ctrl+Shift+B) to build the Apollo project.
65+
### Run all unit tests for the Apollo project in VSCode
66+
Select the "Tasks->Run Tasks..." menu command and click "run all unit tests for the apollo project" from a popup menu to check the code style for the Apollo project.
67+
### Run a code style check task for the Apollo project in VSCode
68+
Select the "Tasks->Run Tasks..." menu command and click "code style check for the apollo project" from a popup menu to check the code style for the Apollo project.
69+
### Clean the Apollo project in VSCode
70+
Select the "Tasks->Run Tasks..." menu command and click "clean the apollo project" from a popup menu to clean the Apollo project.
6571
### Change the building option
66-
you can change the "build" option to an other one such as "build_gpu" (refer to the "apollo.sh" file for details) in ".vscode/tasks.json"
72+
You can change the "build" option to another one such as "build_gpu" (refer to the "apollo.sh" file for details) in ".vscode/tasks.json"
6773

6874
## <span id="test">Test</span>
6975
```bash

0 commit comments

Comments
 (0)