Merge "Allow bash scripts to work within a distributation folder."

This commit is contained in:
Chiao Cheng
2013-03-01 18:45:40 +00:00
committed by Android (Google) Code Review
4 changed files with 43 additions and 17 deletions

View File

@@ -2,8 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_STATIC_JAVA_LIBRARIES := \ LOCAL_STATIC_JAVA_LIBRARIES := guavalib
guavalib \
LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_SRC_FILES := $(call all-subdir-java-files)

View File

@@ -14,12 +14,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# Generates a module index file by searching through android source tree for make files. The # Generates a module index file by searching through android source
# intellij-gen.sh script automatically calls this script the first time or if you delete the # tree for make files. The intellij-gen.sh script automatically calls
# generated indexed file. The only time you need to run this manually is if modules are added or # this script the first time or if you delete the generated indexed
# deleted. # file. The only time you need to run this manually is if modules are
# added or deleted.
# #
# To use: # To use, run the following command from either your repo root or
# development/tools/idegen:
# index-gen.sh # index-gen.sh
# #
# Only tested on linux. Should work for macs but have not tried. # Only tested on linux. Should work for macs but have not tried.
@@ -27,7 +29,15 @@
set -e set -e
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
root_dir=`readlink -f -n $script_dir/../../..` #root_dir=`readlink -f -n $script_dir/../../..`
root_dir=$PWD
if [ ! -e $root_dir/.repo ]; then
root_dir=$PWD/../../..
if [ ! -e $root_dir/.repo ]; then
echo "Repo root not found. Run this script from your repo root or the idegen directory."
exit 1
fi
fi
tmp_file=tmp.txt tmp_file=tmp.txt
dest_file=module-index.txt dest_file=module-index.txt

View File

@@ -14,7 +14,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# To use: # To use, run the following command from either your repo root or
# development/tools/idegen:
# intellij-gen.sh <module name> # intellij-gen.sh <module name>
# #
# where module name is the LOCAL_PACKAGE_NAME in Android.mk for the project. # where module name is the LOCAL_PACKAGE_NAME in Android.mk for the project.
@@ -22,27 +23,38 @@
# For example, to generate a project for Contacts, use: # For example, to generate a project for Contacts, use:
# intellij-gen.sh Contacts # intellij-gen.sh Contacts
# #
# The project directory (.idea) will be put in the root directory of the module. Sharable iml # The project directory (.idea) will be put in the root directory of
# files will be put into each respective module directory. # the module. Sharable iml files will be put into each respective
# module directory.
# #
# Only tested on linux. Should work for macs but have not tried. # Only tested on linux. Should work for macs but have not tried.
# #
set -e set -e
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
root_dir=`readlink -f -n $script_dir/../../..`
index_file=$script_dir/module-index.txt
idegenjar=$root_dir/out/host/common/obj/JAVA_LIBRARIES/idegen_intermediates/javalib.jar
progname=`basename $0` progname=`basename $0`
if [ $# -ne 1 ] if [ $# -ne 1 ]
then then
echo "Usage: $progname <module_name>" echo "Usage: $progname <module_name>"
exit 1 exit 1
fi fi
module_name=$1 module_name=$1
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
root_dir=$PWD
if [ ! -e $root_dir/.repo ]; then
root_dir=$PWD/../../..
if [ ! -e $root_dir/.repo ]; then
echo "Repo root not found. Run this script from your repo root or the idegen directory."
exit 1
fi
fi
index_file=$root_dir/module-index.txt
idegenjar=$script_dir/idegen.jar
if [ ! -e $idegenjar ]; then
# See if the jar is in the build directory.
idegenjar=$root_dir/out/host/linux-x86/framework/idegen.jar
fi
if [ ! -e "$index_file" ]; then if [ ! -e "$index_file" ]; then
echo "Module index file missing; generating this is only done the first time." echo "Module index file missing; generating this is only done the first time."
echo "If any dependencies change, you should generate a new index file by running index-gen.sh." echo "If any dependencies change, you should generate a new index file by running index-gen.sh."

View File

@@ -55,6 +55,11 @@ public class IntellijProject {
// First pass, find all dependencies and cache them. // First pass, find all dependencies and cache them.
Module module = cache.getAndCache(moduleName); Module module = cache.getAndCache(moduleName);
if (module == null) {
logger.info("Module '" + moduleName + "' not found." +
" Module names are case senstive.");
return;
}
projectIdeaDir = new File(module.getDir(), ".idea"); projectIdeaDir = new File(module.getDir(), ".idea");
projectIdeaDir.mkdir(); projectIdeaDir.mkdir();
copyTemplates(); copyTemplates();