Skip to content
Merged
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions check_dependent_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ this_repo="$2"
this_repo_diener_arg="$3"
dependent_repo="$4"
github_api_token="$5"
update_crates_on_default_branch="$6"

this_repo_dir="$PWD"
github_api="https://api.github.com"
Expand Down Expand Up @@ -151,6 +152,15 @@ match_their_crates() {

patch_and_check_dependent() {
match_their_crates "$(basename "$PWD")"

# Update the crates to the latest version.
#
# This is for example needed if there was a pr to Substrate that only required a Polkadot companion
# and Cumulus wasn't yet updated to use the latest commit of Polkadot.
for update in $update_crates_on_default_branch; do
cargo update -p $update
done

diener patch --crates-to-patch "$this_repo_dir" "$this_repo_diener_arg" --path "Cargo.toml"
eval "${COMPANION_CHECK_COMMAND:-cargo check --all-targets --workspace}"
}
Expand All @@ -171,6 +181,7 @@ process_companion_pr() {
fi

if [ "$companion_repo" != "$dependent_repo" ]; then
echo "companion repo $companion_repo doesn't match dependent repo $dependent_repo. Check that you pasted the pure link to the companion."
return
fi

Expand Down Expand Up @@ -266,6 +277,14 @@ main() {
git clone --depth 1 "https://github.com/$org/$dependent_repo.git"
pushd "$dependent_repo" >/dev/null

# Update the crates to the latest version.
#
# This is for example needed if there was a pr to Substrate that only required a Polkadot companion
# and Cumulus wasn't yet updated to use the latest commit of Polkadot.
for update in $update_crates_on_default_branch; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it needs to be run 2 times here and in patch_and_check_dependent()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are 2 different code paths.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question, but it's not a big deal to run cargo update 2 times, worst case nothing happens

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are different code paths. Both are not called together.

cargo update -p $update
done

patch_and_check_dependent

popd >/dev/null
Expand Down