diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2016-09-12 10:20:42 +0000 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2016-09-12 10:43:58 +0000 |
commit | 6f1c61a6757cb28b2dec6bf31b815e51abd0fda9 (patch) | |
tree | 16b4a736999f0d4dbbdf7a5806a3d59e98a92e5b /scripts | |
parent | f33e8c0ee7ee7582b1b65d6a847b53dec122e5c9 (diff) |
Delete intellij script generator now that https://ij.bazel.io is live.
--
MOS_MIGRATED_REVID=132857927
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/get_all_bazel_paths.sh | 97 | ||||
-rw-r--r-- | scripts/resources/idea/.name | 1 | ||||
-rw-r--r-- | scripts/resources/idea/copyright/profiles_settings.xml | 3 | ||||
-rw-r--r-- | scripts/resources/idea/misc.xml | 19 | ||||
-rw-r--r-- | scripts/resources/idea/modules.xml | 8 | ||||
-rw-r--r-- | scripts/resources/idea/vcs.xml | 6 | ||||
-rwxr-xr-x | scripts/setup-intellij.sh | 170 |
7 files changed, 0 insertions, 304 deletions
diff --git a/scripts/get_all_bazel_paths.sh b/scripts/get_all_bazel_paths.sh deleted file mode 100755 index 2d9b04ab4c..0000000000 --- a/scripts/get_all_bazel_paths.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# Copyright 2015 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Gets all libraries needed for IDE support in Bazel - -set -eu - -cd $(dirname "$0") -cd .. - -function query() { - ./output/bazel query --keep_going -- "$@" -} - -# Compile bazel -[ -f "output/bazel" ] || ./compile.sh compile >&2 || exit $? - -# Build almost everything. -# //third_party/ijar/test/... is disabled due to #273. -# xcode and android tools do not work out of the box. -# native code should not be explicitly built, since it may not be compatible -# with this platform. -targets_to_build=(//src/{main,java_tools,test/{java,cpp}}/... //third_party/...) -targets_to_omit=(-//third_party/ijar/test/... -//third_party/java/j2objc/... -//src/main/native/...) -./output/bazel build -- ${targets_to_build[@]} ${targets_to_omit[@]} >&2 \ - || exit $? - -# Source roots. -JAVA_PATHS="$(find src -name "*.java" | sed "s|/com/google/.*$||" | sort -u)" -if [ "$(uname -s | tr 'A-Z' 'a-z')" != "darwin" ]; then - JAVA_PATHS="$(echo "${JAVA_PATHS}" | fgrep -v "/objc_tools/")" -fi - -THIRD_PARTY_JAR_PATHS="$(find third_party -name "*.jar" | sort -u)" - -# Android-SDK-dependent files may need to be excluded from compilation. -ANDROID_IMPORTING_FILES="$(grep "^import android\." -R -l --include "*.java" src | sort)" - -# All other generated libraries. -readonly package_list=$(find src -name "BUILD" | sed "s|/BUILD||" | sed "s|^|//|") -# Returns the package of file $1 -function get_package_of() { - # look for the longest matching package - for i in ${package_list}; do - if [[ "$1" =~ ^$i ]]; then # we got a match - echo $(echo -n $i | wc -c | xargs echo) $i - fi - done | sort -r -n | head -1 | cut -d " " -f 2 -} - -# returns the target corresponding to file $1 -function get_target_of() { - local package=$(get_package_of $1) - local file=$(echo $1 | sed "s|^${package}/||g") - echo "${package}:${file}" -} - -# Returns the target that consume file $1 -function get_consuming_target() { - # Here to the god of bazel, I should probably offer one or two memory chips for that - local target=$(get_target_of $1) - # Get the rule that generated this file. - local generating_target=$(query "kind(rule, deps(${target}, 1)) - ${target}") - [[ -n $generating_target ]] || echo "Couldn't get generating target for ${target}" 1>&2 - local java_library=$(query "rdeps(set(${targets_to_build[@]}) ${targets_to_omit[@]}, ${generating_target}, 1) - ${generating_target}") - echo "${java_library}" -} - -# Returns the library that contains the generated file $1 -function get_containing_library() { - get_consuming_target $1 | sed 's|:|/lib|' | sed 's|^//|bazel-bin/|' | sed 's|$|.jar|' -} - -function collect_generated_paths() { - # uniq to avoid doing blaze query on duplicates. - (find -L bazel-bin -name '*_srcjar.srcjar' | sed 's/_srcjar.srcjar$/.jar/'; - for path in $(find bazel-genfiles/ -name "*.java" | sed 's|/\{0,1\}bazel-genfiles/\{1,2\}|//|' | uniq); do - source_path=$(echo ${path} | sed 's|//|bazel-genfiles/|' | sed 's|/com/.*$||') - echo "$(get_containing_library ${path}):${source_path}" - done) | sort -u -} - -# GENERATED_PATHS stores pairs of jar:source_path as a list of strings, with -# each pair internally delimited by a colon. Use ${string//:/ } to split one. -GENERATED_PATHS="$(collect_generated_paths)" diff --git a/scripts/resources/idea/.name b/scripts/resources/idea/.name deleted file mode 100644 index 7fd901bbdc..0000000000 --- a/scripts/resources/idea/.name +++ /dev/null @@ -1 +0,0 @@ -bazel
\ No newline at end of file diff --git a/scripts/resources/idea/copyright/profiles_settings.xml b/scripts/resources/idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3377..0000000000 --- a/scripts/resources/idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ -<component name="CopyrightManager"> - <settings default="" /> -</component>
\ No newline at end of file diff --git a/scripts/resources/idea/misc.xml b/scripts/resources/idea/misc.xml deleted file mode 100644 index 97932299ed..0000000000 --- a/scripts/resources/idea/misc.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="EntryPointsManager"> - <entry_points version="2.0" /> - </component> - <component name="ProjectLevelVcsManager" settingsEditedManually="false"> - <OptionsSetting value="true" id="Add" /> - <OptionsSetting value="true" id="Remove" /> - <OptionsSetting value="true" id="Checkout" /> - <OptionsSetting value="true" id="Update" /> - <OptionsSetting value="true" id="Status" /> - <OptionsSetting value="true" id="Edit" /> - <ConfirmationsSetting value="0" id="Add" /> - <ConfirmationsSetting value="0" id="Remove" /> - </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> - <output url="file://$PROJECT_DIR$/out" /> - </component> -</project>
\ No newline at end of file diff --git a/scripts/resources/idea/modules.xml b/scripts/resources/idea/modules.xml deleted file mode 100644 index a79a04da42..0000000000 --- a/scripts/resources/idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="ProjectModuleManager"> - <modules> - <module fileurl="file://$PROJECT_DIR$/bazel.iml" filepath="$PROJECT_DIR$/bazel.iml" /> - </modules> - </component> -</project>
\ No newline at end of file diff --git a/scripts/resources/idea/vcs.xml b/scripts/resources/idea/vcs.xml deleted file mode 100644 index 35eb1ddfbb..0000000000 --- a/scripts/resources/idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="" vcs="Git" /> - </component> -</project>
\ No newline at end of file diff --git a/scripts/setup-intellij.sh b/scripts/setup-intellij.sh deleted file mode 100755 index ac645d8e90..0000000000 --- a/scripts/setup-intellij.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/bash -# Copyright 2015 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generates an IntelliJ project in Bazel. - -set -o errexit -cd $(dirname "$0") -cd .. - -mkdir -p .idea/ -cp -R scripts/resources/idea/*.* .idea/ -source scripts/get_all_bazel_paths.sh - -readonly compiler_file=.idea/compiler.xml -cat >$compiler_file <<'EOH' -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="CompilerConfiguration"> - <excludeFromCompile> -EOH -for android_file in $ANDROID_IMPORTING_FILES; do - echo " <file url=\"\$PROJECT_DIR\$/${android_file}\" />" >> $compiler_file -done -cat >>$compiler_file <<'EOF' - </excludeFromCompile> - <resourceExtensions /> - <wildcardResourcePatterns> - <entry name="!?*.java" /> - <entry name="!?*.form" /> - <entry name="!?*.class" /> - <entry name="!?*.groovy" /> - <entry name="!?*.scala" /> - <entry name="!?*.flex" /> - <entry name="!?*.kt" /> - <entry name="!?*.clj" /> - <entry name="!?*.aj" /> - </wildcardResourcePatterns> - <annotationProcessing> - <profile default="true" name="Default" enabled="true"> - <processor name="com.google.auto.value.processor.AutoValueProcessor" /> - <processorPath useClasspath="true" /> - </profile> - </annotationProcessing> - </component> -</project> -EOF - -readonly iml_file=bazel.iml -# 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> - <content url="file://\$MODULE_DIR\$/src"> -EOH - -for source in ${JAVA_PATHS}; do - if [[ $source == *"javatests" ]]; then - is_test_source="true" - elif [[ $source == *"test/java" ]]; then - is_test_source="true" - else - is_test_source="false" - fi - echo ' <sourceFolder url="file://$MODULE_DIR$/'"${source}\" isTestSource=\"${is_test_source}\" />" >> $iml_file -done -cat >> $iml_file <<'EOF' - </content> - <content url="file://$MODULE_DIR$/third_party/java"> -EOF - -THIRD_PARTY_JAVA_PATHS="$(ls third_party/java | sort -u | sed -e 's%$%/java%')" - -for third_party_java_path in ${THIRD_PARTY_JAVA_PATHS}; do - echo ' <sourceFolder url="file://$MODULE_DIR$/third_party/java/'${third_party_java_path}'" isTestSource="false" />' >> $iml_file -done -cat >> $iml_file <<'EOF' - </content> - <orderEntry type="sourceFolder" forTests="false" /> -EOF - -# Write a module-library entry, usually a jar file but occasionally a directory. -function write_jar_entry() { - local root_file=$1 - if [[ $# > 1 ]]; then - local source_path=$2 - else - local source_path="" - fi - local protocol="file" - local file_end="" - if [[ $root_file == *.jar ]]; then - protocol="jar" - file_end="!" - fi - local readonly basename=${root_file##*/} - cat >> $iml_file <<EOF - <orderEntry type="module-library"> - <library name="${basename}"> - <CLASSES> - <root url="${protocol}://\$MODULE_DIR\$/${root_file}${file_end}/" /> - </CLASSES> - <JAVADOC /> -EOF - if [[ -z "${source_path}" ]]; then - echo " <SOURCES />" >> $iml_file - else - cat >> $iml_file <<EOF - <SOURCES> - <root url="jar:/\$MODULE_DIR\$/${source_path}!/" /> - </SOURCES> -EOF - fi - if [[ $protocol == "file" ]]; then - cat >> $iml_file <<EOF - <jarDirectory url="file://\$MODULE_DIR\$/${root_file}" recursive="false" /> -EOF - fi - cat >> $iml_file <<'EOF' - </library> - </orderEntry> -EOF -} - -# Slight hack to make sure (1) our langtools is picked up before the SDK -# default, but that (2) SDK is picked up before auto-value, because that -# apparently causes problems for auto-value otherwise. -readonly javac_jar="third_party/java/jdk/langtools/javac.jar" -write_jar_entry "$javac_jar" - -cat >> $iml_file <<'EOF' - <orderEntry type="inheritedJdk" /> -EOF - -for path_pair in ${GENERATED_PATHS}; do - write_jar_entry ${path_pair//:/ } -done - -for jar in ${THIRD_PARTY_JAR_PATHS}; do - if [[ jar != "$javac_jar" ]]; then - write_jar_entry $jar - fi -done - -write_jar_entry "bazel-bin/src/main/protobuf" - -cat >> $iml_file <<'EOF' - </component> -</module> -EOF - -echo -echo Done. Project file: $iml_file |