Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed deprecation warnings caused by QuarkusPlugin #38249

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
ribafish marked this conversation as resolved.
Show resolved Hide resolved
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
Loading