Skip to content

Commit 8724c41

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/move-map-hash-generator
2 parents fff7145 + ded3fcf commit 8724c41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3350
-0
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## PR Type
2+
3+
<!-- Select one and remove others. If an appropriate one is not listed, please write by yourself. -->
4+
5+
- New Feature
6+
- Improvement
7+
- Bug Fix
8+
9+
## Related Links
10+
11+
<!-- Please write related links to GitHub/Jira/Slack/etc. -->
12+
13+
## Description
14+
15+
<!-- Describe what this PR changes. -->
16+
17+
## Review Procedure
18+
19+
<!-- Explain how to review this PR. -->
20+
21+
## Remarks
22+
23+
<!-- Write remarks as you like if you need them. -->
24+
25+
## Pre-Review Checklist for the PR Author
26+
27+
**PR Author should check the checkboxes below when creating the PR.**
28+
29+
- [ ] Code follows [coding guidelines][coding-guidelines]
30+
- [ ] Assign PR to reviewer
31+
32+
## Checklist for the PR Reviewer
33+
34+
**Reviewers should check the checkboxes below before approval.**
35+
36+
- [ ] Commits are properly organized and messages are according to the guideline
37+
- [ ] Code follows [coding guidelines][coding-guidelines]
38+
- [ ] (Optional) Unit tests have been written for new behavior
39+
- [ ] PR title describes the changes
40+
41+
## Post-Review Checklist for the PR Author
42+
43+
**PR Author should check the checkboxes below before merging.**
44+
45+
- [ ] All open points are addressed and tracked via issues or tickets
46+
- [ ] Write [release notes][release-notes]
47+
48+
## CI Checks
49+
50+
- **Build and test for PR / build-and-test-pr**: Required to pass before the merge.
51+
- **Build and test for PR / clang-tidy-pr**: NOT required to pass before the merge. It is up to the reviewer(s).
52+
- **Check spelling**: NOT required to pass before the merge. It is up to the reviewer(s). See [here][spell-check-dict] if you want to add some words to the spell check dictionary.
53+
54+
[coding-guidelines]: https://tier4.atlassian.net/wiki/spaces/AIP/pages/1194394777/T4
55+
[release-notes]: https://tier4.atlassian.net/wiki/spaces/AIP/pages/563774416
56+
[spell-check-dict]: https://github.com/tier4/autoware-spell-check-dict#how-to-contribute
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: sync main for develop
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 19 * * *" # run at 4 AM JST
7+
8+
jobs:
9+
sync-main-for-develop:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- name: Generate Token
13+
uses: tibdex/github-app-token@v1
14+
id: generate-token
15+
with:
16+
app_id: ${{ secrets.APP_ID }}
17+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
18+
19+
- name: Create Pull Request
20+
uses: tier4/github-actions/create-sync-main-pull-request@main
21+
id: create-pull-request
22+
with:
23+
token: ${{ steps.generate-token.outputs.token }}
24+
base-branch: develop
25+
main-branch: main
26+
sync-branch: sync-main-for-develop
27+
28+
- name: Enable Auto-merge
29+
if: steps.create-pull-request.outputs.pull-request-operation == 'created'
30+
uses: peter-evans/enable-pull-request-automerge@v1
31+
with:
32+
token: ${{ steps.generate-token.outputs.token }}
33+
pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }}
34+
merge-method: merge
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: sync public
2+
3+
on:
4+
schedule:
5+
- cron: "0 19 * * *" # run at 4 AM JST
6+
workflow_dispatch:
7+
8+
env:
9+
BASE_BRANCH: develop
10+
SYNC_TARGET_BRANCH: develop
11+
SYNC_TARGET_REPOSITORY: https://github.com/tier4/AutowareArchitectureProposal_api_adaptor.git
12+
13+
jobs:
14+
sync-public:
15+
runs-on: ubuntu-20.04
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
with:
21+
ref: ${{ env.BASE_BRANCH }}
22+
fetch-depth: 0
23+
24+
- name: Generate token
25+
uses: tibdex/github-app-token@v1
26+
id: generate-token
27+
with:
28+
app_id: ${{ secrets.PROPOSAL_SYNC_APP_ID }}
29+
private_key: ${{ secrets.PROPOSAL_SYNC_APP_PRIVATE_KEY }}
30+
31+
- name: Set git config for private repositories
32+
run: |
33+
git config --local --unset-all http.https://github.com/.extraheader || true
34+
git config --global url.https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com.insteadOf 'https://github.com'
35+
36+
- name: Push to public repository
37+
run: |
38+
git remote add public ${{ env.SYNC_TARGET_REPOSITORY }}
39+
git fetch public
40+
git push public ${{ env.BASE_BRANCH }}:${{ env.SYNC_TARGET_BRANCH }}

