Skip to content
Permalink
Browse files

[Build] Readded support for UWP

  • Loading branch information
xen2 committed Nov 11, 2018
1 parent 63b14a1 commit d16b2d23b560bccef44ec9e2aa77bc8e3c09b640
@@ -13,6 +13,7 @@
<!--This variable can be overriden by a platform specific targets (in case the executable is located into an assembly dll )-->
<XenkoIsExecutable Condition=" '$(OutputType)' == 'Exe'">true</XenkoIsExecutable>
<XenkoIsExecutable Condition=" '$(OutputType)' == 'WinExe'">true</XenkoIsExecutable>
<XenkoIsExecutable Condition=" '$(OutputType)' == 'AppContainerExe'">true</XenkoIsExecutable>

<!--asset BuildPath for all platforms (same as package)-->
<XenkoCompileAssetBuildPath Condition="'$(XenkoCompileAssetBuildPath)' == ''">$(MSBuildProjectDirectory)\..\Cache\data</XenkoCompileAssetBuildPath>
@@ -63,4 +64,27 @@
<RemoveDir Condition="Exists('$(XenkoCompileAssetBuildPath)')" ContinueOnError="true" Directories="$(XenkoCompileAssetBuildPath)"/>
<RemoveDir Condition="Exists('$(XenkoCompileAssetOutputPath)')" ContinueOnError="true" Directories="$(XenkoCompileAssetOutputPath)"/>
</Target>

<!-- UWP: Compile and Transform Assets into Content during PrepareResources phase -->
<PropertyGroup Condition="'$(XenkoIsExecutable)' == 'true' And '$(XenkoPlatform)' == 'UWP'">
<!-- Use OutputPath to define AppxPackage directory -->
<AppxPackageDir>$(OutputPath)\$(AppxPackageDirName)\</AppxPackageDir>
<AppxPackageTestDir>$(AppxPackageDir)Test\</AppxPackageTestDir>
<AppxPackageName>$(AssemblyName)</AppxPackageName>
<PrepareResourcesDependsOn>
_XenkoDeployAssetsUWP;
$(PrepareResourcesDependsOn)
</PrepareResourcesDependsOn>
</PropertyGroup>
<Target Name="_XenkoDeployAssetsUWP" DependsOnTargets="XenkoCompileAsset">
<ItemGroup>
<!-- Define the Assets to deploy -->
<AssetsToDeploy Include="$(XenkoCompileAssetOutputPath)\**\*.*"/>

