Skip to content
Browse files

[Assets] Support Packing and consuming simple NuGet packages with Xen…

…ko assets
  • Loading branch information
xen2 committed Sep 20, 2018
1 parent 2f446a3 commit 406a74c3f382756e3b3df172504e51b840dc56d9
Showing with 34 additions and 1 deletion.
  1. +22 −0 Targets/Xenko.targets
  2. +12 −1 sources/assets/Xenko.Core.Assets/PackageStore.cs
@@ -378,4 +378,26 @@
<RemoveDir Condition="Exists('$(XenkoCompileAssetBuildPath)')" ContinueOnError="true" Directories="$(XenkoCompileAssetBuildPath)"/>
<RemoveDir Condition="Exists('$(XenkoCompileAssetOutputPath)')" ContinueOnError="true" Directories="$(XenkoCompileAssetOutputPath)"/>

<!-- Pack target / TODO: More advanced logic by using a Task/exe to move and save all assets/resources properly rather than hardcoded list of folders -->
<Target Name="PrepareXenkoAssetsForPack" BeforeTargets="_GetPackageFiles">
<None Include="*.xkpkg*" Exclude="*.user">
<None Include="Assets/**/*.xk*" Exclude="*.user">
<None Include="Effects/**/*.xk*" Exclude="*.user">
<None Include="Resources/*.*" Exclude="*.user">
@@ -169,7 +169,18 @@ public UFile GetPackageFileName(string packageName, PackageVersionRange versionR
// If package was not found,
if (package != null)
return UPath.Combine(store.GetRealPath(package), new UFile(packageName + Package.PackageFileExtension));
var packageRoot = (UDirectory)store.GetRealPath(package);
var packageFilename = new UFile(packageName + Package.PackageFileExtension);

// First look for xkpkg at package root
var packageFile = UPath.Combine(packageRoot, packageFilename);
if (File.Exists(packageFile))
return packageFile;

// Then look for xkpkg inside xenko subfolder
packageFile = UPath.Combine(UPath.Combine(packageRoot, (UDirectory)"xenko"), packageFilename);
if (File.Exists(packageFile))
return packageFile;

// TODO: Check version for default package

0 comments on commit 406a74c

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