Merge "bazel: document IntelliJ plugin, and remove homebrew script."
This commit is contained in:
@@ -117,6 +117,20 @@ Note that when building an individual plugin, the `core.zip` package
|
||||
is not regenerated.
|
||||
|
||||
|
||||
|
||||
[[IDEs]]
|
||||
== Using an IDE.
|
||||
|
||||
=== IntelliJ
|
||||
|
||||
The Gerrit build works with Bazel's [IntelliJ
|
||||
plugin](https://ij.bazel.io). Do the following:
|
||||
|
||||
* Install the plugin (requires IJ 2016.2 or newer)
|
||||
* Select "File > Import Bazel project".
|
||||
* Select "Workspace": (directory holding gerrit source)
|
||||
* Select "project view: generate from BUILD": (enter top level BUILD file)
|
||||
|
||||
[[documentation]]
|
||||
=== Documentation
|
||||
|
||||
|
@@ -1,72 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script sets up a 'bazel_external' libraries for maven jars and Auto classes.
|
||||
#
|
||||
# To use:
|
||||
#
|
||||
# * Start IntelliJ
|
||||
# * Go to "project structure" (Ctrl-Alt-Shift-S),
|
||||
# * Go to "Libraries",
|
||||
# * Right click "bazel_external"
|
||||
# * Select "Add to Module"
|
||||
# * Select all modules, click OK
|
||||
# * Click "Apply"
|
||||
|
||||
mkdir -p .idea/libraries/
|
||||
dest=.idea/libraries/bazel_external.xml
|
||||
|
||||
cat <<EOF > $dest
|
||||
<component name="libraryTable">
|
||||
<library name="bazel_external">
|
||||
<CLASSES>
|
||||
EOF
|
||||
|
||||
for jar in $(bazel query --nohost_deps --output=location 'kind(file,deps(kind(java_import,deps(//...))))' | grep 'source file .*jar$' | sed 's|/BUILD:[0-9]*:[0-9]*: source file [^:]*:|/|' ); do
|
||||
cat <<EOF >> $dest
|
||||
<root url="jar://$jar!/" />
|
||||
EOF
|
||||
done
|
||||
|
||||
cat <<EOF >> $dest
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
EOF
|
||||
|
||||
dest=.idea/libraries/bazel_autogen.xml
|
||||
cat <<EOF > $dest
|
||||
<component name="libraryTable">
|
||||
<library name="bazel_autogen">
|
||||
<CLASSES />
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
EOF
|
||||
|
||||
not_found=""
|
||||
|
||||
for dep in $(bazel query 'rdeps(//...,//lib/auto:auto-value,1) - //lib/auto:auto-value'); do
|
||||
root=$(echo $dep | sed 's|//\(.*\):\(.*\)|bazel-bin/\1/_javac/\2/lib\2_sourcegenfiles|g')
|
||||
if [[ ! -d $root ]]; then
|
||||
# for some reason, tests don't have the "lib" prefix.
|
||||
root=$(echo $dep | sed 's|//\(.*\):\(.*\)|bazel-bin/\1/_javac/\2/\2_sourcegenfiles|g')
|
||||
fi
|
||||
if [[ ! -d $root ]]; then
|
||||
not_found="$not_found $root"
|
||||
fi
|
||||
cat <<EOF >> $dest
|
||||
<root url="file://\$PROJECT_DIR\$/$root" />
|
||||
EOF
|
||||
done
|
||||
|
||||
cat <<EOF >> $dest
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
EOF
|
||||
|
||||
|
||||
if [[ -n "$not_found" ]]; then
|
||||
echo "some generated roots were missing. Did you run 'bazel build' yet?"
|
||||
fi
|
Reference in New Issue
Block a user