Skip to content
Permalink
Browse files

[Engine] Move default assets to individual assemblies rather than glo…

…bal Xenko.xkpkg
  • Loading branch information
xen2 committed Oct 22, 2018
1 parent d0c771f commit 051a8110383946d86c0d1c708d70d38ba0c33f63
Showing with 194 additions and 68 deletions.
  1. +0 −13 Xenko.xkpkg
  2. +12 −0 sources/assets/Xenko.Core.Assets.CompilerApp/Xenko.Core.Assets.CompilerApp.csproj
  3. +66 −0 sources/assets/Xenko.Core.Assets.CompilerApp/build/Xenko.Core.Assets.CompilerApp.targets
  4. +25 −0 sources/assets/Xenko.Core.Assets/Package.cs
  5. +1 −0 sources/assets/Xenko.Core.Assets/PackageSession.Dependencies.cs
  6. +20 −7 sources/{engine/Xenko.Assets → assets/Xenko.Core.Assets}/Tasks/PackAssets.cs
  7. +2 −2 sources/core/Xenko.Core/build/Xenko.Core.targets
  8. +0 −22 sources/engine/Xenko.Assets/AssetPackage/XenkoAssetPackage.xkpkg
  9. 0 ...enko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/DefaultGraphicsCompositorLevel10.xkgfxcomp
  10. 0 ...Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/DefaultGraphicsCompositorLevel9.xkgfxcomp
  11. +1 −1 ...engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/XenkoClearCoatMetalFlakesNM.xktex
  12. +1 −1 .../engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/XenkoClearCoatOrangePeelNM.xktex
  13. +1 −1 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/XenkoDebugSpriteFont.xktex
  14. 0 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/XenkoDefaultFont.xkfnt
  15. +1 −1 ...es/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/XenkoDefaultSplashScreen.xktex
  16. +1 −1 ...e/{Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/XenkoEnvironmentLightingDFGLUT16.xktex
  17. +1 −1 ...ne/{Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/XenkoEnvironmentLightingDFGLUT8.xktex
  18. +14 −14 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/XenkoUIDesigns.xksheet
  19. 0 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Assets/Shared/XenkoUILibrary.xkuilib
  20. 0 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Resources/ClearCoatMetalFlakesNM.dds
  21. 0 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Resources/ClearCoatOrangePeelNM.dds
  22. 0 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Resources/EnvironmentLightingDFGLUT16.dds
  23. 0 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Resources/EnvironmentLightingDFGLUT8.dds
  24. 0 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Resources/UIDesigns.dds
  25. 0 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Resources/XenkoDebugSpriteFont.png
  26. 0 sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Resources/XenkoDefaultSplashScreen.png
  27. BIN sources/engine/{Xenko.Assets → Xenko.Engine}/AssetPackage/Workfiles/UIDesigns.pdn
  28. +1 −0 sources/engine/Xenko.Engine/Xenko.Engine.csproj
  29. +11 −0 sources/engine/Xenko.Engine/Xenko.Engine.xkpkg
  30. +2 −1 sources/engine/Xenko.Graphics/Xenko.Graphics.csproj
  31. +4 −0 sources/engine/Xenko.Graphics/Xenko.Graphics.xkpkg
  32. +2 −1 sources/engine/Xenko.Particles/Xenko.Particles.csproj
  33. +4 −0 sources/engine/Xenko.Particles/Xenko.Particles.xkpkg
  34. +2 −1 sources/engine/Xenko.Video/Xenko.Video.csproj
  35. +4 −0 sources/engine/Xenko.Video/Xenko.Video.xkpkg
  36. +10 −1 sources/shaders/Xenko.Core.Shaders/Xenko.Core.Shaders.csproj
  37. +8 −0 sources/targets/Xenko.GlobalSettings.targets
@@ -12,15 +12,6 @@ Meta:
Description: Xenko Game Package
LicenseUrl: http://xenko.com/license.txt
ProjectUrl: http://xenko.com
AssetFolders:
- Path: sources/engine/Xenko.Assets/AssetPackage/Assets/Shared
- Path: sources/engine/Xenko.Engine/Rendering
- Path: sources/engine/Xenko.Graphics/Shaders
- Path: sources/editor/Xenko.Assets.Presentation/Shaders
- Path: sources/engine/Xenko.Particles/Shaders
- Path: sources/engine/Xenko.Video/Shaders
ResourceFolders:
- sources/engine/Xenko.Assets/AssetPackage/Resources
TemplateFolders:
- Path: sources/editor/Xenko.Assets.Presentation/Templates/Core
Group: Core
@@ -126,7 +117,3 @@ TemplateFolders:
- samples\Templates\ThirdPersonPlatformer\ThirdPersonPlatformer\ThirdPersonPlatformer.xktpl
- samples\Templates\TopDownRPG\TopDownRPG\TopDownRPG.xktpl
- samples\Templates\VRSandbox\VRSandbox\VRSandbox.xktpl
RootAssets:
- c90f3988-0544-4cbe-993f-13af7d9c23c6:XenkoDefaultFont
- d26edb11-10bd-403c-b3c2-9c7fcccf25e5:XenkoDefaultSplashScreen
- FF02239B-3697-4EBB-9F37-FE880659E64B:XenkoDebugSpriteFont
@@ -34,6 +34,7 @@
<Compile Include="..\..\shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<None Include="build\**\*.targets" PackagePath="build\" Pack="true" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\Xenko.Core.Design\Xenko.Core.Design.csproj" />
@@ -58,4 +59,15 @@
<Import Project="..\..\tools\Xenko.Core.VisualStudio\Xenko.Core.VisualStudio.projitems" Label="Shared" />
<Import Project="$(XenkoPostSettingsTargets)" />
<Import Project="Sdk.targets" Sdk="MSBuild.Sdk.Extras" Version="1.6.55" />

<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeExtraAssemblies</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target Name="IncludeExtraAssemblies">
<ItemGroup>
<BuildOutputInPackage Include="$(OutputPath)System*.dll" />
<BuildOutputInPackage Include="$(OutputPath)NuGet*.dll" />
<BuildOutputInPackage Include="$(OutputPath)Newtonsoft.Json.dll" />
</ItemGroup>
</Target>
</Project>
@@ -0,0 +1,66 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
*****************************************************************************************************************************
Compile Asset
*****************************************************************************************************************************
-->
<PropertyGroup>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
XenkoCompileAsset
</PrepareForRunDependsOn>

<!--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>

<!--asset BuildPath for all platforms (same as package)-->
<XenkoCompileAssetBuildPath Condition="'$(XenkoCompileAssetBuildPath)' == ''">$(MSBuildProjectDirectory)\..\Cache\data</XenkoCompileAssetBuildPath>

<!--asset OutputPath for Android.-->
<XenkoCompileAssetOutputPath Condition="'$(XenkoCompileAssetOutputPath)' == '' and '$(XenkoPlatform)' == 'Android'">$(ProjectDir)$(IntermediateOutputPath)assets\data</XenkoCompileAssetOutputPath>

<!--asset OutputPath for other platforms. Note: this is overridden for UnitTests projects. -->
<XenkoCompileAssetOutputPath Condition="'$(XenkoCompileAssetOutputPath)' == ''">$(TargetDir)data</XenkoCompileAssetOutputPath>

<XenkoCompileAssetCommand Condition="'$(XenkoCompileAssetCommand)' == ''">$(MSBuildThisFileDirectory)..\lib\net462\Xenko.Core.Assets.CompilerApp.exe</XenkoCompileAssetCommand>

<!--<XenkoCompileAssetCommandProxy Condition="'$(DisableAssetCompilerExecServerProxy)' == 'true' Or '$(XenkoDisableAssetCompilerExecServerProxy)' == 'true'">&quot;$(XenkoCompileAssetCommand)&quot;</XenkoCompileAssetCommandProxy>
<XenkoCompileAssetCommandProxy Condition="'$(XenkoCompileAssetCommandProxy)' == ''">&quot;$(XenkoPackageXenkoSdkBin)\Xenko.Core.Assets.CompilerClient.exe&quot;</XenkoCompileAssetCommandProxy>-->
<XenkoCompileAssetCommandProxy>&quot;$(XenkoCompileAssetCommand)&quot;</XenkoCompileAssetCommandProxy>

<!-- Quite hard-coded for our current way to find default game settings -->
<XenkoGameSettings Condition="'$([System.IO.File]::Exists($(MSBuildProjectDirectory)\Assets\GameSettings.xkgamesettings))'== 'true' ">$(MSBuildProjectDirectory)\Assets\GameSettings.xkgamesettings</XenkoGameSettings>
<XenkoGameSettings Condition="'$(XenkoGameSettings)' == '' and '$([System.IO.File]::Exists($(MSBuildProjectDirectory)\..\Assets\Shared\GameSettings.xkgamesettings))' == 'true'">$(MSBuildProjectDirectory)\..\Assets\Shared\GameSettings.xkgamesettings</XenkoGameSettings>
<!-- Quite hard-coded for our current unit tests -->
<XenkoGameSettings Condition="'$(XenkoGameSettings)' == '' and '$([System.IO.File]::Exists($(MSBuildProjectDirectory)\GameAssets\GameSettings.xkgamesettings))' == 'true' ">$(MSBuildProjectDirectory)\GameAssets\GameSettings.xkgamesettings</XenkoGameSettings>
<XenkoGameSettings Condition="'$(XenkoGameSettings)' == '' and '$([System.IO.File]::Exists($(MSBuildProjectDirectory)\AudioAssets\GameSettings.xkgamesettings))' == 'true' ">$(MSBuildProjectDirectory)\AudioAssets\GameSettings.xkgamesettings</XenkoGameSettings>
<XenkoGameSettings Condition="'$(XenkoGameSettings)' == '' and '$([System.IO.File]::Exists($(MSBuildProjectDirectory)\Shaders.Bytecodes\GameSettings.xkgamesettings))' == 'true' ">$(MSBuildProjectDirectory)\Shaders.Bytecodes\GameSettings.xkgamesettings</XenkoGameSettings>
</PropertyGroup>

<!--Compile assets for all XenkoPackage items and only for an executable-->
<Target Name="XenkoCompileAsset" Condition="'$(XenkoIsExecutable)' == 'true'">
<PropertyGroup>
<XenkoCompileAssetCommandProxy>$(XenkoCompileAssetCommandProxy) $(XenkoCompileAssetOptions) --disable-auto-compile --project-configuration &quot;$(Configuration)&quot; --platform=$(XenkoPlatform) --project-configuration=$(Configuration) --output-path=&quot;$(XenkoCompileAssetOutputPath)&quot; --build-path=&quot;$(XenkoCompileAssetBuildPath)&quot; --package-file=&quot;$(MSBuildProjectFullPath)&quot; --log-pipe=&quot;$(XenkoBuildEngineLogPipeUrl)&quot;</XenkoCompileAssetCommandProxy>
<XenkoCompileAssetCommandProxy Condition="'$(XenkoBuildEngineLogVerbose)' != ''">$(XenkoCompileAssetCommandProxy) --verbose</XenkoCompileAssetCommandProxy>
<XenkoCompileAssetCommandProxy Condition="'$(XenkoBuildEngineLogDebug)' != ''">$(XenkoCompileAssetCommandProxy) --debug</XenkoCompileAssetCommandProxy>
</PropertyGroup>

<!-- Ensure the output directory exists -->
<MakeDir Directories="$(TargetDir)"/>

<!-- Compile assets -->
<Exec WorkingDirectory="$(TargetDir)" Command="$(XenkoCompileAssetCommandProxy)" />

<!-- Android specific: include build output in _AndroidAssetsDest so that APK is regenerated -->
<ItemGroup Condition="'$(XenkoPlatform)' == 'Android'">
<_AndroidAssetsDest Include="$(XenkoCompileAssetOutputPath)\**\*.*" />
</ItemGroup>
</Target>

<!-- Clean assets -->
<Target Name="XenkoCleanAsset" Condition="'$(XenkoIsExecutable)' == 'true'">
<RemoveDir Condition="Exists('$(XenkoCompileAssetBuildPath)')" ContinueOnError="true" Directories="$(XenkoCompileAssetBuildPath)"/>
<RemoveDir Condition="Exists('$(XenkoCompileAssetOutputPath)')" ContinueOnError="true" Directories="$(XenkoCompileAssetOutputPath)"/>
</Target>
</Project>
@@ -599,6 +599,7 @@ public static PackageContainer LoadProject(ILogger log, string filePath)
ResourceFolders = { "Resources" },
FullPath = packagePath,
};
package.Meta.Version = TryGetPackageVersion(projectPath) ?? new PackageVersion("1.0.0");
return new SolutionProject(package, Guid.NewGuid(), projectPath) { IsImplicitProject = !packageExists };
}
else
@@ -619,6 +620,30 @@ public static PackageContainer LoadProject(ILogger log, string filePath)
}
}

