Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,7 @@ fun prepareBuild(
return null
}

val pluggedInConfig = moduleConfig.copy(
moduleCustomizeHook = { module, isNew ->
moduleConfig.moduleCustomizeHook.customize(module, isNew)
for (backendId in supportedBackends) {
module.addEnvironmentBindings(lookupFactory(backendId)!!.environmentBindings)
}
},
)
val pluggedInConfig = plugInBackendConfigs(moduleConfig)
return Build(
harness = h,
requiredExt = requiredExt,
Expand All @@ -131,6 +124,19 @@ fun prepareBuild(
)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also looked into making Watcher call prepareBuild, but there's a larger gap for that change. The down side here is if people add other things in the middle of prepareBuild, but I think this is ok for now, anyway.


/** Applies environment bindings for [backends]. */
fun plugInBackendConfigs(
moduleConfig: ModuleConfig,
backends: List<BackendId> = supportedBackends,
): ModuleConfig = ModuleConfig(
moduleCustomizeHook = { module, isNew ->
moduleConfig.moduleCustomizeHook.customize(module, isNew)
for (backendId in backends) {
module.addEnvironmentBindings(lookupFactory(backendId)!!.environmentBindings)
}
},
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could make a superficial test of just this function, but testing for temper watch generally is awkward because of how much infrastructure is currently pulled in there.


/** [Prepare][prepareBuild]s and executes a build, closing the harness afterward. */
fun doBuild(
executorService: ExecutorService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class Watcher(
previouslyCompiled = lastBuild?.partitionedModules?.flatMap { it.second }
?: emptyList(),
runTask = runTask,
moduleConfig = moduleConfig,
moduleConfig = plugInBackendConfigs(moduleConfig),
cancelGroup = cancelGroup,
beforeStartTranslation = outputDirectoriesFree,
includeSnapshot = includeSnapshot,
Expand Down
Loading