diff --git a/build.gradle b/build.gradle index 7852dff3..e887d595 100644 --- a/build.gradle +++ b/build.gradle @@ -21,9 +21,24 @@ repositories { mavenCentral() } +task setHttpProxyFromEnv { + def map = ['HTTP_PROXY': 'http', 'HTTPS_PROXY': 'https'] + for (e in System.getenv()) { + def key = e.key.toUpperCase() + if (key in map) { + def base = map[key] + def url = e.value.toURL() + println " - systemProp.${base}.proxy=${url.host}:${url.port}" + System.setProperty("${base}.proxyHost", url.host.toString()) + System.setProperty("${base}.proxyPort", url.port.toString()) + } + } +} + configurations { pluginLibs + build.dependsOn setHttpProxyFromEnv compile { extendsFrom pluginLibs }