OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 |
| 3 # This script will create a deep snapshot of all Observatory package |
| 4 # dependencies. The output will be in observatory_pub_packages which |
| 5 # then should be committed to third_party/observatory_pub_packages. |
| 6 |
| 7 |
| 8 PUBSPEC_INPUT="pubspec.template" |
| 9 PUBSPEC_OUTPUT="pubspec.yaml" |
| 10 PACKAGES_INPUT="packages" |
| 11 PACKAGES_OUTPUT="observatory_pub_packages" |
| 12 |
| 13 if [ ! -d "../maintainers" ]; then |
| 14 echo "Please run this script from the maintainers directory" |
| 15 exit |
| 16 fi |
| 17 |
| 18 if [ ! -f $PUBSPEC_INPUT ]; then |
| 19 echo "Cannot find $PUBSPEC_INPUT" |
| 20 exit |
| 21 fi |
| 22 |
| 23 # Cleanup leftovers |
| 24 rm -f $PUBSPEC_OUTPUT |
| 25 rm -rf $PACKAGES_INPUT |
| 26 rm -rf $PACKAGES_OUTPUT |
| 27 |
| 28 # Setup for pub get run |
| 29 cp $PUBSPEC_INPUT $PUBSPEC_OUTPUT |
| 30 |
| 31 # Run pub get |
| 32 pub get |
| 33 |
| 34 # Prepare for output |
| 35 mkdir $PACKAGES_OUTPUT |
| 36 |
| 37 OUTPUT_BASE=`realpath $PACKAGES_OUTPUT` |
| 38 # Copy necessary files |
| 39 pushd $PACKAGES_INPUT > /dev/null |
| 40 for i in *; do |
| 41 ACTUAL_PATH=`realpath $i` |
| 42 mkdir $OUTPUT_BASE/$i |
| 43 mkdir $OUTPUT_BASE/$i/lib |
| 44 cp $ACTUAL_PATH/../pubspec.yaml $OUTPUT_BASE/$i/pubspec.yaml |
| 45 rsync -Lr $ACTUAL_PATH/* $OUTPUT_BASE/$i/lib |
| 46 done |
| 47 popd > /dev/null |
| 48 |
| 49 echo '***' |
| 50 echo 'Dumping package dependencies:': |
| 51 echo '' |
| 52 echo 'dependency_overrides:' |
| 53 pushd $PACKAGES_OUTPUT > /dev/null |
| 54 for i in *; do |
| 55 echo -e " $i:\n path: ../../third_party/$PACKAGES_OUTPUT/$i" |
| 56 done |
| 57 popd > /dev/null |
| 58 echo '' |
| 59 echo '***' |
| 60 echo -n 'Now run: rsync -a --delete observatory_pub_packages/ ' |
| 61 echo '~/workspace/dart-third_party/observatory_pub_packages/' |
| 62 echo '***' |
OLD | NEW |