Android getting started: try to finally fix the name of the previous SDK#1400
Android getting started: try to finally fix the name of the previous SDK#1400finagolfin wants to merge 1 commit into
Conversation
| {% 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 %} |
There was a problem hiding this comment.
2 because these arrays are zero-indexed.
There was a problem hiding this comment.
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" %}There was a problem hiding this comment.
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. 👍
There was a problem hiding this comment.
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}} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
Hmm, Federico not too active here lately, I think this will finally work. |
|
@shahmishal, did I finally get this working? 🥲 |
|
@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. 😉 |
@federicobucchi, please take a look, I see you used
slicein theindex.md, as I'm a Jekyll noob.