{"push_id":1063361798,"size":1,"distinct_size":1,"ref":"refs/heads/platforms","head":"4b1b535affb9688fa33bc0d493ebc4c4bfc8aa0b","before":"e99633c2fd0e0cd4007f934d176bfff12b569116","commits":[{"sha":"4b1b535affb9688fa33bc0d493ebc4c4bfc8aa0b","author":{"email":"9685a78bf02e8f63537877a213b2b9254bd73701@sealedabstract.com","name":"Drew Crawford"},"message":"Add proper platform support\n\nRelated to #36\n\nPresently, we tend to enable platform-specific config with an overlay.\nThere are a variety of problems identified with this approach:\n\n1.  There is no convention for which overlay to use for platform-\nspecific config.  This complicates the ecosystem.\n\n2.  In general, a program is always compiled \"for some platform\" but in\npractice a user may forget the necessary overlay.  `require-overlays`\ncan catch this misconfig, but A) it has to be opted into in the atpkg,\nand B) there is no good way to default to the running platform, which is\nthe sane behavior.\n\n3.  Currently, tools tend to conditionally-compile platform-specific\ncode.  The effect of this is to complicate bootstrapping, as a Linux\nbinary *cannot* perform some OSX behavior (and vice versa) because the\nnecessary code is not present in the executable.\n\n4.  This is not scaleable to cross-compilation (iOS for example is\nComing Soon™ but can't be supported in this architecture)\n\nTo work around these problems, we introduce a `Platform` enum, to\nreplace `PlatformPaths`.  `Platform` is a runtime technology, allowing\nfor a Linux binary to reason about what the behavior would be on OSX\netc.\n\nInternally, we have three \"platforms\":\n\n* `hostPlatform`, the platform on which `atbuild` is currently executing\n* `targetPlatform`, the platform for which we are compiling. By default\n   this is the `hostPlatform`\n* `buildPlatform`, the platform where `swift-build-tool` will run.\n   This is usually the `hostPlatform`, but if we are bootstrapping it\n   is the `targetPlatform` instead.\n\nThe user can override the `targetPlatform` by the use of `--platform\nfoo`.  `linux` and `osx` are supported.  `mac` is supported as an alias\nof `osx`.\n\nThe primary effect of a platform is to scope tool-specific behavior\n(e.g., target=OSX uses the OSX SDK, host=Linux uses a linux path for the\ntoolchain, etc).\n\nIn addition to the tool-specific behavior, we enable overlays for the\ntarget platform:\n\n* `atbuild.platform.linux` on Linux\n* `atbuild.platform.osx` and `atbuild.platform.mac` on OSX\n\nThis allows packages to reliably perform per-platform configuration in\nthe overlays.  Critically, some platform overlay is reliably active, so\nusers in most cases will not have to `--use-overlay` to get proper\nplatform behavior.\n\nDEPRECATION WARNING: We believe the `swiftc-path` key is no longer\nrequired, as the functionality used can be achieved either by\n`--toolchain` or `--platform`.  Therefore, I'm adding a warning to users\nthat we intend to remove it and to try these features instead.\n\nWe need to put out a release with these features (and the warning)\nbefore I'm happy to remove it.  In particular, we use it inside\natbuild/atpkg, and removing it immediately would break bootstrapping, so\nlet's give it a little time before we tear it out.  We should remove it\nfrom the documentation though.","distinct":true,"url":"https://api.github.com/repos/AnarchyTools/atbuild/commits/4b1b535affb9688fa33bc0d493ebc4c4bfc8aa0b"}]}