Mercurial > hg > tc-symbol-server
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 |
rev | line source |
---|---|
12 | 1 package jetbrains.buildServer.symbols; |
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 | 5 import java.io.File; |
6 import java.io.FileWriter; | |
7 import java.io.IOException; | |
8 import java.util.Collection; | |
9 | |
10 /** | |
11 * @author Evgeniy.Koshkin | |
12 */ | |
25 | 13 public class SrcSrvStreamBuilder { |
24 | 14 |
25 | 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 | 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 | 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 | 21 } |
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 | 25 final FileWriter fileWriter = new FileWriter(targetFile.getPath(), true); |
20 | 26 |
12 | 27 try { |
24 | 28 fileWriter.write("SRCSRV: ini ------------------------------------------------\r\n"); |
29 fileWriter.write("VERSION=3\r\n"); | |
30 fileWriter.write("INDEXVERSION=2\r\n"); | |
31 fileWriter.write("VERCTRL=http\r\n"); | |
32 fileWriter.write("SRCSRV: variables ------------------------------------------\r\n"); | |
33 fileWriter.write("SRCSRVVERCTRL=http\r\n"); | |
25 | 34 fileWriter.write(String.format("HTTP_ALIAS=%s\r\n", myUrlProvider.getHttpAlias())); |
24 | 35 fileWriter.write("HTTP_EXTRACT_TARGET=%HTTP_ALIAS%/%var2%\r\n"); |
36 fileWriter.write("SRCSRVTRG=%HTTP_EXTRACT_TARGET%\r\n"); | |
37 fileWriter.write("SRCSRVCMD=\r\n"); | |
38 fileWriter.write("SRCSRV: source files ------------------------------------------\r\n"); | |
12 | 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 | 50 } |
51 fileWriter.write("SRCSRV: end ------------------------------------------------"); | |
52 } | |
53 finally { | |
54 fileWriter.close(); | |
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 | 57 } |
58 } |