( client: BazelClient, workspaceInfo: BazelWorkspaceInfo, pathsByLabel: Map<string, string[]>, projectSyncOutputs: readonly ProjectSyncOutput[], )
| 133 | } |
| 134 | |
| 135 | async function syncPathsByLabel( |
| 136 | client: BazelClient, |
| 137 | workspaceInfo: BazelWorkspaceInfo, |
| 138 | pathsByLabel: Map<string, string[]>, |
| 139 | projectSyncOutputs: readonly ProjectSyncOutput[], |
| 140 | ) { |
| 141 | for (const projectSyncOutput of projectSyncOutputs) { |
| 142 | const paths: string[] = []; |
| 143 | paths.push(bazelLabelToAbsolutePath(workspaceInfo, projectSyncOutput.target)); |
| 144 | |
| 145 | if (projectSyncOutput.tsGeneratedDir) { |
| 146 | paths.push(projectSyncOutput.tsGeneratedDir); |
| 147 | } |
| 148 | |
| 149 | pathsByLabel.set(projectSyncOutput.target.toString(), paths); |
| 150 | } |
| 151 | |
| 152 | // TODO(simon): Refactor projectsync bzl rule so that it recursively resolves |
| 153 | // all of these without us having to take care of it. |
| 154 | const missingLabels = new Map<string, BazelLabel>(); |
| 155 | |
| 156 | for (const projectSyncOutput of projectSyncOutputs) { |
| 157 | for (const dependency of projectSyncOutput.dependencies) { |
| 158 | const key = dependency.toString(); |
| 159 | if (!pathsByLabel.has(key)) { |
| 160 | missingLabels.set(key, dependency); |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | if (missingLabels.size > 0) { |
| 166 | const targets = [...missingLabels.values()] |
| 167 | .sort((a, b) => a.toString().localeCompare(b.toString())) |
| 168 | .map(label => `${label.toBuildableString()}_projectsync`); |
| 169 | const newProjectSyncOutputs = await buildProjectSyncs(client, workspaceInfo.workspaceRoot, targets); |
| 170 | await syncPathsByLabel(client, workspaceInfo, pathsByLabel, newProjectSyncOutputs); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | async function collectTsConfigDirs( |
| 175 | bazel: BazelClient, |
no test coverage detected