.github/workflows/sync-public.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: sync public
2+
3+
on:
4+
schedule:
5+
- cron: "0 19 * * *" # run at 4 AM JST
6+
workflow_dispatch:
7+
8+
env:
9+
BASE_BRANCH: main
10+
SYNC_TARGET_BRANCH: main
11+
SYNC_TARGET_REPOSITORY: https://github.com/tier4/AutowareArchitectureProposal_api_adaptor.git
12+
13+
jobs:
14+
sync-public:
15+
runs-on: ubuntu-20.04
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
with:
21+
ref: ${{ env.BASE_BRANCH }}
22+
fetch-depth: 0
23+
24+
- name: Generate token
25+
uses: tibdex/github-app-token@v1
26+
id: generate-token
27+
with:
28+
app_id: ${{ secrets.PROPOSAL_SYNC_APP_ID }}
29+
private_key: ${{ secrets.PROPOSAL_SYNC_APP_PRIVATE_KEY }}
30+
31+
- name: Set git config for private repositories
32+
run: |
33+
git config --local --unset-all http.https://github.com/.extraheader || true
34+
git config --global url.https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com.insteadOf 'https://github.com'
35+
36+
- name: Push to public repository
37+
run: |
38+
git remote add public ${{ env.SYNC_TARGET_REPOSITORY }}
39+
git fetch public
40+
git push public ${{ env.BASE_BRANCH }}:${{ env.SYNC_TARGET_BRANCH }}

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Autoware High Level API

