Skip to content

Commit

Permalink
Change plugin application order in baseline-circleci (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 authored and iamdanfox committed Aug 1, 2018
1 parent aff3449 commit 4baeb05
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,21 @@ public final class BaselineCircleCi implements Plugin<Project> {

@Override
public void apply(Project project) {
if (project != project.getRootProject()) {
project.getLogger().warn(
"com.palantir.baseline-circleci should be applied to the root project only, not '{}'",
project.getName());
}

project.getPluginManager().apply(CircleStylePlugin.class);

// the `./gradlew resolveConfigurations` task is used on CI to download all jars for convenient caching
project.getRootProject().allprojects(proj ->
proj.getPluginManager().apply(ConfigurationResolverPlugin.class));

String circleArtifactsDir = System.getenv("CIRCLE_ARTIFACTS");
if (circleArtifactsDir == null) {
project.getLogger().info("$CIRCLE_ARTIFACTS variable is not set, not configuring junit/profiling reports");
return;
}

Expand All @@ -54,10 +66,6 @@ public void apply(Project project) {
throw new RuntimeException("failed to create CIRCLE_ARTIFACTS directory", e);
}

// the `./gradlew resolveConfigurations` task is used on CI to download all jars for convenient caching
project.getRootProject().allprojects(proj ->
proj.getPluginManager().apply(ConfigurationResolverPlugin.class));

project.getRootProject().allprojects(proj ->
proj.getTasks().withType(Test.class, test -> {
Path junitReportsDir = Paths.get(circleArtifactsDir, "junit");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ class BaselineCircleCiIntegrationTest extends AbstractPluginTest {
new File(System.getenv('CIRCLE_ARTIFACTS')).toPath().deleteDir()
}

def 'applies the configuration resolver plugin'() {
when:
buildFile << standardBuildFile

then:
BuildResult result = with('resolveConfigurations').build()
result.task(':resolveConfigurations').outcome == TaskOutcome.SUCCESS
}

def 'collects html reports'() {
when:
buildFile << standardBuildFile
Expand Down

0 comments on commit 4baeb05

Please sign in to comment.