|
21 | 21 | import dev.jbang.Settings; |
22 | 22 | import dev.jbang.dependencies.ArtifactInfo; |
23 | 23 | import dev.jbang.dependencies.MavenCoordinate; |
| 24 | +import dev.jbang.source.BuildContext; |
24 | 25 | import dev.jbang.source.Project; |
25 | 26 | import dev.jbang.source.ProjectBuilder; |
26 | 27 | import dev.jbang.util.JarUtil; |
@@ -82,11 +83,13 @@ protected Path createManifest(String newPath) throws IOException { |
82 | 83 | public Integer doCall() throws IOException { |
83 | 84 | exportMixin.validate(); |
84 | 85 | ProjectBuilder pb = createProjectBuilder(exportMixin); |
85 | | - Project prj = pb.build(exportMixin.scriptMixin.scriptOrFile).builder().build(); |
86 | | - return apply(prj, pb); |
| 86 | + Project prj = pb.build(exportMixin.scriptMixin.scriptOrFile); |
| 87 | + BuildContext ctx = BuildContext.forProject(prj); |
| 88 | + prj.builder(ctx).build(); |
| 89 | + return apply(prj, ctx); |
87 | 90 | } |
88 | 91 |
|
89 | | - abstract int apply(Project prj, ProjectBuilder pb) throws IOException; |
| 92 | + abstract int apply(Project prj, BuildContext ctx) throws IOException; |
90 | 93 |
|
91 | 94 | protected ProjectBuilder createProjectBuilder(ExportMixin exportMixin) { |
92 | 95 | return ProjectBuilder |
@@ -118,9 +121,9 @@ Path getJarOutputPath() { |
118 | 121 | class ExportLocal extends BaseExportCommand { |
119 | 122 |
|
120 | 123 | @Override |
121 | | - int apply(Project prj, ProjectBuilder pb) throws IOException { |
| 124 | + int apply(Project prj, BuildContext ctx) throws IOException { |
122 | 125 | // Copy the JAR |
123 | | - Path source = prj.getJarFile(); |
| 126 | + Path source = ctx.getJarFile(); |
124 | 127 | Path outputPath = getJarOutputPath(); |
125 | 128 | if (outputPath.toFile().exists()) { |
126 | 129 | if (exportMixin.force) { |
@@ -155,9 +158,9 @@ class ExportPortable extends BaseExportCommand { |
155 | 158 | public static final String LIB = "lib"; |
156 | 159 |
|
157 | 160 | @Override |
158 | | - int apply(Project prj, ProjectBuilder pb) throws IOException { |
| 161 | + int apply(Project prj, BuildContext ctx) throws IOException { |
159 | 162 | // Copy the JAR |
160 | | - Path source = prj.getJarFile(); |
| 163 | + Path source = ctx.getJarFile(); |
161 | 164 | Path outputPath = getJarOutputPath(); |
162 | 165 | if (outputPath.toFile().exists()) { |
163 | 166 | if (exportMixin.force) { |
@@ -205,14 +208,14 @@ class ExportMavenPublish extends BaseExportCommand { |
205 | 208 | String version; |
206 | 209 |
|
207 | 210 | @Override |
208 | | - int apply(Project prj, ProjectBuilder pb) throws IOException { |
| 211 | + int apply(Project prj, BuildContext ctx) throws IOException { |
209 | 212 | Path outputPath = exportMixin.outputFile; |
210 | 213 |
|
211 | 214 | if (outputPath == null) { |
212 | 215 | outputPath = Settings.getLocalMavenRepo(); |
213 | 216 | } |
214 | 217 | // Copy the JAR |
215 | | - Path source = prj.getJarFile(); |
| 218 | + Path source = ctx.getJarFile(); |
216 | 219 |
|
217 | 220 | if (!outputPath.toFile().isDirectory()) { |
218 | 221 | if (outputPath.toFile().exists()) { |
@@ -306,9 +309,9 @@ int apply(Project prj, ProjectBuilder pb) throws IOException { |
306 | 309 | class ExportNative extends BaseExportCommand { |
307 | 310 |
|
308 | 311 | @Override |
309 | | - int apply(Project prj, ProjectBuilder pb) throws IOException { |
| 312 | + int apply(Project prj, BuildContext ctx) throws IOException { |
310 | 313 | // Copy the native binary |
311 | | - Path source = prj.getNativeImageFile(); |
| 314 | + Path source = ctx.getNativeImageFile(); |
312 | 315 | Path outputPath = getNativeOutputPath(); |
313 | 316 | if (outputPath.toFile().exists()) { |
314 | 317 | if (exportMixin.force) { |
@@ -345,9 +348,9 @@ Path getNativeOutputPath() { |
345 | 348 | class ExportFatjar extends BaseExportCommand { |
346 | 349 |
|
347 | 350 | @Override |
348 | | - int apply(Project prj, ProjectBuilder pb) throws IOException { |
| 351 | + int apply(Project prj, BuildContext ctx) throws IOException { |
349 | 352 | // Copy the native binary |
350 | | - Path source = prj.getJarFile(); |
| 353 | + Path source = ctx.getJarFile(); |
351 | 354 | Path outputPath = getFatjarOutputPath(); |
352 | 355 | if (outputPath.toFile().exists()) { |
353 | 356 | if (exportMixin.force) { |
|
0 commit comments