The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 1 | IDEGen automatically generates Android IDE configurations for IntelliJ IDEA |
| 2 | and Eclipse. Your IDE should be able to compile everything in a reasonable |
| 3 | amount of time with no errors. |
| 4 | |
| 5 | If you're using IntelliJ... |
| 6 | |
| 7 | If this is your first time using IDEGen... |
| 8 | |
| 9 | IDEA needs a lot of memory. Add "-Xms748m -Xmx748m" to your VM options |
| 10 | in "IDEA_HOME/bin/idea.vmoptions" on Linux or |
| 11 | "IntelliJ IDEA.app/Contents/Info.plist" on OS X. |
| 12 | |
| 13 | Create a JDK configuration named "1.5 (No Libraries)" by adding a new |
| 14 | JDK like you normally would and then removing all of the jar entries |
| 15 | under the "Classpath" tab. This will ensure that you only get access to |
| 16 | Android's core libraries and not those from your desktop VM. |
| 17 | |
| 18 | From the project's root directory... |
| 19 | |
| 20 | Repeat these steps after each sync... |
| 21 | |
| 22 | 1) make (to produce generated .java source) |
| 23 | 2) development/tools/idegen/idegen.sh |
| 24 | 3) Open android.ipr in IntelliJ. If you already have the project open, |
| 25 | hit the sync button in IntelliJ, and it will automatically detect the |
| 26 | updated configuration. |
| 27 | |
| 28 | If you get unexpected compilation errors from IntelliJ, try running |
| 29 | "Build -> Rebuild Project". Sometimes IntelliJ gets confused after the |
| 30 | project changes significantly. |
| 31 | |
| 32 | If you're using Eclipse... |
| 33 | |
| 34 | If this is your first time using IDEGen... |
| 35 | |
| 36 | Edit eclipse.ini ("Eclipse.app/Contents/MacOS/eclipse.ini" on OS X) and |
| 37 | add "-Xms748m -Xmx748m" to your VM options. |
| 38 | |
| 39 | Configure a JRE named "1.5 (No Libraries)" under "Preferences -> Java -> |
| 40 | Installed JREs". Remove all of the jar entries underneath "JRE system |
| 41 | libraries". Eclipse will not let you save your configuration unless at |
| 42 | least one jar is present, so include a random jar that won't get in the |
| 43 | way. |
| 44 | |
| 45 | From the project's root directory... |
| 46 | |
| 47 | Repeat these steps after each sync... |
| 48 | |
| 49 | 1) make (to produce generated .java source) |
| 50 | 2) development/tools/idegen/idegen.sh |
| 51 | 3) Import the project root directory into your Eclipse workspace. If you |
| 52 | already have the project open, simply refresh it (F5). |
| 53 | |
| 54 | Excluding source roots and jars |
| 55 | |
| 56 | IDEGen keeps an exclusion list in the "excluded-paths" file. This file |
| 57 | has one regular expression per line that matches paths (relative to the |
| 58 | project root) that should be excluded from the IDE configuration. We |
| 59 | use Java's regular expression parser (see java.util.regex.Parser). |
| 60 | |
| 61 | You can create your own additional exclusion list by creating an |
| 62 | "excluded-paths" file in the project's root directory. For example, you |
| 63 | might exclude all apps except the Browser in your IDE configuration with |
| 64 | this regular expression: "^packages/apps/(?!Browser)". |
| 65 | |
| 66 | Controlling source root ordering (Eclipse) |
| 67 | |
| 68 | You may want some source roots to come before others in Eclipse. Simply |
| 69 | create a file named "path-precedence" in your project's root directory. |
| 70 | Each line in the file is a regular expression that matches a source root |
| 71 | path (relative to the project's root directory). If a given source root's |
| 72 | path matches a regular expression that comes earlier in the file, that |
| 73 | source root will come earlier in the generated configuration. If a source |
| 74 | root doesn't match any of the expressions in the file, it will come last, |
| 75 | so you effectively have an implicit ".*" rule at the end of the file. |
| 76 | |
| 77 | For example, if you want your applications's source root to come first, |
| 78 | you might add an expression like "^packages/apps/MyApp/src$" to the top |
| 79 | of the "path-precedence" file. To make source roots under ./out come last, |
| 80 | add "^(?!out/)" (which matches all paths that don't start with "out/"). |