Merge pull request #8187 from zmstone/0611-copy-example-configs-to-etc-elixir

mix build: release example configs
This commit is contained in:
Zaiming (Stone) Shi 2022-06-13 13:51:52 +01:00 committed by GitHub
commit 022ec06bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 3 deletions

View File

@ -224,7 +224,7 @@ prepare-build-deps:
## elixir target is to create release packages using Elixir's Mix ## elixir target is to create release packages using Elixir's Mix
.PHONY: $(REL_PROFILES:%=%-elixir) $(PKG_PROFILES:%=%-elixir) .PHONY: $(REL_PROFILES:%=%-elixir) $(PKG_PROFILES:%=%-elixir)
$(REL_PROFILES:%=%-elixir) $(PKG_PROFILES:%=%-elixir): $(COMMON_DEPS) $(ELIXIR_COMMON_DEPS) mix-deps-get $(REL_PROFILES:%=%-elixir) $(PKG_PROFILES:%=%-elixir): $(COMMON_DEPS) $(ELIXIR_COMMON_DEPS) mix-deps-get
@$(BUILD) $(subst -elixir,,$(@)) elixir @env IS_ELIXIR=yes $(BUILD) $(subst -elixir,,$(@)) elixir
.PHONY: $(REL_PROFILES:%=%-elixir-pkg) .PHONY: $(REL_PROFILES:%=%-elixir-pkg)
define gen-elixir-pkg-target define gen-elixir-pkg-target

4
build
View File

@ -293,8 +293,8 @@ export_release_vars() {
log "building artifact=$ARTIFACT for profile=$PROFILE" log "building artifact=$ARTIFACT for profile=$PROFILE"
case "$ARTIFACT" in case "$ARTIFACT" in
doc) doc|docs)
make_doc make_docs
;; ;;
rel) rel)
make_rel make_rel

22
mix.exs
View File

@ -114,6 +114,7 @@ defmodule EMQXUmbrella.MixProject do
} = check_profile!() } = check_profile!()
base_steps = [ base_steps = [
&make_docs(&1),
:assemble, :assemble,
&create_RELEASES/1, &create_RELEASES/1,
&copy_files(&1, release_type, package_type, edition_type), &copy_files(&1, release_type, package_type, edition_type),
@ -283,6 +284,12 @@ defmodule EMQXUmbrella.MixProject do
# Custom Steps # Custom Steps
############################################################################# #############################################################################
defp make_docs(release) do
profile = System.get_env("MIX_ENV")
os_cmd("build", [profile, "docs"])
release
end
defp copy_files(release, release_type, package_type, edition_type) do defp copy_files(release, release_type, package_type, edition_type) do
overwrite? = Keyword.get(release.options, :overwrite, false) overwrite? = Keyword.get(release.options, :overwrite, false)
@ -322,6 +329,21 @@ defmodule EMQXUmbrella.MixProject do
force: overwrite? force: overwrite?
) )
# copy generated docs
Enum.each(
[
"apps/emqx_dashboard/priv/www/static/emqx-en.conf.example",
"apps/emqx_dashboard/priv/www/static/emqx-zh.conf.example"
],
fn file ->
Mix.Generator.copy_file(
file,
Path.join(etc, Path.basename(file)),
force: overwrite?
)
end
)
# this is required by the produced escript / nodetool # this is required by the produced escript / nodetool
Mix.Generator.copy_file( Mix.Generator.copy_file(
Path.join(release.version_path, "start_clean.boot"), Path.join(release.version_path, "start_clean.boot"),