1*6777b538SAndroid Build Coastguard Worker# GN AST 2*6777b538SAndroid Build Coastguard Worker 3*6777b538SAndroid Build Coastguard WorkerA Python library for working with GN files via abstract syntax tree (AST). 4*6777b538SAndroid Build Coastguard Worker 5*6777b538SAndroid Build Coastguard Worker## JNI Refactor Example 6*6777b538SAndroid Build Coastguard Worker 7*6777b538SAndroid Build Coastguard WorkerThis library was originally created to perform the refactor within 8*6777b538SAndroid Build Coastguard Worker`jni_refactor.py`. The file is left as an example. 9*6777b538SAndroid Build Coastguard Worker 10*6777b538SAndroid Build Coastguard Worker```sh 11*6777b538SAndroid Build Coastguard Worker# To apply to all files: 12*6777b538SAndroid Build Coastguard Workerfind -name BUILD.gn > file-list.txt 13*6777b538SAndroid Build Coastguard Worker# To apply to those that match a pattern: 14*6777b538SAndroid Build Coastguard Workergrep -r --files-with-matches --include "BUILD.gn" "some pattern" > file-list.txt 15*6777b538SAndroid Build Coastguard Worker 16*6777b538SAndroid Build Coastguard Worker# To run one-at-a-time: 17*6777b538SAndroid Build Coastguard Workerfor f in $(cat file-list.txt); do python3 jni_refactor.py "$f"; done 18*6777b538SAndroid Build Coastguard Worker# To run in parallel: 19*6777b538SAndroid Build Coastguard Workerparallel python3 jni_refactor.py -- $(cat file-list.txt) 20*6777b538SAndroid Build Coastguard Worker``` 21