Update "make edoc" to use ExDoc

This commit is contained in:
Badlop 2024-02-23 12:44:39 +01:00
parent cb9053cd79
commit bb349d6085
3 changed files with 53 additions and 5 deletions

View File

@ -341,6 +341,8 @@ jobs:
- run: make xref
- run: make edoc
- name: Run rel
run: |
make rel

View File

@ -133,6 +133,8 @@ ifeq "$(REBAR_VER)" "6"
CONFIGURE_DEPS=(cd deps/eimp; ./configure)
EBINDIR=$(DEPSDIR)/ejabberd/ebin
XREFOPTIONS=graph
EDOCPRE=MIX_ENV=edoc
EDOCTASK=docs --proglang erlang
CLEANARG=--deps
ELIXIR_LIBDIR_RAW=$(shell elixir -e "IO.puts(:filename.dirname(:code.lib_dir(:elixir)))" -e ":erlang.halt")
ELIXIR_LIBDIR=":$(ELIXIR_LIBDIR_RAW)"
@ -238,9 +240,25 @@ translations:
doap:
tools/generate-doap.sh
edoc:
$(ERL) -noinput +B -eval \
'case edoc:application(ejabberd, ".", []) of ok -> halt(0); error -> halt(1) end.'
#.
#' edoc
#
edoc: edoc_files edoc_compile
$(EDOCPRE) $(REBAR) $(EDOCTASK)
edoc_compile: deps
$(EDOCPRE) $(REBAR) compile
edoc_files: _build/edoc/docs.md _build/edoc/logo.png
_build/edoc/docs.md: edoc_compile
echo "For much more detailed and complete ejabberd documentation, " \
"go to the [ejabberd Docs](https://docs.ejabberd.im/) site." \
> _build/edoc/docs.md
_build/edoc/logo.png: edoc_compile
wget https://docs.ejabberd.im/static/shared/images/footer_logo_e.png -O _build/edoc/logo.png
#.
#' copy-files
@ -650,7 +668,7 @@ help:
@echo " relive Start a live ejabberd in _build/relive/"
@echo ""
@echo " doap Generate DOAP file"
@echo " edoc Generate edoc documentation (unused)"
@echo " edoc Generate EDoc documentation [mix]"
@echo " options Generate ejabberd_option.erl"
@echo " translations Extract translation files"
@echo " TAGS Generate tags file for text editors"

30
mix.exs
View File

@ -3,6 +3,7 @@ defmodule Ejabberd.MixProject do
def project do
[app: :ejabberd,
source_url: "https://github.com/processone/ejabberd",
version: version(),
description: description(),
elixir: elixir_required_version(),
@ -17,6 +18,7 @@ defmodule Ejabberd.MixProject do
language: :erlang,
releases: releases(),
package: package(),
docs: docs(),
deps: deps()]
end
@ -103,7 +105,7 @@ defmodule Ejabberd.MixProject do
[{:base64url, "~> 1.0"},
{:cache_tab, "~> 1.0"},
{:eimp, "~> 1.0"},
{:ex_doc, ">= 0.0.0", only: :dev},
{:ex_doc, "~> 0.31", only: [:dev, :edoc], runtime: false},
{:fast_tls, ">= 1.1.18"},
{:fast_xml, ">= 1.1.51"},
{:fast_yaml, "~> 1.0"},
@ -161,6 +163,7 @@ defmodule Ejabberd.MixProject do
for {:true, app} <- [{config(:pam), :epam},
{config(:lua), :luerl},
{config(:redis), :eredis},
{Mix.env() == :edoc, :ex_doc},
{if_version_below(~c"22", true), :lager},
{config(:mysql), :p1_mysql},
{config(:sip), :esip},
@ -350,6 +353,31 @@ defmodule Ejabberd.MixProject do
release
end
defp docs do
[
main: "readme",
logo: "_build/edoc/logo.png",
source_ref: "master",
extra_section: "", # No need for Pages section name, it's the only one
api_reference: false, # API section has just Elixir, hide it
filter_modules: "aaaaa", # Module section has just Elixir modules, hide them
extras: [
"README.md": [title: "Readme"],
"COMPILE.md": [title: "Compile and Install"],
"CONTAINER.md": [title: "Container Image"],
"CONTRIBUTING.md": [title: "Contributing"],
"CONTRIBUTORS.md": [title: "Contributors"],
"CODE_OF_CONDUCT.md": [title: "Code of Conduct"],
"CHANGELOG.md": [title: "ChangeLog"],
"COPYING": [title: "Copying License"],
"_build/edoc/docs.md": [title: "&xrArr; ejabberd Docs"]
],
groups_for_extras: [
"": Path.wildcard("*.md") ++ ["COPYING"],
"For more documentation": "_build/edoc/docs.md"
]
]
end
end
defmodule Mix.Tasks.Compile.Asn1 do