Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
60c7d38b
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
60c7d38b
编写于
11月 06, 2017
作者:
A
Aaron Xiao
提交者:
Jiangtao Hu
11月 06, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Data: Get commit ID upon every compiling.
上级
6cf158a6
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
130 addition
and
37 deletion
+130
-37
apollo.sh
apollo.sh
+8
-2
modules/data/conf/task_info_template.pb.txt
modules/data/conf/task_info_template.pb.txt
+0
-0
modules/data/recorder/BUILD
modules/data/recorder/BUILD
+8
-0
modules/data/recorder/info_collector.cc
modules/data/recorder/info_collector.cc
+45
-28
modules/data/recorder/info_collector.h
modules/data/recorder/info_collector.h
+17
-7
modules/data/recorder/update_task_info.cc
modules/data/recorder/update_task_info.cc
+52
-0
未找到文件。
apollo.sh
浏览文件 @
60c7d38b
...
...
@@ -126,6 +126,12 @@ function build() {
# Build python proto
build_py_proto
# Update task info template on compiling, but don't check in.
bazel-bin/modules/data/recorder/update_task_info
\
--commit_id
=
$(
git rev-parse HEAD
)
git update-index
--assume-unchanged
\
modules/data/conf/task_info_template.pb.txt
}
function
cibuild
()
{
...
...
@@ -300,8 +306,8 @@ function release() {
# release info
META
=
${
ROOT_DIR
}
/meta.txt
echo
"Git commit:
$(
git
show
--oneline
-s
|
awk
'{print $1}'
)
"
>
$META
echo
"Build time:
$
TIME
"
>>
$META
echo
"Git commit:
$(
git
rev-parse HEAD
)
"
>
$META
echo
"Build time:
$
(
get_now
)
"
>>
$META
}
function
gen_coverage
()
{
...
...
modules/data/conf/task_info_template.pb.txt
0 → 100644
浏览文件 @
60c7d38b
modules/data/recorder/BUILD
浏览文件 @
60c7d38b
...
...
@@ -13,4 +13,12 @@ cc_library(
],
)
cc_binary
(
name
=
"update_task_info"
,
srcs
=
[
"update_task_info.cc"
],
deps
=
[
":info_collector"
,
],
)
cpplint
()
modules/data/recorder/info_collector.cc
浏览文件 @
60c7d38b
...
...
@@ -19,53 +19,70 @@
#include "modules/canbus/common/canbus_gflags.h"
#include "modules/common/adapters/adapter_manager.h"
DEFINE_string
(
task_info_template_file
,
"modules/data/conf/task_info_template.pb.txt"
,
"Path of the task info template file."
);
namespace
apollo
{
namespace
data
{
Task
InfoCollector
::
GetTaskInfo
()
{
Task
task
;
*
task
.
mutable_vehicle
()
=
GetVehicleInfo
();
*
task
.
mutable_environment
()
=
GetEnvironmentInfo
();
*
task
.
mutable_hardware
()
=
GetHardwareInfo
();
*
task
.
mutable_software
()
=
GetSoftwareInfo
();
*
task
.
mutable_user
()
=
GetUserInfo
();
return
task
;
using
apollo
::
common
::
util
::
GetProtoFromASCIIFile
;
using
apollo
::
common
::
util
::
GetProtoFromFile
;
using
apollo
::
common
::
util
::
SetProtoToASCIIFile
;
InfoCollector
::
InfoCollector
()
:
task_info_
(
LoadTaskInfoTemplate
())
{
}
const
Task
&
InfoCollector
::
GetTaskInfo
()
{
// Use MergeFrom to override the template.
GetVehicleInfo
();
GetEnvironmentInfo
();
GetHardwareInfo
();
GetSoftwareInfo
();
GetUserInfo
();
return
task_info_
;
}
VehicleInfo
InfoCollector
::
GetVehicleInfo
()
{
VehicleInfo
vehicle
;
const
VehicleInfo
&
InfoCollector
::
GetVehicleInfo
()
{
VehicleInfo
*
vehicle
=
task_info_
.
mutable_vehicle
()
;
static
auto
*
chassis_detail
=
CHECK_NOTNULL
(
apollo
::
common
::
adapter
::
AdapterManager
::
GetChassisDetail
());
if
(
!
chassis_detail
->
Empty
())
{
*
vehicle
.
mutable_license
()
=
chassis_detail
->
GetLatestObserved
().
license
();
*
vehicle
->
mutable_license
()
=
chassis_detail
->
GetLatestObserved
().
license
();
}
CHECK
(
apollo
::
common
::
util
::
GetProtoFromFile
(
FLAGS_canbus_conf_file
,
vehicle
.
mutable_canbus_conf
()));
CHECK
(
apollo
::
common
::
util
::
GetProtoFromFile
(
FLAGS_vehicle_config_path
,
vehicle
.
mutable_vehicle_config
()));
return
vehicle
;
CHECK
(
GetProtoFromFile
(
FLAGS_canbus_conf_file
,
vehicle
->
mutable_canbus_conf
()));
CHECK
(
GetProtoFromFile
(
FLAGS_vehicle_config_path
,
vehicle
->
mutable_vehicle_config
()));
return
*
vehicle
;
}
// TODO(xiaoxq): Implement the info getters.
EnvironmentInfo
InfoCollector
::
GetEnvironmentInfo
()
{
EnvironmentInfo
environment
;
return
environment
;
const
EnvironmentInfo
&
InfoCollector
::
GetEnvironmentInfo
()
{
return
task_info_
.
environment
();
}
const
HardwareInfo
&
InfoCollector
::
GetHardwareInfo
()
{
return
task_info_
.
hardware
();
}
const
SoftwareInfo
&
InfoCollector
::
GetSoftwareInfo
()
{
return
task_info_
.
software
();
}
HardwareInfo
InfoCollector
::
GetHardwareInfo
()
{
HardwareInfo
hardware
;
return
hardware
;
const
UserInfo
&
InfoCollector
::
GetUserInfo
()
{
return
task_info_
.
user
();
}
SoftwareInfo
InfoCollector
::
GetSoftwareInfo
()
{
SoftwareInfo
software
;
return
software
;
Task
InfoCollector
::
LoadTaskInfoTemplate
()
{
Task
task_info
;
CHECK
(
GetProtoFromASCIIFile
(
FLAGS_task_info_template_file
,
&
task_info
));
return
task_info
;
}
UserInfo
InfoCollector
::
GetUserInfo
()
{
UserInfo
user
;
return
user
;
bool
InfoCollector
::
SaveTaskInfoTemplate
(
const
Task
&
task_info
)
{
return
SetProtoToASCIIFile
(
task_info
,
FLAGS_task_info_template_file
);
}
}
// namespace data
...
...
modules/data/recorder/info_collector.h
浏览文件 @
60c7d38b
...
...
@@ -28,15 +28,25 @@ namespace data {
class
InfoCollector
{
public:
// Get task information, which doesn't contain TaskData.
static
Task
GetTaskInfo
();
InfoCollector
();
// Get task information.
const
Task
&
GetTaskInfo
();
// Get specific information.
// Listening topics: ChassisDetail.
static
VehicleInfo
GetVehicleInfo
();
static
EnvironmentInfo
GetEnvironmentInfo
();
static
HardwareInfo
GetHardwareInfo
();
static
SoftwareInfo
GetSoftwareInfo
();
static
UserInfo
GetUserInfo
();
const
VehicleInfo
&
GetVehicleInfo
();
const
EnvironmentInfo
&
GetEnvironmentInfo
();
const
HardwareInfo
&
GetHardwareInfo
();
const
SoftwareInfo
&
GetSoftwareInfo
();
const
UserInfo
&
GetUserInfo
();
// Load and save the task information template.
static
Task
LoadTaskInfoTemplate
();
static
bool
SaveTaskInfoTemplate
(
const
Task
&
task_info
);
private:
Task
task_info_
;
};
}
// namespace data
...
...
modules/data/recorder/update_task_info.cc
0 → 100644
浏览文件 @
60c7d38b
/******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "gflags/gflags.h"
#include "modules/common/log.h"
#include "modules/data/recorder/info_collector.h"
DEFINE_string
(
docker_image
,
""
,
"Current container's docker image."
);
DEFINE_string
(
commit_id
,
""
,
"Current commit ID."
);
namespace
apollo
{
namespace
data
{
void
UpdateTaskInfo
()
{
Task
task
=
InfoCollector
::
LoadTaskInfoTemplate
();
// Update software information.
auto
*
software
=
task
.
mutable_software
();
if
(
!
FLAGS_docker_image
.
empty
())
{
software
->
set_docker_image
(
FLAGS_docker_image
);
}
if
(
!
FLAGS_commit_id
.
empty
())
{
software
->
set_commit_id
(
FLAGS_commit_id
);
}
CHECK
(
InfoCollector
::
SaveTaskInfoTemplate
(
task
));
}
}
// namespace data
}
// namespace apollo
int
main
(
int
argc
,
char
**
argv
)
{
google
::
InitGoogleLogging
(
argv
[
0
]);
google
::
ParseCommandLineFlags
(
&
argc
,
&
argv
,
true
);
apollo
::
data
::
UpdateTaskInfo
();
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录