-
-
Save touchopia/6148922 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # begin config section | |
| SOURCE=src | |
| BUILD=dist | |
| MAINCLASS=CrosswordApp | |
| UNCRUSTIFY=uncrustify.cfg | |
| OWNPACKAGES="com.hovercatsw uk.ac.soton" | |
| # end of config section | |
| TARGET=$BUILD/$MAINCLASS.java | |
| COMPLETE=`tempfile --prefix=flatten` | |
| TEMP=`tempfile --prefix=flatten` | |
| find src -name '*.java' | xargs cat | grep -v package >$COMPLETE | |
| mkdir -p $BUILD | |
| grep "^import" <$COMPLETE | sort -d | uniq >$TARGET | |
| for pkg in $OWNPACKAGES | |
| do | |
| grep -v $pkg <$TARGET >$TEMP | |
| cat $TEMP > $TARGET | |
| done | |
| grep -v "^import" <$COMPLETE | sed "s/^public //" | sed "s/class $MAINCLASS/public class $MAINCLASS/" >>$TARGET | |
| uncrustify -c $UNCRUSTIFY --replace --no-backup $TARGET | |
| rm -f $TEMP $COMPLETE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment