annotate agent/src/jetbrains/buildServer/symbols/SrcSrvStreamBuilder.java @ 117:d2c79f95c2a6 default tip

remove tailing slash in teamcity server url when constructing symbol server url
author Evgeniy.Koshkin@unit-519.Labs.IntelliJ.Net
date Fri, 27 May 2016 15:27:30 +0300
parents 89220bce43c8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
1 package jetbrains.buildServer.symbols;
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
2
50
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
3 import jetbrains.buildServer.agent.BuildProgressLogger;
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
4
12
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
5 import java.io.File;
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
6 import java.io.FileWriter;
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
7 import java.io.IOException;
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
8 import java.util.Collection;
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
9
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
10 /**
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
11 * @author Evgeniy.Koshkin
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
12 */
25
f4e0050e2a2f resolve server url from config parameter
Evgeniy.Koshkin
parents: 24
diff changeset
13 public class SrcSrvStreamBuilder {
24
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
14
25
f4e0050e2a2f resolve server url from config parameter
Evgeniy.Koshkin
parents: 24
diff changeset
15 private final FileUrlProvider myUrlProvider;
50
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
16 private final BuildProgressLogger myProgressLogger;
12
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
17
50
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
18 public SrcSrvStreamBuilder(final FileUrlProvider urlProvider, BuildProgressLogger progressLogger) {
25
f4e0050e2a2f resolve server url from config parameter
Evgeniy.Koshkin
parents: 24
diff changeset
19 myUrlProvider = urlProvider;
50
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
20 myProgressLogger = progressLogger;
12
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
21 }
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
22
50
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
23 public int dumpStreamToFile(File targetFile, Collection<File> sourceFiles) throws IOException {
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
24 int processedFilesCount = 0;
12
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
25 final FileWriter fileWriter = new FileWriter(targetFile.getPath(), true);
20
10cb71666d5e more fixes in generated srcsrv
Evgeniy.Koshkin
parents: 19
diff changeset
26
12
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
27 try {
24
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
28 fileWriter.write("SRCSRV: ini ------------------------------------------------\r\n");
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
29 fileWriter.write("VERSION=3\r\n");
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
30 fileWriter.write("INDEXVERSION=2\r\n");
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
31 fileWriter.write("VERCTRL=http\r\n");
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
32 fileWriter.write("SRCSRV: variables ------------------------------------------\r\n");
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
33 fileWriter.write("SRCSRVVERCTRL=http\r\n");
25
f4e0050e2a2f resolve server url from config parameter
Evgeniy.Koshkin
parents: 24
diff changeset
34 fileWriter.write(String.format("HTTP_ALIAS=%s\r\n", myUrlProvider.getHttpAlias()));
24
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
35 fileWriter.write("HTTP_EXTRACT_TARGET=%HTTP_ALIAS%/%var2%\r\n");
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
36 fileWriter.write("SRCSRVTRG=%HTTP_EXTRACT_TARGET%\r\n");
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
37 fileWriter.write("SRCSRVCMD=\r\n");
9cbdbfed44f4 fixed sources loading
Evgeniy.Koshkin
parents: 20
diff changeset
38 fileWriter.write("SRCSRV: source files ------------------------------------------\r\n");
12
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
39 for(File sourceFile : sourceFiles){
50
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
40 String url = null;
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
41 try{
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
42 url = myUrlProvider.getFileUrl(sourceFile);
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
43 } catch (Exception ex){
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
44 myProgressLogger.warning("Failed to calculate url for source file " + sourceFile);
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
45 myProgressLogger.exception(ex);
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
46 }
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
47 if(url == null) continue;
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
48 processedFilesCount++;
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
49 fileWriter.write(String.format("%s*%s\r\n", sourceFile, url));
12
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
50 }
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
51 fileWriter.write("SRCSRV: end ------------------------------------------------");
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
52 }
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
53 finally {
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
54 fileWriter.close();
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
55 }
50
89220bce43c8 skipped source indexing of pdb's which weren't built during current build; the reason is that its impossible to construct url's for sources in this case
Evgeniy.Koshkin
parents: 29
diff changeset
56 return processedFilesCount;
12
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
57 }
662a0be55de7 - source indexing works!
Evgeniy.Koshkin
parents:
diff changeset
58 }