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
diff --git a/scripts/setup-intellij.sh b/scripts/setup-intellij.sh
index ea8e2b8..424b0ba 100755
--- a/scripts/setup-intellij.sh
+++ b/scripts/setup-intellij.sh
@@ -49,6 +49,7 @@
     </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 @@
 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 @@
   </component>
 </module>
 EOF
+
+echo
+echo Done. Project file: $iml_file