|
1 | 1 | /* |
2 | | - * Copyright (C) 2016-2022 DiffPlug |
| 2 | + * Copyright (C) 2016-2023 DiffPlug |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
15 | 15 | */ |
16 | 16 | package com.diffplug.gradle.osgi; |
17 | 17 |
|
18 | | - |
19 | 18 | import aQute.bnd.osgi.Builder; |
20 | 19 | import aQute.bnd.osgi.Constants; |
21 | 20 | import com.diffplug.common.base.*; |
|
38 | 37 | import org.gradle.api.Task; |
39 | 38 | import org.gradle.api.java.archives.Attributes; |
40 | 39 | import org.gradle.api.plugins.JavaPlugin; |
41 | | -import org.gradle.api.plugins.JavaPluginConvention; |
| 40 | +import org.gradle.api.plugins.JavaPluginExtension; |
42 | 41 | import org.gradle.api.tasks.SourceSet; |
43 | 42 | import org.gradle.api.tasks.SourceSetOutput; |
44 | 43 | import org.gradle.api.tasks.bundling.Jar; |
@@ -150,8 +149,8 @@ public void execute(Task unused) { |
150 | 149 | } |
151 | 150 |
|
152 | 151 | private static Path outputManifest(Jar jarTask) { |
153 | | - JavaPluginConvention javaConvention = jarTask.getProject().getConvention().getPlugin(JavaPluginConvention.class); |
154 | | - SourceSet main = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME); |
| 152 | + JavaPluginExtension javaExtension = jarTask.getProject().getExtensions().getByType(JavaPluginExtension.class); |
| 153 | + SourceSet main = javaExtension.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME); |
155 | 154 | return main.getOutput().getResourcesDir().toPath().resolve("META-INF/MANIFEST.MF"); |
156 | 155 | } |
157 | 156 |
|
@@ -188,8 +187,8 @@ private static String takeBndAction(Project project, Jar jarTask, Throwing.Funct |
188 | 187 | builder.addClasspath(runtimeConfig); |
189 | 188 |
|
190 | 189 | // put the class files and resources into the jar |
191 | | - JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class); |
192 | | - SourceSetOutput main = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput(); |
| 190 | + JavaPluginExtension javaExtension = project.getExtensions().getByType(JavaPluginExtension.class); |
| 191 | + SourceSetOutput main = javaExtension.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput(); |
193 | 192 | // delete empty folders so that bnd doesn't make Export-Package entries for them |
194 | 193 | Set<String> includeresource = new LinkedHashSet<>(); |
195 | 194 | deleteEmptyFoldersIfExists(main.getResourcesDir()); |
|
0 commit comments