File elixir-1.13.4-git.patch of Package elixir
diff --git a/.github/workflows/builds.hex.pm.yml b/.github/workflows/builds.hex.pm.yml
new file mode 100644
index 000000000..f263f5a7c
--- /dev/null
+++ b/.github/workflows/builds.hex.pm.yml
@@ -0,0 +1,87 @@
+name: builds.hex.pm
+
+on:
+ push:
+ branches:
+ - main
+ - v*.*
+ tags:
+ - v*
+
+env:
+ ELIXIR_OPTS: "--warnings-as-errors"
+ ERLC_OPTS: "warnings_as_errors"
+ LANG: C.UTF-8
+
+concurrency: builds_txt
+
+jobs:
+ release_pre_built:
+ strategy:
+ fail-fast: true
+ max-parallel: 1
+ matrix:
+ include:
+ - otp: 23
+ otp_version: '23.3'
+ build_docs: build_docs
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 50
+ - name: Get tags
+ run: git fetch --tags origin
+ - uses: ./.github/workflows/release_pre_built
+ with:
+ otp_version: ${{ matrix.otp_version }}
+ otp: ${{ matrix.otp }}
+ build_docs: ${{ matrix.build_docs }}
+ - name: Utils.sh
+ run: |
+ cat << 'EOF' > utils.sh
+ function purge_key() {
+ curl \
+ -X POST \
+ -H "Fastly-Key: ${FASTLY_KEY}" \
+ -H "Accept: application/json" \
+ -H "Content-Length: 0" \
+ "https://api.fastly.com/service/$1/purge/$2"
+ }
+ function purge() {
+ purge_key ${FASTLY_REPO_SERVICE_ID} $1
+ purge_key ${FASTLY_BUILDS_SERVICE_ID} $1
+ sleep 2
+ purge_key ${FASTLY_REPO_SERVICE_ID} $1
+ purge_key ${FASTLY_BUILDS_SERVICE_ID} $1
+ sleep 2
+ purge_key ${FASTLY_REPO_SERVICE_ID} $1
+ purge_key ${FASTLY_BUILDS_SERVICE_ID} $1
+ }
+ EOF
+ chmod +x utils.sh
+ - name: Upload Docs to S3
+ if: ${{ matrix.build_docs }}
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.HEX_AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }}
+ AWS_REGION: ${{ secrets.HEX_AWS_REGION }}
+ AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }}
+ FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }}
+ FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }}
+ FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}
+ run: |
+ source utils.sh
+ version=$(echo ${{ github.ref_name }} | sed -e 's/^v//g')
+ for f in doc/*; do
+ if [ -d "$f" ]; then
+ app=`echo $f | sed s/"doc\/"//`
+ tarball="${app}-${version}.tar.gz"
+ surrogate_key="docs/${app}-${version}"
+ tar -czf "${tarball}" -C "doc/${app}" .
+ aws s3 cp "${tarball}" "s3://${{ env.AWS_S3_BUCKET }}/docs/${tarball}" \
+ --cache-control "public,max-age=3600" \
+ --metadata "{\"surrogate-key\":\"${surrogate_key}\",\"surrogate-control\":\"public,max-age=604800\"}"
+ purge "${surrogate_key}"
+ fi
+ done
diff --git a/.github/workflows/release_pre_built/action.yml b/.github/workflows/release_pre_built/action.yml
new file mode 100644
index 000000000..e8d063014
--- /dev/null
+++ b/.github/workflows/release_pre_built/action.yml
@@ -0,0 +1,51 @@
+name: "Release pre built"
+description: "Builds elixir release, ExDoc and generates docs"
+inputs:
+ otp:
+ description: "The major OTP version"
+ otp_version:
+ description: "The exact OTP version (major.minor[.patch])"
+ build_docs:
+ description: "If docs have to be built or not"
+runs:
+ using: "composite"
+ steps:
+ - uses: erlef/setup-beam@v1
+ with:
+ otp-version: ${{ inputs.otp_version }}
+ version-type: strict
+ - name: Build Elixir Release
+ shell: bash
+ run: |
+ make Precompiled.zip
+ mv Precompiled.zip elixir-otp-${{ inputs.otp }}.zip
+ shasum -a 1 elixir-otp-${{ inputs.otp }}.zip > elixir-otp-${{ inputs.otp }}.zip.sha1sum
+ shasum -a 256 elixir-otp-${{ inputs.otp }}.zip > elixir-otp-${{ inputs.otp }}.zip.sha256sum
+ echo "$PWD/bin" >> $GITHUB_PATH
+ - name: Get latest stable ExDoc version
+ if: ${{ inputs.build_docs }}
+ shell: bash
+ run: |
+ EX_DOC_LATEST_STABLE_VERSION=$(curl -s https://hex.pm/api/packages/ex_doc | jq --raw-output '.latest_stable_version')
+ echo "EX_DOC_LATEST_STABLE_VERSION=${EX_DOC_LATEST_STABLE_VERSION}" >> $GITHUB_ENV
+ - uses: actions/checkout@v3
+ if: ${{ inputs.build_docs }}
+ with:
+ repository: elixir-lang/ex_doc
+ ref: v${{ env.EX_DOC_LATEST_STABLE_VERSION }}
+ path: ex_doc
+ - name: Build ex_doc
+ if: ${{ inputs.build_docs }}
+ shell: bash
+ run: |
+ mv ex_doc ../ex_doc
+ cd ../ex_doc
+ ../elixir/bin/mix do local.rebar --force, local.hex --force, deps.get, compile
+ cd ../elixir
+ - name: Build Docs
+ if: ${{ inputs.build_docs }}
+ shell: bash
+ run: |
+ make Docs.zip
+ shasum -a 1 Docs.zip > Docs.zip.sha1sum
+ shasum -a 256 Docs.zip > Docs.zip.sha256sum
diff --git a/Makefile b/Makefile
index 4e6d3534f..5432e06b3 100644
--- a/Makefile
+++ b/Makefile
@@ -179,40 +179,48 @@ clean_residual_files:
LOGO_PATH = $(shell test -f ../docs/logo.png && echo "--logo ../docs/logo.png")
SOURCE_REF = $(shell tag="$(call GIT_TAG)" revision="$(call GIT_REVISION)"; echo "$${tag:-$$revision}")
+
DOCS_FORMAT = html
-COMPILE_DOCS = CANONICAL=$(CANONICAL) bin/elixir ../ex_doc/bin/ex_doc "$(1)" "$(VERSION)" "lib/$(2)/ebin" --main "$(3)" --source-url "https://github.com/elixir-lang/elixir" --source-ref "$(call SOURCE_REF)" $(call LOGO_PATH) --output doc/$(2) --canonical "https://hexdocs.pm/$(2)/$(CANONICAL)" --homepage-url "https://elixir-lang.org/docs.html" --formatter "$(DOCS_FORMAT)" $(4)
+DOCS_COMPILE = CANONICAL=$(CANONICAL) bin/elixir ../ex_doc/bin/ex_doc "$(1)" "$(VERSION)" "lib/$(2)/ebin" --main "$(3)" --source-url "https://github.com/elixir-lang/elixir" --source-ref "$(call SOURCE_REF)" $(call LOGO_PATH) --output doc/$(2) --canonical "https://hexdocs.pm/$(2)/$(CANONICAL)" --homepage-url "https://elixir-lang.org/docs.html" --formatter "$(DOCS_FORMAT)" $(4)
+DOCS_CONFIG = bin/elixir lib/elixir/scripts/docs_config.exs "$(1)"
docs: compile ../ex_doc/bin/ex_doc docs_elixir docs_eex docs_mix docs_iex docs_ex_unit docs_logger
docs_elixir: compile ../ex_doc/bin/ex_doc
@ echo "==> ex_doc (elixir)"
$(Q) rm -rf doc/elixir
- $(call COMPILE_DOCS,Elixir,elixir,Kernel,--config "lib/elixir/docs.exs")
+ $(call DOCS_COMPILE,Elixir,elixir,Kernel,--config "lib/elixir/scripts/elixir_docs.exs")
+ $(call DOCS_CONFIG,elixir)
docs_eex: compile ../ex_doc/bin/ex_doc
@ echo "==> ex_doc (eex)"
$(Q) rm -rf doc/eex
- $(call COMPILE_DOCS,EEx,eex,EEx,--config "lib/mix/docs.exs")
+ $(call DOCS_COMPILE,EEx,eex,EEx,--config "lib/elixir/scripts/mix_docs.exs")
+ $(call DOCS_CONFIG,eex)
docs_mix: compile ../ex_doc/bin/ex_doc
@ echo "==> ex_doc (mix)"
$(Q) rm -rf doc/mix
- $(call COMPILE_DOCS,Mix,mix,Mix,--config "lib/mix/docs.exs")
+ $(call DOCS_COMPILE,Mix,mix,Mix,--config "lib/elixir/scripts/mix_docs.exs")
+ $(call DOCS_CONFIG,mix)
docs_iex: compile ../ex_doc/bin/ex_doc
@ echo "==> ex_doc (iex)"
$(Q) rm -rf doc/iex
- $(call COMPILE_DOCS,IEx,iex,IEx,--config "lib/mix/docs.exs")
+ $(call DOCS_COMPILE,IEx,iex,IEx,--config "lib/elixir/scripts/mix_docs.exs")
+ $(call DOCS_CONFIG,iex)
docs_ex_unit: compile ../ex_doc/bin/ex_doc
@ echo "==> ex_doc (ex_unit)"
$(Q) rm -rf doc/ex_unit
- $(call COMPILE_DOCS,ExUnit,ex_unit,ExUnit,--config "lib/mix/docs.exs")
+ $(call DOCS_COMPILE,ExUnit,ex_unit,ExUnit,--config "lib/elixir/scripts/mix_docs.exs")
+ $(call DOCS_CONFIG,ex_unit)
docs_logger: compile ../ex_doc/bin/ex_doc
@ echo "==> ex_doc (logger)"
$(Q) rm -rf doc/logger
- $(call COMPILE_DOCS,Logger,logger,Logger,--config "lib/mix/docs.exs")
+ $(call DOCS_COMPILE,Logger,logger,Logger,--config "lib/elixir/scripts/mix_docs.exs")
+ $(call DOCS_CONFIG,logger)
../ex_doc/bin/ex_doc:
@ echo "ex_doc is not found in ../ex_doc as expected. See README for more information."
@@ -221,23 +229,23 @@ docs_logger: compile ../ex_doc/bin/ex_doc
#==> Zip tasks
Docs.zip: docs
- rm -f Docs-v$(VERSION).zip
- zip -9 -r Docs-v$(VERSION).zip CHANGELOG.md doc NOTICE LICENSE README.md
- @ echo "Docs file created $(CURDIR)/Docs-v$(VERSION).zip"
+ rm -f Docs.zip
+ zip -9 -r Docs.zip CHANGELOG.md doc NOTICE LICENSE README.md
+ @ echo "Docs file created $(CURDIR)/Docs.zip"
Precompiled.zip: build_man compile
- rm -f Precompiled-v$(VERSION).zip
- zip -9 -r Precompiled-v$(VERSION).zip bin CHANGELOG.md lib/*/ebin lib/*/lib LICENSE man NOTICE README.md VERSION
- @ echo "Precompiled file created $(CURDIR)/Precompiled-v$(VERSION).zip"
+ rm -f Precompiled.zip
+ zip -9 -r Precompiled.zip bin CHANGELOG.md lib/*/ebin lib/*/lib LICENSE man NOTICE README.md VERSION
+ @ echo "Precompiled file created $(CURDIR)/Precompiled.zip"
zips: Precompiled.zip Docs.zip
@ echo ""
@ echo "### Checksums"
@ echo ""
- @ shasum -a 1 < Precompiled-v$(VERSION).zip | sed -e "s/-//" | xargs echo " * Precompiled.zip SHA1:"
- @ shasum -a 512 < Precompiled-v$(VERSION).zip | sed -e "s/-//" | xargs echo " * Precompiled.zip SHA512:"
- @ shasum -a 1 < Docs-v$(VERSION).zip | sed -e "s/-//" | xargs echo " * Docs.zip SHA1:"
- @ shasum -a 512 < Docs-v$(VERSION).zip | sed -e "s/-//" | xargs echo " * Docs.zip SHA512:"
+ @ shasum -a 1 < Precompiled.zip | sed -e "s/-//" | xargs echo " * Precompiled.zip SHA1:"
+ @ shasum -a 512 < Precompiled.zip | sed -e "s/-//" | xargs echo " * Precompiled.zip SHA512:"
+ @ shasum -a 1 < Docs.zip | sed -e "s/-//" | xargs echo " * Docs.zip SHA1:"
+ @ shasum -a 512 < Docs.zip | sed -e "s/-//" | xargs echo " * Docs.zip SHA512:"
@ echo ""
#==> Test tasks
diff --git a/lib/elixir/lib/kernel/special_forms.ex b/lib/elixir/lib/kernel/special_forms.ex
index 65c7b1628..43797eea0 100644
--- a/lib/elixir/lib/kernel/special_forms.ex
+++ b/lib/elixir/lib/kernel/special_forms.ex
@@ -1612,7 +1612,7 @@ defp validate_exists(path) do
end
Note how the code above is better organized and clearer once we
- make sure each clause in `with` returns a normalize format.
+ make sure each clause in `with` returns a normalized format.
"""
defmacro with(args), do: error!([args])
diff --git a/lib/elixir/scripts/docs_config.exs b/lib/elixir/scripts/docs_config.exs
new file mode 100644
index 000000000..e24101732
--- /dev/null
+++ b/lib/elixir/scripts/docs_config.exs
@@ -0,0 +1,19 @@
+# Generate docs_config.js for version chooser in ExDoc
+[app] = System.argv()
+
+{text_tags, 0} = System.cmd("git", ["tag"])
+skipped = Version.parse!("1.0.3")
+
+list_contents =
+ text_tags
+ |> String.split()
+ |> Enum.map(fn "v" <> rest -> Version.parse!(rest) end)
+ |> Enum.filter(&(Version.compare(&1, skipped) == :gt))
+ |> Enum.sort({:desc, Version})
+ |> Enum.map_intersperse(", ", fn version ->
+ version_string = to_string(version)
+ ~s[{"version":"v#{version_string}", "url":"https://hexdocs.pm/#{app}/#{version_string}"}]
+ end)
+
+File.mkdir_p!("doc/#{app}")
+File.write!("doc/#{app}/docs_config.js", ["var versionNodes = [", list_contents, "];\n"])
diff --git a/lib/elixir/docs.exs b/lib/elixir/scripts/elixir_docs.exs
similarity index 100%
rename from lib/elixir/docs.exs
rename to lib/elixir/scripts/elixir_docs.exs
diff --git a/lib/mix/docs.exs b/lib/elixir/scripts/mix_docs.exs
similarity index 100%
rename from lib/mix/docs.exs
rename to lib/elixir/scripts/mix_docs.exs