Skip to content

Commit

Permalink
Merge branch 'topic/deps' into 'master'
Browse files Browse the repository at this point in the history
Use dependency commits from a file to build ALS.

See merge request eng/ide/ada_language_server!1685
  • Loading branch information
reznikmm committed Sep 13, 2024
2 parents 9a310e7 + 338d7b6 commit 6582a39
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 30 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ jobs:
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/aarch64-Linux-gmp-6.2.1.tar.bz2 . --sse=AES256
sudo tar xjf aarch64-Linux-gcc-14.2.tar.bz2 -C /
sudo tar xjf aarch64-Linux-gmp-6.2.1.tar.bz2 -C /
- name: Fetch dependency commits numbers
shell: bash
if: ${{ env.TAG != env.DEFAULT_TAG }}
run: |
# For tags `actions/checkout@v2` action fetches a tag's commit, but
# not the tag annotation itself. Let's refetch the tag from origin.
# This makes `git show --no-patch --format=%n $TAG` work again.
git tag --delete $TAG
git fetch --tags
git show --no-patch --format=%n $TAG > deps.txt
- name: Build
shell: bash
run: |
Expand Down Expand Up @@ -100,7 +110,6 @@ jobs:
path: |
integration/vscode/ada/arm*
integration/vscode/ada/x64*
commits.txt
- name: Upload release
shell: bash
if: ${{ env.TAG != env.DEFAULT_TAG }}
Expand Down
21 changes: 2 additions & 19 deletions .github/workflows/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,11 @@ else
NAME=${NODE_ARCH_PLATFORM%/*}-${NODE_ARCH_PLATFORM#*/}
fi

# For tags `actions/checkout@v2` action fetches a tag's commit, but
# not the tag annotation itself. Let's refetch the tag from origin.
# This makes `git show --no-patch --format=%n $TAG` work again.
git tag --delete "$TAG"
git fetch --tags

function release_notes() {
echo "# Release notes"

# Select the content of the first section of CHANGELOG.md
sed -n -e '/^## \\<next>/,/^##/p' <CHANGELOG.md | tail -n +2 | head -n -1

COMMITS=commits.txt

if [ -f "$COMMITS" ]; then
{
echo "# Dependency commits"
echo ""
cat "$COMMITS"
echo ""
}
fi
sed -n -e '/^## \\<next>/,/^##/p' CHANGELOG.md | sed -e '1d;$d'
}

release_notes >release_notes.md
Expand Down Expand Up @@ -69,7 +52,7 @@ upload_url=$(curl \
echo "upload_url=$upload_url"

FILE=$NAME.tar.gz
tar czvf "$FILE" "integration/vscode/ada/$NODE_ARCH_PLATFORM" commits.txt
tar czvf "$FILE" "integration/vscode/ada/$NODE_ARCH_PLATFORM"

# Upload $FILE as an asset to the release
curl \
Expand Down
25 changes: 25 additions & 0 deletions doc/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Building Ada Language Server from sources

1. Install Alire, Python 3, NodeJS. Add them to `PATH`.

2. Disable dependency sharing in Alire

alr settings --global --set dependencies.shared false

3. Clone repository

git clone https://github.com/AdaCore/ada_language_server.git
cd ada_language_server

4. If you know dependency commits numbers then create `deps.txt` file
with lines `<repo_name>=commit`. Otherwise checkout `edge` branch.

5. Build scripts installs Python modules. So it's better to activate
`venv` for Python:

python -m venv venv
source venv/bin/activate

5. Run `build_als.sh` script

./scripts/build_als.sh
17 changes: 9 additions & 8 deletions scripts/build_als.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ vss

# Pins repo names (crate name by default)

repo_adasat=AdaSAT
repo_gnatcoll=gnatcoll-core
repo_lal_refactor=lal-refactor
repo_langkit_support=langkit
Expand Down Expand Up @@ -72,21 +71,23 @@ function install_index() {

# Clone dependencies
function pin_crates() {
echo "$(git rev-parse HEAD) ada_language_server" >commits.txt

for crate in $PINS; do
repo_var=repo_$crate
branch_var=branch_$crate

repo=${!repo_var}
branch=${!branch_var}
commit=""

if [ -f deps.txt ]; then
commit=$(grep "^${repo:-$crate}=" deps.txt | sed -e 's/.*=//')
fi

URL="https://github.com/AdaCore/${repo:-$crate}.git"
GIT="git clone --depth=1"
[ -d "subprojects/$crate" ] ||
$GIT -b "${branch:-master}" "$URL" "subprojects/$crate"
commit=$(git -C "subprojects/$crate" rev-parse HEAD)
echo "$commit $crate" >>commits.txt
if [ ! -d "subprojects/$crate" ]; then
git clone "$URL" "subprojects/$crate"
git -C "subprojects/$crate" checkout "${commit:-${branch:-master}}"
fi
cp -v "subprojects/$crate".toml "subprojects/$crate/alire.toml"
alr --force --non-interactive pin "$crate" "--use=$PWD/subprojects/$crate"
done
Expand Down
4 changes: 2 additions & 2 deletions subprojects/gnatcoll.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ prepend = "${CRATE_ROOT}/core:${CRATE_ROOT}/projects:${CRATE_ROOT}/minimal"
prepend = "${CRATE_ROOT}/core:${CRATE_ROOT}/projects:${CRATE_ROOT}/minimal"

[environment.'case(os)'.macos.DYLD_LIBRARY_PATH]
append = "${CRATE_ROOT}/projects/lib/gnatcoll_projects/relocatable:${CRATE_ROOT}/core/lib/gnatcoll_core/relocatable:${CRATE_ROOT}/minimal/lib/gnatcoll_core/relocatable"
append = "${CRATE_ROOT}/projects/lib/gnatcoll_projects/relocatable:${CRATE_ROOT}/core/lib/gnatcoll_core/relocatable:${CRATE_ROOT}/minimal/lib/gnatcoll_core/relocatable:${CRATE_ROOT}/lib/gnatcoll_projects/relocatable:${CRATE_ROOT}/lib/gnatcoll_core/relocatable"

[environment.'case(os)'.windows.PATH]
append = "${CRATE_ROOT}/projects/lib/gnatcoll_projects/relocatable;${CRATE_ROOT}/core/lib/gnatcoll_core/relocatable;${CRATE_ROOT}/minimal/lib/gnatcoll_core/relocatable"
append = "${CRATE_ROOT}/projects/lib/gnatcoll_projects/relocatable;${CRATE_ROOT}/core/lib/gnatcoll_core/relocatable;${CRATE_ROOT}/minimal/lib/gnatcoll_core/relocatable;${CRATE_ROOT}/lib/gnatcoll_projects/relocatable;${CRATE_ROOT}/lib/gnatcoll_core/relocatable"

[gpr-externals]
GNATCOLL_ATOMICS = ["intrinsic", "mutex"]
Expand Down

0 comments on commit 6582a39

Please sign in to comment.