private static PackageVersion TryGetPackageVersion(string projectPath)
{
try
{
// Load a project without specifying a platform to make sure we get the correct platform type
var msProject = VSProjectHelper.LoadProject(projectPath, platform: "NoPlatform");
try
{

var packageVersion = msProject.GetPropertyValue("PackageVersion");
return !string.IsNullOrEmpty(packageVersion) ? new PackageVersion(packageVersion) : null;
}
finally
{
msProject.ProjectCollection.UnloadAllProjects();
msProject.ProjectCollection.Dispose();
}
}
catch
{
return null;
}
}

/// <summary>
/// Second part of the package loading process, when references, assets and package analysis is done.
/// </summary>
@@ -245,6 +245,7 @@ private async Task PreLoadPackageDependencies(ILogger log, SolutionProject proje
{
// Load package
var loadedProject = LoadProject(log, file, true, loadParameters);
loadedProject.Package.Meta.Version = projectDependency.Version;
Projects.Add(loadedProject);

loadedPackage = loadedProject.Package;
@@ -6,13 +6,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using Xenko.Core.Assets;
using Xenko.Core.Diagnostics;
using Xenko.Core.IO;
using Xenko.Core.Yaml;
using Xenko.Core.Yaml.Events;

namespace Xenko.Assets.Tasks
namespace Xenko.Core.Assets.Tasks
{
public class PackAssets : Task
{
@@ -124,6 +123,7 @@ void TryCopyResource(UFile resourceFilePath, UFile targetFilePath)
var yamlEventReader = new EventReader(new Parser(streamReader));
yamlEventReader.ReadCurrent(parsingEvents);

var hasChanges = false;
foreach (var parsingEvent in parsingEvents)
{
if (parsingEvent is Scalar scalar)
@@ -139,17 +139,30 @@ void TryCopyResource(UFile resourceFilePath, UFile targetFilePath)
targetResourcePath = UPath.Combine(resourceOutputPath, (UFile)sourceResourcePath.GetFileName());
TryCopyResource(sourceResourcePath, targetResourcePath);
}
scalar.Value = targetResourcePath.MakeRelative(assetOutputPath);
var newValue = targetResourcePath.MakeRelative(assetOutputPath);
if (scalar.Value != newValue)
{
hasChanges = true;
scalar.Value = newValue;
}
}
}
}

using (var output = File.CreateText(outputFile))
if (!hasChanges)
{
// We do this because pure text files could be parsed as YAML events even though they are not
File.Copy(asset.FilePath, outputFile, true);
}
else
{
var emitter = new Emitter(output, AssetYamlSerializer.Default.GetSerializerSettings().PreferredIndent);
foreach (var parsingEvent in parsingEvents)
using (var output = File.CreateText(outputFile))
{
emitter.Emit(parsingEvent);
var emitter = new Emitter(output, AssetYamlSerializer.Default.GetSerializerSettings().PreferredIndent);
foreach (var parsingEvent in parsingEvents)
{
emitter.Emit(parsingEvent);
}
}
}

@@ -39,12 +39,12 @@
<XenkoAssemblyProcessorPath>$(MSBuildThisFileDirectory)..\tools\AssemblyProcessor\Xenko.Core.AssemblyProcessor.Packed.exe</XenkoAssemblyProcessorPath>
</PropertyGroup>
<UsingTask TaskName="AssemblyProcessorTask" AssemblyFile="$(XenkoAssemblyProcessorPath)" Condition=" '$(XenkoAssemblyProcessorPath)' != '' And '$(XenkoAssemblyProcessorDev)' != 'true' "/>
<Target Name="XenkoRunAssemblyProcessor" DependsOnTargets="ResolveProjectReferences">
<Target Name="XenkoRunAssemblyProcessor" DependsOnTargets="ResolveAssemblyReferences">
<WriteLinesToFile File="$(IntermediateOutputPath)XenkoReferences.cache" Lines="@(ReferencePath)" Overwrite="true" />
<PropertyGroup>
<XenkoAssemblyProcessorOptions Condition="'$(XenkoAssemblyProcessorOptions)' == ''">--auto-notify-property --parameter-key --auto-module-initializer --serialization</XenkoAssemblyProcessorOptions>
<!-- If building user solutions (not unit tests), provide assembly processor with ProjectReferences paths so that they can be readded to assembly references for serialization module initializer (otherwise .exe don't have real reference on Game assemblies with auto load scene game) -->
<XenkoAssemblyProcessorOptions Condition="'$(XenkoUnitTest)' != 'true'">$(XenkoAssemblyProcessorOptions) @(_ResolvedProjectReferencePaths->'--add-reference=%22%(Identity)%22',' ')</XenkoAssemblyProcessorOptions>
<XenkoAssemblyProcessorOptions Condition="'$(XenkoUnitTest)' != 'true'">$(XenkoAssemblyProcessorOptions) @(ReferencePath->'--add-reference=%22%(Identity)%22',' ')</XenkoAssemblyProcessorOptions>
<XenkoAssemblyProcessorOptions Condition="'$(DocumentationFile)' != ''">$(XenkoAssemblyProcessorOptions) --docfile="$(DocumentationFile)"</XenkoAssemblyProcessorOptions>
<XenkoAssemblyProcessorOptions>$(XenkoAssemblyProcessorOptions) --references-file="$(IntermediateOutputPath)XenkoReferences.cache"</XenkoAssemblyProcessorOptions>
<XenkoAssemblyProcessorOptions>$(XenkoAssemblyProcessorOptions) --platform=$(XenkoPlatform) --targetFramework=$(XenkoNETFrameworkVersion) "$(IntermediateOutputPath)$(TargetName)$(TargetExt)"</XenkoAssemblyProcessorOptions>

This file was deleted.

@@ -2,7 +2,7 @@
Id: 7e2761d1-ef86-420a-b7a7-a0ed1c16f9bb
SerializedVersion: {Xenko: 2.0.0.0}
Tags: []
Source: ../../Resources/ClearCoatMetalFlakesNM.dds
Source: !file ../../Resources/ClearCoatMetalFlakesNM.dds
IsCompressed: false
GenerateMipmaps: true
Type: !NormalMapTextureType {}
@@ -2,7 +2,7 @@
Id: 2f76bcba-ae9f-4954-b98d-f94c2102ff86
SerializedVersion: {Xenko: 2.0.0.0}
Tags: []
Source: ../../Resources/ClearCoatOrangePeelNM.dds
Source: !file ../../Resources/ClearCoatOrangePeelNM.dds
IsCompressed: false
GenerateMipmaps: true
Type: !NormalMapTextureType {}
@@ -2,7 +2,7 @@
Id: FF02239B-3697-4EBB-9F37-FE880659E64B
SerializedVersion: {Xenko: 2.0.0}
Tags: []
Source: ../../Resources/XenkoDebugSpriteFont.png
Source: !file ../../Resources/XenkoDebugSpriteFont.png
IsCompressed: false
Type: !ColorTextureType
UseSRgbSampling: false
@@ -2,7 +2,7 @@
Id: d26edb11-10bd-403c-b3c2-9c7fcccf25e5
SerializedVersion: {Xenko: 2.0.0}
Tags: []
Source: ../../Resources/XenkoDefaultSplashScreen.png
Source: !file ../../Resources/XenkoDefaultSplashScreen.png
IsCompressed: false
Type: !ColorTextureType
ColorKeyColor: {R: 255, G: 0, B: 255, A: 255}
@@ -2,7 +2,7 @@
Id: a49995f8-2380-4baa-a03e-f8d1da35b79a
SerializedVersion: {Xenko: 2.0.0}
Tags: []
Source: ../../Resources/EnvironmentLightingDFGLUT16.dds
Source: !file ../../Resources/EnvironmentLightingDFGLUT16.dds
IsCompressed: false
GenerateMipmaps: false
Type: !ColorTextureType
@@ -2,7 +2,7 @@
Id: 87540190-ab97-4b4e-b3c2-d57d2fbb1ff3
SerializedVersion: {Xenko: 2.0.0}
Tags: []
Source: ../../Resources/EnvironmentLightingDFGLUT8.dds
Source: !file ../../Resources/EnvironmentLightingDFGLUT8.dds
IsCompressed: false
GenerateMipmaps: false
Type: !ColorTextureType

0 comments on commit 051a811

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