HomePhabricator

[Cashtab] Overhaul the addGenerated.sh script

Description

[Cashtab] Overhaul the addGenerated.sh script

Summary:
This script just doesn't work. Here are some of the fixes:

  • Set bash to exit on failure
  • Fix the array of files creation/appending
  • Use an absolute path for the find root so the script can be run from anywhere
  • Only search in src/ to not override the node_modules files
  • Use proper quoting to prevent globbing expansion issues in the file names
  • Rewrite the array loop so it actually runs on each element, not only the first one
  • Build the @generated mark in a variable so the script is not marked as generated
  • Use proper indentation
  • Add the missing newline at the end of the file
  • Make sed compatible with BSD/OSX variant
  • Remove the unnecessary function
  • Remove the unnecessary exit code

The file being no longer marked as generated, this will let the linter do its magic and help preventing new issues from being introduced.

Ref T2030.

Test Plan:
On both OSX (Catalina) and Linux (Arch):
Remove the @generated mark from some of the files and run the script several times. Check the mark is added where missing but never duplicated.

Reviewers: #bitcoin_abc, bytesofman

Reviewed By: #bitcoin_abc, bytesofman

Subscribers: bytesofman, hungsam

Maniphest Tasks: T2030

Differential Revision: https://reviews.bitcoinabc.org/D10629

Details

Provenance
FabienAuthored on Dec 3 2021, 23:42
FabienPushed on Dec 6 2021, 08:09
Reviewer
Restricted Project
Differential Revision
D10629: [Cashtab] Overhaul the addGenerated.sh script
Parents
rABC527b5d07b687: [avalanche] Use the ProofPool multi index to store the orphan proofs
Branches
Unknown
Tags
Unknown
Tasks
Restricted Maniphest Task