From f93fbef8ecbcf1f09cd18632bd209dbf641f7c96 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 2 May 2014 10:21:56 +0200 Subject: IntelliJ project files Fixes compilation within IDEA. Allows compiling and running JUnit tests directly withing the IDE. --- build.xml | 3 +- src/intellij/README | 10 +++-- src/intellij/actors.iml.SAMPLE | 3 +- src/intellij/compiler.iml.SAMPLE | 7 +-- src/intellij/interactive.iml.SAMPLE | 4 +- src/intellij/library.iml.SAMPLE | 5 ++- src/intellij/manual.iml.SAMPLE | 5 ++- src/intellij/partest-extras.iml.SAMPLE | 27 ++++++++++++ src/intellij/partest-javaagent.iml.SAMPLE | 13 ++++++ src/intellij/reflect.iml.SAMPLE | 6 +-- src/intellij/repl.iml.SAMPLE | 4 +- src/intellij/scala-lang.ipr.SAMPLE | 72 +++++++++++++++++-------------- src/intellij/scaladoc.iml.SAMPLE | 9 ++-- src/intellij/scalap.iml.SAMPLE | 3 +- src/intellij/setup.sh | 15 ++----- src/intellij/test-junit.iml.SAMPLE | 30 +++++++++++++ src/intellij/test.iml.SAMPLE | 22 +++++++--- src/intellij/update.sh | 22 ++++++++++ 18 files changed, 188 insertions(+), 72 deletions(-) create mode 100644 src/intellij/partest-extras.iml.SAMPLE create mode 100644 src/intellij/partest-javaagent.iml.SAMPLE create mode 100644 src/intellij/test-junit.iml.SAMPLE create mode 100755 src/intellij/update.sh diff --git a/build.xml b/build.xml index 95ce2fe4e2..a66c138cbe 100755 --- a/build.xml +++ b/build.xml @@ -368,12 +368,13 @@ TODO: - + + diff --git a/src/intellij/README b/src/intellij/README index ade87749cd..a39691f4f0 100644 --- a/src/intellij/README +++ b/src/intellij/README @@ -1,8 +1,12 @@ Use the latest IntelliJ IDEA release and install the Scala plugin from within the IDE. +Compilation withing IDEA is performed in "-Dlocker.skip=1" mode: the sources are built +directly using the STARR compiler. + The following steps are required to use IntelliJ IDEA on Scala trunk - - compile "locker" using "ant locker.done". This will also download some JARs from - Maven to ./build/deps, which are included in IntelliJ's classpath. + - Run "ant init". This will download some JARs from to ./build/deps, which are + included in IntelliJ's classpath. - Run src/intellij/setup.sh - Open ./src/intellij/scala-lang.ipr in IntelliJ - - File, Project Settings, Project, SDK. Create an SDK entry named "1.6" containing the java 1.6 SDK + - File, Project Settings, Project, SDK. Create an SDK entry named "1.6" containing the + java 1.6 SDK diff --git a/src/intellij/actors.iml.SAMPLE b/src/intellij/actors.iml.SAMPLE index 896c4966ff..b15af8b110 100644 --- a/src/intellij/actors.iml.SAMPLE +++ b/src/intellij/actors.iml.SAMPLE @@ -4,7 +4,8 @@ diff --git a/src/intellij/compiler.iml.SAMPLE b/src/intellij/compiler.iml.SAMPLE index 9fb9cd55eb..50253000ab 100644 --- a/src/intellij/compiler.iml.SAMPLE +++ b/src/intellij/compiler.iml.SAMPLE @@ -4,7 +4,8 @@ @@ -19,8 +20,8 @@ - - + + diff --git a/src/intellij/interactive.iml.SAMPLE b/src/intellij/interactive.iml.SAMPLE index c6c8ebb606..83178021d3 100644 --- a/src/intellij/interactive.iml.SAMPLE +++ b/src/intellij/interactive.iml.SAMPLE @@ -4,7 +4,8 @@ @@ -23,3 +24,4 @@ + diff --git a/src/intellij/library.iml.SAMPLE b/src/intellij/library.iml.SAMPLE index cac53dff15..137ce6eb9c 100644 --- a/src/intellij/library.iml.SAMPLE +++ b/src/intellij/library.iml.SAMPLE @@ -4,8 +4,9 @@ diff --git a/src/intellij/manual.iml.SAMPLE b/src/intellij/manual.iml.SAMPLE index 3295a4a877..8babde73ea 100644 --- a/src/intellij/manual.iml.SAMPLE +++ b/src/intellij/manual.iml.SAMPLE @@ -4,7 +4,8 @@ @@ -18,8 +19,8 @@ - + diff --git a/src/intellij/partest-extras.iml.SAMPLE b/src/intellij/partest-extras.iml.SAMPLE new file mode 100644 index 0000000000..c2ada43493 --- /dev/null +++ b/src/intellij/partest-extras.iml.SAMPLE @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/intellij/partest-javaagent.iml.SAMPLE b/src/intellij/partest-javaagent.iml.SAMPLE new file mode 100644 index 0000000000..e47e0f6349 --- /dev/null +++ b/src/intellij/partest-javaagent.iml.SAMPLE @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/intellij/reflect.iml.SAMPLE b/src/intellij/reflect.iml.SAMPLE index 7d10522826..d206304896 100644 --- a/src/intellij/reflect.iml.SAMPLE +++ b/src/intellij/reflect.iml.SAMPLE @@ -4,8 +4,9 @@ @@ -19,7 +20,6 @@ - diff --git a/src/intellij/repl.iml.SAMPLE b/src/intellij/repl.iml.SAMPLE index fc78ffe8c2..83791f4f6e 100644 --- a/src/intellij/repl.iml.SAMPLE +++ b/src/intellij/repl.iml.SAMPLE @@ -4,7 +4,8 @@ @@ -23,3 +24,4 @@ + diff --git a/src/intellij/scala-lang.ipr.SAMPLE b/src/intellij/scala-lang.ipr.SAMPLE index a0765b3e99..c0614c946c 100644 --- a/src/intellij/scala-lang.ipr.SAMPLE +++ b/src/intellij/scala-lang.ipr.SAMPLE @@ -1,8 +1,5 @@ - - - - - + + + + + + @@ -41,11 +40,16 @@ - @@ -234,45 +241,46 @@ - - - - - - - - - - - - - + - - + - - - + - - + - - - + + + - + + + + + + + + + + + + + + + + + + diff --git a/src/intellij/scaladoc.iml.SAMPLE b/src/intellij/scaladoc.iml.SAMPLE index 07bea5bf5d..8f9a0d8344 100644 --- a/src/intellij/scaladoc.iml.SAMPLE +++ b/src/intellij/scaladoc.iml.SAMPLE @@ -4,7 +4,8 @@ @@ -20,8 +21,8 @@ - - - + + + diff --git a/src/intellij/scalap.iml.SAMPLE b/src/intellij/scalap.iml.SAMPLE index 77eea7c38f..27ae451369 100644 --- a/src/intellij/scalap.iml.SAMPLE +++ b/src/intellij/scalap.iml.SAMPLE @@ -4,7 +4,8 @@ diff --git a/src/intellij/setup.sh b/src/intellij/setup.sh index bd324ba5bd..ec303778ed 100755 --- a/src/intellij/setup.sh +++ b/src/intellij/setup.sh @@ -5,19 +5,10 @@ set -e export SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" -export BASE="$( cd "$( dirname "$0" )"/../.. && pwd )" echo "About to delete .ipr and .iml files and replace with the .SAMPLE files. Press enter to continue or CTRL-C to cancel." read -(rm -f *.ipr *.iml 2>/dev/null) -for f in $(ls "$SCRIPT_DIR"/*.SAMPLE); do - NEW_FILE=`echo $f | perl -pe 's/.SAMPLE//'`; - - cp $f $NEW_FILE - - # IntelliJ doesn't process the "compilerOptions" setting for variable - # replacement. If it did, we would just use "$PROJECT_DIR$". Instead, - # we do this replacement ourselves. - perl -pi -e 's/\$BASE_DIR\$/$ENV{"BASE"}/g' $NEW_FILE - echo "Created $NEW_FILE" +for f in "$SCRIPT_DIR"/*.SAMPLE; do + g=${f%.SAMPLE} + cp $f $g done diff --git a/src/intellij/test-junit.iml.SAMPLE b/src/intellij/test-junit.iml.SAMPLE new file mode 100644 index 0000000000..bb51c30a4f --- /dev/null +++ b/src/intellij/test-junit.iml.SAMPLE @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/intellij/test.iml.SAMPLE b/src/intellij/test.iml.SAMPLE index 423be2062c..cb4a8568a1 100644 --- a/src/intellij/test.iml.SAMPLE +++ b/src/intellij/test.iml.SAMPLE @@ -1,21 +1,31 @@ + + + + + + - + + + - - + - - - + + + diff --git a/src/intellij/update.sh b/src/intellij/update.sh new file mode 100755 index 0000000000..eb6fea782f --- /dev/null +++ b/src/intellij/update.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# +# Updates the .SAMPLE files with the current project files. +# + +set -e +export SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" + +echo "About to create overwrite the .ipr.SAMPLE and .iml.SAMPLE files with the current project files. Press enter to continue or CTRL-C to cancel." +read + +for f in "$SCRIPT_DIR"/*.{iml,ipr}; do + cp $f $f.SAMPLE +done + +for f in "$SCRIPT_DIR"/*.SAMPLE; do + g=${f%.SAMPLE} + if [[ ! -f $g ]]; then + echo "Stale sample file, deleting $f" + rm $f + fi +done -- cgit v1.2.3