Created
November 24, 2015 09:05
-
-
Save mohitsethi/1220bd9c0c7d2d317945 to your computer and use it in GitHub Desktop.
gradle proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()) | |
| } | |
| } | |
| } | |
| build.dependsOn setHttpProxyFromEnv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment