@@ -38,12 +38,20 @@ val quarkusTestBaseRuntimeClasspathConfiguration by configurations.creating {
3838val quarkusTestCompileOnlyConfiguration by configurations.creating {
3939}
4040
41- val testModelPath = layout.buildDirectory.file(" quarkus-app-test-model.dat" ).get().asFile.toPath()
41+ val testModelPath = layout.buildDirectory.file(" quarkus-app-test-model.dat" )
4242
43- val buildModel = tasks.register(" buildModel" ) {
44- dependsOn(configurations.named(" testRuntimeClasspath" ))
45-
46- if (testModelPath.notExists()) {
43+ val buildModel = if (findProperty(" skipTests" ) as String? != " true" ) {
44+ tasks.register(" buildModel" ) {
45+ val modelPath = testModelPath.get().asFile.toPath()
46+
47+ inputs.files(configurations.named(" testRuntimeClasspath" ))
48+ outputs.file(testModelPath)
49+
50+ // Quarkus GradleApplicationModelBuilder requires Project at execution time
51+ notCompatibleWithConfigurationCache(" Quarkus GradleApplicationModelBuilder.buildAll() requires Project reference" )
52+
53+ onlyIf { modelPath.notExists() }
54+
4755 doLast {
4856 val modelParameter = ModelParameterImpl ()
4957 modelParameter.mode = LaunchMode .TEST .toString()
@@ -52,17 +60,20 @@ val buildModel = tasks.register("buildModel") {
5260 modelParameter,
5361 project
5462 )
55- BootstrapUtils .serializeAppModel(model as ApplicationModel ? , testModelPath )
63+ BootstrapUtils .serializeAppModel(model as ApplicationModel ? , modelPath )
5664 }
5765 }
58- outputs.file(testModelPath)
66+ } else {
67+ null
5968}
6069
6170tasks {
6271 test {
63- dependsOn(buildModel)
72+ if (buildModel != null ) {
73+ dependsOn(buildModel)
74+ }
6475
65- systemProperty(" quarkus-internal-test.serialized-app-model.path" , testModelPath.toString())
76+ systemProperty(" quarkus-internal-test.serialized-app-model.path" , testModelPath.get().asFile. toString())
6677 }
6778
6879 if (findProperty(" denyUnsafe" ) as Boolean ) {
0 commit comments