aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2016-06-10 10:03:02 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-06-10 12:37:04 +0000
commit367982d8aba29569ebd31f1ee21cab85dae826f7 (patch)
tree0be81e5e72d76f93b2514eb50212e909aa2f0695 /scripts
parent104c9a2fd06af64c17c7e85228b8629cd7e5e951 (diff)
Delete eclipse_generate.sh
This is no longer maintained and is now replaced by e4b: https://github.com/bazelbuild/e4b Fixes #12. -- MOS_MIGRATED_REVID=124545211
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/eclipse-generate.sh160
-rwxr-xr-xscripts/get_project_paths.sh80
-rwxr-xr-xscripts/setup-eclipse.sh66
3 files changed, 0 insertions, 306 deletions
diff --git a/scripts/eclipse-generate.sh b/scripts/eclipse-generate.sh
deleted file mode 100755
index 144d8c220b..0000000000
--- a/scripts/eclipse-generate.sh
+++ /dev/null
@@ -1,160 +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 eclipse files for Bazel
-
-set -eu
-
-progname=$0
-function usage() {
- echo "Usage: $progname command args..." >&2
- echo "Possible commands are:" >&2
- echo " classpath java_paths lib_paths jre output_path" >&2
- echo " factorypath project_name plugin_paths" >&2
- echo " project project_name" >&2
- echo " apt_settings output_path" >&2
- exit 1
-}
-
-function read_entry() {
- if [[ -e "${1// /_}" ]]; then
- cat "$1"
- else
- echo "$1"
- fi
-}
-
-function generate_classpath() {
- if [[ "$#" != 4 ]]; then
- usage
- fi
-
- java_paths="$(read_entry "$1")"
- lib_paths="$(read_entry "$2")"
- jre="$3"
- output_path="$4"
-
- cat <<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-EOF
-
- for path in $java_paths; do
- echo " <classpathentry kind=\"src\" path=\"$path\"/>"
- done
-
- for path_pair in $lib_paths; do
- path_arr=(${path_pair//:/ })
- jar=${path_arr[0]}
- source_path=${path_arr[1]-}
- if [ -n "${source_path}" ]; then
- echo " <classpathentry kind=\"lib\" path=\"${jar}\" sourcepath=\"${source_path}\"/>"
- else
- echo " <classpathentry kind=\"lib\" path=\"${jar}\"/>"
- fi
- done
-
- # Write the end of the .classpath file
- cat <<EOF
- <classpathentry kind="output" path="${output_path}"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/${jre}">
- <accessrules>
- <accessrule kind="accessible" pattern="**"/>
- </accessrules>
- </classpathentry>
-</classpath>
-EOF
-}
-
-function generate_factorypath() {
- if [ "$#" != 2 ]; then
- usage
- fi
- project_name="$1"
- plugin_paths="$(read_entry "$2")"
-
- cat <<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<factorypath>
-EOF
-
- for path in $plugin_paths; do
- echo " <factorypathentry kind=\"WKSPJAR\" id=\"/${project_name}/${path}\" enabled=\"true\" runInBatchMode=\"false\" />"
- done
-
- # Write the end of the .factorypath file
- cat <<EOF
-</factorypath>
-EOF
-}
-
-function generate_project() {
- if [ "$#" != 1 ]; then
- usage
- fi
- project_name=$1
- cat <<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>${project_name}</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
-EOF
-}
-
-function generate_apt_settings() {
- if [ "$#" != 1 ]; then
- usage
- fi
- output_path=$1
- cat <<EOF
-eclipse.preferences.version=1
-org.eclipse.jdt.apt.aptEnabled=true
-org.eclipse.jdt.apt.genSrcDir=${output_path}
-org.eclipse.jdt.apt.reconcileEnabled=true
-EOF
-}
-
-command=$1
-shift
-case "${command}" in
- classpath)
- generate_classpath "$@"
- ;;
- factorypath)
- generate_factorypath "$@"
- ;;
- project)
- generate_project "$@"
- ;;
- apt_settings)
- generate_apt_settings "$@"
- ;;
- *)
- usage
- ;;
-esac
diff --git a/scripts/get_project_paths.sh b/scripts/get_project_paths.sh
deleted file mode 100755
index 803ca579c7..0000000000
--- a/scripts/get_project_paths.sh
+++ /dev/null
@@ -1,80 +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 of a Bazel workspace
-
-set -eu
-
-# Build everything
-bazel build -- ${TARGET} >&2 || exit $?
-
-function query() {
- bazel query -k -- "$@"
-}
-
-# Find the bazel-workspaceName link
-EXECUTION_ROOT_PATH=$(bazel info execution_root)
-WORKSPACE_PATH=$(bazel info workspace)
-for i in ${WORKSPACE_PATH}/bazel-*; do
- if [[ "$(readlink $i)" == "${EXECUTION_ROOT_PATH}" ]]; then
- EXECUTION_ROOT=$(basename $i)
- fi
-done
-
-# Do a bazel query and replace the result by paths relative to the workspace.
-# @repo//package:target will be replaced by
-# bazel-%workspaceName%/external/repo/package/target
-# //package:target will be replaced by package/target
-function query_to_path() {
- query "$1" | sed 's|:|/|' \
- | sed 's|@\(.*\)///\{0,1\}|'"${EXECUTION_ROOT}"'/external/\1/|' \
- | sed 's|^//||' | sort -u
-}
-
-ACTUAL_TARGETS="set($(query $(echo ${TARGET} | sed 's/ \([^-]\)/ +\1/g')))"
-
-# Now for java each targets, find all sources and all jars
-PATHS=$(query_to_path 'filter("\.java$",
- deps(kind("(java_binary|java_library|java_test|java_plugin)",
- deps('"$ACTUAL_TARGETS"')))
- except deps(//tools/...))')
-# Java Files:
-JAVA_PATHS=$(echo "$PATHS" | sed 's_\(/java\(tests\)\{0,1\}\)/.*$_\1_' | sort -u)
-
-# Java plugins
-PLUGIN_PATHS=$(query_to_path 'filter("\.jar$",
- deps(kind(java_import,
- deps(kind(java_plugin,
- deps('"$ACTUAL_TARGETS"')))))
- except deps(//tools/...))')
-# Jar Files:
-JAR_FILES=$(query_to_path 'filter("\.jar$", deps(kind(java_import, deps('"$ACTUAL_TARGETS"')))
- except deps(//tools/...))')
-
-# Generated files are direct dependencies of java rules that are not java rules,
-# filegroup, binaries or external dependencies.
-# We also handle genproto separately it is output in bazel-genfiles not in
-# bazel-bin.
-# We suppose that all files are generated in the same package than the library.
-GEN_LIBS=$(query 'let gendeps = kind(rule, deps(kind(java_*, deps('"$ACTUAL_TARGETS"')), 1))
- - kind("(java_.*|filegroup|.*_binary|genproto|bind)", deps('"$ACTUAL_TARGETS"'))
- - deps(//tools/...)
- in rdeps('"$ACTUAL_TARGETS"', set($gendeps), 1) - set($gendeps)' \
- | sed 's|^//\(.*\):\(.*\)|bazel-bin/\1/lib\2.jar:bazel-genfiles/\1|')
-
-# Hack for genproto
-PROTOBUFS=$(query 'kind(genproto, deps('"$ACTUAL_TARGETS"'))' \
- | sed 's|^//\(.*\):\(.*\)$|bazel-bin/\1/lib\2.jar:bazel-bin/\1/lib\2.jar.proto_output/|')
-LIB_PATHS="${JAR_FILES} ${PROTOBUFS} ${GEN_LIBS}"
diff --git a/scripts/setup-eclipse.sh b/scripts/setup-eclipse.sh
deleted file mode 100755
index 89c8ea078c..0000000000
--- a/scripts/setup-eclipse.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-# 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 Eclipse project. If a .project is not present, it will creates
-# it and it will overwrite any .classpath file present
-#
-# Usage: ./setup-eclipse.sh
-#
-
-set -eu
-TARGET=$(echo //src/{main,java_tools,test/{java,cpp}}/... //third_party/... \
- -//third_party/ijar/test/... -//third_party/java/j2objc/...)
-JRE="JavaSE-1.8"
-PROJECT_NAME="bazel"
-OUTPUT_PATH="bazel-out/ide/classes"
-GENERATED_PATH="bazel-out/ide/generated"
-EXTRA_JARS="bazel-bazel/external/local_jdk/lib/tools.jar"
-
-cd $(dirname $(dirname "$0"))
-
-# Compile bazel
-[ -f "output/bazel" ] || ./compile.sh >&2 || exit $?
-
-# Make the script use actual bazel
-function bazel() {
- ./output/bazel "$@"
-}
-
-#
-# End of part specific to bazel
-#
-source ./scripts/get_project_paths.sh
-
-mkdir -p ${OUTPUT_PATH} ${GENERATED_PATH}
-
-# Overwrite .classpath and .factorypath.
-./scripts/eclipse-generate.sh classpath "$JAVA_PATHS" "$LIB_PATHS $EXTRA_JARS" "$JRE" "$OUTPUT_PATH" >.classpath
-if [ -n "$PLUGIN_PATHS" ]; then
- ./scripts/eclipse-generate.sh factorypath "$PROJECT_NAME" "$PLUGIN_PATHS" >.factorypath
- mkdir -p .settings
- # Write apt settings if not present.
- [ -e ".settings/org.eclipse.jdt.apt.core.prefs" ] || \
- ./scripts/eclipse-generate.sh apt_settings "$GENERATED_PATH" > .settings/org.eclipse.jdt.apt.core.prefs
-fi
-# Write .project if not present.
-[ -e ".project" ] || \
- ./scripts/eclipse-generate.sh project "$PROJECT_NAME" > .project
-
-echo
-echo '***'
-echo '*** Eclipse project generated'
-echo '***'
-echo
-echo 'You can now import the bazel project into Eclipse.'