Fix CorError header file generation (dotnet/coreclr#22294)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Wed, 30 Jan 2019 20:16:13 +0000 (21:16 +0100)
committerGitHub <noreply@github.com>
Wed, 30 Jan 2019 20:16:13 +0000 (21:16 +0100)
The checked in batch script was only usable if you have a Razzle environment and even then it didn't update the right files.

Commit migrated from https://github.com/dotnet/coreclr/commit/6a43dd765ea6341310fde3f83bb41ff88d94b435

src/coreclr/src/inc/genheaders.cs
src/coreclr/src/pal/prebuilt/corerror/makecorerror.bat

index af33b1d..6a55cd8 100644 (file)
@@ -1,3 +1,7 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
 using System;
 using System.Xml;
 using System.Xml.Schema;
@@ -31,8 +35,9 @@ public class GenerateHeaders {
        int minHR = MakeHresult(SeverityError,FaciltyUrt,0);            
        int maxHR = MakeHresult(SeverityError,FaciltyUrt,0xffff);               
 
-
+        PrintLicenseHeader(HSW);
         PrintHeader(HSW);  
+        PrintLicenseHeader(RSW);
         PrintResourceHeader(RSW);
         
         XmlTextReader rdr = new XmlTextReader(args[0]);
@@ -150,6 +155,12 @@ public class GenerateHeaders {
     Environment.Exit(-1);
     }   
 
+    private static void PrintLicenseHeader(StreamWriter SW) {
+        SW.WriteLine("// Licensed to the .NET Foundation under one or more agreements.");
+        SW.WriteLine("// The .NET Foundation licenses this file to you under the MIT license.");
+        SW.WriteLine("// See the LICENSE file in the project root for more information.");
+        SW.WriteLine();
+    }
 
     private static void PrintHeader(StreamWriter SW) {
 
index f9b964f..7e5d6e8 100644 (file)
@@ -4,24 +4,8 @@ REM The .NET Foundation licenses this file to you under the MIT license.
 REM See the LICENSE file in the project root for more information.
 setlocal
 
-if "%_NTROOT%" == "" goto LUsage
+csc ..\..\..\inc\genheaders.cs
 
-set MANAGED_TOOLS_PATH=%MANAGED_TOOLS_ROOT%\%MANAGED_TOOLS_VERSION%
-set CORERROR_PATH=%_NTROOT%\ndp\clr\src\inc
-
-%MANAGED_TOOLS_PATH%\genheaders.exe %CORERROR_PATH%\corerror.xml ..\inc\corerror.h mscorurt.rc
-
-goto LExit
-
-:LUsage
-
-echo.
-echo makecorerror.bat
-echo.
-echo    Builds corerror.h for PALRT
-echo.
-echo    Should be run inside razzle environment, depends on %%_NTROOT%% environment variable.
-echo.
-
-:LExit
+genheaders.exe ..\..\..\inc\corerror.xml ..\inc\corerror.h mscorurt.rc
 
+del genheaders.exe