public TRunner HudsonFetchBuildVersion() { ScriptExecutionEnvironment.LogTaskStarted("Fetching the build version"); if (IsRunningUnderHudson) { ScriptExecutionEnvironment.LogMessage("Running under Hudson"); string projectVersionFileName = MakePathFromRootDir(ProductId) + ".ProjectVersion.txt"; if (false == File.Exists(projectVersionFileName)) { Fail("Project version file ('{0}') is missing.", projectVersionFileName); } using (Stream stream = File.Open(projectVersionFileName, FileMode.Open)) { using (StreamReader reader = new StreamReader(stream)) { string versionAsString = reader.ReadLine(); BuildVersion = new Version(versionAsString); } } string hudsonBuildNumberString = Environment.GetEnvironmentVariable("BUILD_NUMBER"); int hudsonBuildNumber = int.Parse(hudsonBuildNumberString, CultureInfo.InvariantCulture); string svnRevisionNumberString = Environment.GetEnvironmentVariable("SVN_REVISION"); int svnRevisionNumber = int.Parse(svnRevisionNumberString, CultureInfo.InvariantCulture); BuildVersion = new Version( BuildVersion.Major, BuildVersion.Minor, svnRevisionNumber, hudsonBuildNumber); Log("Project build version: {0}", BuildVersion); ScriptExecutionEnvironment.LogTaskFinished(); return(ReturnThisTRunner()); } return(FetchBuildVersion()); }
private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e) { ScriptExecutionEnvironment.LogMessage(e.Data); }