Page MenuHomePhabricator

[native] Clean up `detect_abis.sh`
ClosedPublic

Authored by abosh on Aug 16 2022, 1:02 PM.
Tags
None
Referenced Files
F3396186: D4851.id15694.diff
Sun, Dec 1, 10:54 AM
Unknown Object (File)
Fri, Nov 29, 6:00 AM
Unknown Object (File)
Fri, Nov 29, 5:54 AM
Unknown Object (File)
Fri, Nov 29, 4:12 AM
Unknown Object (File)
Fri, Nov 8, 1:55 PM
Unknown Object (File)
Fri, Nov 8, 1:42 PM
Unknown Object (File)
Tue, Nov 5, 8:14 AM
Unknown Object (File)
Oct 10 2024, 5:13 AM

Details

Summary

Relevant Linear issue here. D4717 was my original code to fix this, but it ended up breaking yarn react-native run-android.

Turns out the problematic code was writing if [[ ! $found ]] instead of if [[ "$found" = false ]] since in bash ! returns true for any nonempty string (and found is nonempty even when it's equal to false). Once I changed that, yarn react-native run-android builds successfully.

Test Plan

Along with ShellCheck, ran yarn react-native run-android successfully.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

native/android/app/bash/detect_abis.sh
12–17 ↗(On Diff #15680)

This code loops through ABIS to see if ABI is in there already, setting found to true if it's found.

19–20 ↗(On Diff #15680)

This is where the code was breaking yarn react-native run-android before. Now that found is compared to the string false instead of using [[ ! $found ]], ABI is only added to ABIS if it wasn't found in there before.

Would prefer to use associative arrays, but can't guarantee bash4+ is available until after move to nix dev

native/android/app/bash/detect_abis.sh
19–20 ↗(On Diff #15680)

You should always quote a value when testing, as if it's unset, then it will likely not be what you intended [[ -z "$found" ]];

This revision is now accepted and ready to land.Aug 16 2022, 4:37 PM
native/android/app/bash/detect_abis.sh
19–20 ↗(On Diff #15680)

Ah I missed this! Thank you.

Would prefer to use associative arrays, but can't guarantee bash4+ is available until after move to nix dev

Same :( Associative arrays are so much cleaner

Quote false in [[ ]].

This revision was landed with ongoing or failed builds.Aug 16 2022, 6:10 PM
This revision was automatically updated to reflect the committed changes.