Skip to content

Commit

Permalink
Use native JSON in Elixir
Browse files Browse the repository at this point in the history
This also lets us support `depth` for git repositories.
  • Loading branch information
TylerWitt committed Jan 14, 2025
1 parent c4fa116 commit 92e3547
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 18 deletions.
8 changes: 4 additions & 4 deletions hex/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ RUN apt-get update \
# * https://github.com/dependabot/dependabot-core/pull/7865
# * https://erlangforums.com/t/erlang-solutions-apt-package-for-otp-25/1552/1
# * https://erlangforums.com/t/the-eef-is-looking-for-volunteers-to-take-over-esls-build-packages/2238/1
ARG ERLANG_MAJOR_VERSION=24
ARG ERLANG_MAJOR_VERSION=27
ARG ERLANG_VERSION=1:${ERLANG_MAJOR_VERSION}.2.1+dfsg-1ubuntu0.1
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
erlang=${ERLANG_VERSION}

# Install Elixir
# https://github.com/elixir-lang/elixir/releases
ARG ELIXIR_VERSION=v1.14.4
ARG ELIXIR_CHECKSUM=b5705275d62ce3dae172d25d7ea567fffdabb45458abeb29c0189923b907367c
ARG ELIXIR_VERSION=v1.18.1
ARG ELIXIR_CHECKSUM=558113a9c03e891616982e802d76ebb75ff53a372aee8260a8e0ba746800d0ff
RUN curl -sSLfO https://github.com/elixir-lang/elixir/releases/download/${ELIXIR_VERSION}/elixir-otp-${ERLANG_MAJOR_VERSION}.zip \
&& echo "$ELIXIR_CHECKSUM elixir-otp-${ERLANG_MAJOR_VERSION}.zip" | sha256sum -c - \
&& unzip -d /usr/local/elixir -x elixir-otp-${ERLANG_MAJOR_VERSION}.zip \
Expand All @@ -32,7 +32,7 @@ USER dependabot
COPY --chown=dependabot:dependabot hex/helpers /opt/hex/helpers
ENV MIX_HOME="/opt/hex/mix"
# https://github.com/hexpm/hex/releases
ENV HEX_VERSION="2.0.6"
ENV HEX_VERSION="2.1.1"
RUN bash /opt/hex/helpers/build

COPY --chown=dependabot:dependabot hex $DEPENDABOT_HOME/hex
Expand Down
4 changes: 0 additions & 4 deletions hex/helpers/build
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,3 @@ esac

cp $CP_OPTS "$helpers_dir/lib" "$install_dir"
cp $CP_OPTS "$helpers_dir/mix.exs" "$install_dir"
cp $CP_OPTS "$helpers_dir/mix.lock" "$install_dir"

cd "$install_dir"
mix deps.get
4 changes: 2 additions & 2 deletions hex/helpers/lib/run.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule DependencyHelper do
def main() do
IO.read(:stdio, :all)
|> Jason.decode!()
|> JSON.decode!()
|> run()
|> case do
{output, 0} ->
Expand Down Expand Up @@ -33,7 +33,7 @@ defmodule DependencyHelper do

defp encode_and_write(content) do
content
|> Jason.encode!()
|> JSON.encode!
|> IO.write()
end

Expand Down
6 changes: 1 addition & 5 deletions hex/helpers/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule DependabotCore.Mixfile do
def project do
[app: :dependabot_core,
version: "0.1.0",
elixir: "~> 1.5",
elixir: "~> 1.18",
start_permanent: Mix.env == :prod,
lockfile: System.get_env("MIX_LOCK") || "mix.lock",
deps_path: System.get_env("MIX_DEPS") || "deps",
Expand All @@ -14,8 +14,4 @@ defmodule DependabotCore.Mixfile do
def application do
[extra_applications: [:logger]]
end

defp deps() do
[{:jason, "~> 1.0"}]
end
end
3 changes: 0 additions & 3 deletions hex/helpers/mix.lock

This file was deleted.

0 comments on commit 92e3547

Please sign in to comment.