Skip to content

Commit

Permalink
More complaining
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Feb 9, 2024
1 parent 42e2418 commit 542d1bf
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ abstract class SpotlessUtilsExtension {
SpotlessUtilsExtension(Project project) {
configPath = new File(project.rootDir, '.gradle/formatter-config.xml')

if (!configPath.exists()) {
Files.createDirectories(configPath.toPath().parent)

try (
final input = SpotlessUtilsExtension.getResourceAsStream('/formatter-config.xml');
final output = Files.newOutputStream(configPath.toPath())
) {
input.transferTo(output)
}
}

final extract = project.tasks.register('extraGUSpotlessConfiguration', ExtractSpotlessConfiguration) {
it.output.set(configPath)
}
Expand All @@ -47,6 +36,18 @@ abstract class SpotlessUtilsExtension {
}

void configure(JavaExtension ext) {
// Spotless requires the config file to exist during configuration
if (!configPath.exists()) {
Files.createDirectories(configPath.toPath().parent)

try (
final input = SpotlessUtilsExtension.getResourceAsStream('/formatter-config.xml');
final output = Files.newOutputStream(configPath.toPath())
) {
input.transferTo(output)
}
}

ext.endWithNewline()
ext.indentWithSpaces()
ext.removeUnusedImports()
Expand Down

0 comments on commit 542d1bf

Please sign in to comment.