aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Carmi Grushko <carmi@google.com>2015-11-19 14:07:21 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-11-19 16:47:56 +0000
commitd30ae4daafba3d1aad7dd15f988116ecf43a2d7f (patch)
treec5110dcdc0b06d5acbea40799bd8167bade4c48b
parent5f048979364f9c9dcad8a7c941f43865e27b227f (diff)
When setting up an IntelliJ project for Bazel, point at the AutoValue annotation processor, and add its output directory to the source tree.
-- MOS_MIGRATED_REVID=108239745
-rwxr-xr-xscripts/setup-intellij.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/setup-intellij.sh b/scripts/setup-intellij.sh
index ea8e2b8453..424b0ba97f 100755
--- a/scripts/setup-intellij.sh
+++ b/scripts/setup-intellij.sh
@@ -49,6 +49,7 @@ cat >>$compiler_file <<'EOF'
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="true">
+ <processor name="com.google.auto.value.processor.AutoValueProcessor" />
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
@@ -57,13 +58,16 @@ cat >>$compiler_file <<'EOF'
EOF
readonly iml_file=bazel.iml
-# The content root output/classes is used for generated sources, specifically
-# AutoValue.
+# Code generated by AutoValue is put in $MODULE_DIR/out/generated; adding it as a Source Root
+# allows IntelliJ to find it while editing. (that is, generated classes won't be marked as unknown.)
cat > $iml_file <<EOH
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://\$MODULE_DIR\$/out" />
+ <content url="file://\$MODULE_DIR$/out/generated">
+ <sourceFolder url="file://\$MODULE_DIR$/out/generated" isTestSource="false" generated="true" />
+ </content>
<orderEntry type="inheritedJdk" />
<content url="file://\$MODULE_DIR\$/src">
EOH
@@ -150,3 +154,6 @@ cat >> $iml_file <<'EOF'
</component>
</module>
EOF
+
+echo
+echo Done. Project file: $iml_file