Skip to content

Commit

Permalink
Merge pull request quarkusio#38249 from ribafish/gk/quarkusPluginGrad…
Browse files Browse the repository at this point in the history
…le9Fix

Fixed deprecation warnings caused by QuarkusPlugin
  • Loading branch information
aloubyansky authored Jan 17, 2024
2 parents e7c8069 + 4db15c3 commit c7ad2cf
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public void apply(Project project) {
final QuarkusPluginExtension quarkusExt = project.getExtensions().create(EXTENSION_NAME, QuarkusPluginExtension.class,
project);

createSourceSets(project);
createConfigurations(project);
registerTasks(project, quarkusExt);
}
Expand Down Expand Up @@ -323,7 +324,7 @@ public boolean isSatisfiedBy(Task t) {
quarkusGenerateCodeDev.configure(task -> task.setSourcesDirectories(getSourcesParents(mainSourceSet)));
quarkusGenerateCodeTests.configure(task -> task.setSourcesDirectories(getSourcesParents(testSourceSet)));

SourceSet intTestSourceSet = sourceSets.create(INTEGRATION_TEST_SOURCE_SET_NAME);
SourceSet intTestSourceSet = sourceSets.getByName(INTEGRATION_TEST_SOURCE_SET_NAME);
intTestSourceSet.setCompileClasspath(
intTestSourceSet.getCompileClasspath()
.plus(mainSourceSet.getOutput())
Expand All @@ -345,7 +346,7 @@ public boolean isSatisfiedBy(Task t) {
intTestTask.setTestClassesDirs(intTestSourceOutputClasses);
});

SourceSet nativeTestSourceSet = sourceSets.create(NATIVE_TEST_SOURCE_SET_NAME);
SourceSet nativeTestSourceSet = sourceSets.getByName(NATIVE_TEST_SOURCE_SET_NAME);
nativeTestSourceSet.setCompileClasspath(
nativeTestSourceSet.getCompileClasspath()
.plus(mainSourceSet.getOutput())
Expand Down Expand Up @@ -391,8 +392,8 @@ public void execute(Task task) {
// quarkusBuild is expected to run after the project has passed the tests
quarkusBuildCacheableAppParts.configure(task -> task.shouldRunAfter(tasks.withType(Test.class)));

SourceSet generatedSourceSet = sourceSets.create(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES);
SourceSet generatedTestSourceSet = sourceSets.create(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES);
SourceSet generatedSourceSet = sourceSets.getByName(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES);
SourceSet generatedTestSourceSet = sourceSets.getByName(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES);

// Register the quarkus-generated-code
for (String provider : QuarkusGenerateCode.CODE_GENERATION_PROVIDER) {
Expand Down Expand Up @@ -423,14 +424,22 @@ private static void configureGenerateCodeTask(QuarkusGenerateCode task, String g
task.getGeneratedOutputDirectory().set(generatedSources.getJava().getClassesDirectory().get().getAsFile());
}

private void createSourceSets(Project project) {
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
sourceSets.create(INTEGRATION_TEST_SOURCE_SET_NAME);
sourceSets.create(NATIVE_TEST_SOURCE_SET_NAME);
sourceSets.create(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES);
sourceSets.create(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES);
}

private void createConfigurations(Project project) {

final ConfigurationContainer configContainer = project.getConfigurations();

// Custom configuration to be used for the dependencies of the testNative task
configContainer.maybeCreate(NATIVE_TEST_IMPLEMENTATION_CONFIGURATION_NAME)
configContainer.getByName(NATIVE_TEST_IMPLEMENTATION_CONFIGURATION_NAME)
.extendsFrom(configContainer.findByName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME));
configContainer.maybeCreate(NATIVE_TEST_RUNTIME_ONLY_CONFIGURATION_NAME)
configContainer.getByName(NATIVE_TEST_RUNTIME_ONLY_CONFIGURATION_NAME)
.extendsFrom(configContainer.findByName(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME));

// create a custom configuration to be used for the dependencies of the quarkusIntTest task
Expand Down

0 comments on commit c7ad2cf

Please sign in to comment.