Skip to content

Commit c08cd63

Browse files
authored
Merge pull request #9382 from microsoft/feature/asset-retargeting
Adds groundwork for migrating projects off NuGet to UPM/.unitypackages
2 parents 8348d2e + 3b75b97 commit c08cd63

File tree

8 files changed

+263
-84
lines changed

8 files changed

+263
-84
lines changed

Assets/MRTK/Tools/MSBuild/Scripts/AssetScriptReferenceRetargeter.cs

Lines changed: 249 additions & 82 deletions
Large diffs are not rendered by default.

Assets/MRTK/Tools/MSBuild/Scripts/Utilities.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static class Utilities
5656
public static string MSBuildOutputFolder { get; } = GetNormalizedPath(ProjectPath + MSBuildFolderName, true);
5757
public static string PackagesCopyPath { get; } = Path.Combine(MSBuildOutputFolder, PackagesCopyFolderName);
5858
public const string MetaFileGuidRegex = @"guid:\s*([0-9a-fA-F]{32})";
59+
public const string MetaFileIdRegex = @"fileID:\s*(-?[0-9]+)";
5960

6061
private static readonly string packagesPath;
6162

@@ -118,7 +119,7 @@ public static bool TryGetGuidForAsset(FileInfo assetPath, out Guid guid)
118119
while (!reader.EndOfStream)
119120
{
120121
string line = reader.ReadLine();
121-
Match match = Regex.Match(line, Utilities.MetaFileGuidRegex);
122+
Match match = Regex.Match(line, MetaFileGuidRegex);
122123

123124
if (match.Success)
124125
{
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file is intentionally left blank. It will be filled in during the build pipeline. It exists to maintain a stable meta file and GUID.

Assets/MRTK/Tools/MSBuild/mrtk_guid_remapping_dictionary.txt.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MRTK/Tools/MixedReality.Toolkit.Tools.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<file src="..\..\MRTK\Core\MixedReality.Toolkit.targets" target="build\Microsoft.MixedReality.Toolkit.Tools.targets" />
2828

2929
<file src="..\..\..\Plugins\**\Microsoft.MixedReality.Toolkit.Tools.*" target="Plugins\" />
30+
<file src="..\..\..\Plugins\**\Microsoft.MixedReality.Toolkit.MSBuild.*" target="Plugins\" />
3031
<file src="..\..\..\..\Assets\MRTK\Tools\**\*.cs" target="contentFiles\any\any\.PkgSrc\MRTK\Tools" />
3132
</files>
3233
</package>

pipelines/templates/tasks/assetretargeting.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ steps:
1616
$method = "Microsoft.MixedReality.Toolkit.MSBuild.AssetScriptReferenceRetargeter.RetargetAssets"
1717
# Uses unitysetup.powershell
1818
try {
19-
Start-UnityEditor -Project "$(Get-Location)" -Version ${{ parameters.UnityVersion }} -ExecuteMethod $method -BatchMode -Quit -Wait -LogFile "$($logFile.FullName)" -AdditionalArguments "-NoGraphics -CacheServerIPAddress ${Env:COG-UnityCache-WUS2-01}"
19+
Start-UnityEditor -Project "$(Get-Location)" -Version ${{ parameters.UnityVersion }} -ExecuteMethod $method -BatchMode -Quit -Wait -LogFile "$($logFile.FullName)" -AdditionalArguments "-NoGraphics -CacheServerIPAddress ${Env:COG-UnityCache-WUS2-01} -dictionaryFileOutputFolder `"$(Build.SourcesDirectory)/Assets/MRTK/Tools/MSBuild`""
2020
}
2121
finally {
2222
if (Test-Path $logFile)

pipelines/templates/tasks/publish-nuget.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ steps:
1313

1414
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2 # NuGetCommand
1515
displayName: 'NuGet push'
16+
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI'))
1617
inputs:
1718
command: push
1819
packagesToPush: '${{ parameters.packageLocation }}/**/*.nupkg;!${{ parameters.packageLocation }}/**/*.symbols.nupkg'

pipelines/templates/tasks/publish-upm.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
steps:
44
- task: PowerShell@2
55
displayName: 'UPM packages to registry'
6+
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI'))
67
inputs:
78
targetType: filePath
89
filePath: ./scripts/packaging/publishupmpackages.ps1

0 commit comments

Comments
 (0)