Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into edge
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic-merge committed Oct 20, 2023
2 parents 2359a87 + b2ebac8 commit d5ee2f1
Show file tree
Hide file tree
Showing 25 changed files with 92 additions and 579 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/build-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@
set -x -e
DEBUG=$1 # Value is '' or 'debug'
RUNNER_OS=$2 # ${{ runner.os }} is Linux, Windiws, maxOS
TAG=$3 # For master it's 23.0.999, while for tag it's the tag itself
TAG=$3 # For master it's 24.0.999, while for tag it's the tag itself
NO_REBASE=$4 # Specify this to skip the rebase over the edge branch. Used for local debugging.

prefix=/tmp/ADALIB_DIR

export CPATH=/usr/local/include
export LIBRARY_PATH=/usr/local/lib
export DYLD_LIBRARY_PATH=/usr/local/lib
export PATH=`ls -d $PWD/cached_gnat/*/bin |tr '\n' ':'`$PATH
export ADAFLAGS=-g1

if [ $RUNNER_OS = Windows ]; then
prefix=/opt/ADALIB_DIR
mount `cygpath -w $RUNNER_TEMP|cut -d: -f1`:/opt /opt
export CPATH=`cygpath -w /c/msys64/mingw64/include`
export LIBRARY_PATH=`cygpath -w /c/msys64/mingw64/lib`
mount D:/opt /opt
fi

export GPR_PROJECT_PATH=$prefix/share/gpr:\
Expand All @@ -22,11 +30,6 @@ $PWD/subprojects/lal-refactor/gnat:\
$PWD/subprojects/libadalang-tools/src:\
$PWD/subprojects/spawn/gnat:\
$PWD/subprojects/stubs
export CPATH=/usr/local/include:/mingw64/include
export LIBRARY_PATH=/usr/local/lib:/mingw64/lib
export DYLD_LIBRARY_PATH=/usr/local/lib
export PATH=`ls -d $PWD/cached_gnat/*/bin |tr '\n' ':'`$PATH
export ADAFLAGS=-g1
echo PATH=$PATH

BRANCH=master
Expand Down Expand Up @@ -57,6 +60,7 @@ FILE=libadalang-$RUNNER_OS-$BRANCH${DEBUG:+-dbg}-static.tar.gz
# and we don't delete it after use.
if [ ! -f "$FILE" ]; then
aws s3 cp s3://adacore-gha-tray-eu-west-1/libadalang/$FILE . --sse=AES256
umask 0 # To avoid permission errors on MSYS2
tar xzf $FILE -C $prefix
rm -f -v $FILE
else
Expand Down
41 changes: 19 additions & 22 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 2*.*.*
name: Build binaries
env:
DEFAULT_TAG: 23.0.999
DEFAULT_TAG: 24.0.999
AWS_DEFAULT_REGION: eu-west-1
jobs:
build:
Expand All @@ -18,10 +18,10 @@ jobs:
os: [macos-11, ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Setup Python 3.8
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'
- name: Initialize TAG and git autocrlf
shell: bash
run: |
Expand All @@ -31,15 +31,19 @@ jobs:
else
echo "TAG=$DEFAULT_TAG" >> $GITHUB_ENV
fi
- name: Force Alire use preinstalled MSYS2
shell: bash
if: ${{ runner.os == 'Windows' }}
run: |
mkdir -p ~/.config/alire
echo '[msys2]' >> ~/.config/alire/config.toml
echo 'install_dir = "C:\\msys64"' >> ~/.config/alire/config.toml
- name: Install iconv and gmp (Windows only)
run: pacman --noconfirm -S mingw64/mingw-w64-x86_64-libiconv mingw64/mingw-w64-x86_64-gmp
if: ${{ runner.os == 'Windows' }}
uses: msys2/setup-msys2@v2
with:
path-type: inherit
update: true
install: >-
mingw64/mingw-w64-x86_64-libiconv
mingw64/mingw-w64-x86_64-gmp
shell: c:\msys64\usr\bin\bash.exe -l -e -o pipefail {0}
env:
MSYSTEM: MINGW64
- name: Get als
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -79,29 +83,22 @@ jobs:
- uses: actions/cache@v3
with:
path: ./cached_gnat
key: ${{ runner.os }}-alire-2022
restore-keys: ${{ runner.os }}-alire-2022
key: ${{ runner.os }}-alire-2023
restore-keys: ${{ runner.os }}-alire-2023
- name: Get GNAT toolchain with alire
uses: alire-project/setup-alire@v2
with:
toolchain: gnat_native^12 gprbuild^22
toolchain: gnat_native^13 gprbuild^22
toolchain_dir: ./cached_gnat
- name: Build (Windows)
if: ${{ runner.os == 'Windows' }}
shell: msys2 {0}
- name: Build
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}}
run: |
# This is to avoid locking .sh on win that prevents its updating
cp .github/workflows/build-binaries.sh .github/workflows/build-binaries.sh_
.github/workflows/build-binaries.sh_ "${{ matrix.debug }}" ${{ runner.os }} ${{ env.TAG }}
- name: Build (non-Windows)
env:
AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}}
if: ${{ runner.os != 'Windows' }}
run: .github/workflows/build-binaries.sh "${{ matrix.debug }}" ${{ runner.os }} ${{ env.TAG }}
- name: Archive ALS binary
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pack-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -x -e
DEBUG=$1 # Value is '' or 'debug'
VSCE_TOKEN=$2
OVSX_TOKEN=$3
TAG=$4 # For master it's 23.0.999, while for tag it's the tag itself
TAG=$4 # For master it's 24.0.999, while for tag it's the tag itself

