on master help sign in
asset-manifest: Provide access to the deprecated version as a user setting
cb79db4Ali Abrar
ChangeLog.md+1−1
@@ -6,7 +6,7 @@ This project's release branch is `master`. This log is written from the perspect
6
6
7* Use TemplateHaskell to determine asset file paths
7* Use TemplateHaskell to determine asset file paths
8 * Migration: All uses of `static @"some/path"` become `$(static "some/path")`. Instead of requiring `TypeApplications` and `DataKinds`, modules calling `static` must now enable `TemplateHaskell`.
8 * Migration: All uses of `static @"some/path"` become `$(static "some/path")`. Instead of requiring `TypeApplications` and `DataKinds`, modules calling `static` must now enable `TemplateHaskell`.
9− * Deprecation: Deprecate static asset modules generated via 'obelisk-asset-manifest-generate' in favor of modules generated via 'obelisk-asset-th-generate'. The new executable takes the same arguments as the old and should be a drop-in replacement.
9+ * Deprecation: Deprecate static asset modules generated via 'obelisk-asset-manifest-generate' in favor of modules generated via 'obelisk-asset-th-generate'. The new executable takes the same arguments as the old and should be a drop-in replacement. To preserve the old behavior, set `__deprecated.useObeliskAssetManifestGenerate = true;` in your obelisk project configuration.
10 * Feature: Files added to the static directory while `ob run` is active no longer require `ob run` to be restarted
10 * Feature: Files added to the static directory while `ob run` is active no longer require `ob run` to be restarted
11
11
12## v0.9.1.0
12## v0.9.1.0
default.nix+10−4
@@ -65,7 +65,7 @@ in rec {
65 '';
65 '';
66 nullIfAbsent = p: if lib.pathExists p then p else null;
66 nullIfAbsent = p: if lib.pathExists p then p else null;
67 #TODO: Avoid copying files within the nix store. Right now, obelisk-asset-manifest-generate copies files into a big blob so that the android/ios static assets can be imported from there; instead, we should get everything lined up right before turning it into an APK, so that copies, if necessary, only exist temporarily.
67 #TODO: Avoid copying files within the nix store. Right now, obelisk-asset-manifest-generate copies files into a big blob so that the android/ios static assets can be imported from there; instead, we should get everything lined up right before turning it into an APK, so that copies, if necessary, only exist temporarily.
68− processAssets = { src, packageName ? "obelisk-generated-static", moduleName ? "Obelisk.Generated.Static" }: pkgs.runCommand "asset-manifest" {
68+ processAssets = { src, packageName ? "obelisk-generated-static", moduleName ? "Obelisk.Generated.Static", exe ? "obelisk-asset-th-generate" }: pkgs.runCommand "asset-manifest" {
69 inherit src;
69 inherit src;
70 outputs = [ "out" "haskellManifest" "symlinked" ];
70 outputs = [ "out" "haskellManifest" "symlinked" ];
71 nativeBuildInputs = [ ghcObelisk.obelisk-asset-manifest ];
71 nativeBuildInputs = [ ghcObelisk.obelisk-asset-manifest ];
@@ -73,7 +73,7 @@ in rec {
73 set -euo pipefail
73 set -euo pipefail
74 touch "$out"
74 touch "$out"
75 mkdir -p "$symlinked"
75 mkdir -p "$symlinked"
76− obelisk-asset-th-generate "$src" "$haskellManifest" ${packageName} ${moduleName} "$symlinked"
76+ ${exe} "$src" "$haskellManifest" ${packageName} ${moduleName} "$symlinked"
77 '';
77 '';
78
78
79 compressedJs = frontend: optimizationLevel: pkgs.runCommand "compressedJs" {} ''
79 compressedJs = frontend: optimizationLevel: pkgs.runCommand "compressedJs" {} ''
@@ -237,13 +237,14 @@ in rec {
237 , withHoogle ? false # Setting this to `true` makes shell reloading far slower
237 , withHoogle ? false # Setting this to `true` makes shell reloading far slower
238 , __closureCompilerOptimizationLevel ? "ADVANCED" # Set this to `null` to skip the closure-compiler step
238 , __closureCompilerOptimizationLevel ? "ADVANCED" # Set this to `null` to skip the closure-compiler step
239 , __withGhcide ? false
239 , __withGhcide ? false
240+ , __deprecated ? {}
240 }:
241 }:
241 let
242 let
242 allConfig = nixpkgs.lib.makeExtensible (self: {
243 allConfig = nixpkgs.lib.makeExtensible (self: {
243 base = base';
244 base = base';
244 inherit args;
245 inherit args;
245 userSettings = {
246 userSettings = {
246− inherit android ios packages overrides tools shellToolOverrides withHoogle __closureCompilerOptimizationLevel __withGhcide;
247+ inherit android ios packages overrides tools shellToolOverrides withHoogle __closureCompilerOptimizationLevel __withGhcide __deprecated;
247 staticFiles = if staticFiles == null then self.base + /static else staticFiles;
248 staticFiles = if staticFiles == null then self.base + /static else staticFiles;
248 };
249 };
249 frontendName = "frontend";
250 frontendName = "frontend";
@@ -251,7 +252,12 @@ in rec {
251 commonName = "common";
252 commonName = "common";
252 staticName = "obelisk-generated-static";
253 staticName = "obelisk-generated-static";
253 staticFilesImpure = let fs = self.userSettings.staticFiles; in if lib.isDerivation fs then fs else toString fs;
254 staticFilesImpure = let fs = self.userSettings.staticFiles; in if lib.isDerivation fs then fs else toString fs;
255+ processedStatic = processAssets {
254− processedStatic = processAssets { src = self.userSettings.staticFiles; };
256+ src = self.userSettings.staticFiles;
257+ exe = if lib.attrByPath ["userSettings" "__deprecated" "useObeliskAssetManifestGenerate"] false self
258+ then builtins.trace "obelisk-asset-manifest-generate is deprecated. Use obelisk-asset-th-generate instead." "obelisk-asset-manifest-generate"
259+ else "obelisk-asset-th-generate";
260+ };
255 # The packages whose names and roles are defined by this package
261 # The packages whose names and roles are defined by this package
256 predefinedPackages = lib.filterAttrs (_: x: x != null) {
262 predefinedPackages = lib.filterAttrs (_: x: x != null) {
257 ${self.frontendName} = nullIfAbsent (self.base + "/frontend");
263 ${self.frontendName} = nullIfAbsent (self.base + "/frontend");