diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index 629ce704..b36064a8 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -47,10 +47,10 @@ jobs: uses: actions/cache@v3 with: path: | - deps - _build + apps/**/deps + apps/**/_build - key: ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-${{ hashFiles('**/mix.lock') }} + key: ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-${{ hashFiles('apps/**/mix.lock') }} restore-keys: | ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}- @@ -58,29 +58,27 @@ jobs: # the cached version. - name: Install and compile dependencies run: | - mix deps.get - mix deps.compile --skip-umbrella-children + make deps.poncho + make deps.compile.poncho - name: Compile and don't let warnings through - run: mix compile --warnings-as-errors + run: make compile.poncho # Step: Check that the checked in code has already been formatted. # This step fails if something was found unformatted. # Customize this step as desired. - name: Check Formatting - run: mix format --check-formatted + run: MIX_ENV=dev mix format --check-formatted # Step: Run credo static code analysis - name: Credo static analysis - run: mix credo + run: make credo.check.poncho dialyzer: runs-on: ubuntu-latest name: Run Dialyzer env: - project_mix_lock: ${{ format('{0}{1}', github.workspace, '/mix.lock') }} - projects_ex_blob: ${{ format('{0}{1}', github.workspace, '/projects/**/*.ex') }} - projects_locks_blob: ${{ format('{0}{1}', github.workspace, '/projects/*/mix.lock') }} + apps_mix_lock: ${{ format('{0}{1}', github.workspace, 'apps/**/mix.lock') }} MIX_ENV: dev steps: # Step: Setup Elixir + Erlang image as the base. @@ -95,13 +93,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set Variables - id: set_mix_lock_hash - run: | - mix_lock_hash="${{ hashFiles(env.project_mix_lock) }}" - projects_hash="${{ hashFiles(env.projects_ex_blob, env.projects_locks_blob) }}" - echo "mix_lock_hash=$mix_lock_hash::$projects_hash" >> "$GITHUB_OUTPUT" - # Step: Define how to cache deps. Restores existing cache if present. - name: Cache deps id: cache-deps @@ -110,10 +101,10 @@ jobs: cache-name: cache-elixir-deps-1 with: path: | - deps - _build + apps/**/deps + apps/**/_build - key: ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-${{ hashFiles('**/mix.lock') }} + key: ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-${{ hashFiles('apps/**/mix.lock') }} restore-keys: | ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}- @@ -123,7 +114,10 @@ jobs: uses: actions/cache@v3 with: path: "priv/plts" - key: lexical-plts-2-${{ env.DEFAULT_OTP }}-${{ env.DEFAULT_ELIXIR }}-${{ steps.set_mix_lock_hash.outputs.mix_lock_hash }} + key: lexical-plts-2-${{ env.DEFAULT_OTP }}-${{ env.DEFAULT_ELIXIR }}-${{ hashFiles('apps/**/mix.lock' ) }}-${{ github.run_id }} + restore-keys: | + lexical-plts-2-${{ env.DEFAULT_OTP }}-${{ env.DEFAULT_ELIXIR }}-${{ hashFiles('apps/**/mix.lock') }}- + lexical-plts-2-${{ env.DEFAULT_OTP }}-${{ env.DEFAULT_ELIXIR }}- # Step: Download project dependencies. If unchanged, uses # the cached version. @@ -194,17 +188,17 @@ jobs: uses: actions/cache@v3 with: path: | - deps - _build + apps/**/deps + apps/**/_build - key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }} + key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('apps/**/mix.lock') }} restore-keys: | ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}- # Step: Download project dependencies. If unchanged, uses # the cached version. - name: Install and compile the app - run: make compile.all + run: make compile.poncho # Step: Execute the tests. - name: Run tests diff --git a/Makefile b/Makefile index 87e7393c..1af0403e 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,41 @@ -dialyzer_dirs = lexical_shared lexical_plugin +poncho_dirs = common lexical_credo proto protocol remote_control server -compile.all: compile.umbrella +dialyzer_dirs= lexical_shared lexical_plugin -dialyzer.all: compile.all dialyzer.umbrella +compile.all: compile.poncho -test.all: test.umbrella +dialyzer.all: compile.poncho dialyzer.poncho -dialyzer.plt.all: dialyzer.plt.umbrella +test.all: test.poncho -dialyzer.umbrella: - mix dialyzer +dialyzer.plt.all: dialyzer.plt.poncho -dialyzer.plt.umbrella: - mix dialyzer --plt +env.test: + export MIX_ENV=test -test.umbrella: - mix test +deps.poncho: + $(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix deps.get && cd ../..;) -compile.umbrella: - mix deps.get - mix compile --skip-umbrella-children --warnings-as-errors +deps.compile.poncho: deps.poncho + $(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix deps.compile && cd ../..;) +compile.poncho: deps.poncho + $(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix deps.get && mix compile --warnings-as-errors && cd ../..;) +compile.protocols.poncho: deps.poncho + $(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix deps.get && mix compile.protocols --warnings-as-errors && cd ../..;) + +test.poncho: deps.poncho + $(foreach dir, $(poncho_dirs), cd apps/$(dir) && MIX_ENV=test mix test && cd ../..;) + +format.check.poncho: env.test deps.poncho + $(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix format --check-formatted && cd ../..;) + +credo.check.poncho: deps.poncho + $(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix credo && cd ../..;) + +dialyzer.plt.poncho: + $(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix dialyzer --plt && cd ../..;) + +dialyzer.poncho: compile.poncho compile.protocols.poncho + $(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix dialyzer && cd ../..;) diff --git a/apps/common/.credo.exs b/apps/common/.credo.exs new file mode 100644 index 00000000..b65c86be --- /dev/null +++ b/apps/common/.credo.exs @@ -0,0 +1,3 @@ +Code.require_file("../../mix_credo.exs") + +Mix.Credo.config(excluded: ["lib/future/**/*.ex"]) diff --git a/apps/remote_control/benchmarks/snowflake_bench.exs b/apps/common/benchmarks/snowflake_bench.exs similarity index 100% rename from apps/remote_control/benchmarks/snowflake_bench.exs rename to apps/common/benchmarks/snowflake_bench.exs diff --git a/config/config.exs b/apps/common/config/config.exs similarity index 74% rename from config/config.exs rename to apps/common/config/config.exs index 51f54f36..eece3a80 100644 --- a/config/config.exs +++ b/apps/common/config/config.exs @@ -4,5 +4,3 @@ config :snowflake, machine_id: 1, # First second of 2024 epoch: 1_704_070_800_000 - -import_config("#{Mix.env()}.exs") diff --git a/apps/common/mix.exs b/apps/common/mix.exs index 03d141a6..c33d3029 100644 --- a/apps/common/mix.exs +++ b/apps/common/mix.exs @@ -1,19 +1,17 @@ defmodule Common.MixProject do use Mix.Project + Code.require_file("../../mix_includes.exs") def project do [ app: :common, version: "0.7.2", - build_path: "../../_build", - config_path: "../../config/config.exs", - deps_path: "../../deps", - lockfile: "../../mix.lock", elixir: "~> 1.13", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), - compilers: [:yecc] ++ Mix.compilers() + compilers: [:yecc] ++ Mix.compilers(), + dialyzer: Mix.Dialyzer.config() ] end @@ -33,6 +31,9 @@ defmodule Common.MixProject do defp deps do [ + {:benchee, "~> 1.3", only: :test}, + Mix.Credo.dependency(), + Mix.Dialyzer.dependency(), {:snowflake, "~> 1.0"}, {:sourceror, "~> 1.7"}, {:stream_data, "~> 1.1", only: [:test], runtime: false}, diff --git a/apps/common/mix.lock b/apps/common/mix.lock new file mode 100644 index 00000000..0c7c66c9 --- /dev/null +++ b/apps/common/mix.lock @@ -0,0 +1,15 @@ +%{ + "benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"}, + "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, + "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, + "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, + "file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "patch": {:hex, :patch, "0.15.0", "947dd6a8b24a2d2d1137721f20bb96a8feb4f83248e7b4ad88b4871d52807af5", [:mix], [], "hexpm", "e8dadf9b57b30e92f6b2b1ce2f7f57700d14c66d4ed56ee27777eb73fb77e58d"}, + "snowflake": {:hex, :snowflake, "1.0.4", "8433b4e04fbed19272c55e1b7de0f7a1ee1230b3ae31a813b616fd6ef279e87a", [:mix], [], "hexpm", "badb07ebb089a5cff737738297513db3962760b10fe2b158ae3bebf0b4d5be13"}, + "sourceror": {:hex, :sourceror, "1.7.1", "599d78f4cc2be7d55c9c4fd0a8d772fd0478e3a50e726697c20d13d02aa056d4", [:mix], [], "hexpm", "cd6f268fe29fa00afbc535e215158680a0662b357dc784646d7dff28ac65a0fc"}, + "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, + "stream_data": {:hex, :stream_data, "1.1.3", "15fdb14c64e84437901258bb56fc7d80aaf6ceaf85b9324f359e219241353bfb", [:mix], [], "hexpm", "859eb2be72d74be26c1c4f272905667672a52e44f743839c57c7ee73a1a66420"}, +} diff --git a/apps/lexical_credo/.credo.exs b/apps/lexical_credo/.credo.exs new file mode 100644 index 00000000..0e9ed7f4 --- /dev/null +++ b/apps/lexical_credo/.credo.exs @@ -0,0 +1,3 @@ +Code.require_file("../../mix_credo.exs") + +Mix.Credo.config() diff --git a/apps/lexical_credo/mix.exs b/apps/lexical_credo/mix.exs index 8fa1917c..b7f1be29 100644 --- a/apps/lexical_credo/mix.exs +++ b/apps/lexical_credo/mix.exs @@ -1,6 +1,6 @@ defmodule LexicalCredo.MixProject do use Mix.Project - + Code.require_file("../../mix_dialyzer.exs") @repo_url "https://github.com/lexical-lsp/lexical/" @version "0.5.0" @@ -8,14 +8,11 @@ defmodule LexicalCredo.MixProject do [ app: :lexical_credo, version: @version, - build_path: "../../_build", - config_path: "../../config/config.exs", - deps_path: "../../deps", - lockfile: "../../mix.lock", elixir: "~> 1.13", start_permanent: Mix.env() == :prod, deps: deps(), - docs: docs() + docs: docs(), + dialyzer: Mix.Dialyzer.config(add_apps: [:jason]) ] end @@ -30,8 +27,9 @@ defmodule LexicalCredo.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:common, in_umbrella: true}, + {:common, path: "../common", env: Mix.env()}, {:credo, "> 0.0.0", only: [:dev, :test]}, + Mix.Dialyzer.dependency(), {:jason, "> 0.0.0", optional: true}, {:ex_doc, "~> 0.34", optional: true, only: [:dev, :hex]} ] diff --git a/apps/lexical_credo/mix.lock b/apps/lexical_credo/mix.lock new file mode 100644 index 00000000..a107b724 --- /dev/null +++ b/apps/lexical_credo/mix.lock @@ -0,0 +1,20 @@ +%{ + "benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"}, + "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, + "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.43", "34b2f401fe473080e39ff2b90feb8ddfeef7639f8ee0bbf71bb41911831d77c5", [:mix], [], "hexpm", "970a3cd19503f5e8e527a190662be2cee5d98eed1ff72ed9b3d1a3d466692de8"}, + "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, + "ex_doc": {:hex, :ex_doc, "0.37.2", "2a3aa7014094f0e4e286a82aa5194a34dd17057160988b8509b15aa6c292720c", [:mix], [{:earmark_parser, "~> 1.4.42", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "4dfa56075ce4887e4e8b1dcc121cd5fcb0f02b00391fd367ff5336d98fa49049"}, + "file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"}, + "makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"}, + "makeup_erlang": {:hex, :makeup_erlang, "1.0.2", "03e1804074b3aa64d5fad7aa64601ed0fb395337b982d9bcf04029d68d51b6a7", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "af33ff7ef368d5893e4a267933e7744e46ce3cf1f61e2dccf53a111ed3aa3727"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"}, + "snowflake": {:hex, :snowflake, "1.0.4", "8433b4e04fbed19272c55e1b7de0f7a1ee1230b3ae31a813b616fd6ef279e87a", [:mix], [], "hexpm", "badb07ebb089a5cff737738297513db3962760b10fe2b158ae3bebf0b4d5be13"}, + "sourceror": {:hex, :sourceror, "1.7.1", "599d78f4cc2be7d55c9c4fd0a8d772fd0478e3a50e726697c20d13d02aa056d4", [:mix], [], "hexpm", "cd6f268fe29fa00afbc535e215158680a0662b357dc784646d7dff28ac65a0fc"}, + "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, + "stream_data": {:hex, :stream_data, "1.1.3", "15fdb14c64e84437901258bb56fc7d80aaf6ceaf85b9324f359e219241353bfb", [:mix], [], "hexpm", "859eb2be72d74be26c1c4f272905667672a52e44f743839c57c7ee73a1a66420"}, +} diff --git a/apps/proto/.credo.exs b/apps/proto/.credo.exs new file mode 100644 index 00000000..0e9ed7f4 --- /dev/null +++ b/apps/proto/.credo.exs @@ -0,0 +1,3 @@ +Code.require_file("../../mix_credo.exs") + +Mix.Credo.config() diff --git a/apps/proto/mix.exs b/apps/proto/mix.exs index cc745fa1..adfb5f8e 100644 --- a/apps/proto/mix.exs +++ b/apps/proto/mix.exs @@ -1,17 +1,15 @@ defmodule Proto.MixProject do use Mix.Project + Code.require_file("../../mix_includes.exs") def project do [ app: :proto, version: "0.7.2", - build_path: "../../_build", - config_path: "../../config/config.exs", - deps_path: "../../deps", - lockfile: "../../mix.lock", elixir: "~> 1.13", start_permanent: Mix.env() == :prod, - deps: deps() + deps: deps(), + dialyzer: Mix.Dialyzer.config(add_apps: [:jason]) ] end @@ -25,8 +23,10 @@ defmodule Proto.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:jason, "~> 1.4", optional: true}, - {:common, in_umbrella: true} + {:common, path: "../common", env: Mix.env()}, + Mix.Credo.dependency(), + Mix.Dialyzer.dependency(), + {:jason, "~> 1.4", optional: true} ] end end diff --git a/apps/proto/mix.lock b/apps/proto/mix.lock new file mode 100644 index 00000000..89b115bc --- /dev/null +++ b/apps/proto/mix.lock @@ -0,0 +1,14 @@ +%{ + "benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"}, + "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, + "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, + "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, + "file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "snowflake": {:hex, :snowflake, "1.0.4", "8433b4e04fbed19272c55e1b7de0f7a1ee1230b3ae31a813b616fd6ef279e87a", [:mix], [], "hexpm", "badb07ebb089a5cff737738297513db3962760b10fe2b158ae3bebf0b4d5be13"}, + "sourceror": {:hex, :sourceror, "1.7.1", "599d78f4cc2be7d55c9c4fd0a8d772fd0478e3a50e726697c20d13d02aa056d4", [:mix], [], "hexpm", "cd6f268fe29fa00afbc535e215158680a0662b357dc784646d7dff28ac65a0fc"}, + "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, + "stream_data": {:hex, :stream_data, "1.1.3", "15fdb14c64e84437901258bb56fc7d80aaf6ceaf85b9324f359e219241353bfb", [:mix], [], "hexpm", "859eb2be72d74be26c1c4f272905667672a52e44f743839c57c7ee73a1a66420"}, +} diff --git a/apps/protocol/.credo.exs b/apps/protocol/.credo.exs new file mode 100644 index 00000000..0e9ed7f4 --- /dev/null +++ b/apps/protocol/.credo.exs @@ -0,0 +1,3 @@ +Code.require_file("../../mix_credo.exs") + +Mix.Credo.config() diff --git a/apps/protocol/mix.exs b/apps/protocol/mix.exs index d2e2c401..fa5c1bd1 100644 --- a/apps/protocol/mix.exs +++ b/apps/protocol/mix.exs @@ -1,17 +1,16 @@ defmodule Lexical.Protocol.MixProject do use Mix.Project + Code.require_file("../../mix_includes.exs") def project do [ app: :protocol, + env: Mix.env(), version: "0.7.2", - build_path: "../../_build", - config_path: "../../config/config.exs", - deps_path: "../../deps", - lockfile: "../../mix.lock", elixir: "~> 1.13", start_permanent: Mix.env() == :prod, deps: deps(), + dialyzer: Mix.Dialyzer.config(add_apps: [:jason]), consolidate_protocols: Mix.env() != :test, elixirc_paths: elixirc_paths(Mix.env()) ] @@ -30,10 +29,12 @@ defmodule Lexical.Protocol.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:common, in_umbrella: true}, + {:common, path: "../common", env: Mix.env()}, + Mix.Credo.dependency(), + Mix.Dialyzer.dependency(), {:jason, "~> 1.4", optional: true}, {:patch, "~> 0.15", only: [:test]}, - {:proto, in_umbrella: true} + {:proto, path: "../proto", env: Mix.env()} ] end end diff --git a/apps/protocol/mix.lock b/apps/protocol/mix.lock new file mode 100644 index 00000000..0c7c66c9 --- /dev/null +++ b/apps/protocol/mix.lock @@ -0,0 +1,15 @@ +%{ + "benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"}, + "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, + "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, + "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, + "file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "patch": {:hex, :patch, "0.15.0", "947dd6a8b24a2d2d1137721f20bb96a8feb4f83248e7b4ad88b4871d52807af5", [:mix], [], "hexpm", "e8dadf9b57b30e92f6b2b1ce2f7f57700d14c66d4ed56ee27777eb73fb77e58d"}, + "snowflake": {:hex, :snowflake, "1.0.4", "8433b4e04fbed19272c55e1b7de0f7a1ee1230b3ae31a813b616fd6ef279e87a", [:mix], [], "hexpm", "badb07ebb089a5cff737738297513db3962760b10fe2b158ae3bebf0b4d5be13"}, + "sourceror": {:hex, :sourceror, "1.7.1", "599d78f4cc2be7d55c9c4fd0a8d772fd0478e3a50e726697c20d13d02aa056d4", [:mix], [], "hexpm", "cd6f268fe29fa00afbc535e215158680a0662b357dc784646d7dff28ac65a0fc"}, + "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, + "stream_data": {:hex, :stream_data, "1.1.3", "15fdb14c64e84437901258bb56fc7d80aaf6ceaf85b9324f359e219241353bfb", [:mix], [], "hexpm", "859eb2be72d74be26c1c4f272905667672a52e44f743839c57c7ee73a1a66420"}, +} diff --git a/apps/remote_control/.credo.exs b/apps/remote_control/.credo.exs new file mode 100644 index 00000000..fc32fd65 --- /dev/null +++ b/apps/remote_control/.credo.exs @@ -0,0 +1,3 @@ +Code.require_file("../../mix_credo.exs") + +Mix.Credo.config(excluded: ["test/fixtures/**/*.ex"]) diff --git a/apps/remote_control/config/config.exs b/apps/remote_control/config/config.exs new file mode 100644 index 00000000..e4846f90 --- /dev/null +++ b/apps/remote_control/config/config.exs @@ -0,0 +1,2 @@ +import Config +import_config("#{config_env()}.exs") diff --git a/apps/remote_control/config/dev.exs b/apps/remote_control/config/dev.exs new file mode 100644 index 00000000..e69de29b diff --git a/apps/remote_control/config/prod.exs b/apps/remote_control/config/prod.exs new file mode 100644 index 00000000..e69de29b diff --git a/config/test.exs b/apps/remote_control/config/test.exs similarity index 69% rename from config/test.exs rename to apps/remote_control/config/test.exs index 8aa85ee5..0dfb9734 100644 --- a/config/test.exs +++ b/apps/remote_control/config/test.exs @@ -1,6 +1,4 @@ import Config -alias Lexical.Server.JsonRpc -alias Lexical.Test.Transport.NoOp config :logger, level: :none @@ -9,5 +7,4 @@ config :remote_control, modules_cache_expiry: {50, :millisecond}, search_store_quiescent_period_ms: 10 -config :server, transport: NoOp config :stream_data, initial_size: 50 diff --git a/apps/remote_control/lib/mix/tasks/namespace/abstract.ex b/apps/remote_control/lib/mix/tasks/namespace/abstract.ex index 6228a4ee..b6139971 100644 --- a/apps/remote_control/lib/mix/tasks/namespace/abstract.ex +++ b/apps/remote_control/lib/mix/tasks/namespace/abstract.ex @@ -58,11 +58,15 @@ defmodule Mix.Tasks.Namespace.Abstract do {:attribute, anno, type, {name, rewrite(type_rep), rewrite(clauses)}} end - defp do_rewrite({:for, target}) do + defp do_rewrite({:for, target}) when is_atom(target) do # Protocol implementation {:for, rewrite_module(target)} end + defp do_rewrite({:for, target}) do + {:for, rewrite(target)} + end + defp do_rewrite({:protocol, protocol}) do {:protocol, rewrite_module(protocol)} end diff --git a/apps/remote_control/lib/mix/tasks/namespace/transform/app_directories.ex b/apps/remote_control/lib/mix/tasks/namespace/transform/app_directories.ex index c8f844d3..0d26725a 100644 --- a/apps/remote_control/lib/mix/tasks/namespace/transform/app_directories.ex +++ b/apps/remote_control/lib/mix/tasks/namespace/transform/app_directories.ex @@ -4,11 +4,16 @@ defmodule Mix.Tasks.Namespace.Transform.AppDirectories do def apply_to_all(base_directory) do base_directory |> find_app_directories() - |> Enum.each(&apply/1) + |> Enum.each(&apply_transform(base_directory, &1)) end - def apply(app_path) do - namespaced_app_path = Namespace.Path.apply(app_path) + def apply_transform(base_dirctory, app_path) do + namespaced_relative_path = + app_path + |> Path.relative_to(base_dirctory) + |> Namespace.Path.apply() + + namespaced_app_path = Path.join(base_dirctory, namespaced_relative_path) with {:ok, _} <- File.rm_rf(namespaced_app_path) do File.rename!(app_path, namespaced_app_path) diff --git a/apps/remote_control/lib/mix/tasks/namespace/transform/beams.ex b/apps/remote_control/lib/mix/tasks/namespace/transform/beams.ex index 97362e97..0dfe6452 100644 --- a/apps/remote_control/lib/mix/tasks/namespace/transform/beams.ex +++ b/apps/remote_control/lib/mix/tasks/namespace/transform/beams.ex @@ -17,16 +17,17 @@ defmodule Mix.Tasks.Namespace.Transform.Beams do all_beams = Enum.concat(consolidated_beams, app_beams) total_files = length(all_beams) - chunk_size = ceil(total_files / System.schedulers_online()) me = self() - all_beams - |> Enum.chunk_every(chunk_size) - |> Enum.each(fn chunk -> - Task.async(fn -> - Enum.each(chunk, &apply_and_update_progress(&1, me)) - end) + spawn(fn -> + all_beams + |> Task.async_stream( + &apply_and_update_progress(&1, me), + ordered: false, + timeout: :infinity + ) + |> Stream.run() end) block_until_done(0, total_files) diff --git a/apps/remote_control/mix.exs b/apps/remote_control/mix.exs index 437d7d5f..185934e4 100644 --- a/apps/remote_control/mix.exs +++ b/apps/remote_control/mix.exs @@ -1,17 +1,15 @@ defmodule Lexical.RemoteControl.MixProject do use Mix.Project + Code.require_file("../../mix_includes.exs") def project do [ app: :remote_control, version: "0.7.2", - build_path: "../../_build", - config_path: "../../config/config.exs", - deps_path: "../../deps", - lockfile: "../../mix.lock", elixir: "~> 1.13", start_permanent: Mix.env() == :prod, deps: deps(), + dialyzer: Mix.Dialyzer.config(), elixirc_paths: elixirc_paths(Mix.env()), aliases: aliases(), preferred_cli_env: [benchmark: :test] @@ -20,7 +18,7 @@ defmodule Lexical.RemoteControl.MixProject do def application do [ - extra_applications: [:logger, :sasl, :eex], + extra_applications: [:logger, :sasl, :eex, :path_glob], mod: {Lexical.RemoteControl.Application, []} ] end @@ -43,13 +41,14 @@ defmodule Lexical.RemoteControl.MixProject do defp deps do [ {:benchee, "~> 1.3", only: :test}, - {:common, in_umbrella: true}, + {:common, path: "../common", env: Mix.env()}, + Mix.Credo.dependency(), + Mix.Dialyzer.dependency(), {:elixir_sense, github: "elixir-lsp/elixir_sense", ref: "73ce7e0d239342fb9527d7ba567203e77dbb9b25"}, {:patch, "~> 0.15", only: [:dev, :test], optional: true, runtime: false}, {:path_glob, "~> 0.2", optional: true}, {:phoenix_live_view, "~> 1.0", only: [:test], optional: true, runtime: false}, - {:snowflake, "~> 1.0"}, {:sourceror, "~> 1.7"} ] end diff --git a/apps/remote_control/mix.lock b/apps/remote_control/mix.lock new file mode 100644 index 00000000..a9dcb746 --- /dev/null +++ b/apps/remote_control/mix.lock @@ -0,0 +1,30 @@ +%{ + "benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "castore": {:hex, :castore, "1.0.11", "4bbd584741601eb658007339ea730b082cc61f3554cf2e8f39bf693a11b49073", [:mix], [], "hexpm", "e03990b4db988df56262852f20de0f659871c35154691427a5047f4967a16a62"}, + "credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"}, + "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, + "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, + "elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "73ce7e0d239342fb9527d7ba567203e77dbb9b25", [ref: "73ce7e0d239342fb9527d7ba567203e77dbb9b25"]}, + "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, + "file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "mime": {:hex, :mime, "2.0.6", "8f18486773d9b15f95f4f4f1e39b710045fa1de891fada4516559967276e4dc2", [:mix], [], "hexpm", "c9945363a6b26d747389aac3643f8e0e09d30499a138ad64fe8fd1d13d9b153e"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, + "patch": {:hex, :patch, "0.15.0", "947dd6a8b24a2d2d1137721f20bb96a8feb4f83248e7b4ad88b4871d52807af5", [:mix], [], "hexpm", "e8dadf9b57b30e92f6b2b1ce2f7f57700d14c66d4ed56ee27777eb73fb77e58d"}, + "path_glob": {:hex, :path_glob, "0.2.0", "b9e34b5045cac5ecb76ef1aa55281a52bf603bf7009002085de40958064ca312", [:mix], [{:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "be2594cb4553169a1a189f95193d910115f64f15f0d689454bb4e8cfae2e7ebc"}, + "phoenix": {:hex, :phoenix, "1.7.19", "36617efe5afbd821099a8b994ff4618a340a5bfb25531a1802c4d4c634017a57", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "ba4dc14458278773f905f8ae6c2ec743d52c3a35b6b353733f64f02dfe096cd6"}, + "phoenix_html": {:hex, :phoenix_html, "4.2.0", "83a4d351b66f472ebcce242e4ae48af1b781866f00ef0eb34c15030d4e2069ac", [:mix], [], "hexpm", "9713b3f238d07043583a94296cc4bbdceacd3b3a6c74667f4df13971e7866ec8"}, + "phoenix_live_view": {:hex, :phoenix_live_view, "1.0.4", "327491b033e79db2f887b065c5a2993228449091883d74cfa1baa12f8c98d5eb", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a9865316ddf8d78f382d63af278d20436b52d262b60239956817a61279514366"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, + "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, + "plug": {:hex, :plug, "1.16.1", "40c74619c12f82736d2214557dedec2e9762029b2438d6d175c5074c933edc9d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a13ff6b9006b03d7e33874945b2755253841b238c34071ed85b0e86057f8cddc"}, + "plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"}, + "snowflake": {:hex, :snowflake, "1.0.4", "8433b4e04fbed19272c55e1b7de0f7a1ee1230b3ae31a813b616fd6ef279e87a", [:mix], [], "hexpm", "badb07ebb089a5cff737738297513db3962760b10fe2b158ae3bebf0b4d5be13"}, + "sourceror": {:hex, :sourceror, "1.7.1", "599d78f4cc2be7d55c9c4fd0a8d772fd0478e3a50e726697c20d13d02aa056d4", [:mix], [], "hexpm", "cd6f268fe29fa00afbc535e215158680a0662b357dc784646d7dff28ac65a0fc"}, + "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, + "stream_data": {:hex, :stream_data, "1.1.3", "15fdb14c64e84437901258bb56fc7d80aaf6ceaf85b9324f359e219241353bfb", [:mix], [], "hexpm", "859eb2be72d74be26c1c4f272905667672a52e44f743839c57c7ee73a1a66420"}, + "telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"}, + "websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"}, + "websock_adapter": {:hex, :websock_adapter, "0.5.8", "3b97dc94e407e2d1fc666b2fb9acf6be81a1798a2602294aac000260a7c4a47d", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "315b9a1865552212b5f35140ad194e67ce31af45bcee443d4ecb96b5fd3f3782"}, +} diff --git a/apps/remote_control/test/lexical/remote_control/build/document/compilers/config_test.exs b/apps/remote_control/test/lexical/remote_control/build/document/compilers/config_test.exs index d42cb844..e8fb49df 100644 --- a/apps/remote_control/test/lexical/remote_control/build/document/compilers/config_test.exs +++ b/apps/remote_control/test/lexical/remote_control/build/document/compilers/config_test.exs @@ -43,7 +43,7 @@ defmodule Lexical.RemoteControl.Build.Document.Compilers.ConfigTest do end test "files in the config directory with relative paths are detected" do - assert recognizes?(document_with_path("../../config/test.exs")) + assert recognizes?(document_with_path("./config/test.exs")) end test "files outside the config directory are not detected" do diff --git a/apps/server/.credo.exs b/apps/server/.credo.exs new file mode 100644 index 00000000..0e9ed7f4 --- /dev/null +++ b/apps/server/.credo.exs @@ -0,0 +1,3 @@ +Code.require_file("../../mix_credo.exs") + +Mix.Credo.config() diff --git a/bin/activate_version_manager.sh b/apps/server/bin/activate_version_manager.sh similarity index 100% rename from bin/activate_version_manager.sh rename to apps/server/bin/activate_version_manager.sh diff --git a/bin/boot.exs b/apps/server/bin/boot.exs similarity index 100% rename from bin/boot.exs rename to apps/server/bin/boot.exs diff --git a/bin/debug_shell.sh b/apps/server/bin/debug_shell.sh similarity index 100% rename from bin/debug_shell.sh rename to apps/server/bin/debug_shell.sh diff --git a/bin/start_lexical.sh b/apps/server/bin/start_lexical.sh similarity index 100% rename from bin/start_lexical.sh rename to apps/server/bin/start_lexical.sh diff --git a/apps/server/config/config.exs b/apps/server/config/config.exs new file mode 100644 index 00000000..45a44d26 --- /dev/null +++ b/apps/server/config/config.exs @@ -0,0 +1,8 @@ +import Config + +config :snowflake, + machine_id: 1, + # First second of 2024 + epoch: 1_704_070_800_000 + +import_config("#{config_env()}.exs") diff --git a/config/dev.exs b/apps/server/config/dev.exs similarity index 100% rename from config/dev.exs rename to apps/server/config/dev.exs diff --git a/config/prod.exs b/apps/server/config/prod.exs similarity index 100% rename from config/prod.exs rename to apps/server/config/prod.exs diff --git a/apps/server/config/runtime.exs b/apps/server/config/runtime.exs new file mode 100644 index 00000000..d1683e3c --- /dev/null +++ b/apps/server/config/runtime.exs @@ -0,0 +1,22 @@ +import Config + +if Code.ensure_loaded?(LoggerFileBackend) do + log_directory = Path.join(File.cwd!(), ".lexical") + + unless File.exists?(log_directory) do + File.mkdir_p(log_directory) + end + + log_file_name = Path.join(log_directory, "lexical.log") + + config :logger, + handle_sasl_reports: true, + handle_otp_reports: true, + backends: [{LoggerFileBackend, :general_log}] + + config :logger, :general_log, + path: log_file_name, + level: :debug +else + :ok +end diff --git a/apps/server/config/test.exs b/apps/server/config/test.exs new file mode 100644 index 00000000..becde769 --- /dev/null +++ b/apps/server/config/test.exs @@ -0,0 +1 @@ +import Config diff --git a/apps/server/lib/mix/tasks/package.ex b/apps/server/lib/mix/tasks/package.ex index c9737e42..522aa723 100644 --- a/apps/server/lib/mix/tasks/package.ex +++ b/apps/server/lib/mix/tasks/package.ex @@ -97,6 +97,7 @@ defmodule Mix.Tasks.Package do copy_priv_files(package_root) copy_config(package_root) write_vm_versions(package_root) + File.rm_rf!(scratch_directory) if Keyword.get(opts, :zip, false) do @@ -230,15 +231,22 @@ defmodule Mix.Tasks.Package do end defp server_deps do - server_path = Mix.Project.deps_paths()[:server] + deps_apps = + if Mix.Project.get() == Lexical.Server.MixProject do + Mix.Project.deps_apps() + else + server_path = Mix.Project.deps_paths()[:server] + + Mix.Project.in_project(:server, server_path, fn _ -> + Mix.Project.deps_apps() + end) + end deps = - Mix.Project.in_project(:server, server_path, fn _ -> - Enum.map(Mix.Project.deps_apps(), fn app_module -> - app_module - |> Namespace.Module.apply() - |> to_string() - end) + Enum.map(deps_apps, fn app_module -> + app_module + |> Namespace.Module.apply() + |> to_string() end) server_dep = diff --git a/apps/server/mix.exs b/apps/server/mix.exs index aec37d3c..5f11c060 100644 --- a/apps/server/mix.exs +++ b/apps/server/mix.exs @@ -1,17 +1,15 @@ defmodule Lexical.Server.MixProject do use Mix.Project + Code.require_file("../../mix_includes.exs") def project do [ app: :server, version: "0.7.2", - build_path: "../../_build", - config_path: "../../config/config.exs", - deps_path: "../../deps", - lockfile: "../../mix.lock", elixir: "~> 1.13", start_permanent: Mix.env() == :prod, deps: deps(), + dialyzer: Mix.Dialyzer.config(add_apps: [:jason, :proto]), aliases: aliases(), elixirc_paths: elixirc_paths(Mix.env()) ] @@ -26,6 +24,8 @@ defmodule Lexical.Server.MixProject do def aliases do [ + compile: "compile --docs --debug-info", + docs: "docs --html", test: "test --no-start" ] end @@ -40,15 +40,17 @@ defmodule Lexical.Server.MixProject do defp deps do [ - {:common, in_umbrella: true}, + {:common, path: "../common", env: Mix.env()}, + Mix.Credo.dependency(), + Mix.Dialyzer.dependency(), {:elixir_sense, github: "elixir-lsp/elixir_sense", ref: "73ce7e0d239342fb9527d7ba567203e77dbb9b25"}, {:jason, "~> 1.4"}, {:logger_file_backend, "~> 0.0", only: [:dev, :prod]}, {:patch, "~> 0.15", runtime: false, only: [:dev, :test]}, {:path_glob, "~> 0.2"}, - {:protocol, in_umbrella: true}, - {:remote_control, in_umbrella: true, runtime: false}, + {:protocol, path: "../protocol", env: Mix.env()}, + {:remote_control, path: "../remote_control", env: Mix.env()}, {:sourceror, "~> 1.7"} ] end diff --git a/apps/server/mix.lock b/apps/server/mix.lock new file mode 100644 index 00000000..30e5507e --- /dev/null +++ b/apps/server/mix.lock @@ -0,0 +1,19 @@ +%{ + "benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"}, + "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, + "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, + "elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "73ce7e0d239342fb9527d7ba567203e77dbb9b25", [ref: "73ce7e0d239342fb9527d7ba567203e77dbb9b25"]}, + "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, + "file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "logger_file_backend": {:hex, :logger_file_backend, "0.0.14", "774bb661f1c3fed51b624d2859180c01e386eb1273dc22de4f4a155ef749a602", [:mix], [], "hexpm", "071354a18196468f3904ef09413af20971d55164267427f6257b52cfba03f9e6"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, + "patch": {:hex, :patch, "0.15.0", "947dd6a8b24a2d2d1137721f20bb96a8feb4f83248e7b4ad88b4871d52807af5", [:mix], [], "hexpm", "e8dadf9b57b30e92f6b2b1ce2f7f57700d14c66d4ed56ee27777eb73fb77e58d"}, + "path_glob": {:hex, :path_glob, "0.2.0", "b9e34b5045cac5ecb76ef1aa55281a52bf603bf7009002085de40958064ca312", [:mix], [{:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "be2594cb4553169a1a189f95193d910115f64f15f0d689454bb4e8cfae2e7ebc"}, + "snowflake": {:hex, :snowflake, "1.0.4", "8433b4e04fbed19272c55e1b7de0f7a1ee1230b3ae31a813b616fd6ef279e87a", [:mix], [], "hexpm", "badb07ebb089a5cff737738297513db3962760b10fe2b158ae3bebf0b4d5be13"}, + "sourceror": {:hex, :sourceror, "1.7.1", "599d78f4cc2be7d55c9c4fd0a8d772fd0478e3a50e726697c20d13d02aa056d4", [:mix], [], "hexpm", "cd6f268fe29fa00afbc535e215158680a0662b357dc784646d7dff28ac65a0fc"}, + "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, + "stream_data": {:hex, :stream_data, "1.1.3", "15fdb14c64e84437901258bb56fc7d80aaf6ceaf85b9324f359e219241353bfb", [:mix], [], "hexpm", "859eb2be72d74be26c1c4f272905667672a52e44f743839c57c7ee73a1a66420"}, +} diff --git a/apps/server/test/lexical/server/code_intelligence/completion/translations/macro_test.exs b/apps/server/test/lexical/server/code_intelligence/completion/translations/macro_test.exs index 8743eb70..f5137076 100644 --- a/apps/server/test/lexical/server/code_intelligence/completion/translations/macro_test.exs +++ b/apps/server/test/lexical/server/code_intelligence/completion/translations/macro_test.exs @@ -846,7 +846,7 @@ defmodule Lexical.Server.CodeIntelligence.Completion.Translations.MacroTest do "macro_2_without_parens ${1:arg1}, ${2:arg2}, ${3:arg3}, ${4:arg4}" end - @broken_by_elixir_sense? Version.match?(System.version(), ">= 1.14.0") + @broken_by_elixir_sense? Version.match?(System.version(), ">= 1.13.0") # The update to elixir sense broke these tests @tag [skip: @broken_by_elixir_sense?] diff --git a/config/runtime.exs b/config/runtime.exs deleted file mode 100644 index 44f01b94..00000000 --- a/config/runtime.exs +++ /dev/null @@ -1,24 +0,0 @@ -import Config - -cond do - Code.ensure_loaded?(LoggerFileBackend) -> - log_directory = Path.join(File.cwd!(), ".lexical") - - unless File.exists?(log_directory) do - File.mkdir_p(log_directory) - end - - log_file_name = Path.join(log_directory, "lexical.log") - - config :logger, - handle_sasl_reports: true, - handle_otp_reports: true, - backends: [{LoggerFileBackend, :general_log}] - - config :logger, :general_log, - path: log_file_name, - level: :debug - - true -> - :ok -end diff --git a/integration/Dockerfile b/integration/Dockerfile index 93143abd..b13624e6 100644 --- a/integration/Dockerfile +++ b/integration/Dockerfile @@ -30,16 +30,14 @@ RUN integration/boot/set_up_mise.sh COPY integration/boot/set_up_asdf.sh integration/boot/set_up_asdf.sh RUN integration/boot/set_up_asdf.sh +COPY mix_*.exs . COPY apps apps -COPY config config -COPY mix* . + +WORKDIR /lexical/apps/server RUN mix local.hex --force RUN mix deps.get RUN mix compile - -COPY bin bin - RUN mix package CMD bash diff --git a/mix.exs b/mix.exs index 4523de87..f8a147e5 100644 --- a/mix.exs +++ b/mix.exs @@ -1,5 +1,4 @@ defmodule Lexical.LanguageServer.MixProject do - Code.require_file("mix_dialyzer.exs") use Mix.Project def project do @@ -11,16 +10,14 @@ defmodule Lexical.LanguageServer.MixProject do aliases: aliases(), docs: docs(), name: "Lexical", - consolidate_protocols: Mix.env() != :test, - dialyzer: Mix.Dialyzer.config(:lexical) + consolidate_protocols: Mix.env() != :test ] end defp deps do [ {:ex_doc, "~> 0.34", only: :dev, runtime: false}, - {:credo, "~> 1.7", only: [:dev, :test]}, - Mix.Dialyzer.dependency() + {:credo, "~> 1.7", only: [:dev, :test]} ] end diff --git a/mix_credo.exs b/mix_credo.exs new file mode 100644 index 00000000..fcca0657 --- /dev/null +++ b/mix_credo.exs @@ -0,0 +1,43 @@ +defmodule Mix.Credo do + def dependency do + {:credo, "~> 1.7", only: [:dev, :test]} + end + + def config(opts \\ []) do + included = Keyword.get(opts, :included, []) + excluded = Keyword.get(opts, :excluded, []) + + %{ + configs: [ + %{ + name: "default", + files: %{ + included: ["lib/", "src/", "test/" | included], + excluded: excluded + }, + plugins: [], + requires: [], + strict: true, + parse_timeout: 5000, + color: true, + checks: [ + {Credo.Check.Design.AliasUsage, + if_nested_deeper_than: 3, if_called_more_often_than: 1}, + {Credo.Check.Readability.AliasOrder, []}, + {Credo.Check.Readability.ModuleDoc, false}, + {Credo.Check.Readability.PreferImplicitTry, false}, + {Credo.Check.Refactor.CyclomaticComplexity, max_complexity: 10}, + {Credo.Check.Refactor.Nesting, max_nesting: 3}, + {Credo.Check.Refactor.PipeChainStart, []} + ] + } + ] + } + end + + def absolute_path(relative_path) do + __ENV__.file + |> Path.dirname() + |> Path.join(relative_path) + end +end diff --git a/mix_dialyzer.exs b/mix_dialyzer.exs index f95a5766..297eee04 100644 --- a/mix_dialyzer.exs +++ b/mix_dialyzer.exs @@ -3,12 +3,14 @@ defmodule Mix.Dialyzer do {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false, optional: true} end - def config(name \\ :dialyzer) do + def config(opts \\ []) do + add_apps = [:compiler, :ex_unit, :mix, :wx | Keyword.get(opts, :add_apps, [])] + [ plt_core_path: absolute_path("priv/plts"), - plt_file: {:no_warn, absolute_path("priv/plts/#{name}.plt")}, + plt_file: {:no_warn, absolute_path("priv/plts/#{plt_name()}.plt")}, plt_add_deps: :apps_direct, - plt_add_apps: [:compiler, :ex_unit, :jason, :mix, :wx], + plt_add_apps: add_apps, ignore_warnings: absolute_path("dialyzer.ignore-warnings") ] end @@ -18,4 +20,8 @@ defmodule Mix.Dialyzer do |> Path.dirname() |> Path.join(relative_path) end + + defp plt_name do + File.cwd!() |> Path.basename() |> String.to_atom() + end end diff --git a/mix_includes.exs b/mix_includes.exs new file mode 100644 index 00000000..ac464788 --- /dev/null +++ b/mix_includes.exs @@ -0,0 +1,5 @@ +for filename <- ~w(mix_dialyzer.exs mix_credo.exs) do + full_path = Path.join(__DIR__, filename) + + Code.require_file(full_path) +end