Skip to content

Commit

Permalink
Fixed the self-apply bug by moving it into its own folder, so the Tes…
Browse files Browse the repository at this point in the history
…tKit-generated `.gradle` folder doesn't fight with the real folder.
  • Loading branch information
nedtwigg committed Jan 6, 2017
1 parent f7ba9f6 commit c821e85
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,12 @@ private static Project createProject(Consumer<SpotlessExtension> test) throws Ex

/** Runs against the `spotlessSelfApply.gradle` file. */
static void runWithTestKit(Type type) throws Exception {
File pluginGradleDir = new File(StandardSystemProperty.USER_DIR.value());
File rootDir = pluginGradleDir.getParentFile();
File selfApplyDir = new File(rootDir, "selfApply");
GradleRunner.create()
.withPluginClasspath()
.withProjectDir(new File(StandardSystemProperty.USER_DIR.value()).getParentFile())
.withProjectDir(selfApplyDir)
.withArguments("-b", "spotlessSelf.gradle", "spotless" + type.checkApply("Check", "Apply"), "--stacktrace")
.forwardOutput()
.build();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions spotlessSelf.gradle → selfApply/spotlessSelf.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
// applied by SelfTest
// important for it to be in its own directory
plugins {
id 'com.diffplug.gradle.spotless'
id 'java'
}

repositories { mavenCentral() }
spotless {
java {
target '**/*.java'
target '../**/*.java'
licenseHeaderFile 'spotless.license'
importOrderFile 'spotless.importorder'
eclipseFormatFile 'spotless.eclipseformat.xml'
trimTrailingWhitespace()
}
freshmark {
target '**/*.md'
propertiesFile('gradle.properties')
target '../**/*.md'
propertiesFile('../gradle.properties')
properties {
it.put('yes', ':+1:')
it.put('no', ':white_large_square:')
}
}
format 'misc', {
target '**/*.gradle', '**/*.md', '**/*.gitignore'
target '../**/*.gradle', '../**/*.md', '../**/*.gitignore'
indentWithTabs()
trimTrailingWhitespace()
endWithNewline()
Expand Down

0 comments on commit c821e85

Please sign in to comment.