Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and cache relay list per configuration excluding Release #7797

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

buggmagnet
Copy link
Contributor

@buggmagnet buggmagnet commented Mar 11, 2025

This PR changes the relays-prebuild.sh script to :

  • Cache a relay list per configuration
  • Automatically switch the relays.json file to the correct configuration
  • Not download the relays list when the build scheme specifies a Release build.

This change is Reviewable

@buggmagnet buggmagnet added the iOS Issues related to iOS label Mar 11, 2025
@buggmagnet buggmagnet self-assigned this Mar 11, 2025
Copy link

linear bot commented Mar 11, 2025

pinkisemils
pinkisemils previously approved these changes Mar 11, 2025
Copy link
Collaborator

@pinkisemils pinkisemils left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


ios/relays-prebuild.sh line 10 at r1 (raw file):

# Do not download the file for release builds, a different script will take care of that.
if [ "$CONFIGURATION" == "Release" ]; then
  return 0

This is technically out of spec, but this script should fail loudly if there is no relay list exists at this point, IMO. Failing loudly would help us identify a case where we have forgotten to commit the relay list for a given release build :)


ios/relays-prebuild.sh line 13 at r1 (raw file):

fi

BACKUP_FILE="$CONFIGURATION_TEMP_DIR/relays.json"

Why not namespace it like $CONFIGURATION_TEMP_DIR/relays.json.$CONFIGURATION? Then we're not overwriting the other file when switching between builds, this can help with the not that likely case of allowing builds to continue to work when offline.

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

Will this implementation do what we want it to do?

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


ios/relays-prebuild.sh line 13 at r1 (raw file):

Previously, pinkisemils (Emīls Piņķis) wrote…

Why not namespace it like $CONFIGURATION_TEMP_DIR/relays.json.$CONFIGURATION? Then we're not overwriting the other file when switching between builds, this can help with the not that likely case of allowing builds to continue to work when offline.

Is this directory ever cleared? If not, after being built once the same file will be reused every time, which isn't what we want.

Copy link
Contributor Author

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


ios/relays-prebuild.sh line 13 at r1 (raw file):

Why not namespace it

As the name implies, $CONFIGURATION_TEMP_DIR is a temp directory specifically tied to the $CONFIGURATION parameter, as such the whole folder is name spaced instead of the file itself.

Is this directory ever cleared?

Yes, when you issue a clean command to Xcode

We get to control exactly when we want a fresh file.

@buggmagnet buggmagnet force-pushed the always-refresh-relay-file-opportunistically-ios-1097 branch from efe1ffd to 377d95c Compare March 12, 2025 08:52
Copy link
Contributor Author

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, all discussions resolved (waiting on @pinkisemils and @rablador)


ios/relays-prebuild.sh line 10 at r1 (raw file):

Previously, pinkisemils (Emīls Piņķis) wrote…

This is technically out of spec, but this script should fail loudly if there is no relay list exists at this point, IMO. Failing loudly would help us identify a case where we have forgotten to commit the relay list for a given release build :)

I added that loud failure, but I didn't test it from the CLI. I couldn't see any echo statements from within Xcode, so I'm hoping that running a build from the CLI (Which is what the CI is doing I assume) will display the error message.

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

N/m that, I forgot to remove comment.

Reviewable status: 0 of 1 files reviewed, all discussions resolved (waiting on @pinkisemils)

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


ios/relays-prebuild.sh line 13 at r1 (raw file):

Previously, buggmagnet wrote…

Why not namespace it

As the name implies, $CONFIGURATION_TEMP_DIR is a temp directory specifically tied to the $CONFIGURATION parameter, as such the whole folder is name spaced instead of the file itself.

Is this directory ever cleared?

Yes, when you issue a clean command to Xcode

We get to control exactly when we want a fresh file.

That's nice I think, although a little opaque to the user. Maybe we should add a line to the ReadMe to indicate this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS Issues related to iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants