asset-bundle 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+25/−16 lines, 2 filesdep ~CabalPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: Cabal
API changes (from Hackage documentation)
- Distribution.Simple.AssetBundle: postCopy :: Maybe (Executable -> String) -> [InstalledPackageInfo] -> Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO ()
+ Distribution.Simple.AssetBundle: postCopy :: Maybe (Executable -> String) -> [FilePath] -> [InstalledPackageInfo] -> Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO ()
Files
- asset-bundle.cabal +10/−10
- src/Distribution/Simple/AssetBundle.hs +15/−6
asset-bundle.cabal view
@@ -1,11 +1,13 @@--- This file has been generated from package.yaml by hpack version 0.20.0.+cabal-version: 1.12 ++-- This file has been generated from package.yaml by hpack version 0.31.0. -- -- see: https://github.com/sol/hpack ----- hash: 27d9faf3397d71854825e5086a6411921f86576fa9cce6fd3b8f6cb0c22fd5d9+-- hash: 427350334aa1a977dbaef751fcc98377254bbeed9134e8797360c95753071360 name: asset-bundle-version: 0.1.0.0+version: 0.1.0.1 synopsis: A build-time Cabal library that bundles executables with assets description: Please see the Hackage documentation at <http://hackage.haskell.org/package/asset-bundle/docs/Distribution-Simple-AssetBundle.html> category: distribution, bundle, zip, library, program@@ -17,8 +19,6 @@ license: BSD3 license-file: LICENSE build-type: Simple-cabal-version: >= 1.10- extra-source-files: README.org @@ -27,15 +27,15 @@ location: https://github.com/deech/asset-bundle library+ exposed-modules:+ Distribution.Simple.AssetBundle+ other-modules:+ Paths_asset_bundle hs-source-dirs: src build-depends:- Cabal >=1.24.0.0+ Cabal >=1.22.0.0 , base >=4.7 && <5 , directory >=1.2.4.0 , filepath- exposed-modules:- Distribution.Simple.AssetBundle- other-modules:- Paths_asset_bundle default-language: Haskell2010
src/Distribution/Simple/AssetBundle.hs view
@@ -43,7 +43,7 @@ import Distribution.Simple.Program(Program, simpleProgram, runProgram, defaultProgramDb) import Distribution.Simple.Program.Db(requireProgram) import Distribution.Simple.Setup(CopyFlags, fromFlag, copyDest)-import Distribution.Simple.Utils (withTempDirectory, copyDirectoryRecursiveVerbose, createDirectoryIfMissingVerbose, installExecutableFile, copyFileVerbose, normaliseLineEndings)+import Distribution.Simple.Utils (withTempDirectory, copyDirectoryRecursiveVerbose, createDirectoryIfMissingVerbose, installExecutableFile, copyFileVerbose, normaliseLineEndings, rawSystemExit) import Distribution.Text(display) import Distribution.Verbosity(normal, Verbosity) import System.Directory (getTemporaryDirectory, doesDirectoryExist, withCurrentDirectory, setOwnerExecutable, setPermissions, executable, getPermissions)@@ -219,12 +219,17 @@ The zip is named /\<executable-name\>_bundled.zip/ and it's copied to <https://www.stackage.org/haddock/lts-11.4/Cabal-2.0.1.1/Distribution-Simple-InstallDirs.html#v:bindir the Cabal-local bin directory>. - It takes a list of 'InstalledPackageInfo' , which can be generated using 'depsWithData', containing this project's dependencies so it can gather- up the resources and @Maybe (Executable -> String)@ which allows you to add arbitrary content to the launch script before an executable is run;- more on that below in the 'Adding Custom Code', in the 'Launch Scripts'section below. Most of the time you'll probably want to pass in 'Nothing'.+ It takes a list of 'InstalledPackageInfo' , which can be generated using+ 'depsWithData', containing this project's dependencies so it can gather up the+ resources, a list of extra files (no directories!) ['FilePath'] you may want+ to include that are just copied to the root of zip archive, and @Maybe+ (Executable -> String)@ which allows you to add arbitrary content to the+ launch script before an executable is run and; more on that below in the+ 'Adding Custom Code', in the 'Launch Scripts'section below. Most of the time+ you'll probably want to pass in 'Nothing'. -}-postCopy:: Maybe (Executable -> String) -> [InstalledPackageInfo] -> Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO ()-postCopy preRun deps args copyFlags pd localBuildInfo =+postCopy:: Maybe (Executable -> String) -> [FilePath] -> [InstalledPackageInfo] -> Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO ()+postCopy preRun extraFiles deps args copyFlags pd localBuildInfo = let installDirs = absoluteInstallDirs pd localBuildInfo (fromFlag (copyDest copyFlags)) binPref = bindir installDirs prefixOrSuffix componentLocalBuildInfo pathTemplate =@@ -262,6 +267,10 @@ in do createDirectoryIfMissingVerbose normal False zipDir mapM_ (\dep -> copyDirectoryRecursiveVerbose normal (takeDirectory (InstalledPackageInfo.dataDir dep)) zipDir) deps+ case buildOS of+ -- Windows has issues with copy file permissions+ Windows -> mapM_ (\f -> rawSystemExit normal "cp" [f, zipDir]) extraFiles+ _ -> mapM_ (\f -> copyFileVerbose normal f zipDir) extraFiles case buildOS of Windows -> installRunner "bat" bat _ -> installRunner "sh" sh