|
|
@@ -63,22 +63,42 @@ allprojects { |
|
|
|
|
|
|
|
repositories { |
|
|
|
def repository = project.hasProperty('qa') ? 'sonarsource-qa' : 'sonarsource' |
|
|
|
// The environment variables ARTIFACTORY_PRIVATE_USERNAME and ARTIFACTORY_PRIVATE_PASSWORD are used on QA env (Jenkins) |
|
|
|
// On local box, please add artifactoryUsername and artifactoryPassword to ~/.gradle/gradle.properties |
|
|
|
def artifactoryUsername = System.env.'ARTIFACTORY_PRIVATE_USERNAME' ?: (project.hasProperty('artifactoryUsername') ? project.getProperty('artifactoryUsername') : '') |
|
|
|
def artifactoryPassword = System.env.'ARTIFACTORY_PRIVATE_PASSWORD' ?: (project.hasProperty('artifactoryPassword') ? project.getProperty('artifactoryPassword') : '') |
|
|
|
def artifactoryUrl = System.getenv('ARTIFACTORY_URL') ?: (project.hasProperty('artifactoryUrl') ? project.getProperty('artifactoryUrl') : '') |
|
|
|
|
|
|
|
if (artifactoryUrl == '') { |
|
|
|
throw new GradleException('Invalid artifactoryUrl') |
|
|
|
} |
|
|
|
|
|
|
|
maven { |
|
|
|
// The environment variables ARTIFACTORY_PRIVATE_USERNAME and ARTIFACTORY_PRIVATE_PASSWORD are used on QA env (Jenkins) |
|
|
|
// On local box, please add artifactoryUsername and artifactoryPassword to ~/.gradle/gradle.properties |
|
|
|
def artifactoryUsername = System.env.'ARTIFACTORY_PRIVATE_USERNAME' ?: (project.hasProperty('artifactoryUsername') ? project.getProperty('artifactoryUsername') : '') |
|
|
|
def artifactoryPassword = System.env.'ARTIFACTORY_PRIVATE_PASSWORD' ?: (project.hasProperty('artifactoryPassword') ? project.getProperty('artifactoryPassword') : '') |
|
|
|
if (!artifactoryUsername || ! artifactoryPassword) { |
|
|
|
|
|
|
|
// Workaround for artifactory |
|
|
|
// https://www.jfrog.com/jira/browse/RTFACT-13797 |
|
|
|
repository = 'public' |
|
|
|
} |
|
|
|
url "https://repox.jfrog.io/repox/${repository}" |
|
|
|
if (artifactoryPassword) { |
|
|
|
authentication { |
|
|
|
header(HttpHeaderAuthentication) |
|
|
|
} |
|
|
|
credentials(HttpHeaderCredentials) { |
|
|
|
name = "Authorization" |
|
|
|
value = "Bearer $artifactoryPassword" |
|
|
|
} |
|
|
|
} else { |
|
|
|
// Workaround for artifactory |
|
|
|
// https://www.jfrog.com/jira/browse/RTFACT-13797 |
|
|
|
repository = 'public' |
|
|
|
} |
|
|
|
url "${artifactoryUrl}/${repository}" |
|
|
|
} |
|
|
|
ivy { |
|
|
|
if (artifactoryUsername && artifactoryPassword) { |
|
|
|
url "${artifactoryUrl}/sonarsource-bucket" |
|
|
|
authentication { |
|
|
|
header(HttpHeaderAuthentication) |
|
|
|
} |
|
|
|
credentials(HttpHeaderCredentials) { |
|
|
|
name = "Authorization" |
|
|
|
value = "Bearer $artifactoryPassword" |
|
|
|
} |
|
|
|
|
|
|
|
patternLayout { |
|
|
|
artifact '/[organisation]/[module]/[module]-[revision].[ext]' |