Skip to content

Commit

Permalink
attempt to re-detect project root is pointless
Browse files Browse the repository at this point in the history
we receive project root as a projectDir parameter
  • Loading branch information
neowit committed Jan 4, 2024
1 parent 2657e06 commit c35a6bc
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/main/scala/com/neowit/apex/ProjectsCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,21 @@ object ProjectsCache {
_projectByPath.get(projectDir) match {
case Some(_project) => _project
case None =>
Project.findApexProjectRoot(projectDir.toPath) match {
case Some(projectRoot) =>
val project = new Project(projectRoot)
// add SObjectLibrary
val sobjectLib = new SObjectLibrary(session)
// make sure model is not loaded for this session (e.g. when running tests in parallel)
// different test classes can not re-use same DatabaseModel because their projects have different Ast Trees
DatabaseModel.removeModelBySession(session)
// load SObject library
project.addExternalLibrary(sobjectLib)
// add StdLib (must go after SObject library because some Objects in DB may conflict with names in StdLib)
project.loadStdLib()
val projectRoot = projectDir.toPath
val project = new Project(projectRoot)
// add SObjectLibrary
val sobjectLib = new SObjectLibrary(session)
// make sure model is not loaded for this session (e.g. when running tests in parallel)
// different test classes can not re-use same DatabaseModel because their projects have different Ast Trees
DatabaseModel.removeModelBySession(session)
// load SObject library
project.addExternalLibrary(sobjectLib)
// add StdLib (must go after SObject library because some Objects in DB may conflict with names in StdLib)
project.loadStdLib()

_projectByPath += projectDir -> project
project

_projectByPath += projectDir -> project
project
case None =>
throw new IllegalArgumentException("Failed ot detect project root by path: " + projectDir)
}

}
}
Expand Down

0 comments on commit c35a6bc

Please sign in to comment.