summaryrefslogtreecommitdiff
path: root/src/md/MD.props
blob: 69f817f846c2087086379ae9598f697b660409ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <!-- 
        MetadataFlavor has to be set prior to including this file:
            wks (Desktop or CoreCLR - base on FeatureCoreclr setting)
            dac
            mscordbi
            WinRT-RO
            WinRT-RW
    -->
    <!--
        MetaData features and defines:
            FeatureMetadataEmit ... Basic set of emit APIs (IMetaDataEmit*, etc.).
                FEATURE_METADATA_EMIT
                    Enabled for: Desktop, CoreCLR, dac, mscordbi, WinRT-RW.
                    Disabled for: WinRT-RO.
            FeatureMetadataEmitAll ... Additional emit APIs (Merging, saving EnC, etc.) mostly for compiler support.
					Note: Requires FeatureMetadataEmit=true (definition of IMetaDataEmit* APIs).
                FEATURE_METADATA_EMIT_ALL
                    Enabled for: Desktop.
                    Disabled for: CoreCLR, dac, mscordbi, WinRT-RO, WinRT-RW.
            FeatureMetadataEmitInDebugger ... Most emit APIs are E_NOTIMPL (as we shipped them in 3.5 and 4.0)
					Note: Requires FeatureMetadataEmit=true (definition of IMetaDataEmit* APIs) and 
                                   FeatureMetadataEmitAll=false (some E_NOTIMPL for debuggers are rather under #ifdef *_EMIT_ALL).
				FEATURE_METADATA_EMIT_IN_DEBUGGER
					Enabled for: dac, mscordbi
					Disabled for: Desktop, CoreCLR, WinRT-RO, WinRT-RW
				List of APIs that return E_NOTIMPL is defined by what we shipped in 3.5/4.0:
                    IMetaDataAssemblyEmit - All methods supported.
                    IMetaDataEmit - Most methods return E_NOTIMPL, except:
                        Save
                        SaveToStream
                        SaveToMemory
                        GetSaveSize
                        TranslateSigWithScope
                        DefineTypeDef
                        SetModuleProps
                        SetHandler
                    IMetaDataEmit2 - All methods return E_NOTIMPL.
            FeatureMetadataInternalAPIs ... IMDInternalRO and IMDInternalRW implementation.
                FEATURE_METADATA_INTERNAL_APIS
                    Enabled for: Desktop, CoreCLR, dac, mscordbi.
                    Disabled for: WinRT-RO, WinRT-RW.
            FeatureMetadataInVM ... Implementation depending on VM (e.g. code:IMetaDataAssemblyImport::FindAssembliesByName - Fusion dependency, IMetaDataValidator).
                FEATURE_METADATA_IN_VM
                    Enabled for: Desktop, CoreCLR.
                    Disabled for: dac, mscordbi, WinRT-RO, WinRT-RW.
            FeatureMetadataStandaloneWinRT ... Specifics for both WinRT DLLs (e.g. disabling old formats - v1.x, 2.0 Beta1, NT 5 Beta).
                FEATURE_METADATA_STANDALONE_WINRT
                    Enabled for: WinRT-RO, WinRT-RW.
                    Disabled for: Desktop, CoreCLR, dac, mscordbi.
            FeatureMetadataStandaloneWinRTReadOnly ... Specifics for WinRT-RO DLL (no dependencies on ole32.dll).
                FEATURE_METADATA_STANDALONE_WINRT_RO
                    Enabled for: WinRT-RO.
                    Disabled for: Desktop, CoreCLR, dac, mscordbi, WinRT-RW.
            
            FEATURE_METADATA_LOAD_TRUSTED_IMAGES ... Enabled only by mscordbi.
            FEATURE_METADATA_RELEASE_MEMORY_ON_REOPEN ... Enabled only by mscordbi
                Normally Reopening the MD on a new block of memory does not delete any previous memory. In scenarios where the MD is updated
                many times (reflection.emit), the debugger continually updates the MD and memory growth becomes N^2 relative to the size of metadata.
                This feature deletes old memory blocks during re-open if we can determine that we haven't given out pointers to their data.
                See bug .net 4.5 bug 458597 as an example of 1.5GB memory growth.
            FEATURE_METADATA_CUSTOM_DATA_SOURCE ... Enabled only by mscordbi.
                This allows a metadata reader to be initialized with an implementation of IMDCustomDataSource which provides more flexibility for
                how the data flows into the metadata reader.
            FEATURE_METADATA_DEBUGGEE_DATA_SOURCE ... Enabled only by mscordbi.
                This is a data source implementation that marshals data out of the debuggee's implementation of MDInternalRW and provides it
                as a custom data source to a debugger hosted implementation of the metadata reader.
            FEATURE_METADATA_VERIFY_LAYOUTS ... Enabled only by wks.
                A set of static asserts that verify the data structures used in MD match the layouts expected in the debuggee data source.
            
            FEATURE_METADATA_PERF_STATS ... Optional flavor of MetaData for MD perf investigations (not used for a very long time).
            
        Note: FeatureMetadata* settings and MetadataFlavor value will be checked in file:MD.targets which is included by all subdirectories.
    -->

    <PropertyGroup Condition="'$(MetadataFlavor)' == 'WinRT-RO' or '$(MetadataFlavor)' == 'WinRT-RW'">
        <!-- Standalone CLR product (no features enabled by default in clr.props) -->
        <ClrProduct>Standalone</ClrProduct>
    </PropertyGroup>

    <!--Import the settings. It has to be done early before FeatureCoreclr is used. -->
    <Import Project="$(_NTDRIVE)$(_NTROOT)\ndp\clr\clr.props" />

    <PropertyGroup Condition="'$(MetadataFlavor)' == 'wks'">
        <!-- Enable all features -->
        <FeatureMetadataEmit>true</FeatureMetadataEmit>
        
        <!-- Desktop -->
        <FeatureMetadataEmitAll Condition="'$(FeatureCoreclr)' != 'true'">true</FeatureMetadataEmitAll>
        <FeatureMetadataValidator Condition="'$(FeatureCoreclr)' != 'true'">true</FeatureMetadataValidator>

        <FeatureMetadataInternalAPIs>true</FeatureMetadataInternalAPIs>
        <FeatureMetadataInVM>true</FeatureMetadataInVM>
        <FeatureMetadataVerifyLayouts>true</FeatureMetadataVerifyLayouts>
    </PropertyGroup>

    <PropertyGroup Condition="'$(MetadataFlavor)' == 'dac'">
        <!-- Disable all APIs except Public Import and Internal Import&Emit -->
        <FeatureMetadataEmit>true</FeatureMetadataEmit>
        <FeatureMetadataEmitInDebugger>true</FeatureMetadataEmitInDebugger>
        <FeatureMetadataInternalAPIs>true</FeatureMetadataInternalAPIs>
    </PropertyGroup>
    
    <PropertyGroup Condition="'$(MetadataFlavor)' == 'mscordbi'">
        <!-- Enable all internal APIs and all public APIs (with some some implemented as E_NOTIMPL) -->
        <FeatureMetadataEmit>true</FeatureMetadataEmit>
        <FeatureMetadataEmitInDebugger>true</FeatureMetadataEmitInDebugger>
        <FeatureMetadataInternalAPIs>true</FeatureMetadataInternalAPIs>
        <FeatureMetadataCustomDataSource>true</FeatureMetadataCustomDataSource>
        <FeatureMetadataDebuggeeDataSource>true</FeatureMetadataDebuggeeDataSource>
        <!-- Enable mscordbi-only (perf) feature -->
        <CDefines>$(CDefines);FEATURE_METADATA_LOAD_TRUSTED_IMAGES;FEATURE_METADATA_RELEASE_MEMORY_ON_REOPEN</CDefines>

        <!-- Changing defaults set by clr.props -->
        <LinkNoLibraries>true</LinkNoLibraries>
        <LinkUseCMT>true</LinkUseCMT>
        <UseMsvcrt>false</UseMsvcrt>
    </PropertyGroup>
    
    <PropertyGroup Condition="'$(MetadataFlavor)' == 'WinRT-RO' or '$(MetadataFlavor)' == 'WinRT-RW'">
        <!-- Standalone CLR product (no features enabled by default in clr.props) -->
        <ClrProduct>Standalone</ClrProduct>
        
        <FeatureUtilcodeNoDependencies>true</FeatureUtilcodeNoDependencies>
        <FeatureUseLcid>true</FeatureUseLcid>
        
        <FeatureMetadataStandaloneWinRT>true</FeatureMetadataStandaloneWinRT>
        <FeatureMetadataStandaloneWinRTReadOnly Condition="'$(MetadataFlavor)' == 'WinRT-RO'">true</FeatureMetadataStandaloneWinRTReadOnly>

        <FeatureMetadataEmit Condition="'$(MetadataFlavor)' == 'WinRT-RW'">true</FeatureMetadataEmit>

        <!-- Link static CRT -->
        <LinkNoLibraries>true</LinkNoLibraries>
        <LinkUseCMT>true</LinkUseCMT>
        <UseMsvcrt>false</UseMsvcrt>
    </PropertyGroup>

    <PropertyGroup Condition="'$(CrossGenCompile)' == 'true'">
        <!-- Override settings of certain features to disable them for crossgen unconditionally -->
        <FeatureMetadataEmitAll>false</FeatureMetadataEmitAll>
        <FeatureMetadataValidator>false</FeatureMetadataValidator>
    </PropertyGroup>
    
    <!-- Verification of FeatureMetadata* and MetadataFlavor set - hook it up early in the build process (e.g. ResolveProjectReferencesForCompile) -->
    <Target Name="MetadataFlavorAndFeaturesCheck"
            BeforeTargets="ResolveProjectReferencesForCompile">
        <Error Condition="'$(MetadataFlavor)' != 'wks' and '$(MetadataFlavor)' != 'dac' and '$(MetadataFlavor)' != 'mscordbi' and '$(MetadataFlavor)' != 'WinRT-RO' and '$(MetadataFlavor)' != 'WinRT-RW'"
               Text="Unrecognized MetadataFlavor value '$(MetadataFlavor)'." />

        <Error Condition="'$(FeatureMetadataEmitAll)' == 'true' and '$(FeatureMetadataEmit)' != 'true'"
               Text="FeatureMetadataEmitAll (compiler support) depends on FeatureMetadataEmit (IMetaDataEmit interfaces) - see file:MD.props" />
        <Error Condition="'$(FeatureMetadataEmitInDebugger)' == 'true' and '$(FeatureMetadataEmit)' != 'true'"
               Text="FeatureMetadataEmitInDebugger (bunch of E_NOTIMPLs) depends on FeatureMetadataEmit (IMetaDataEmit interfaces) - see file:MD.props" />
        <Error Condition="'$(FeatureMetadataEmitInDebugger)' == 'true' and '$(FeatureMetadataEmitAll)' == 'true'"
               Text="FeatureMetadataEmitInDebugger (bunch of E_NOTIMPLs) depends on FeatureMetadataEmitAll (compiler support) disabled - see file:MD.props" />
    </Target>
        
</Project>