Skip to content

Commit

Permalink
Use dependency commits from a file to build ALS.
Browse files Browse the repository at this point in the history
Refs #1351
  • Loading branch information
reznikmm committed Sep 13, 2024
1 parent 9a310e7 commit 394c2c9
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 34 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,23 @@ jobs:
AWS_DEFAULT_REGION: eu-west-1
run: |
sudo apt install -y libc6-dev-arm64-cross linux-libc-dev-arm64-cross binutils-aarch64-linux-gnu
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/aarch64-Linux-gcc-14.2.tar.bz2 . --sse=AES256
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/aarch64-Linux-gmp-6.2.1.tar.bz2 . --sse=AES256
#aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/aarch64-Linux-gcc-14.2.tar.bz2 . --sse=AES256
#aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/aarch64-Linux-gmp-6.2.1.tar.bz2 . --sse=AES256
curl -L 'https://www.dropbox.com/scl/fi/0qe3ouaf1asty5z6kc5nw/aarch64-Linux-gnat-14.tar?rlkey=dxuztwe4zfpdy3bd96fsr3ckm&st=jl7ascbf&dl=1' \
| tar xvf -
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 +113,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
19 changes: 1 addition & 18 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
}

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
10 changes: 5 additions & 5 deletions subprojects/gnatcoll.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ tags = ["gnatcoll", "json", "email", "refcount", "projects", "gpr", "vfs"]
disabled = true

[environment.'case(os)'.windows.GPR_PROJECT_PATH]
prepend = "${CRATE_ROOT}/core;${CRATE_ROOT}/projects;${CRATE_ROOT}/minimal"
prepend = "${CRATE_ROOT}/core;${CRATE_ROOT}/projects"

[environment.'case(os)'.linux.GPR_PROJECT_PATH]
prepend = "${CRATE_ROOT}/core:${CRATE_ROOT}/projects:${CRATE_ROOT}/minimal"
prepend = "${CRATE_ROOT}/core:${CRATE_ROOT}/projects"

[environment.'case(os)'.macos.GPR_PROJECT_PATH]
prepend = "${CRATE_ROOT}/core:${CRATE_ROOT}/projects:${CRATE_ROOT}/minimal"
prepend = "${CRATE_ROOT}/core:${CRATE_ROOT}/projects"

[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}/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}/lib/gnatcoll_projects/relocatable;${CRATE_ROOT}/lib/gnatcoll_core/relocatable"

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

0 comments on commit 394c2c9

Please sign in to comment.