Skip to content

Commit

Permalink
Fixed iOS and Android XNB building logic
Browse files Browse the repository at this point in the history
Added clarification about how XNBs are handled in content
  • Loading branch information
vchelaru committed Apr 20, 2024
1 parent ae2ecdd commit 859c288
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,15 @@ private bool IsContentFile(ProjectItem bi, ProjectBase buildItemOwner, VisualStu

if (!shouldSkipContent)
{
// If we got to this point, then the file has not been explicitly excluded as content. However, we still may want to skip it if it's not in the content directory.
string containingProjectContent = FileManager.Standardize(buildItemOwner.ContentDirectory).ToLowerInvariant();
string standardUnevaluatedInclude = FileManager.Standardize(bi.UnevaluatedInclude).ToLowerInvariant();
var isRelativeToContentFolder = standardUnevaluatedInclude.StartsWith(containingProjectContent);

shouldSkipContent = standardUnevaluatedInclude.StartsWith(containingProjectContent) == false;
// This could still be content if it's an XNB, but XNBs are platform-specific. We don't want to sync an XNB from one platform to another. We'll let the
// XNB builder handle this. See the ContentPipelinePlugin for more information.

shouldSkipContent = !isRelativeToContentFolder;
}

return !shouldSkipContent;
Expand Down
12 changes: 0 additions & 12 deletions FRBDK/Glue/Glue/VSHelpers/ProjectSyncer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,6 @@ public static void UpdateSyncedProjectsInGlux()

public static void SyncProjects(ProjectBase sourceProjectBase, ProjectBase projectBaseToModify, bool performTranslation)
{
// July 18, 2011
// We used to pass
// in the sourceProject
// and the sourceContentProject
// separately, but now the sourceProject
// has a reference to the sourceContentProject,
// so there's no need to do that. I'm adding this
// comment just in case at some point we were actually
// passing in the two separately for some reason...although
// I think it was done because this code was originally written
// before ProjectBase had a ContentProject property.

projectBaseToModify.SyncTo(sourceProjectBase, performTranslation);
}

Expand Down
16 changes: 12 additions & 4 deletions FRBDK/Glue/OfficialPlugins/ContentPipelinePlugin/BuildLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ public static bool GetIfNeedsMonoGameFilesBuilt(ProjectBase project)
{
return project is MonoGameDesktopGlBaseProject ||
project is AndroidProject ||
project is UwpProject
// todo: need to support iOS
project is UwpProject ||
project is AndroidMonoGameNet8Project ||
project is IosMonoGameNet8Project
;

}
Expand Down Expand Up @@ -298,10 +299,14 @@ private static string GetPipelinePlatformNameFor(ProjectBase project)
{
platform = "DesktopGL";
}
else if (project is AndroidProject)
else if (project is AndroidProject or AndroidMonoGameNet8Project)
{
platform = "Android";
}
else if (project is IosMonoGameNet8Project)
{
platform = "iOS";
}
else if (project is UwpProject)
{
platform = "WindowsStoreApp";
Expand All @@ -313,7 +318,10 @@ private static string GetPipelinePlatformNameFor(ProjectBase project)
public static string GetXnbDestinationDirectory(FilePath fullFileName, ProjectBase project)
{
string platform = GetPipelinePlatformNameFor(project);

if(string.IsNullOrEmpty(platform))
{
throw new InvalidOperationException($"The project type {project.GetType().Name} does not have a specified platform for the content pipeline. This must be added.");
}
string contentDirectory = GlueState.ContentDirectory;
string projectDirectory = GlueState.CurrentGlueProjectDirectory;
string destinationDirectory = fullFileName.GetDirectoryContainingThis().FullPath;
Expand Down

0 comments on commit 859c288

Please sign in to comment.