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