|
| 1 | +/* |
| 2 | + * Copyright 2016 DiffPlug |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package com.diffplug.gradle.spotless; |
| 17 | + |
| 18 | +import java.io.IOException; |
| 19 | + |
| 20 | +import org.assertj.core.api.Assertions; |
| 21 | +import org.gradle.testkit.runner.GradleRunner; |
| 22 | +import org.junit.Test; |
| 23 | + |
| 24 | +/** Reproduces https://github.com/diffplug/spotless/issues/506 */ |
| 25 | +public class MultiProjectAfterEvaluate extends GradleIntegrationTest { |
| 26 | + @Test |
| 27 | + public void failureDoesntTriggerAll() throws IOException { |
| 28 | + setFile("settings.gradle").toLines("include 'sub'"); |
| 29 | + setFile("build.gradle").toLines("buildscript { repositories { mavenCentral() }}"); |
| 30 | + setFile("sub/build.gradle") |
| 31 | + .toLines( |
| 32 | + "plugins {", |
| 33 | + " id 'com.diffplug.gradle.spotless'", |
| 34 | + " id 'java'", |
| 35 | + "}", |
| 36 | + "spotless { java { googleJavaFormat() } }"); |
| 37 | + String output = gradleRunner6().withArguments("spotlessApply", "--warning-mode", "all").build().getOutput().replace("\r\n", "\n"); |
| 38 | + Assertions.assertThat(output).contains("Using method Project#afterEvaluate(Action) when the project is already evaluated has been deprecated."); |
| 39 | + } |
| 40 | + |
| 41 | + private final GradleRunner gradleRunner6() throws IOException { |
| 42 | + return gradleRunner().withGradleVersion("6.0"); |
| 43 | + } |
| 44 | +} |
0 commit comments