Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/mt-dependency-update-baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ jobs:
fetch-depth: 0 # fetch all (not required util release build)
- name: MT check out submodules
run: ./checkout_submodules.sh
- name: MT check out all git submodule closest branch
- name: MT switch all git submodule closest branch
if: github.event_name == 'pull_request'
run: |
echo "[MT] > Checking out submodules closest branch, '$MT_BRANCH_NAME' or '$MT_TARGET_BRANCH_NAME' or '$MT_DEFAULT_BRANCH_NAME':"
git submodule foreach 'git checkout $MT_BRANCH_NAME || git checkout $MT_TARGET_BRANCH_NAME || git checkout $MT_DEFAULT_BRANCH_NAME'
echo "[MT] > Switching submodules closest branch, '$MT_BRANCH_NAME' or '$MT_TARGET_BRANCH_NAME' or '$MT_DEFAULT_BRANCH_NAME':"
git submodule foreach 'git switch $MT_BRANCH_NAME || git switch $MT_TARGET_BRANCH_NAME || git switch $MT_DEFAULT_BRANCH_NAME'
echo "[MT] > Showing submodules current branch:"
git submodule foreach 'git branch --show-current'
- name: MT check out this module repo build branch
- name: MT switch this module repo build branch
run: |
REPOSITORY_OWNER_AND_NAME=${{ github.repository }};
REPOSITORY_NAME=$(basename $REPOSITORY_OWNER_AND_NAME);
echo "Repository name: '$REPOSITORY_NAME'."
echo "Fetching from repo '$REPOSITORY_NAME':"
git -C $REPOSITORY_NAME fetch -v --all;
echo "Checking our this repo '$REPOSITORY_NAME' workflow branch '$MT_BRANCH_NAME':"
echo "Switching this repo '$REPOSITORY_NAME' workflow branch '$MT_BRANCH_NAME':"
git -C $REPOSITORY_NAME switch $MT_BRANCH_NAME;
echo "Pulling from repo '$REPOSITORY_NAME':"
git -C $REPOSITORY_NAME pull -v;
Expand Down
6 changes: 3 additions & 3 deletions cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ function cleanupDirectory() {
continue;
fi
local S_FILE_NAME_DEST=${S_FILE_NAME#"MT"}; # MT+filename used to ignore ".gitignore"
if [[ "$S_FILE_NAME_DEST" == *MTSTAR ]]; then
S_FILE_NAME_DEST_STARTS_WITH=${S_FILE_NAME_DEST%MTSTAR};
S_FILE_NAME_DEST_LIST=$(find ${DEST_FILE_PATH}/ -mindepth 1 -maxdepth 1 -name "$S_FILE_NAME_DEST_STARTS_WITH*" -exec basename {} \; | xargs);
if [[ "$S_FILE_NAME_DEST" == *MTSTAR* ]]; then
S_FILE_NAME_DEST_REGEX=${S_FILE_NAME_DEST//MTSTAR*/*};
S_FILE_NAME_DEST_LIST=$(find ${DEST_FILE_PATH}/ -mindepth 1 -maxdepth 1 -name "$S_FILE_NAME_DEST_REGEX" -exec basename {} \; | xargs);
else # just use file name
S_FILE_NAME_DEST_LIST="$S_FILE_NAME_DEST";
fi
Expand Down
2 changes: 1 addition & 1 deletion code_sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ echo "--------------------------------------------------------------------------
echo "> Checkout branch '$GIT_BRANCH'...";
git submodule foreach git fetch -v --all;
git submodule foreach git branch -v -a;
git submodule foreach git checkout $GIT_BRANCH;
git submodule foreach git switch $GIT_BRANCH;
# git submodule foreach git switch --guess $GIT_BRANCH; # EXPERIMENTAL
RESULT=$?;
if [[ ${RESULT} -ne 0 ]]; then
Expand Down
2 changes: 2 additions & 0 deletions commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ function printGitStatus() {
echo "> [GIT STATUS & LOG]...";
echo "'$(basename $PWD)'"
git config --get remote.origin.url;
echo "> status:";
git status -sb;
STAGED_DIFF=$(git diff --cached | head -n $DIFF_LIMIT);
if [ -n "$STAGED_DIFF" ]; then
Expand All @@ -276,6 +277,7 @@ function printGitStatus() {
echo "$LOG";
echo "--------------------------------------------------";
git submodule foreach "
echo \"> status:\";
git status -sb;
git config --get remote.origin.url;
STAGED_DIFF=\$(git diff --cached | head -n $DIFF_LIMIT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ if [ -f "${FILE_1_PNG}" ]; then
exit 0; # compat w/ manually created file
else
echo ">> File '$FILE_1_PNG' already exist: overriding image... (MT_GENERATE_IMAGES=$MT_GENERATE_IMAGES)";
rm -f "${FILE_1_PNG}";
Comment thread
mmathieum marked this conversation as resolved.
checkResult $?;
fi
fi

rm -f "${FILE_1_PNG}";
checkResult $?;

CONFIG_DIR="${ROOT_DIR}/config";
if [ ! -d "$CONFIG_DIR" ]; then
echo "$CONFIG_DIR doesn't exist!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ if [ -f "${FILE_1_PNG}" ]; then
exit 0; # compat w/ manually created file
else
echo ">> File '$FILE_1_PNG' already exist: overriding image... (MT_GENERATE_IMAGES=$MT_GENERATE_IMAGES)";
rm -f "${FILE_1_PNG}";
Comment thread
mmathieum marked this conversation as resolved.
checkResult $?;
fi
fi

rm -f "${FILE_1_PNG}";
checkResult $?;

$ROOT_DIR/commons-android/pub/module-hi-res-app-icon.sh; # uses inkscape
checkResult $?;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#!/bin/bash
SCRIPT_DIR="$(dirname "$0")";

ROOT_DIR="$SCRIPT_DIR/../../../../../../..";
COMMONS_DIR="${ROOT_DIR}/commons";
source ${COMMONS_DIR}/commons.sh;

setIsCI;

setGitProjectName;

echo ">> Generating mipmap-*/module_app_icon.[png|xml]...";

APP_ANDROID_DIR="${ROOT_DIR}/app-android";
SRC_DIR="${APP_ANDROID_DIR}/src";
MAIN_DIR="${SRC_DIR}/main";
RES_DIR="${MAIN_DIR}/res";
VALUES_DIR="${RES_DIR}/values"
mkdir -p "${VALUES_DIR}";
checkResult $?;

### values/module_app_icon_color.xml - START

COLOR_FILE_NAME_XML="module_app_icon_color.xml"
COLOR_FILE_XML="${VALUES_DIR}/${COLOR_FILE_NAME_XML}";
if [ -f "${COLOR_FILE_XML}" ]; then
echo ">> File '$COLOR_FILE_XML' already exist."; # compat with existing values/module_app_icon_color.xml
else
requireCommand "xmllint" "libxml2-utils";
requireCommand "jq";
GTFS_RDS_VALUES_GEN_FILE="$VALUES_DIR/gtfs_rts_values_gen.xml"; # do not change to avoid breaking compat w/ old modules
BIKE_STATION_VALUES_FILE="$VALUES_DIR/bike_station_values.xml";
AGENCY_JSON_FILE="$ROOT_DIR/config/gtfs/agency.json";
COLOR=""
if [ -f $GTFS_RDS_VALUES_GEN_FILE ]; then #1st because color computed
echo "> Agency file: '$GTFS_RDS_VALUES_GEN_FILE'."
COLOR=$(xmllint --xpath "//resources/string[@name='gtfs_rts_color']/text()" "$GTFS_RDS_VALUES_GEN_FILE")
elif [ -f $AGENCY_JSON_FILE ]; then
echo "> Agency file: '$AGENCY_JSON_FILE'."
COLOR=$(jq -r '.default_color // empty' "$AGENCY_JSON_FILE")
elif [ -f $BIKE_STATION_VALUES_FILE ]; then
echo "> Agency file: '$BIKE_STATION_VALUES_FILE'."
COLOR=$(xmllint --xpath "//resources/string[@name='bike_station_color']/text()" "$BIKE_STATION_VALUES_FILE")
Comment thread
mmathieum marked this conversation as resolved.
else
echo "> No agency file! (rds:$GTFS_RDS_VALUES_GEN_FILE|json:$AGENCY_JSON_FILE|bike:$BIKE_STATION_VALUES_FILE)"
exit 1 # error
fi
echo " - color: $COLOR"
if [ -z "$COLOR" ]; then
echo " > No color found for agency type!"
exit 1 # error
fi
rm -f "${COLOR_FILE_XML}";
checkResult $?;
touch "${COLOR_FILE_XML}";
checkResult $?;
cat >>"${COLOR_FILE_XML}" <<EOL
<?xml version="1.0" encoding="utf-8"?>
<!-- DO NOT EDIT: this file is generated by mtransitapps/commons:shared-modules/app-android/src/main/res/MTmipmap-MTSTAR/MTmodule_app_icon.MTSTAR.MT.sh -->
<resources>
<color name="module_app_icon_color">#${COLOR}</color>
</resources>
EOL
if [[ ${IS_CI} = true ]]; then
echo "---------------------------------------------------------------------------------------------------------------"
cat "${COLOR_FILE_XML}"; #DEBUG
echo "---------------------------------------------------------------------------------------------------------------"
fi
Comment thread
mmathieum marked this conversation as resolved.
fi

### values/module_app_icon_color.xml - END

### mipmap-anydpi-v26/module_app_icon.xml - START

FILE_NAME_XML="module_app_icon.xml"
MIPMAP_ANYDPI="${RES_DIR}/mipmap-anydpi-v26"
mkdir -p "${MIPMAP_ANYDPI}";
checkResult $?;
FILE_XML="${MIPMAP_ANYDPI}/${FILE_NAME_XML}";
if [ -f "${FILE_XML}" ]; then
echo ">> File '$FILE_XML' already exist."; # compat with existing mipmap-anydpi-v26/module_app_icon.xml
else
rm -f "${FILE_XML}";
checkResult $?;
touch "${FILE_XML}";
checkResult $?;
cat >>"${FILE_XML}" <<EOL
<?xml version="1.0" encoding="utf-8"?>
<!-- DO NOT EDIT: this file is generated by mtransitapps/commons:shared-modules/app-android/src/main/res/MTmipmap-MTSTAR/MTmodule_app_icon.MTSTAR.MT.sh -->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/module_app_icon_color" />
<foreground android:drawable="@mipmap/module_app_icon_foreground" />
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
</adaptive-icon>
EOL
if [[ ${IS_CI} = true ]]; then
echo "---------------------------------------------------------------------------------------------------------------"
cat "${FILE_XML}"; #DEBUG
echo "---------------------------------------------------------------------------------------------------------------"
fi
fi

$ROOT_DIR/commons-android/pub/module-res-mipmap-launcher-icon-adaptive.sh;
checkResult $?;
Comment thread
mmathieum marked this conversation as resolved.

### mipmap-anydpi-v26/module_app_icon.xml - END

### mipmap-*/module_app_icon.png - START

REQUIRED_ICON_FILE="${MAIN_DIR}/play/listings/en-US/graphics/icon/1.png";
if [ ! -f "$REQUIRED_ICON_FILE" ]; then
$ROOT_DIR/commons/shared-modules/app-android/src/main/play/listings/en-US/graphics/icon/MT1.png.MT.sh;
checkResult $?;
fi

FILE_NAME="module_app_icon.png";
for DENSITY in mdpi hdpi xhdpi xxhdpi xxxhdpi; do
MIPMAP_DIR="${RES_DIR}/mipmap-${DENSITY}"
FILE_PNG="${MIPMAP_DIR}/${FILE_NAME}"
mkdir -p "${MIPMAP_DIR}"
checkResult $?;
if [ -f "${FILE_PNG}" ]; then
if [[ ${MT_GENERATE_IMAGES} != true ]]; then
echo ">> File '$FILE_PNG' already exist."; # compat with existing mipmap-*/module_app_icon.png
exit 0; # compat w/ manually created file
else
echo ">> File '$FILE_PNG' already exist: overriding image... (MT_GENERATE_IMAGES=$MT_GENERATE_IMAGES)";
rm -f "${FILE_PNG}";
checkResult $?;
fi
fi
done

$ROOT_DIR/commons-android/pub/module-res-mipmap-launcher-icon.sh;
checkResult $?;

### mipmap-*/module_app_icon.png - END

echo ">> Generating mipmap-*/module_app_icon.[png|xml]... DONE";

This file was deleted.

2 changes: 1 addition & 1 deletion shared-overwrite/.github/workflows/mt-download-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: MT setup
if: steps.check-input-url.outputs.has_input_url == 'true'
id: mt-setup
uses: mtransitapps/gh-actions/.github/actions/setup@v1.0.1
uses: mtransitapps/gh-actions/.github/actions/setup@v1.1.2
with:
code-sync: ${{ github.ref == format('refs/heads/{0}', env.MT_DEFAULT_BRANCH_NAME) }}

Expand Down
Loading