Merge "Remove ANDROID_BUILD_TOP from intelliJ path variables. [DO NOT MERGE]" into klp-modular-dev

This commit is contained in:
Deepanshu Gupta
2014-10-02 03:26:02 +00:00
committed by Android (Google) Code Review
13 changed files with 75 additions and 23 deletions

View File

@@ -1,11 +1,11 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="asm-4.0"> <library name="asm-4.0">
<CLASSES> <CLASSES>
<root url="jar://$ANDROID_BUILD_TOP$/prebuilts/misc/common/asm/asm-4.0.jar!/" /> <root url="jar://$PROJECT_DIR$/../../../../prebuilts/misc/common/asm/asm-4.0.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$ANDROID_BUILD_TOP$/prebuilts/misc/common/asm/src.zip!/" /> <root url="jar://$PROJECT_DIR$/../../../../prebuilts/misc/common/asm/src.zip!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@@ -1,13 +1,13 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="framework.jar"> <library name="framework.jar">
<CLASSES> <CLASSES>
<root url="jar://$ANDROID_BUILD_TOP$/out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar!/" /> <root url="jar://$PROJECT_DIR$/../../../../out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$ANDROID_BUILD_TOP$/frameworks/base/core/java" /> <root url="file://$PROJECT_DIR$/../../core/java" />
<root url="file://$ANDROID_BUILD_TOP$/frameworks/base/graphics/java" /> <root url="file://$PROJECT_DIR$/../../graphics/java" />
<root url="file://$ANDROID_BUILD_TOP$/libcore/luni/src/main/java" /> <root url="file://$PROJECT_DIR$/../../../../libcore/luni/src/main/java" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@@ -1,11 +1,11 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="guava"> <library name="guava">
<CLASSES> <CLASSES>
<root url="jar://$ANDROID_BUILD_TOP$/out/host/common/obj/JAVA_LIBRARIES/guavalib_intermediates/javalib.jar!/" /> <root url="jar://$PROJECT_DIR$/../../../../out/host/common/obj/JAVA_LIBRARIES/guavalib_intermediates/javalib.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$ANDROID_BUILD_TOP$/external/guava/guava/src" /> <root url="file://$PROJECT_DIR$/../../../../external/guava/guava/src" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@@ -1,7 +1,7 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="icu4j"> <library name="icu4j">
<CLASSES> <CLASSES>
<root url="jar://$ANDROID_BUILD_TOP$/prebuilts/misc/common/icu4j/icu4j.jar!/" /> <root url="jar://$PROJECT_DIR$/../../../../prebuilts/misc/common/icu4j/icu4j.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="http://icu-project.org/apiref/icu4j50rc/" /> <root url="http://icu-project.org/apiref/icu4j50rc/" />

View File

@@ -1,11 +1,11 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="kxml2-2.3.0"> <library name="kxml2-2.3.0">
<CLASSES> <CLASSES>
<root url="jar://$ANDROID_BUILD_TOP$/prebuilts/misc/common/kxml2/kxml2-2.3.0.jar!/" /> <root url="jar://$PROJECT_DIR$/../../../../prebuilts/misc/common/kxml2/kxml2-2.3.0.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$ANDROID_BUILD_TOP$/libcore/xml/src/main/java" /> <root url="file://$PROJECT_DIR$/../../../../libcore/xml/src/main/java" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@@ -1,7 +1,7 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="layoutlib_api-prebuilt"> <library name="layoutlib_api-prebuilt">
<CLASSES> <CLASSES>
<root url="jar://$ANDROID_BUILD_TOP$/prebuilts/misc/common/layoutlib_api/layoutlib_api-prebuilt.jar!/" /> <root url="jar://$PROJECT_DIR$/../../../../prebuilts/misc/common/layoutlib_api/layoutlib_api-prebuilt.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>

View File

@@ -1,7 +1,7 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="ninepatch-prebuilt"> <library name="ninepatch-prebuilt">
<CLASSES> <CLASSES>
<root url="jar://$ANDROID_BUILD_TOP$/prebuilts/misc/common/ninepatch/ninepatch-prebuilt.jar!/" /> <root url="jar://$PROJECT_DIR$/../../../../prebuilts/misc/common/ninepatch/ninepatch-prebuilt.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>

View File

@@ -4,7 +4,7 @@
<root url="file://$PROJECT_DIR$" /> <root url="file://$PROJECT_DIR$" />
</ANNOTATIONS> </ANNOTATIONS>
<CLASSES> <CLASSES>
<root url="jar://$ANDROID_BUILD_TOP$/prebuilts/misc/common/tools-common/tools-common-prebuilt.jar!/" /> <root url="jar://$PROJECT_DIR$/../../../../prebuilts/misc/common/tools-common/tools-common-prebuilt.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>

View File

@@ -8,7 +8,7 @@
<option name="MAIN_CLASS_NAME" value="" /> <option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" /> <option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -Dplatform.dir=&quot;$ANDROID_BUILD_TOP$/out/host/linux-x86/sdk/sdk/android-sdk_eng.deepanshu_linux-x86/platforms/android-L&quot; -Dtest_res.dir=&quot;$PROJECT_DIR$/bridge/tests/res&quot;" /> <option name="VM_PARAMETERS" value="-ea -Dtest_res.dir=&quot;$PROJECT_DIR$/bridge/tests/res&quot;" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" /> <option name="ENV_VARIABLES" />

View File

@@ -4,7 +4,7 @@
<option name="MAIN_CLASS_NAME" value="com.android.tools.layoutlib.create.Main" /> <option name="MAIN_CLASS_NAME" value="com.android.tools.layoutlib.create.Main" />
<option name="VM_PARAMETERS" value="" /> <option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/javalib.jar" /> <option name="PROGRAM_PARAMETERS" value="out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/javalib.jar" />
<option name="WORKING_DIRECTORY" value="file://$ANDROID_BUILD_TOP$/" /> <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/../../../../" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="1.6" /> <option name="ALTERNATIVE_JRE_PATH" value="1.6" />
<option name="ENABLE_SWING_INSPECTOR" value="false" /> <option name="ENABLE_SWING_INSPECTOR" value="false" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$ANDROID_BUILD_TOP$/frameworks/base" vcs="Git" /> <mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component> </component>
</project> </project>

View File

@@ -34,11 +34,11 @@
<orderEntry type="module-library" scope="TEST"> <orderEntry type="module-library" scope="TEST">
<library> <library>
<CLASSES> <CLASSES>
<root url="jar://$ANDROID_BUILD_TOP$/prebuilts/misc/common/sdk-common/sdk-common.jar!/" /> <root url="jar://$MODULE_DIR$/../../../../../prebuilts/misc/common/sdk-common/sdk-common.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$ANDROID_BUILD_TOP$/prebuilts/misc/common/sdk-common/sdk-common-sources.jar!/" /> <root url="jar://$MODULE_DIR$/../../../../../prebuilts/misc/common/sdk-common/sdk-common-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</orderEntry> </orderEntry>

View File

@@ -104,9 +104,61 @@ public class Main {
return platformDir; return platformDir;
} }
// System Property not set. Try to find the directory in the build directory. // System Property not set. Try to find the directory in the build directory.
String out = System.getenv("ANDROID_HOST_OUT"); String androidHostOut = System.getenv("ANDROID_HOST_OUT");
if (out == null || out.isEmpty() || !new File(out).isDirectory()) { if (androidHostOut != null) {
// Can't find the out directory. platformDir = getPlatformDirFromHostOut(new File(androidHostOut));
if (platformDir != null) {
return platformDir;
}
}
String workingDirString = System.getProperty("user.dir");
File workingDir = new File(workingDirString);
// Test if workingDir is android checkout root.
platformDir = getPlatformDirFromRoot(workingDir);
if (platformDir != null) {
return platformDir;
}
// Test if workingDir is platform/frameworks/base/tools/layoutlib. That is, root should be
// workingDir/../../../../ (4 levels up)
File currentDir = workingDir;
for (int i = 0; i < 4; i++) {
if (currentDir != null) {
currentDir = currentDir.getParentFile();
}
}
return currentDir == null ? null : getPlatformDirFromRoot(currentDir);
}
private static String getPlatformDirFromRoot(File root) {
if (!root.isDirectory()) {
return null;
}
File out = new File(root, "out");
if (!out.isDirectory()) {
return null;
}
File host = new File(out, "host");
if (!host.isDirectory()) {
return null;
}
File[] hosts = host.listFiles(new FileFilter() {
@Override
public boolean accept(File path) {
return path.isDirectory() && (path.getName().startsWith("linux-") || path.getName()
.startsWith("darwin-"));
}
});
for (File hostOut : hosts) {
String platformDir = getPlatformDirFromHostOut(hostOut);
if (platformDir != null) {
return platformDir;
}
}
return null;
}
private static String getPlatformDirFromHostOut(File out) {
if (!out.isDirectory()) {
return null; return null;
} }
File sdkDir = new File(out, "sdk" + File.separator + "sdk"); File sdkDir = new File(out, "sdk" + File.separator + "sdk");
@@ -117,7 +169,7 @@ public class Main {
File[] possibleSdks = sdkDir.listFiles(new FileFilter() { File[] possibleSdks = sdkDir.listFiles(new FileFilter() {
@Override @Override
public boolean accept(File path) { public boolean accept(File path) {
return path.isDirectory() && path.getAbsolutePath().contains("android-sdk"); return path.isDirectory() && path.getName().contains("android-sdk");
} }
}); });
for (File possibleSdk : possibleSdks) { for (File possibleSdk : possibleSdks) {