Move intermediate file into intermediate dir (dotnet/coreclr#5981)
authorMyungJoo Ham <myungjoo.ham@gmail.com>
Tue, 28 Jun 2016 07:44:09 +0000 (16:44 +0900)
committerJan Vorlicek <janvorli@microsoft.com>
Tue, 28 Jun 2016 07:44:09 +0000 (09:44 +0200)
The intermediate file, cmake.definitions, is moved into
the intermediate directory: bin/obj/OS.Arch.Conf/

The script won't emit error for not having the cmake
results because some systems (Windows) do not use Cmake
and users might use "skipnative".

Fixes dotnet/coreclr#5976

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/5acbced129024a38aec530f1bb9cd85b7568e05a

src/coreclr/definitionsconsistencycheck.cmake
src/coreclr/src/mscorlib/System.Private.CoreLib.csproj
src/coreclr/src/scripts/check-definitions.py

index cc029bb..51a70f7 100644 (file)
@@ -1,11 +1,11 @@
 get_directory_property( DirDefs COMPILE_DEFINITIONS )
 
 # Reset the definition file
-file(WRITE cmake.definitions "")
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions "")
 foreach( d ${DirDefs} )
     if($ENV{VERBOSE})
         message( STATUS "Compiler Definition: " ${d} )
     endif($ENV{VERBOSE})
-    file(APPEND cmake.definitions ${d})
-    file(APPEND cmake.definitions "\n")
+    file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions ${d})
+    file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/cmake.definitions "\n")
 endforeach()
index 02719e3..6285e4a 100644 (file)
     <Message Importance="High" Text="============" />
     <PropertyGroup>
       <IgnoreDefineConstants>FEATURE_IMPLICIT_TLS;FEATURE_HIJACK</IgnoreDefineConstants>
+      <CMakeDefinitionSaveFile>$(IntermediateOutputPath)\cmake.definitions</CMakeDefinitionSaveFile>
     </PropertyGroup>
-    <Exec Command='python $(MSBuildThisFileDirectory)../scripts/check-definitions.py $(MSBuildThisFileDirectory)../../cmake.definitions "$(DefineConstants)" "$(IgnoreDefineConstants)" ' />
+    <Exec Command='python $(MSBuildThisFileDirectory)..\scripts\check-definitions.py "$(CMakeDefinitionSaveFile)" "$(DefineConstants)" "$(IgnoreDefineConstants)" ' />
     <Message Importance="High" Text="============" />
   </Target>
 
index ace7078..59b309a 100644 (file)
@@ -33,7 +33,12 @@ debug = 0
 # For the native part, return the sorted definition array.
 def loadDefinitionFile(filename):
     result = []
-    f = open(filename, 'r')
+    try:
+        f = open(filename, 'r')
+    except:
+        sys.exit(0)
+    # if cmake was not used (because of skipnative or systems that do not use cmake), this script won't work.
+
     for line in f:
         theLine = line.rstrip("\r\n").strip()
         if (len(theLine) > 0):