@@ -273,8 +273,19 @@ object CrossSources {
273
273
)
274
274
}).flatten
275
275
276
+ val resourceDirectoriesFromDirectives = {
277
+ val resourceDirsFromCli =
278
+ allInputs.elements.flatMap { case rd : ResourceDirectory => Some (rd.path); case _ => None }
279
+ val latestResourceDirsFromBuildOptions : Seq [os.Path ] =
280
+ buildOptions.flatMap(_.value.classPathOptions.resourcesDir).distinct
281
+ latestResourceDirsFromBuildOptions
282
+ .filter(! resourceDirsFromCli.contains(_))
283
+ .map(ResourceDirectory (_))
284
+ }
285
+ val finalInputs = allInputs.add(resourceDirectoriesFromDirectives)
286
+
276
287
val defaultMainElemPath = for {
277
- defaultMainElem <- allInputs .defaultMainClassElement
288
+ defaultMainElem <- finalInputs .defaultMainClassElement
278
289
} yield defaultMainElem.path
279
290
280
291
val pathsWithDirectivePositions
@@ -284,7 +295,7 @@ object CrossSources {
284
295
val baseReqs0 = baseReqs(d.scopePath)
285
296
WithBuildRequirements (
286
297
d.requirements.fold(baseReqs0)(_ orElse baseReqs0),
287
- (d.path, d.path.relativeTo(allInputs .workspace))
298
+ (d.path, d.path.relativeTo(finalInputs .workspace))
288
299
) -> d.directivesPositions
289
300
}
290
301
val inMemoryWithDirectivePositions
@@ -309,7 +320,7 @@ object CrossSources {
309
320
}
310
321
311
322
val resourceDirs : Seq [WithBuildRequirements [os.Path ]] =
312
- resolveResourceDirs(allInputs , preprocessedSources)
323
+ resolveResourceDirs(finalInputs , preprocessedSources)
313
324
314
325
lazy val allPathsWithDirectivesByScope : Map [Scope , Seq [(os.Path , Position .File )]] =
315
326
(pathsWithDirectivePositions ++ inMemoryWithDirectivePositions ++ unwrappedScriptsWithDirectivePositions)
@@ -362,17 +373,15 @@ object CrossSources {
362
373
val paths = pathsWithDirectivePositions.map(_._1)
363
374
val inMemory = inMemoryWithDirectivePositions.map(_._1)
364
375
val unwrappedScripts = unwrappedScriptsWithDirectivePositions.map(_._1)
365
- (
366
- CrossSources (
367
- paths,
368
- inMemory,
369
- defaultMainElemPath,
370
- resourceDirs,
371
- buildOptions,
372
- unwrappedScripts
373
- ),
374
- allInputs
376
+ val crossSources = CrossSources (
377
+ paths,
378
+ inMemory,
379
+ defaultMainElemPath,
380
+ resourceDirs,
381
+ buildOptions,
382
+ unwrappedScripts
375
383
)
384
+ crossSources -> finalInputs
376
385
}
377
386
378
387
/** @return
0 commit comments