-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
App-configurable compatibility options implementation: CompatibilityO…
…ptions (#4976)
- Loading branch information
Showing
64 changed files
with
1,500 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
build/NuSpecs/Microsoft.WindowsAppSDK.AutoInitializer.CS.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. --> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<PropertyGroup> | ||
<DefineConstants Condition="'$(WindowsAppSdkBootstrapInitialize)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_BOOTSTRAP</DefineConstants> | ||
<DefineConstants Condition="'$(WindowsAppSdkDeploymentManagerInitialize)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_DEPLOYMENTMANAGER</DefineConstants> | ||
<DefineConstants Condition="'$(WindowsAppSdkUndockedRegFreeWinRTInitialize)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_UNDOCKEDREGFREEWINRT</DefineConstants> | ||
<DefineConstants Condition="'$(WindowsAppSdkCompatibilityInitialize)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_AUTOINITIALIZE_COMPATIBILITY</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<!-- "BeforeCompile" is used here to ensure this happens at the same time as possible codegen from WindowsAppSdkCompatibilitySetterTarget --> | ||
<Target Name="WindowsAppRuntimeAutoInitializer" BeforeTargets="BeforeCompile"> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildThisFileDirectory)..\include\WindowsAppRuntimeAutoInitializer.cs" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> |
16 changes: 16 additions & 0 deletions
16
build/NuSpecs/Microsoft.WindowsAppSDK.AutoInitializerCommon.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. --> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<!-- Targets file common to both managed and native projects --> | ||
|
||
<PropertyGroup Condition="'$(WindowsAppSdkAutoInitializeNeeded)' == '' and | ||
('$(WindowsAppSdkBootstrapInitialize)' == 'true' or | ||
'$(WindowsAppSdkUndockedRegFreeWinRTInitialize)' == 'true' or | ||
'$(WindowsAppSdkDeploymentManagerInitialize)' == 'true' or | ||
'$(WindowsAppSdkCompatibilityInitialize)' == 'true')"> | ||
<!-- Any of the individual initialize steps will require the core auto initializer --> | ||
<WindowsAppSdkAutoInitialize Condition="'$(WindowsAppSdkAutoInitialize)'==''">true</WindowsAppSdkAutoInitialize> | ||
</PropertyGroup> | ||
|
||
</Project> |
64 changes: 64 additions & 0 deletions
64
build/NuSpecs/Microsoft.WindowsAppSDK.CompatibilitySetter.CS.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. --> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<PropertyGroup Condition="'$(WindowsAppSDKRuntimePatchMode)' != '' or '$(WindowsAppSDKRuntimePatchMode2)' != '' or '$(WindowsAppSDKDisabledChanges)' != ''"> | ||
<WindowsAppSdkCompatibilityInitialize>true</WindowsAppSdkCompatibilityInitialize> | ||
</PropertyGroup> | ||
|
||
<Target Name="WindowsAppSdkCompatibilitySetterTarget" BeforeTargets="CoreCompile" | ||
Condition="'$(WindowsAppSDKRuntimePatchMode)' != '' or '$(WindowsAppSDKRuntimePatchMode2)' != '' or '$(WindowsAppSDKDisabledChanges)' != ''"> | ||
<PropertyGroup> | ||
<WindowsAppSDKGeneratedFilesDir Condition="'$(WindowsAppSDKGeneratedFilesDir)' == '' and '$(GeneratedFilesDir)' != ''">$(GeneratedFilesDir)\WindowsAppSDK\</WindowsAppSDKGeneratedFilesDir> | ||
<WindowsAppSDKGeneratedFilesDir Condition="'$(WindowsAppSDKGeneratedFilesDir)' == ''">$([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)', 'Generated Files', 'WindowsAppSDK'))</WindowsAppSDKGeneratedFilesDir> | ||
|
||
<WindowsAppSDKCompatibilitySetterFile>$(WindowsAppSDKGeneratedFilesDir)WindowsAppSDKCompatibilitySetter.cs</WindowsAppSDKCompatibilitySetterFile> | ||
<WindowsAppSDKCompatibilityPatchMode1Lines Condition="'$(WindowsAppSDKRuntimePatchMode)' != ''"> | ||
compatibilityOptions.PatchMode1 = new WindowsAppRuntimeVersion($(WindowsAppSDKRuntimePatchMode.Replace(".", ",")))%3B | ||
</WindowsAppSDKCompatibilityPatchMode1Lines> | ||
<WindowsAppSDKCompatibilityPatchMode2Lines Condition="'$(WindowsAppSDKRuntimePatchMode2)' != ''"> | ||
compatibilityOptions.PatchMode2 = new WindowsAppRuntimeVersion($(WindowsAppSDKRuntimePatchMode2.Replace(".", ",")))%3B | ||
</WindowsAppSDKCompatibilityPatchMode2Lines> | ||
|
||
<WindowsAppSDKCompatibilityDisabledChangesNoSpaces Condition="'$(WindowsAppSDKDisabledChanges)' != ''">$([System.Text.RegularExpressions.Regex]::Replace($(WindowsAppSDKDisabledChanges), "\s+", ""))</WindowsAppSDKCompatibilityDisabledChangesNoSpaces> | ||
<WindowsAppSDKCompatibilityDisabledChangesLines Condition="'$(WindowsAppSDKCompatibilityDisabledChangesNoSpaces)' != ''"> | ||
var disabledChangesArray = new CompatibilityChange[] { CompatibilityChange.$([System.Text.RegularExpressions.Regex]::Replace($(WindowsAppSDKCompatibilityDisabledChangesNoSpaces), ",([A-Za-z])", ", CompatibilityChange.$1")) }%3B | ||
foreach (var changeId in disabledChangesArray) | ||
{ | ||
compatibilityOptions.DisabledChanges.Add(changeId)%3B | ||
} | ||
</WindowsAppSDKCompatibilityDisabledChangesLines> | ||
|
||
<WindowsAppSDKCompatibilitySetterFileLines> | ||
using Microsoft.Windows.ApplicationModel.WindowsAppRuntime%3B | ||
|
||
// This file is generated by the build based on project properties. | ||
namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Compatibility | ||
{ | ||
class AutoInitialize | ||
{ | ||
// Called by WindowsAppRuntimeAutoInitializer.cs | ||
internal static void ConfigureCompatibility() | ||
{ | ||
var compatibilityOptions = new CompatibilityOptions()%3B | ||
$(WindowsAppSDKCompatibilityPatchMode1Lines) | ||
$(WindowsAppSDKCompatibilityPatchMode2Lines) | ||
$(WindowsAppSDKCompatibilityDisabledChangesLines) | ||
compatibilityOptions.Apply()%3B | ||
} | ||
} | ||
} | ||
</WindowsAppSDKCompatibilitySetterFileLines> | ||
</PropertyGroup> | ||
|
||
<WriteLinesToFile | ||
File="$(WindowsAppSDKCompatibilitySetterFile)" Lines="$(WindowsAppSDKCompatibilitySetterFileLines)" | ||
Overwrite="true" | ||
WriteOnlyWhenDifferent="true" /> | ||
|
||
<ItemGroup> | ||
<Compile Include="$(WindowsAppSDKCompatibilitySetterFile)" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.