@@ -17,6 +17,7 @@ import org.gradle.api.tasks.SourceSet.TEST_SOURCE_SET_NAME
1717import org.gradle.api.tasks.SourceSetContainer
1818import org.gradle.api.tasks.TaskProvider
1919import org.gradle.api.tasks.compile.AbstractCompile
20+ import org.gradle.internal.configuration.problems.projectPathFrom
2021import org.gradle.jvm.tasks.Jar
2122import org.gradle.jvm.toolchain.JavaToolchainService
2223import org.gradle.kotlin.dsl.apply
@@ -33,8 +34,8 @@ import java.util.Locale
3334import javax.inject.Inject
3435
3536private const val CALL_SITE_INSTRUMENTER_MAIN_CLASS = " datadog.trace.plugin.csi.PluginApplication"
36- private const val CSI = " csi"
37- private const val CSI_SOURCE_SET = CSI
37+ const val CSI = " csi"
38+ const val CSI_SOURCE_SET = CSI
3839
3940abstract class CallSiteInstrumentationPlugin : Plugin <Project > {
4041 @get:Inject
@@ -52,13 +53,12 @@ abstract class CallSiteInstrumentationPlugin : Plugin<Project> {
5253
5354 private fun configureSourceSets (project : Project , extension : CallSiteInstrumentationExtension ) {
5455 // create a new source set for the csi files
55- val targetFolder = newBuildFolder(project, extension.targetFolder.get().asFile.toString())
5656 val sourceSets = project.sourceSets
5757 val mainSourceSet = sourceSets.named(MAIN_SOURCE_SET_NAME ).get()
5858 val csiSourceSet = sourceSets.create(CSI_SOURCE_SET ) {
5959 compileClasspath + = mainSourceSet.output // mainly needed for the plugin tests
6060 annotationProcessorPath + = mainSourceSet.annotationProcessorPath
61- java.srcDir(targetFolder)
61+ java.srcDir(extension. targetFolder)
6262 }
6363
6464 project.configurations.named(csiSourceSet.compileClasspathConfigurationName) {
@@ -83,16 +83,6 @@ abstract class CallSiteInstrumentationPlugin : Plugin<Project> {
8383 }
8484 }
8585
86- private fun newBuildFolder (project : Project , name : String ): File {
87- val folder = project.layout.buildDirectory.dir(name).get().asFile
88- if (! folder.exists()) {
89- if (! folder.mkdirs()) {
90- throw GradleException (" Cannot create folder $folder " )
91- }
92- }
93- return folder
94- }
95-
9686 private fun newTempFile (folder : File , name : String ): File {
9787 val file = File (folder, name)
9888 if (! file.exists() && ! file.createNewFile()) {
0 commit comments