Skip to content

Android getting started: try to finally fix the name of the previous SDK#1400

Open
finagolfin wants to merge 1 commit into
swiftlang:mainfrom
finagolfin:get-fix
Open

Android getting started: try to finally fix the name of the previous SDK#1400
finagolfin wants to merge 1 commit into
swiftlang:mainfrom
finagolfin:get-fix

Conversation

@finagolfin
Copy link
Copy Markdown
Member

@federicobucchi, please take a look, I see you used slice in the index.md, as I'm a Jekyll noob.

@finagolfin finagolfin requested a review from a team as a code owner April 28, 2026 04:58
@finagolfin finagolfin marked this pull request as draft April 28, 2026 04:58
{% assign previous_releases = site.data.builds.swift_releases | offset:1 %}
{% assign previous_sdk_name = previous_releases.last.name | append: "_android" %}
{% assign release_count = site.data.builds.swift_releases.size %}
{% assign previous_release = site.data.builds.swift_releases | slice: release_count - 2 %}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

2 because these arrays are zero-indexed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch on the zero-indexing.
slice returns an array here, not a single release object, so I am not sure if previous_release.name would work as expected.
Can you try:

{% assign release_count = site.data.builds.swift_releases.size %}
{% assign previous_release = site.data.builds.swift_releases[release_count | minus: 2] %}
{% assign previous_sdk_name = previous_release.name | append: "_android" %}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

slice returns an array here, not a single release object, so I am not sure if previous_release.name would work as expected.

Are you sure? The doc indicates otherwise when a single number is specified, like I do here, but I have not tested it locally.

If you have a local setup you can try this out on, that would be great. 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You may be right — I was thinking of the general array slicing behavior. Looking at the Liquid docs again, it does seem that passing a single index may return the element directly rather than a sub-array.
I have not tested it locally yet, so I cannot say with certainty.
I didn't test it locally for time constraints, but I would highly recommend to test changes locally

Make sure to remove any old Android SDKs you have installed:

```console
$ swift sdk remove {{previous_sdk_name}}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need to uninstall the previous SDK? Is it because the swift sdk doesn’t recognize the toolchain associated with the installed SDK?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, exactly, it will fail using the build command we give if both versions of the Android SDK are installed. I want to get that working better by submitting this SwiftPM fix for the next patch release, swiftlang/swift-package-manager#9955, after which we can tell people to use that full command instead and remove this caution.

For the next 6.4 release, we should get SDK version checking working, which would be the easiest to use, but will require more work on our end to set that up.

@finagolfin finagolfin marked this pull request as ready for review April 28, 2026 16:05
@finagolfin
Copy link
Copy Markdown
Member Author

Hmm, Federico not too active here lately, I think this will finally work.

@finagolfin
Copy link
Copy Markdown
Member Author

@shahmishal, did I finally get this working? 🥲

@finagolfin
Copy link
Copy Markdown
Member Author

@shahmishal, I think we can get this in, should work. If not, I'll finally get it setup locally, which I've been trying to avoid for this single foray into Liquid templating. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants