{"action":"created","issue":{"url":"https://api.github.com/repos/mono/MonoGame/issues/3515","labels_url":"https://api.github.com/repos/mono/MonoGame/issues/3515/labels{/name}","comments_url":"https://api.github.com/repos/mono/MonoGame/issues/3515/comments","events_url":"https://api.github.com/repos/mono/MonoGame/issues/3515/events","html_url":"https://github.com/mono/MonoGame/issues/3515","id":57261097,"number":3515,"title":"Improving The Platform Extension System","user":{"login":"tomspilman","id":103522,"avatar_url":"https://avatars.githubusercontent.com/u/103522?v=3","gravatar_id":"","url":"https://api.github.com/users/tomspilman","html_url":"https://github.com/tomspilman","followers_url":"https://api.github.com/users/tomspilman/followers","following_url":"https://api.github.com/users/tomspilman/following{/other_user}","gists_url":"https://api.github.com/users/tomspilman/gists{/gist_id}","starred_url":"https://api.github.com/users/tomspilman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomspilman/subscriptions","organizations_url":"https://api.github.com/users/tomspilman/orgs","repos_url":"https://api.github.com/users/tomspilman/repos","events_url":"https://api.github.com/users/tomspilman/events{/privacy}","received_events_url":"https://api.github.com/users/tomspilman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mono/MonoGame/labels/Design","name":"Design","color":"5319e7"},{"url":"https://api.github.com/repos/mono/MonoGame/labels/Feature%20Request","name":"Feature Request","color":"000000"},{"url":"https://api.github.com/repos/mono/MonoGame/labels/Protobuild","name":"Protobuild","color":"e73c00"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":112,"created_at":"2015-02-11T00:38:51Z","updated_at":"2015-12-08T11:29:21Z","closed_at":null,"body":"I'd like to start discussing how we can further improve the system by which different platforms are added in MonoGame.\r\n\r\nIMO the idealistic goal moving forward should be that we can add additional platforms (like PS4 for instance) without needing to make platform specific modifications to existing files in the public repo.  Ideally merging in a platform like XB1, PS4, or WiiU would be as simple as copying a folder of files into the root of the public repo and executing Protobuild.\r\n\r\nAbout a year ago we took two big steps...\r\n\r\n## Moved to using Protobuild for project generation\r\nThe Protobuild change now means zero project file maintenance, new non-platform specific code is quick to add, and no more project file conflicts.  \r\n\r\nThe problem with Protobuild is that all the platform specific info is centralized in one file.  This means that if we have a closed source platform like we do with PS4... we have to maintain a patched version of that definition file with additional `.ps4.cs` files and other platform specific details.\r\n\r\nIdeally there should be a way to optionally include additional platform files/settings from the main Protobuild .definition file.  @hach-que ??\r\n\r\n## Partial classes and \"Platform\" methods\r\nAlso a lot of MonoGame platform code is now done with partial classes and \"Platform\" methods.  This is great as most of the platform code is just adding in various `.platform.cs` and editing the protobuild config file to include them.\r\n\r\nWe still have big classes like `GraphicsDeviceManager` that are a `#if` spaghetti.  We should prioritize converting classes like that into platform partial classes.\r\n\r\nIn places where we smaller `#if` blocks that are enabling some feature for multiple platforms we should look at add a feature specific `#if`.  For example this case here:\r\n\r\nhttps://github.com/mono/MonoGame/blob/develop/MonoGame.Framework/Game.cs#L325\r\n\r\n... we probably need a `#if NO_EXIT` instead of naming specific platforms.  This allows the feature to be toggled on other platforms by changing the Protobuild config.\r\n\r\n## Extending The Pipeline\r\nA big area where we need to design a new abstraction is within the content pipeline.  There are cases where there are platform specific formats and processing that we want to be able to plug into the pipeline instead of being hard coded into the public repo.\r\n\r\nIn this case I started a separate issue for this (see https://github.com/mono/MonoGame/issues/2781) but it is something that needs consideration."},"comment":{"url":"https://api.github.com/repos/mono/MonoGame/issues/comments/162855692","html_url":"https://github.com/mono/MonoGame/issues/3515#issuecomment-162855692","issue_url":"https://api.github.com/repos/mono/MonoGame/issues/3515","id":162855692,"user":{"login":"hach-que","id":504826,"avatar_url":"https://avatars.githubusercontent.com/u/504826?v=3","gravatar_id":"","url":"https://api.github.com/users/hach-que","html_url":"https://github.com/hach-que","followers_url":"https://api.github.com/users/hach-que/followers","following_url":"https://api.github.com/users/hach-que/following{/other_user}","gists_url":"https://api.github.com/users/hach-que/gists{/gist_id}","starred_url":"https://api.github.com/users/hach-que/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hach-que/subscriptions","organizations_url":"https://api.github.com/users/hach-que/orgs","repos_url":"https://api.github.com/users/hach-que/repos","events_url":"https://api.github.com/users/hach-que/events{/privacy}","received_events_url":"https://api.github.com/users/hach-que/received_events","type":"User","site_admin":false},"created_at":"2015-12-08T11:29:21Z","updated_at":"2015-12-08T11:29:21Z","body":"> So it will try to clone and manage repos if I don't beat it to the punch.\r\n\r\nI don't understand what you mean by this - the XSLT is in that repository, what do you expect to happen if the folder that the XSLT is in hasn't already been cloned by Git? (i.e. the user hasn't initialized Git submodules)  The file literally doesn't exist on your computer otherwise, so what is it meant to do?\r\n\r\n> Can we get...\r\n>\r\n> ```\r\n> <Package Uri=\"https-git://github.com/MonoGame/PS4XSLT.git\" Folder=\"PS4XSLT\" GitRef=\"master\" Type=\"PlatformExtension\" />\r\n> ```\r\n>\r\n> To pull a single file or folder from a repo instead of the whole repo?\r\n\r\nWe could add a package type that pulls a single file from a web server (you could then just make this a URL that points to the raw link on GitHub, e.g. like https://github.com/hach-que/Protobuild/raw/master/Protobuild.exe).  This would probably end up being:\r\n\r\n```\r\n<Package Uri=\"https-file://github.com/MonoGame/MonoGame.PS4/XSLT/GenerateProject.CSharp.PlayStation4.xslt\" Folder=\"PS4XSLT\" GitRef=\"master\" Type=\"PlatformExtension\" />\r\n```\r\n\r\n> Is `PlatformExtension` a code word for platform XSLT and it knows where to place it?\r\n\r\nYeah the intention here is that Protobuild would know that the target repo (or file) just contains an XSLT and can treat it differently to other repos (where it would be expecting them to be a Protobuild submodule that it needs to generation in).  Roughly it could see that in the hierarchy and go, okay, now I have a reference that will provide me with an additional XSLT, so I will copy it to whatever location I need (whether that's passing state through to other submodules, storing it locally, copying, etc. doesn't matter as long as it's providing that reference to all the modules in the hierarchy without them having to perform disk scans)."}}