Skip to content

Instantly share code, notes, and snippets.

@gkossakowski
Forked from adriaanm/eclipsify_sbt.sh
Created October 19, 2012 00:54
Show Gist options
  • Save gkossakowski/3915650 to your computer and use it in GitHub Desktop.
Save gkossakowski/3915650 to your computer and use it in GitHub Desktop.
rewire sbt's directory structure so it adheres to a standard eclipse can deal with
#!/bin/sh
BASE=$HOME/git/xsbt/
for SRC in `find $BASE -not -path '*/src*/*' -name '*.scala'`;do
PKG=`grep "^\s*package " $SRC | perl -pse 's/\s*package\s*(\w*?)\b/package $1/' | tr -d '\r' | tr -d ';' | cut -d' ' -f2 | tr '\n.' '//'`
mkdir -p `dirname $SRC`/src/main/scala/$PKG
ln -s $SRC `dirname $SRC`/src/main/scala/$PKG`basename $SRC`
done
for SRC in `find $BASE -path '*/target/src_managed/*' -name '*.scala'`;do
PKG=`grep "^\s*package " $SRC | perl -pse 's/\s*package\s*(\w*?)\b/package $1/' | tr -d '\r' | tr -d ';' | cut -d' ' -f2 | tr '\n.' '//'`
TGT=`dirname $SRC | perl -pe 's/src_managed/src_managed-sane/'`
mkdir -p $TGT/scala/$PKG
ln -s $SRC $TGT/scala/$PKG`basename $SRC`
done
mkdir -p $BASE/ivy/src/main/java-sane/sbt/
ln -s $BASE/ivy/src/main/java/ResolverAdapter.java $BASE/ivy/src/main/java-sane/sbt/ResolverAdapter.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment