aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/libs/sdklib
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2012-04-26 22:23:27 -0700
committerRaphael Moll <ralf@android.com>2012-04-27 16:32:23 -0700
commit528b92910b587a6cb234a17d96fa171a233ed014 (patch)
treec51211ee6588c68fd060e05e3465f727c04853fb /sdkmanager/libs/sdklib
parentf62902ac1a6d5641c836ea47066a599cd88ce129 (diff)
downloadsdk-528b92910b587a6cb234a17d96fa171a233ed014.zip
sdk-528b92910b587a6cb234a17d96fa171a233ed014.tar.gz
sdk-528b92910b587a6cb234a17d96fa171a233ed014.tar.bz2
New env-var to disable SDK Manager cache
Change-Id: Ia1c0ae789f173aca0832c1c7c1f6679645611f9b
Diffstat (limited to 'sdkmanager/libs/sdklib')
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java
index 039e165..c29e988 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DownloadCache.java
@@ -71,7 +71,7 @@ public class DownloadCache {
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1
*/
- private static final boolean DEBUG = System.getenv("SDKMAN_DEBUG_CACHE") != null;
+ private static final boolean DEBUG = System.getenv("SDKMAN_DEBUG_CACHE") != null; //$NON-NLS-1$
/** Key for the Status-Code in the info properties. */
private static final String KEY_STATUS_CODE = "Status-Code"; //$NON-NLS-1$
@@ -156,6 +156,12 @@ public class DownloadCache {
/** Creates a default instance of the URL cache */
public DownloadCache(Strategy strategy) {
mCacheRoot = initCacheRoot();
+
+ // If this is defined in the environment, never use the cache. Useful for testing.
+ if (System.getenv("SDKMAN_DISABLE_CACHE") != null) { //$NON-NLS-1$
+ strategy = Strategy.DIRECT;
+ }
+
mStrategy = mCacheRoot == null ? Strategy.DIRECT : strategy;
}