Skip to content

Commit

Permalink
Add sorting inkuireDB before saving
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperFKorban committed Jul 6, 2021
1 parent af82146 commit c458218
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scaladoc/src/dotty/tools/scaladoc/Inkuire.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ object Inkuire {

var db = InkuireDb(Seq.empty, Map.empty, Seq.empty)

def beforeSave(): Unit = {
db = db.copy(
functions = db.functions.sortBy(_.hashCode),
types = db.types.toSeq.sortBy(_._1.uuid).toMap,
implicitConversions = db.implicitConversions.sortBy(_._1.uuid)
)
}

def generateInkuireConfig(externalMappings: Seq[String]): String = {
val paths = ("../inkuire-db.json" +: externalMappings.map(_ + "../inkuire-db.json")).map(jsonString)
jsonObject(("inkuirePaths", jsonList(paths))).toString
Expand Down
1 change: 1 addition & 0 deletions scaladoc/src/dotty/tools/scaladoc/Scaladoc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ object Scaladoc:
val dbFile = dbPath.toFile()
dbFile.createNewFile()
val dbWriter = new FileWriter(dbFile, false)
Inkuire.beforeSave()
dbWriter.write(s"${EngineModelSerializers.serialize(Inkuire.db)}")
dbWriter.close()

Expand Down

0 comments on commit c458218

Please sign in to comment.