Skip to content

Commit

Permalink
vscode: add the "clean", "unit test" and "code sytle check" tasks in …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
davidhopper2003 authored and ycool committed Mar 9, 2018
1 parent b8c908e commit bbc6d6d
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 4 deletions.
66 changes: 66 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,72 @@
"message": 5
}
}
},
{
"label": "run all unit tests for the apollo project",
"type": "shell",
// you can change the "build" option to others acording to the "apollo.sh" file
"command": "bash apollo_docker.sh test",
// format the error message
"problemMatcher": {
"owner": "cc",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "code style check for the apollo project",
"type": "shell",
// you can change the "build" option to others acording to the "apollo.sh" file
"command": "bash apollo_docker.sh lint",
// format the error message
"problemMatcher": {
"owner": "cc",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "clean the apollo project",
"type": "shell",
// you can change the "build" option to others acording to the "apollo.sh" file
"command": "bash apollo_docker.sh clean",
// format the error message
"problemMatcher": {
"owner": "cc",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
4 changes: 2 additions & 2 deletions apollo_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ function start_build_docker() {
docker ps --format "{{.Names}}" | grep apollo_dev 1>/dev/null 2>&1
if [ $? != 0 ]; then
# If Google is reachable, we fetch the docker image directly.
if ping -q -c 1 -W 1 www.google.com >/dev/null; then
if ping -q -c 1 -W 1 www.google.com 1>/dev/null 2>&1; then
opt=""
# If Google is unreachable but Baidu reachable, we fetch the docker image from China.
elif ping -q -c 1 -W 1 www.baidu.com >/dev/null; then
elif ping -q -c 1 -W 1 www.baidu.com 1>/dev/null 2>&1; then
opt="-C"
# If Baidu is unreachable, we use local images.
else
Expand Down
10 changes: 8 additions & 2 deletions docs/howto/how_to_build_and_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The command will push your most recent release docker image to the docker hub.

## <span id="build_in_vscode">Build in Visual Studio Code</span>
### Install VSCode
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:
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:
```bash
sudo dpkg -i <file>.deb
sudo apt-get install -f # Install dependencies
Expand All @@ -62,8 +62,14 @@ code
Use the keyboard shortcut (Ctrl+K Ctrl+O) to open the Apollo project.
### Build the Apollo project in VSCode
Use the keyboard shortcut (Ctrl+Shift+B) to build the Apollo project.
### Run all unit tests for the Apollo project in VSCode
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.
### Run a code style check task for the Apollo project in VSCode
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.
### Clean the Apollo project in VSCode
Select the "Tasks->Run Tasks..." menu command and click "clean the apollo project" from a popup menu to clean the Apollo project.
### Change the building option
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"
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"

## <span id="test">Test</span>
```bash
Expand Down

0 comments on commit bbc6d6d

Please sign in to comment.