<Content Include="@(AssetsToDeploy)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>data\%(RecursiveDir)%(Filename)%(Extension)</Link>
</Content>
</ItemGroup>
</Target>
</Project>
@@ -94,8 +94,7 @@ private async Task PreLoadPackageDependencies(ILogger log, SolutionProject proje
// Load some informations about the project
try
{
// Load a project without specifying a platform to make sure we get the correct platform type
var msProject = VSProjectHelper.LoadProject(project.FullPath);
var msProject = VSProjectHelper.LoadProject(project.FullPath, extraProperties: new Dictionary<string, string> { { "SkipInvalidConfigurations", "true" } });
try
{
var packageVersion = msProject.GetPropertyValue("PackageVersion");
@@ -105,8 +104,11 @@ private async Task PreLoadPackageDependencies(ILogger log, SolutionProject proje
project.TargetPath = msProject.GetPropertyValue("TargetPath");
package.Meta.Name = msProject.GetPropertyValue("PackageId") ?? msProject.GetPropertyValue("AssemblyName") ?? package.Meta.Name;

var projectIsExecutable = msProject.GetPropertyValue("OutputType");
project.Type = projectIsExecutable.ToLowerInvariant() == "winexe" || projectIsExecutable.ToLowerInvariant() == "exe" ? ProjectType.Executable : ProjectType.Library;
var outputType = msProject.GetPropertyValue("OutputType");
project.Type = outputType.ToLowerInvariant() == "winexe" || outputType.ToLowerInvariant() == "exe"
|| outputType.ToLowerInvariant() == "appcontainerexe" // UWP
? ProjectType.Executable
: ProjectType.Library;

// TODO: Platform might be incorrect if Xenko is not restored yet (it won't include Xenko targets)
if (project.Type == ProjectType.Executable)
@@ -76,11 +76,16 @@
*****************************************************************************************************************************
-->
<!-- List dependency files from .ssdeps -->
<Target Name="_XenkoListDepsFiles" DependsOnTargets="ResolveAssemblyReferences;ResolvePackageAssets">
<PropertyGroup>
<_XenkoListDepsFilesDependsOn>ResolveAssemblyReferences</_XenkoListDepsFilesDependsOn>
<_XenkoListDepsFilesDependsOn Condition="'$(XenkoPlatform)' == 'Windows' Or '$(XenkoPlatform)' == 'Linux'">$(_XenkoListDepsFilesDependsOn);ResolvePackageAssets</_XenkoListDepsFilesDependsOn>
</PropertyGroup>
<Target Name="_XenkoListDepsFiles" DependsOnTargets="$(_XenkoListDepsFilesDependsOn)">
<ItemGroup>
<_XenkoDepsFile Include="@(ReferencePath->'%(RootDir)%(Directory)%(Filename).ssdeps')" Condition="'%(CopyLocal)' != 'false' And Exists('%(RootDir)%(Directory)%(Filename).ssdeps')"/>
<_XenkoDepsFile Include="@(ReferenceDependencyPaths->'%(RootDir)%(Directory)%(Filename).ssdeps')" Condition="'%(CopyLocal)' != 'false' And Exists('%(RootDir)%(Directory)%(Filename).ssdeps')"/>
<_XenkoDepsFile Include="@(RuntimeCopyLocalItems->'%(RootDir)%(Directory)%(Filename).ssdeps')" Condition="Exists('%(RootDir)%(Directory)%(Filename).ssdeps')"/>
<_XenkoDepsFile Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).ssdeps')" Condition="Exists('%(RootDir)%(Directory)%(Filename).ssdeps')"/>
<None Include="@(_XenkoDepsFile)" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Target>
@@ -124,11 +129,24 @@
</Target>

<!-- Copy native libraries to output -->
<Target Name="_XenkoSetupNativeLibraries" DependsOnTargets="_XenkoBuildDependencies" AfterTargets="ResolveAssemblyReferences" Condition="'$(XenkoPlatform)' == 'Windows'">
<Target Name="_XenkoSetupNativeLibrariesWindows" DependsOnTargets="_XenkoBuildDependencies" AfterTargets="ResolveAssemblyReferences" Condition="'$(XenkoPlatform)' == 'Windows'">
<ItemGroup>
<None Include="@(_XenkoDependencyNativeLib)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Target>
<Target Name="_XenkoSetupNativeLibrariesUWP" DependsOnTargets="_XenkoBuildDependencies" AfterTargets="ResolveAssemblyReferences" Condition="'$(XenkoPlatform)' == 'UWP'">
<PropertyGroup>
<XenkoCPU Condition="'$(Platform)' == 'x86'">x86</XenkoCPU>
<XenkoCPU Condition="'$(Platform)' == 'x64'">x64</XenkoCPU>
<XenkoCPU Condition="'$(Platform)' == 'ARM'">ARM</XenkoCPU>
</PropertyGroup>
<ItemGroup>
<Content Include="@(_XenkoDependencyNativeLib)" Condition="$([System.String]::Copy('%(_XenkoDependencyNativeLib.Link)').StartsWith('$(XenkoCPU)'))">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link Condition="'$(XenkoCPU)' != ''">$([System.String]::Copy('%(_XenkoDependencyNativeLib.Link)').Replace('$(XenkoCPU)\', ''))</Link>
</Content>
</ItemGroup>
</Target>
</Project>
@@ -42,7 +42,10 @@
</PropertyGroup>

<PropertyGroup Condition=" '$(XenkoRuntime)' == 'true' ">
<TargetFrameworks>net45</TargetFrameworks>
<XenkoRuntimeTargetFrameworks Condition="'$(XenkoRuntimeTargetFrameworks)' == ''">net45;uap10.0</XenkoRuntimeTargetFrameworks>
<TargetFrameworks>$(XenkoRuntimeTargetFrameworks)</TargetFrameworks>
<!-- UpToDate check doesn't work with multi-TFM projects! https://github.com/dotnet/project-system/issues/2487 -->
<DisableFastUpToDateCheck Condition="$(TargetFrameworks.Contains(';'))">true</DisableFastUpToDateCheck>
<!--<TargetFrameworks>net45;uap10.0;monoandroid50;xamarin.ios10;netstandard2.0</TargetFrameworks>-->
</PropertyGroup>

@@ -57,13 +60,6 @@
<XenkoPlatformDefines>XENKO_PLATFORM_WINDOWS;XENKO_PLATFORM_UWP;NET45;NETFX_CORE;WINDOWS_UAP</XenkoPlatformDefines>
<NUnitLiteBinDir>$(XenkoCommonDependenciesDir)NUnitLite\net-win10\</NUnitLiteBinDir>
</PropertyGroup>
<Choose>
<When Condition=" '$(XenkoPlatform)' == 'UWP' ">
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.0.6" />
</ItemGroup>
</When>
</Choose>

<PropertyGroup Condition=" '$(XenkoPlatform)' == 'Linux' ">
<XenkoPlatformDefines>XENKO_PLATFORM_LINUX;XENKO_PLATFORM_UNIX;NET45</XenkoPlatformDefines>

0 comments on commit d16b2d2

Please sign in to comment.
You can’t perform that action at this time.