changeset 19:c038e1a8c8a5

fixed srcsrv stream content template - srctool now says that files are indexed
author Evgeniy.Koshkin
date Fri, 02 Aug 2013 00:00:17 +0400
parents d1c5ce19d0f7
children 10cb71666d5e
files agent/src/jetbrains/buildServer/symbols/PdbFilePatcher.java agent/src/jetbrains/buildServer/symbols/SrcSrvStreamProvider.java
diffstat 2 files changed, 14 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/agent/src/jetbrains/buildServer/symbols/PdbFilePatcher.java	Thu Aug 01 18:34:06 2013 +0400
+++ b/agent/src/jetbrains/buildServer/symbols/PdbFilePatcher.java	Fri Aug 02 00:00:17 2013 +0400
@@ -28,7 +28,7 @@
   public void patch(File symbolsFile, BuildProgressLogger buildLogger) throws Exception {
     final Collection<File> sourceFiles = mySrcToolExe.getReferencedSourceFiles(symbolsFile);
     if(sourceFiles.isEmpty()){
-      final String message = "No source information found in pdb file " + symbolsFile.getAbsolutePath();
+      final String message = "No source information found in pdb file " + symbolsFile.getCanonicalPath();
       buildLogger.warning(message);
       LOG.debug(message);
       return;
@@ -36,9 +36,9 @@
     final File tmpFile = FileUtil.createTempFile(myHomeDir, "pdb-", ".patch", false);
     myIndexInputProvider.dumpStreamToFile(tmpFile, sourceFiles);
     myPdbStrExe.doCommand(PdbStrExeCommand.WRITE, symbolsFile, tmpFile, PdbStrExe.SRCSRV_STREAM_NAME);
-    final File tmpFile1 = FileUtil.createTempFile(myHomeDir, "pdb-", ".patch", false);
-    myPdbStrExe.doCommand(PdbStrExeCommand.READ, symbolsFile, tmpFile1, PdbStrExe.SRCSRV_STREAM_NAME);
-    if(!FileUtil.checkContentEqual(tmpFile, tmpFile1))
-      throw new Exception("'srcsrv' stream content written to pdb differs from initial one");
+//    final File tmpFile1 = FileUtil.createTempFile(myHomeDir, "pdb-", ".patch", false);
+//    myPdbStrExe.doCommand(PdbStrExeCommand.READ, symbolsFile, tmpFile1, PdbStrExe.SRCSRV_STREAM_NAME);
+//    if(!FileUtil.checkContentEqual(tmpFile, tmpFile1))
+//      throw new Exception("'srcsrv' stream content written to pdb differs from initial one");
   }
 }
--- a/agent/src/jetbrains/buildServer/symbols/SrcSrvStreamProvider.java	Thu Aug 01 18:34:06 2013 +0400
+++ b/agent/src/jetbrains/buildServer/symbols/SrcSrvStreamProvider.java	Fri Aug 02 00:00:17 2013 +0400
@@ -19,9 +19,7 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.net.URI;
 import java.util.Collection;
-import java.util.Date;
 
 /**
  * @author Evgeniy.Koshkin
@@ -40,25 +38,17 @@
   public void dumpStreamToFile(File targetFile, Collection<File> sourceFiles) throws IOException {
     final FileWriter fileWriter = new FileWriter(targetFile.getPath(), true);
     try {
-      fileWriter.write("SRCSRV: ini ------------------------------------------------");
-      fileWriter.write(String.format("VERSION=%d", 1));
-      fileWriter.write(String.format("INDEXVERSION=%d", 1));
-      fileWriter.write("VERCTRL=http");
-      fileWriter.write(String.format("DATETIME=%s", (new Date()).toString()));
-
-      fileWriter.write("SRCSRV: variables ------------------------------------------");
-      fileWriter.write("SRCSRVVERCTRL=http");
-      fileWriter.write(String.format("REST_API_URL=%s", myRestApiUrl));
-      fileWriter.write(String.format("BUILD_LOCATOR=id:%d", myBuildId));
-      fileWriter.write("HTTP_EXTRACT_TARGET=%REST_API_URL%/%BUILD_LOCATOR%/sources/files/%var2%");
-      fileWriter.write("SRCSRVTRG=%HTTP_EXTRACT_TARGET%");
+      fileWriter.write("SRCSRV: ini ------------------------------------------------\r\n");
+      fileWriter.write(String.format("VERSION=%d\n", 1));
+      fileWriter.write("SRCSRV: variables ------------------------------------------\r\n");
+      fileWriter.write("SRCSRVTRG=%http_extract_target%\n");
       fileWriter.write("SRCSRVCMD=");
-
-      final URI checkoutDirUri = mySourcesRootDirectory.toURI();
-      fileWriter.write("SRCSRV: source files ------------------------------------------");
+      fileWriter.write(String.format("HTTP_EXTRACT_TARGET=%s/builds/id:%d/sources/files", myRestApiUrl, myBuildId) + "/%var2%\r\n");
+      fileWriter.write("SRCSRV: source files ------------------------------------------\r\n");
+      String sourcesRootDirectoryPath = mySourcesRootDirectory.getCanonicalPath();
       for(File sourceFile : sourceFiles){
-        final File sourceFileAbsolute = sourceFile.getAbsoluteFile();
-        fileWriter.write(String.format("%s*%s", sourceFileAbsolute.getPath(), checkoutDirUri.relativize(sourceFileAbsolute.toURI()).getPath()));
+        final String sourceFileCanonical = sourceFile.getCanonicalPath();
+        fileWriter.write(String.format("%s*%s\r\n", sourceFileCanonical, sourceFileCanonical.substring(sourcesRootDirectoryPath.length() + 1).replace(File.separator, "/")));
       }
 
       fileWriter.write("SRCSRV: end ------------------------------------------------");