on master help sign in
add publish check to verify that downloaded code builds as well
59245ebEvan Czaplicki
builder/src/Reporting/Exit.hs+5
@@ -285,6 +285,11 @@ data Publish
285 | PublishMissingTag V.Version
285 | PublishMissingTag V.Version
286 | PublishNoGit
286 | PublishNoGit
287 | PublishLocalChanges V.Version
287 | PublishLocalChanges V.Version
288+ --
289+ | PublishZipBadDetails Details
290+ | PublishZipApplication
291+ | PublishZipNoExposed
292+ | PublishZipBuildProblem BuildProblem
288
293
289
294
290publishToReport :: Publish -> Help.Report
295publishToReport :: Publish -> Help.Report
terminal/src/Publish.hs+23−4
@@ -260,11 +260,16 @@ verifyZip (Env root _ manager _ _) pkg vsn =
260
260
261 reportZipBuildCheck $
261 reportZipBuildCheck $
262 Dir.withCurrentDirectory prepublishDir $
262 Dir.withCurrentDirectory prepublishDir $
263− error "TODO Build.generateDocs"
263+ verifyZipBuild prepublishDir
264
264
265 return sha
265 return sha
266
266
267
267
268+toZipUrl :: Pkg.Name -> V.Version -> String
269+toZipUrl pkg vsn =
270+ "https://github.com/" ++ Pkg.toUrl pkg ++ "/zipball/" ++ V.toChars vsn ++ "/"
271+
272+
268withTempDir :: FilePath -> (FilePath -> Task.Task x a) -> Task.Task x a
273withTempDir :: FilePath -> (FilePath -> Task.Task x a) -> Task.Task x a
269withTempDir root callback =
274withTempDir root callback =
270 let
275 let
@@ -277,9 +282,23 @@ withTempDir root callback =
277 (Task.run (callback dir))
282 (Task.run (callback dir))
278
283
279
284
280−toZipUrl :: Pkg.Name -> V.Version -> String
285+verifyZipBuild :: FilePath -> IO (Either Exit.Publish ())
281−toZipUrl pkg vsn =
286+verifyZipBuild root =
282− "https://github.com/" ++ Pkg.toUrl pkg ++ "/zipball/" ++ V.toChars vsn ++ "/"
287+ Task.run $
288+ do details@(Details.Details _ outline _ _ _) <-
289+ Task.eio Exit.PublishZipBadDetails $
290+ Details.load Reporting.silent root
291+
292+ exposed <-
293+ case outline of
294+ Details.ValidApp _ -> Task.throw Exit.PublishZipApplication
295+ Details.ValidPkg _ [] -> Task.throw Exit.PublishZipNoExposed
296+ Details.ValidPkg _ (e:es) -> return (NE.List e es)
297+
298+ _ <- Task.eio Exit.PublishZipBuildProblem $
299+ Build.fromExposed Reporting.silent root details Build.KeepDocs exposed
300+
301+ return ()
283
302
284
303
285
304