From 8088710a7a314c6caea43a8b7696e4434c40fbe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Thu, 15 Aug 2024 12:58:40 +0900 Subject: [PATCH] Do not recompute checksums before release if already computed --- mix.exs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mix.exs b/mix.exs index 7bd7503..678d846 100644 --- a/mix.exs +++ b/mix.exs @@ -24,12 +24,22 @@ defmodule XLA.MixProject do def aliases do [ - # When compiling the checksum task, code paths are pruned, so we - # explicitly load hex back - "hex.publish": ["xla.checksum", fn _ -> Mix.ensure_application!(:hex) end, "hex.publish"] + "hex.publish": [&ensure_checksum_file/1, "hex.publish"] ] end + defp ensure_checksum_file(_) do + valid? = + case File.read("checksum.txt") do + {:ok, content} -> content =~ @version + {:error, :enoent} -> false + end + + if not valid? do + raise "run mix xla.checksum before releasing" + end + end + defp deps do [ {:elixir_make, "~> 0.4", runtime: false},