Skip to content

Commit

Permalink
tighten build around application.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
edward3h committed Aug 21, 2024
1 parent a74ec6c commit e11b70b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public void apply(Project project) {
project.getGradle().getSharedServices().registerIfAbsent("embeddedPostgres", EmbeddedPostgresService.class);

var processorConfigTask = project.getTasks().register("processorConfig", ProcessorConfigTask.class, task -> {
task.getConfigFile().set(project.getLayout().getBuildDirectory().file("config.json"));
task.getApplicationConfigFile().convention(project.getLayout().getBuildDirectory().file("resources/test/application-test.yml"));
task.getConfigFile().set(project.getLayout().getBuildDirectory().file("processorConfig/config.json"));
task.getApplicationConfigFile().convention(project.getLayout().getBuildDirectory().file("processorConfig/application-test.yml"));
task.getDependencyInjectionStyle().convention("JAKARTA");
task.getLiquibaseChangelog().convention(project.getLayout().getProjectDirectory().file("src/main/resources/changelog.xml"));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class ProcessorConfigTask extends DefaultTask {
abstract RegularFileProperty getConfigFile();

@OutputFile
abstract RegularFileProperty getApplicationConfigFile();
public abstract RegularFileProperty getApplicationConfigFile();

@InputFile
abstract RegularFileProperty getLiquibaseChangelog();
Expand Down
8 changes: 8 additions & 0 deletions test-micronaut/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.ethelred.buildsupport.ProcessorConfigTask

plugins {
id("java-convention")
id("org.ethelred.embeddedpostgres")
Expand All @@ -15,4 +17,10 @@ dependencies {
testRuntimeOnly("io.micronaut.sql:micronaut-jdbc-hikari")
testRuntimeOnly(libs.postgresql)
testRuntimeOnly(libs.yaml)
}

val processorConfig = tasks.named<ProcessorConfigTask>("processorConfig")

tasks.named<ProcessResources>("processTestResources") {
from(processorConfig.get().getApplicationConfigFile())
}

0 comments on commit e11b70b

Please sign in to comment.