@@ -274,6 +274,25 @@ function CheckForActualFile {
274274 }
275275}
276276
277+ <#
278+ . SYNOPSIS
279+ Checks if all assembly definitions have a corresponding AssemblyInfo.cs checked in.
280+ Returns true if the AssemblyInfo is missing.
281+ #>
282+ function CheckForAssemblyInfo {
283+ [CmdletBinding ()]
284+ param (
285+ [string ]$FileName
286+ )
287+ process {
288+ if (-not (Test-Path (Join-Path - Path (Split-Path $FileName ) - ChildPath " AssemblyInfo.cs" ))) {
289+ Write-Warning " AssemblyInfo.cs missing for $FileName . Please be sure to check it in alongside this asmdef."
290+ $true ;
291+ }
292+ $false ;
293+ }
294+ }
295+
277296function CheckScript {
278297 [CmdletBinding ()]
279298 param (
@@ -346,9 +365,9 @@ function CheckUnityScene {
346365 [string ]$FileName
347366 )
348367 process {
349- # Checks if there is more than one MixedRealityPlayspace objects in each example unity scene
350368 $containsIssue = $false
351369
370+ # Checks if there is more than one MixedRealityPlayspace objects in each example unity scene
352371 $MatchesPlayspaces = Select-String MixedRealityPlayspace $FileName - AllMatches
353372 $NumPlayspaces = $MatchesPlayspaces.Matches.Count
354373
@@ -369,6 +388,22 @@ function CheckUnityScene {
369388 }
370389}
371390
391+ function CheckAssemblyDefinition {
392+ [CmdletBinding ()]
393+ param (
394+ [string ]$FileName
395+ )
396+ process {
397+ $containsIssue = $false
398+
399+ if (CheckForAssemblyInfo $FileName ) {
400+ $containsIssue = $true
401+ }
402+
403+ $containsIssue
404+ }
405+ }
406+
372407# If the file containing the list of changes was provided and actually exists,
373408# this validation should scope to only those changed files.
374409if ($ChangesFile -and (Test-Path $ChangesFile - PathType leaf)) {
@@ -383,7 +418,8 @@ if ($ChangesFile -and (Test-Path $ChangesFile -PathType leaf)) {
383418 if (((IsCSharpFile - Filename $changedFile ) -and (CheckScript $changedFile )) -or
384419 ((IsAssetFile - Filename $changedFile ) -and (CheckAsset $changedFile )) -or
385420 ((IsUnityScene - Filename $changedFile ) -and (CheckUnityScene $changedFile )) -or
386- ((IsMetaFile - Filename $changedFile ) -and (CheckForActualFile $changedFile ))) {
421+ ((IsMetaFile - Filename $changedFile ) -and (CheckForActualFile $changedFile )) -or
422+ ((IsAsmDef - Filename $changedFile ) -and (CheckAssemblyDefinition $changedFile ))) {
387423 $containsIssue = $true ;
388424 }
389425 }
@@ -420,6 +456,13 @@ else {
420456 $containsIssue = $true
421457 }
422458 }
459+
460+ $asmdefs = Get-ChildItem $Directory * .asmdef - File - Recurse | Select-Object FullName
461+ foreach ($asmdef in $asmdefs ) {
462+ if (CheckAssemblyDefinition $asmdef.FullName ) {
463+ $containsIssue = $true
464+ }
465+ }
423466}
424467
425468$folders = Get-ChildItem $Directory - Directory - Recurse | Select-Object FullName
0 commit comments