Created
March 8, 2017 13:47
-
-
Save imbeyondboredom/807e0367e019a152e143cae69b4b52a3 to your computer and use it in GitHub Desktop.
A script for dynamically injecting the blackduck gradle plugin for scanning dependencies of projects
This file contains 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
echo 'initscript { | |
repositories { | |
mavenCentral() | |
maven { url "http://jcenter.bintray.com" } | |
} | |
dependencies { | |
classpath group: "com.blackducksoftware.integration", name: "hub-gradle-plugin", version: "3.4.1" | |
classpath "commons-lang:commons-lang:2.6" | |
} | |
} | |
rootProject { | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath "commons-lang:commons-lang:2.6" | |
} | |
} | |
apply plugin: com.blackducksoftware.integration.gradle.HubGradlePlugin | |
apply plugin: "java" | |
//group = projectDir | |
createHubOutput { | |
if (project.hasProperty("bd_proj_name")) { | |
hubProjectName project.properties.bd_proj_name; | |
} else { | |
throw new Exception("You must specify a bd_proj_name property"); | |
} | |
if (project.hasProperty("bd_proj_version")) { | |
hubVersionName project.properties.bd_proj_version; | |
} else { | |
throw new Exception("You must specify a bd_proj_version property"); | |
} | |
} | |
deployHubOutput { | |
if (project.hasProperty("bd_proj_name")) { | |
hubProjectName project.properties.bd_proj_name; | |
} else { | |
throw new Exception("You must specify a bd_proj_name property"); | |
} | |
if (project.hasProperty("bd_proj_version")) { | |
hubVersionName project.properties.bd_proj_version; | |
} else { | |
throw new Exception("You must specify a bd_proj_version property"); | |
} | |
hubUrl = "<hub url>" | |
hubUsername = "<hub username" | |
hubPassword = project.properties.bd_password | |
hubScanStartedTimeout = 10 | |
hubScanFinishedTimeout = 10 | |
} | |
}' > init.gradle | |
./gradlew --init-script init.gradle createHubOutput -Pbd_proj_name="$PROJECT_NAME" -Pbd_proj_version="$BD_VERSION_NUMBER" | |
ERCODE=$? | |
exit $ERCODE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment