Skip to content

Commit

Permalink
Move options checking into EvictionsProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolay Obedin committed Oct 9, 2015
1 parent 9e3f196 commit b544afc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ object StructureExtractor extends Extractor {
}

private def extract(acceptedProjectRefs: Seq[ProjectRef])(implicit state: State, options: Options): StructureData = {
val projectsData = {
val nonEvicted = acceptedProjectRefs.flatMap(ProjectExtractor.apply(_))
if (options.download) EvictionsProcessor.apply(acceptedProjectRefs, nonEvicted) else nonEvicted
}

val projectsData =
EvictionsProcessor.apply(acceptedProjectRefs, acceptedProjectRefs.flatMap(ProjectExtractor.apply(_)))
val repositoryData =
RepositoryExtractor.apply(acceptedProjectRefs).map(UnusedLibrariesProcessor.apply(projectsData))

val sbtVersion = setting(Keys.sbtVersion).get
val localCachePath = Option(System.getProperty("sbt.ivy.home", System.getProperty("ivy.home")))
StructureData(sbtVersion, projectsData, repositoryData, localCachePath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ import scala.collection.mutable
* @since 9/15/15.
*/
object EvictionsProcessor {
def apply(acceptedProjectRefs: Seq[ProjectRef], projectsData: Seq[ProjectData])(implicit state: State): Seq[ProjectData] =
new EvictionsProcessor(acceptedProjectRefs, projectsData).process()
def apply(acceptedProjectRefs: Seq[ProjectRef], projectsData: Seq[ProjectData])(implicit state: State, options: Options): Seq[ProjectData] =
if (options.download)
new EvictionsProcessor(acceptedProjectRefs, projectsData).process()
else
projectsData
}

class EvictionsProcessor(acceptedProjectRefs: Seq[ProjectRef], projectsData: Seq[ProjectData]) extends Extractor with Configurations with Modules {
Expand Down

0 comments on commit b544afc

Please sign in to comment.