Skip to content
This repository has been archived by the owner on Nov 30, 2017. It is now read-only.

Commit

Permalink
using correct next version
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Kerwin committed Oct 27, 2016
1 parent c800d71 commit a6129a7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 35 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ description='Black Duck Hub Gradle Plugin'
dependencies {
compile gradleApi()
compile localGroovy()
compile 'com.blackducksoftware.integration:build-tool-common:2.0.12'
compile 'com.blackducksoftware.integration:hub-common:1.4.13'
compile 'com.blackducksoftware.integration:build-tool-common:2.2.0'
compile 'com.blackducksoftware.integration:hub-common:1.5.2'
compile 'commons-io:commons-io:2.5'
compile 'com.google.code.gson:gson:2.7'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
*******************************************************************************/
package com.blackducksoftware.integration.gradle;

import static com.blackducksoftware.integration.build.Constants.CHECK_POLICIES;
import static com.blackducksoftware.integration.build.Constants.CREATE_FLAT_DEPENDENCY_LIST;
import static com.blackducksoftware.integration.build.Constants.CREATE_HUB_OUTPUT;
import static com.blackducksoftware.integration.build.Constants.DEPLOY_HUB_OUTPUT;
import static com.blackducksoftware.integration.build.Constants.DEPLOY_HUB_OUTPUT_AND_CHECK_POLICIES;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.slf4j.Logger;
Expand All @@ -41,82 +47,87 @@ public void apply(final Project project) {
return;
}

if (project.getTasks().findByName("createFlatDependencyList") == null) {
if (project.getTasks().findByName(CREATE_FLAT_DEPENDENCY_LIST) == null) {
createFlatDependencyListTask(project);
}

if (project.getTasks().findByName("createHubOutput") == null) {
if (project.getTasks().findByName(CREATE_HUB_OUTPUT) == null) {
createCreateHubOutputTask(project);
}

if (project.getTasks().findByName("deployHubOutput") == null) {
if (project.getTasks().findByName(DEPLOY_HUB_OUTPUT) == null) {
createDeployHubOutputTask(project);
}

if (project.getTasks().findByName("checkPolicies") == null) {
if (project.getTasks().findByName(CHECK_POLICIES) == null) {
createCheckPoliciesTask(project);
}

if (project.getTasks().findByName("deployHubOutputAndCheckPolicies") == null) {
if (project.getTasks().findByName(DEPLOY_HUB_OUTPUT_AND_CHECK_POLICIES) == null) {
createDeployHubOutputAndCheckPoliciesTask(project);
}
}

private void createFlatDependencyListTask(final Project project) {
logger.info(String.format("Configuring createFlatDependencyList task for project path: %s", project.getPath()));
logger.info(String.format("Configuring %s task for project path: %s", CREATE_FLAT_DEPENDENCY_LIST,
project.getPath()));

final CreateFlatDependencyListTask createFlatDependencyList = project.getTasks()
.create("createFlatDependencyList", CreateFlatDependencyListTask.class);
.create(CREATE_FLAT_DEPENDENCY_LIST, CreateFlatDependencyListTask.class);
createFlatDependencyList.setDescription("Create a flat list of unique dependencies.");
createFlatDependencyList.setGroup("reporting");

logger.info("Successfully configured createFlatDependencyList");
logger.info(String.format("Successfully configured %s", CREATE_FLAT_DEPENDENCY_LIST));
}

private void createCreateHubOutputTask(final Project project) {
logger.info(String.format("Configuring createHubOutput task for project path: %s", project.getPath()));
logger.info(String.format("Configuring %s task for project path: %s", CREATE_HUB_OUTPUT,
project.getPath()));

final CreateHubOutputTask createHubOutput = project.getTasks().create("createHubOutput",
final CreateHubOutputTask createHubOutput = project.getTasks().create(CREATE_HUB_OUTPUT,
CreateHubOutputTask.class);
createHubOutput.setDescription("Create the bdio file.");
createHubOutput.setGroup("reporting");

logger.info("Successfully configured createHubOutput");
logger.info(String.format("Successfully configured %s", CREATE_HUB_OUTPUT));
}

private void createDeployHubOutputTask(final Project project) {
logger.info(String.format("Configuring deployHubOutput task for project path: %s", project.getPath()));
logger.info(String.format("Configuring %s task for project path: %s", DEPLOY_HUB_OUTPUT,
project.getPath()));

final DeployHubOutputTask deployHubOutput = project.getTasks().create("deployHubOutput",
final DeployHubOutputTask deployHubOutput = project.getTasks().create(DEPLOY_HUB_OUTPUT,
DeployHubOutputTask.class);
deployHubOutput.setDescription("Deploy the bdio file to the Hub server.");
deployHubOutput.setGroup("reporting");

logger.info("Successfully configured deployHubOutput");
logger.info(String.format("Successfully configured %s", DEPLOY_HUB_OUTPUT));
}

private void createCheckPoliciesTask(final Project project) {
logger.info(String.format("Configuring checkPolicies task for project path: %s", project.getPath()));
logger.info(String.format("Configuring %s task for project path: %s", CHECK_POLICIES,
project.getPath()));

final CheckPoliciesTask checkPolicies = project.getTasks().create("checkPolicies", CheckPoliciesTask.class);
checkPolicies.setDescription(
"Check the project's policies on the Hub. *Note: This will check ONLY the current policy status, NOT the updated status after a deploy of bdio output. For that, you would use deployHubOutputAndCheckPolicies.");
final CheckPoliciesTask checkPolicies = project.getTasks().create(CHECK_POLICIES, CheckPoliciesTask.class);
checkPolicies.setDescription(String.format(
"Check the project's policies on the Hub. *Note: This will check ONLY the current policy status, NOT the updated status after a deploy of bdio output. For that, you would use %s.",
DEPLOY_HUB_OUTPUT_AND_CHECK_POLICIES));
checkPolicies.setGroup("reporting");

logger.info("Successfully configured checkPolicies");
logger.info(String.format("Successfully configured %s", CHECK_POLICIES));
}

private void createDeployHubOutputAndCheckPoliciesTask(final Project project) {
logger.info(String.format("Configuring deployHubOutputAndCheckPolicies task for project path: %s",
logger.info(String.format("Configuring %s task for project path: %s", DEPLOY_HUB_OUTPUT_AND_CHECK_POLICIES,
project.getPath()));

final DeployHubOutputAndCheckPoliciesTask deployHubOutputAndCheckPolicies = project.getTasks()
.create("deployHubOutputAndCheckPolicies", DeployHubOutputAndCheckPoliciesTask.class);
.create(DEPLOY_HUB_OUTPUT_AND_CHECK_POLICIES, DeployHubOutputAndCheckPoliciesTask.class);
deployHubOutputAndCheckPolicies.setDescription(
"Create, then deploy the bdio file and wait for completion, then check the project's policies on the Hub.");
deployHubOutputAndCheckPolicies.setGroup("reporting");

logger.info("Successfully configured deployHubOutputAndCheckPolicies");
logger.info(String.format("Successfully configured %s", DEPLOY_HUB_OUTPUT_AND_CHECK_POLICIES));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void deployHubOutput(final Slf4jIntLogger logger, final RestConnection re
final File file = new File(outputDirectory, filename);
bomImportRestService.importBomFile(file, Constants.BDIO_FILE_MEDIA_TYPE);

logger.info(String.format("Uploaded the file %s to %s", file, restConnection.getBaseUrl()));
logger.info(String.format(Constants.UPLOAD_FILE_MESSAGE, file, restConnection.getBaseUrl()));
}

public void waitForHub(final RestConnection restConnection, final String hubProjectName,
Expand All @@ -68,7 +68,7 @@ public void waitForHub(final RestConnection restConnection, final String hubProj
scanStartedTimeout * 1000, scanFinishedTimeout * 1000, new Slf4jIntLogger(logger));
} catch (IOException | BDRestException | URISyntaxException | ProjectDoesNotExistException | UnexpectedHubResponseException
| HubIntegrationException | InterruptedException e) {
logger.error(String.format("There was an error waiting for the scans: %s", e.getMessage()), e);
logger.error(String.format(Constants.SCAN_ERROR_MESSAGE, e.getMessage()), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@ public HubServerConfigBuilder getHubServerConfigBuilder() {
hubServerConfigBuilder.setProxyPassword(hubProxyPassword);

return hubServerConfigBuilder;
// final HubServerConfig hubServerConfig = builder.build();
// RestConnection restConnection;
// try {
// restConnection = new RestConnection(hubServerConfig);
// } catch (IllegalArgumentException | URISyntaxException | BDRestException | EncryptionException e) {
// throw new GradleException("Could not connect to the Hub - please check the logs for configuration errors.");
// }
//
// return restConnection;
}

public String getHubProjectName() {
Expand Down

0 comments on commit a6129a7

Please sign in to comment.