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

Bundle a pre-generated relay list instead of generating one on android #7518

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

Conversation

Pururun
Copy link
Contributor

@Pururun Pururun commented Jan 24, 2025

For dev builds we rely on the app to download the relay list from the api. This will make the app behave a bit weird if it is not able to download the relay list

For release builds on release branches we will generate a relay list and commit it to the branch. This will then be used by the app and thus release builds will have a bundled relays.json.

This is required for reproducible builds.


This change is Reviewable

@Pururun Pururun added the Android Issues related to Android label Jan 24, 2025
@Pururun Pururun self-assigned this Jan 24, 2025
Copy link

linear bot commented Jan 24, 2025

@Pururun Pururun marked this pull request as ready for review January 24, 2025 13:51
Copy link
Collaborator

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 5 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Pururun)


android/app/build.gradle.kts line 299 at r2 (raw file):

}

tasks.register("ensureRelayListExist") {

Perhaps we could skip checking this build time and just doing it in the extractFile function? In other words crash if the list is missing for builds where we expect it to exist.


prepare-release.sh line 75 at r2 (raw file):

    
    git add dist-assets/relays/relays.json
    git commit -S -m "Bundle relay list" \

I suggest changing to something like: Add relay list to bundle with $PRODUCT_VERSION

Code quote:

Bundle relay list

Copy link
Member

@faern faern left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 5 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @Pururun)


prepare-release.sh line 73 at r2 (raw file):

    mkdir dist-assets/relays
    cargo run -q -p mullvad-api --bin relay_list > dist-assets/relays/relays.json
    

Nit, but whitespaces 🙈


prepare-release.sh line 74 at r2 (raw file):

    cargo run -q -p mullvad-api --bin relay_list > dist-assets/relays/relays.json
    
    git add dist-assets/relays/relays.json

You don't need to add it, you specify the path to git commit below already.


android/app/build.gradle.kts line 334 at r2 (raw file):

    val localProperties = gradleLocalProperties(rootProject.projectDir, providers)
    val versionName = generateVersionName(localProperties)
    return versionName.contains("dev")

I know this is not new in this PR. But on desktop we check if the version contains "-dev-" and not just "dev". I think this is more resilient to accidentally matching something as dev even if it's more nitpicky than maybe needed here and now.

@Pururun Pururun requested review from kl and removed request for Rawa January 24, 2025 17:24
Copy link
Contributor Author

@Pururun Pururun 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: 2 of 8 files reviewed, 3 unresolved discussions (waiting on @albin-mullvad and @faern)


prepare-release.sh line 73 at r2 (raw file):

Previously, faern (Linus Färnstrand) wrote…

Nit, but whitespaces 🙈

Done


prepare-release.sh line 74 at r2 (raw file):

Previously, faern (Linus Färnstrand) wrote…

You don't need to add it, you specify the path to git commit below already.

Done


prepare-release.sh line 75 at r2 (raw file):

Previously, albin-mullvad wrote…

I suggest changing to something like: Add relay list to bundle with $PRODUCT_VERSION

Done


android/app/build.gradle.kts line 299 at r2 (raw file):

Previously, albin-mullvad wrote…

Perhaps we could skip checking this build time and just doing it in the extractFile function? In other words crash if the list is missing for builds where we expect it to exist.

Moved it to the function. It is a bit messy since service is its own module, but that could be fixed when the merge that app and service module.


android/app/build.gradle.kts line 334 at r2 (raw file):

Previously, faern (Linus Färnstrand) wrote…

I know this is not new in this PR. But on desktop we check if the version contains "-dev-" and not just "dev". I think this is more resilient to accidentally matching something as dev even if it's more nitpicky than maybe needed here and now.

Good feedback! Changed.

@albin-mullvad albin-mullvad requested a review from faern January 24, 2025 23:40
Copy link
Collaborator

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 6 of 6 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @faern)

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

Successfully merging this pull request may close these issues.

3 participants