1#!/bin/bash 2# 3# Copyright (C) 2012 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16# 17# To use: 18# intellij-gen.sh <module name> 19# 20# where module name is the LOCAL_PACKAGE_NAME in Android.mk for the project. 21# 22# For example, to generate a project for Contacts, use: 23# intellij-gen.sh Contacts 24# 25# The project directory (.idea) will be put in the root directory of the module. Sharable iml 26# files will be put into each respective module directory. 27# 28# Only tested on linux. Should work for macs but have not tried. 29# 30set -e 31 32script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 33root_dir=`readlink -f -n $script_dir/../../..` 34index_file=$script_dir/module-index.txt 35idegenjar=$root_dir/out/host/common/obj/JAVA_LIBRARIES/idegen_intermediates/javalib.jar 36 37progname=`basename $0` 38if [ $# -ne 1 ] 39then 40 echo "Usage: $progname <module_name>" 41 exit 1 42fi 43 44module_name=$1 45 46if [ ! -e "$index_file" ]; then 47 echo "Module index file missing; generating this is only done the first time." 48 echo "If any dependencies change, you should generate a new index file by running index-gen.sh." 49 $script_dir/index-gen.sh 50fi 51 52echo "Checking for $idegenjar" 53if [ -e "$idegenjar" ]; then 54 echo "Generating project files for $module_name" 55 cmd="java -cp $idegenjar com.android.idegen.IntellijProject $index_file $module_name" 56 echo $cmd 57 $cmd 58else 59 echo "Couldn't find idegen.jar. Please run make first." 60fi 61