@@ -8,6 +8,7 @@ import org.openrewrite.config.CategoryDescriptor
88import org.openrewrite.config.Environment
99import org.openrewrite.config.RecipeDescriptor
1010import java.net.URI
11+ import java.net.URL
1112import java.net.URLClassLoader
1213import java.nio.file.Path
1314import java.nio.file.Paths
@@ -17,7 +18,7 @@ import kotlin.io.path.toPath
1718/* *
1819 * Data class to hold both descriptors and recipes loaded from an environment
1920 */
20- data class EnvironmentData (
21+ private data class EnvironmentData (
2122 val recipeDescriptors : Collection <RecipeDescriptor >,
2223 val categoryDescriptors : Collection <CategoryDescriptor >,
2324 val recipes : Collection <Recipe >
@@ -45,12 +46,17 @@ class RecipeLoader {
4546 recipeSources : String ,
4647 recipeClasspath : String
4748 ): RecipeLoadResult {
48- // Create classloader from classpath
49- val classloader = createClassLoader(recipeClasspath)
50-
5149 // Parse recipe origins
5250 val recipeOrigins: Map <URI , RecipeOrigin > = RecipeOrigin .parse(recipeSources)
53-
51+
52+ // Create classloader from classpath
53+ val classloader = recipeClasspath.split(" ;" )
54+ .map(Paths ::get)
55+ .map(Path ::toUri)
56+ .map(URI ::toURL)
57+ .toTypedArray<URL >()
58+ .let { URLClassLoader (it) }
59+
5460 // Add manifest information
5561 addInfosFromManifests(recipeOrigins, classloader)
5662
@@ -66,19 +72,7 @@ class RecipeLoader {
6672 recipeOrigins = recipeOrigins
6773 )
6874 }
69-
70- /* *
71- * Create a URLClassLoader from the classpath string
72- */
73- private fun createClassLoader (recipeClasspath : String ): ClassLoader {
74- return recipeClasspath.split(" ;" )
75- .map(Paths ::get)
76- .map(Path ::toUri)
77- .map(URI ::toURL)
78- .toTypedArray()
79- .let { URLClassLoader (it) }
80- }
81-
75+
8276 /* *
8377 * Process recipe jars in parallel and collect both descriptors and recipes
8478 */
0 commit comments