autoware_api_generator/CMakeLists.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
project(autoware_api_generator)
3+
4+
find_package(ament_cmake REQUIRED)
5+
6+
if(BUILD_TESTING)
7+
find_package(ament_lint_auto REQUIRED)
8+
ament_lint_auto_find_test_dependencies()
9+
endif()
10+
11+
install(
12+
DIRECTORY cmake config resource script template
13+
DESTINATION share/${PROJECT_NAME}
14+
)
15+
16+
ament_package(CONFIG_EXTRAS "autoware_api_generator-extras.cmake")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2021 Tier IV, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
include("${autoware_api_generator_DIR}/autoware_api_generate_library.cmake")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Copyright 2021 Tier IV, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
macro(autoware_api_generate_library target)
16+
17+
# init path settings
18+
normalize_path(_build_path "${CMAKE_CURRENT_BINARY_DIR}/autoware_api_generator")
19+
normalize_path(_share_path "${autoware_api_generator_DIR}/..")
20+
21+
# parse and check
22+
cmake_parse_arguments(_ARG "USE_GROUP_PATH" "REMAP;EXTRA" "SPECS" ${ARGN})
23+
if(NOT _ARG_REMAP)
24+
set(_remap_file "${_share_path}/config/remap.yaml")
25+
else()
26+
set(_remap_file "${CMAKE_CURRENT_SOURCE_DIR}/${_ARG_REMAP}")
27+
endif()
28+
if(NOT _ARG_EXTRA)
29+
set(_extra_file "${_share_path}/config/extra.yaml")
30+
else()
31+
set(_extra_file "${CMAKE_CURRENT_SOURCE_DIR}/${_ARG_EXTRA}")
32+
endif()
33+
34+
# create specification file list
35+
set(_spec_files "")
36+
list(APPEND _spec_files "${_share_path}/resource/external.yaml")
37+
list(APPEND _spec_files "${_share_path}/resource/internal.yaml")
38+
39+
# create generating file list
40+
set(_target_api_names "")
41+
set(_target_cpp_files "")
42+
set(_target_py_files "")
43+
set(_target_cmake_files "")
44+
foreach(_api ${_ARG_UNPARSED_ARGUMENTS})
45+
string(REGEX REPLACE "^/+" "" _api "${_api}")
46+
if(NOT ${_ARG_USE_GROUP_PATH})
47+
string(REGEX REPLACE "^[^/]+" "" _api "${_api}")
48+
string(REGEX REPLACE "^/+" "" _api "${_api}")
49+
endif()
50+
list(APPEND _target_api_names "${_api}")
51+
list(APPEND _target_cpp_files "${_build_path}/cpp/${_api}.hpp")
52+
list(APPEND _target_py_files "${_build_path}/py/${_api}.py")
53+
list(APPEND _target_cmake_files "${_build_path}/cmake/${_api}.cmake")
54+
endforeach()
55+
56+
# set dependencies for main target
57+
set(autoware_api_generator_TARGET "${target}")
58+
add_custom_target(${autoware_api_generator_TARGET} ALL SOURCES ${_spec_files} ${_remap_file})
59+
add_custom_target(${autoware_api_generator_TARGET}__cmake SOURCES ${_target_cmake_files})
60+
61+
# set dependencies for cpp target
62+
add_custom_target(${autoware_api_generator_TARGET}__cpp SOURCES ${_target_cpp_files})
63+
add_dependencies(${autoware_api_generator_TARGET} ${autoware_api_generator_TARGET}__cpp)
64+
65+
# set dependencies for py target
66+
add_custom_target(${autoware_api_generator_TARGET}__py SOURCES ${_target_py_files})
67+
add_dependencies(${autoware_api_generator_TARGET} ${autoware_api_generator_TARGET}__py)
68+
69+
# use a temporary file to avoid long command
70+
file(WRITE "${_build_path}/list.txt" "${_target_api_names}")
71+
72+
# generate configure_file scripts
73+
add_custom_command(
74+
OUTPUT ${_target_cmake_files}
75+
COMMAND python3 ${_share_path}/script/configure.py
76+
"--package" ${PROJECT_NAME}
77+
"--build" ${_build_path}/cmake
78+
"--names" ${_build_path}/list.txt
79+
"--remap" ${_remap_file}
80+
"--extra" ${_extra_file}
81+
"--specs" ${_spec_files}
82+
DEPENDS
83+
${_share_path}/script/configure.py
84+
${_build_path}/list.txt
85+
${_remap_file}
86+
${_spec_files}
87+
)
88+
89+
# generate cpp file from configure_file script
90+
foreach(_api ${_target_api_names})
91+
set(_api_output "${_build_path}/cpp/${_api}.hpp")
92+
set(_api_script "${_build_path}/cmake/${_api}.cmake")
93+
add_custom_command(
94+
OUTPUT ${_api_output}
95+
COMMAND ${CMAKE_COMMAND}
96+
-D INPUT=${_share_path}/template/cpp
97+
-D OUTPUT=${_api_output}
98+
-P ${_api_script}
99+
DEPENDS
100+
${_share_path}/template/cpp/service.in
101+
${_share_path}/template/cpp/topic.in
102+
${autoware_api_generator_TARGET}__cmake
103+
)
104+
endforeach()
105+
106+
# generate py file from configure_file script
107+
foreach(_api ${_target_api_names})
108+
set(_api_output "${_build_path}/py/${_api}.py")
109+
set(_api_script "${_build_path}/cmake/${_api}.cmake")
110+
add_custom_command(
111+
OUTPUT ${_api_output}
112+
COMMAND ${CMAKE_COMMAND}
113+
-D INPUT=${_share_path}/template/py
114+
-D OUTPUT=${_api_output}
115+
-P ${_api_script}
116+
DEPENDS
117+
${_share_path}/template/py/service.in
118+
${_share_path}/template/py/topic.in
119+
${autoware_api_generator_TARGET}__cmake
120+
)
121+
endforeach()
122+
123+
# install generated cpp files
124+
if(EXISTS ${_build_path})
125+
install(
126+
DIRECTORY ${_build_path}/cpp/
127+
DESTINATION include/${PROJECT_NAME}
128+
PATTERN *.hpp
129+
)
130+
ament_export_include_directories(include)
131+
endif()
132+
133+
# install generated py files
134+
file(WRITE ${_build_path}/py/__init__.py "")
135+
ament_python_install_package(${PROJECT_NAME} PACKAGE_DIR "${_build_path}/py")
136+
137+
endmacro(autoware_api_generate_library)
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
library-cpp:
2+
service:
3+
header: rclcpp/rclcpp.hpp
4+
service: rclcpp::Service
5+
client: rclcpp::Client
6+
topic:
7+
header: rclcpp/rclcpp.hpp
8+
subscription: rclcpp::Subscription
9+
publisher: rclcpp::Publisher
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

autoware_api_generator/package.xml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
5+
<name>autoware_api_generator</name>
6+
<version>0.0.0</version>
7+
<description>The autoware_api_generator package</description>
8+
<maintainer email="isamu.takagi@tier4.jp">Takagi, Isamu</maintainer>
9+
<license>Apache License 2.0</license>
10+
11+
<buildtool_depend>ament_cmake</buildtool_depend>
12+
13+
<export>
14+
<build_type>ament_cmake</build_type>
15+
</export>
16+
17+
</package>

0 commit comments

Comments
 (0)