Skip to content

Commit

Permalink
Change package resources default location
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed Jan 30, 2024
1 parent bde4e61 commit 6d1e169
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import org.gradle.api.NonNullApi;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.file.SourceDirectorySet;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.jvm.toolchain.JavaToolchainService;
import org.gradle.util.GradleVersion;

Expand All @@ -39,10 +41,13 @@ public void apply(Project project) {
}

project.getPlugins().apply(JavaPlugin.class);
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
SourceDirectorySet mainResources = sourceSets.getByName("main").getResources();

JavaModulePackagingExtension javaModulePackaging = project.getExtensions().create("javaModulePackaging", JavaModulePackagingExtension.class);
javaModulePackaging.getApplicationName().convention(project.getName());
javaModulePackaging.getApplicationVersion().convention(project.provider(() -> (String) project.getVersion()));
javaModulePackaging.getJpackageResources().convention(project.getLayout().getProjectDirectory().dir("resources"));
javaModulePackaging.getJpackageResources().convention(project.provider(() ->
project.getLayout().getProjectDirectory().dir(mainResources.getSrcDirs().iterator().next().getParent() + "/resourcesPackage")));
}
}

0 comments on commit 6d1e169

Please sign in to comment.