in teamcity-symbol-server/src/main/java/jetbrains/buildServer/symbols/BuildSymbolsIndexProvider.java [48:103]
public void generateMedatadata(@NotNull SBuild sBuild, @NotNull MetadataStorageWriter metadataStorageWriter) {
final BuildArtifact symbols = sBuild.getArtifacts(BuildArtifactsViewMode.VIEW_HIDDEN_ONLY).getArtifact(".teamcity/symbols");
final long buildId = sBuild.getBuildId();
final Set<String> processedSymbols = new HashSet<>();
if(symbols != null){
for (BuildArtifact symbolSignaturesSource : symbols.getChildren()){
if (!symbolSignaturesSource.getName().startsWith(SymbolsConstants.SYMBOL_SIGNATURES_FILE_NAME_PREFIX) &&
!symbolSignaturesSource.getName().startsWith(SymbolsConstants.BINARY_SIGNATURES_FILE_NAME_PREFIX))
continue;
final Set<PdbSignatureIndexEntry> indexEntries;
try {
indexEntries = PdbSignatureIndexUtil.read(symbolSignaturesSource.getInputStream(), false);
} catch (Exception e) {
LOG.warnAndDebugDetails(String.format(
"Failed to read symbols index file %s of build %s",
symbolSignaturesSource.getRelativePath(), LogUtil.describe(sBuild)), e);
continue;
}
LOG.debug(String.format("Build with id %d provides %d symbol file signatures.", buildId, indexEntries.size()));
for (final PdbSignatureIndexEntry indexEntry : indexEntries) {
final String signature = indexEntry.getGuid();
final String fileName = indexEntry.getFileName();
final String metadataKey = getMetadataKey(signature, fileName);
if (processedSymbols.contains(metadataKey)) continue;
String artifactPath = indexEntry.getArtifactPath();
if(artifactPath == null){
LOG.debug(String.format("Artifact path is not provided for artifact %s, locating it by name in build %s artifacts.", fileName, LogUtil.describe(sBuild)));
artifactPath = locateArtifact(sBuild, fileName);
if(artifactPath != null){
LOG.debug(String.format("Located artifact by name %s, path - %s. Build - %s", fileName, artifactPath, LogUtil.describe(sBuild)));
}
}
LOG.info(String.format(
"Indexing symbol file %s with signature %s of build %s", fileName, signature, LogUtil.describe(sBuild)
));
final HashMap<String, String> data = new HashMap<>();
data.put(SIGNATURE_KEY, signature);
data.put(FILE_NAME_KEY, fileName);
data.put(ARTIFACT_PATH_KEY, artifactPath);
metadataStorageWriter.addParameters(metadataKey, data);
mySymbolsCache.invalidate(buildId);
processedSymbols.add(metadataKey);
}
}
}
if (processedSymbols.isEmpty()) {
LOG.debug("Build with id " + buildId + " doesn't provide symbols index data.");
}
}