From fe974a630825f558edbddef1ef8eec11c2bf18ba Mon Sep 17 00:00:00 2001 From: Florian Braun Date: Mon, 14 Jan 2019 16:15:21 +0100 Subject: [PATCH] added proxy support for gradle. proxy is only used when a system wide proxy is supplied via env variables HTTP_PROXY or HTTPS_PROXY like it is common on OSX and Linux --- build.gradle | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 }