function make_change_log()
{
Expand Down
14 changes: 14 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
stages:
- build_and_test
- check
- run_downstream_ci

issue-check:
services:
- image:e3
stage: check
needs: [] # Do not wait for the other stages to execute
interruptible: true # Cancel job if the branch is pushed
variables: # do not checkout the git repository, not needed
GIT_STRATEGY: none
rules: # Launch only on merge requests
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- require_issue # launch the verification

.basic-setup:
# Use generic_anod_ci here.
- generic_anod_ci
Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export ALS=$(ROOTDIR)/.obj/server/ada_language_server$(EXE)

# Tester files
TESTER=$(ROOTDIR)/.obj/tester/tester-run$(EXE)
CODEC_TEST=.obj/codec_test/codec_test$(EXE)

# Env variable to set for update VS Code test references
MOCHA_ALS_UPDATE=
Expand Down Expand Up @@ -92,12 +91,12 @@ else
endif

all: coverage-instrument
$(GPRBUILD) -P gnat/lsp_3_17.gpr -p $(COVERAGE_BUILD_FLAGS) -c lsp-inputs.adb
$(GPRBUILD) -P gnat/lsp_3_17.gpr -p $(COVERAGE_BUILD_FLAGS)
$(GPRBUILD) -P gnat/tester.gpr -p $(BUILD_FLAGS)
$(GPRBUILD) -d -ws -c -u -P gnat/lsp_server.gpr -p $(BUILD_FLAGS) s-memory.adb
$(GPRBUILD) -P gnat/lsp_server.gpr -p $(COVERAGE_BUILD_FLAGS) \
-XVERSION=$(VERSION) -XBUILD_DATE=$(BUILD_DATE)
$(GPRBUILD) -P gnat/codec_test.gpr -p $(COVERAGE_BUILD_FLAGS)
$(GPRBUILD) -P gnat/lsp_client.gpr -p $(COVERAGE_BUILD_FLAGS)
ifdef NODE
mkdir -p integration/vscode/ada/$(NODE_ARCH)/$(NODE_PLATFORM)
Expand All @@ -117,15 +116,12 @@ ifneq ($(COVERAGE),)
rm -rf .obj/*/gnatcov-instr
$(COVERAGE_INSTR) -XVERSION=$(VERSION) -XBUILD_DATE=$(BUILD_DATE) \
-Pgnat/lsp_server.gpr --projects lsp_server --projects lsp_3_17
$(COVERAGE_INSTR) -Pgnat/tester.gpr --projects lsp
$(COVERAGE_INSTR) -Pgnat/codec_test.gpr --projects lsp
endif

install:
gprinstall -f -P gnat/lsp_server.gpr -p -r --mode=usage \
--prefix=$(DESTDIR) $(LIBRARY_FLAGS)
gprinstall -f -P gnat/tester.gpr -p --prefix=$(DESTDIR) $(LIBRARY_FLAGS)
gprinstall -f -P gnat/codec_test.gpr -p --prefix=$(DESTDIR) $(LIBRARY_FLAGS)
gprinstall -f -P gnat/lsp_client.gpr -p -r \
--mode=dev \
--prefix=$(DESTDIR) \
Expand All @@ -140,7 +136,6 @@ clean:
-$(GPRCLEAN) -P gnat/lsp_3_17.gpr $(LIBRARY_FLAGS)
-$(GPRCLEAN) -P gnat/lsp_server.gpr $(LIBRARY_FLAGS)
-$(GPRCLEAN) -P gnat/tester.gpr $(LIBRARY_FLAGS)
-$(GPRCLEAN) -P gnat/codec_test.gpr $(LIBRARY_FLAGS)
-rm -rf integration/vscode/ada/$(NODE_ARCH)/$(NODE_PLATFORM)

vscode:
Expand Down Expand Up @@ -173,7 +168,6 @@ check: all
(cd `dirname $$a ` ; $(TESTER) `basename $$a`) ;\
done; \
fi
${CODEC_TEST} < testsuite/codecs/index.txt

deploy: check
integration/$(USER)/deploy.sh $(NODE_PLATFORM)
Expand Down
32 changes: 0 additions & 32 deletions gnat/codec_test.gpr

This file was deleted.

2 changes: 2 additions & 0 deletions gnat/lsp_3_17.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ project LSP_3_17 is

package Compiler is
for Default_Switches ("Ada") use Common_Ada_Switches & Ada_Switches;
for Switches ("lsp-inputs.adb") use
Common_Ada_Switches & Ada_Switches & ("-O0");
for Local_Configuration_Pragmas use "gnat.adc";
end Compiler;

Expand Down
4 changes: 2 additions & 2 deletions integration/vscode/ada/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integration/vscode/ada/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ada",
"displayName": "Language Support for Ada",
"description": "A Language Server providing Ada and SPARK support in Visual Studio Code",
"version": "23.0.999",
"version": "24.0.999",
"publisher": "AdaCore",
"license": "GPL-3.0",
"engines": {
Expand Down
18 changes: 3 additions & 15 deletions integration/vscode/ada/src/clients.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import * as vscode from 'vscode';
import { existsSync } from 'fs';
import * as vscode from 'vscode';
import {
Disposable,
ExecuteCommandRequest,
LanguageClient,
LanguageClientOptions,
ServerOptions,
} from 'vscode-languageclient/node';
import { mainLogChannel } from './extension';
import GnatTaskProvider from './gnatTaskProvider';
import GprTaskProvider from './gprTaskProvider';
import { getEvaluatedCustomEnv, logErrorAndThrow } from './helpers';
import { mainLogChannel } from './extension';
import { logErrorAndThrow } from './helpers';

export class ContextClients {
public readonly gprClient: LanguageClient;
Expand Down Expand Up @@ -147,18 +147,6 @@ function createClient(
// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used

// Retrieve the user's custom environment variables if specified in their
// settings/workspace: we'll then launch any child process with this custom
// environment
const custom_env = getEvaluatedCustomEnv();

if (custom_env) {
for (const var_name in custom_env) {
const var_value: string = custom_env[var_name];
process.env[var_name] = var_value;
}
}

// Options to control the server
const serverOptions: ServerOptions = {
run: { command: serverExecPath, args: extra },
Expand Down
15 changes: 12 additions & 3 deletions integration/vscode/ada/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ import { ContextClients } from './clients';
import { registerCommands } from './commands';
import { initializeDebugging } from './debugConfigProvider';
import { initializeTestView } from './gnattest';
import { assertSupportedEnvironments, getEvaluatedCustomEnv } from './helpers';
import {
assertSupportedEnvironments,
getEvaluatedCustomEnv,
setCustomEnvironment,
} from './helpers';

const ADA_CONTEXT = 'ADA_PROJECT_CONTEXT';
export let contextClients: ContextClients;
Expand All @@ -39,8 +43,6 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
mainLogChannel = vscode.window.createOutputChannel('Ada Extension');
mainLogChannel.appendLine('Starting Ada extension');

assertSupportedEnvironments(mainLogChannel);

// Log the environment that the extension (and all VS Code) will be using
const customEnv = getEvaluatedCustomEnv();

Expand All @@ -52,6 +54,13 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
}
}

// Set the custom environment into the current node process. This must be
// done before calling assertSupportedEnvironments in order to set the ALS
// environment variable if provided.
setCustomEnvironment();

assertSupportedEnvironments(mainLogChannel);

// Create the Ada and GPR clients.
contextClients = new ContextClients(context);

Expand Down
26 changes: 26 additions & 0 deletions integration/vscode/ada/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,33 @@ export function getEvaluatedCustomEnv() {
return custom_env;
}

/**
* Read the environment variables specified in the vscode setting
* `terminal.integrated.env.<os>` and set them in the current node process so
* that they become inherited by any child processes.
*/
export function setCustomEnvironment() {
// Retrieve the user's custom environment variables if specified in their
// settings/workspace: we'll then launch any child process with this custom
// environment
const custom_env = getEvaluatedCustomEnv();

if (custom_env) {
for (const var_name in custom_env) {
const var_value: string = custom_env[var_name];
process.env[var_name] = var_value;
}
}
}

export function assertSupportedEnvironments(mainChannel: vscode.OutputChannel) {
if (process.env.ALS) {
// The User provided an external ALS executable. Do not perform any
// platform support checks because we may be on an unsupported platform
// where the User built and provided ALS.
return;
}

type Env = {
arch: 'arm' | 'arm64' | 'x64';
platform: 'win32' | 'linux' | 'darwin';
Expand Down
Loading

0 comments on commit d5ee2f1

Please sign in to comment.