-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathupdate_submodules.bat
More file actions
56 lines (48 loc) · 2 KB
/
update_submodules.bat
File metadata and controls
56 lines (48 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
::
:: Copyright (C) 2025-2026 HERE Europe B.V.
::
:: 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.
::
:: SPDX-License-Identifier: Apache-2.0
:: License-Filename: LICENSE
::
@echo off
setlocal
:: ----------------------------------------------------------------------------
:: Script to initialize, update, and checkout a specific submodule to a fixed commit
:: This script is for projects where submodule content is not modified directly.
:: ----------------------------------------------------------------------------
:: Define the submodule path and desired commit ID to sync to
set "SUBMODULE_PATH=assets/here-icons"
set "HERE_ICON_LIBRARY_COMMIT_ID=f17e4cb733c1cafb5dfd9e5298a007af390f8153"
:: Step 1: Initialize and update the submodule recursively
echo Initializing and updating submodules...
git submodule update --init --recursive
:: Check if the submodule update was successful
if errorlevel 1 (
echo Failed to initialize and update submodules.
exit /b 1
)
:: Step 2: Checkout the submodule to a fixed commit ID
:: This is useful when you want to pin the submodule to a specific version
echo Checking out submodule "%SUBMODULE_PATH%" to commit %HERE_ICON_LIBRARY_COMMIT_ID%...
pushd "%SUBMODULE_PATH%"
git checkout %HERE_ICON_LIBRARY_COMMIT_ID% --force
if errorlevel 1 (
echo Failed to checkout commit %HERE_ICON_LIBRARY_COMMIT_ID% in submodule "%SUBMODULE_PATH%".
popd
exit /b 1
)
popd
echo Submodule synced to commit %HERE_ICON_LIBRARY_COMMIT_ID% successfully.
endlocal
exit /b 0