Skip to content

Commit

Permalink
Configure resource path to expected value (group + platform + variant)
Browse files Browse the repository at this point in the history
  • Loading branch information
lacasseio committed Nov 27, 2021
1 parent fb71a71 commit 92f458f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions buildSrc/src/main/java/gradlebuild/JniNokeePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void apply(Project project) {
project.getPluginManager().apply(NativeToolChainRules.class);

configureCppTasks(project);
configureMainLibrary(project.getExtensions().getByType(JavaNativeInterfaceLibrary.class));
configureMainLibrary(project);
configureVariants(project);
addComponentSourcesSetsToProjectSourceSet(project.getTasks(), project.getExtensions().getByType(JavaNativeInterfaceLibrary.class));

Expand All @@ -68,7 +68,8 @@ private static String toVariantName(TargetMachine targetMachine) {
return targetMachine.getOperatingSystemFamily().getName() + "-" + targetMachine.getArchitecture().getName();
}

private void configureMainLibrary(JavaNativeInterfaceLibrary library) {
private void configureMainLibrary(Project project) {
JavaNativeInterfaceLibrary library = project.getExtensions().getByType(JavaNativeInterfaceLibrary.class);
library.getTargetMachines().set(supportedMachines(library.getMachines()));
library.getTasks().configureEach(CppCompile.class, task -> {
task.getCompilerArgs().addAll(task.getTargetPlatform().map(targetPlatform -> {
Expand Down Expand Up @@ -103,6 +104,12 @@ private void configureMainLibrary(JavaNativeInterfaceLibrary library) {
});
}
});
library.getVariants().configureEach(variant -> {
variant.getResourcePath().set(String.join("/",
project.getGroup().toString().replace('.', '/'),
"platform",
toVariantName(variant.getTargetMachine())));
});
}

private void addComponentSourcesSetsToProjectSourceSet(TaskContainer tasks, JavaNativeInterfaceLibrary library) {
Expand Down

0 comments on commit 92f458f

Please sign in to comment.