add support for dart as a hook language

This commit is contained in:
Anthony Sottile 2021-08-28 18:44:34 -04:00
parent 0f08ba77c8
commit f8e21cb78b
19 changed files with 227 additions and 29 deletions

View file

@ -2,9 +2,9 @@
import sys
LANGUAGES = [
'conda', 'coursier', 'docker', 'docker_image', 'dotnet', 'fail', 'golang',
'node', 'perl', 'pygrep', 'python', 'r', 'ruby', 'rust', 'script',
'swift', 'system',
'conda', 'coursier', 'dart', 'docker', 'docker_image', 'dotnet', 'fail',
'golang', 'node', 'perl', 'pygrep', 'python', 'r', 'ruby', 'rust',
'script', 'swift', 'system',
]
FIELDS = [
'ENVIRONMENT_DIR', 'get_default_version', 'healthy', 'install_environment',

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# This is a script used in CI to install coursier
set -euxo pipefail
set -euo pipefail
COURSIER_URL="https://github.com/coursier/coursier/releases/download/v2.0.0/cs-x86_64-pc-linux"
COURSIER_HASH="e2e838b75bc71b16bcb77ce951ad65660c89bda7957c79a0628ec7146d35122f"
@ -11,3 +11,5 @@ rm -f "$ARTIFACT"
curl --location --silent --output "$ARTIFACT" "$COURSIER_URL"
echo "$COURSIER_HASH $ARTIFACT" | sha256sum --check
chmod ugo+x /tmp/coursier/cs
echo '##vso[task.prependpath]/tmp/coursier'

17
testing/get-dart.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
VERSION=2.13.4
if [ "$OSTYPE" = msys ]; then
URL="https://storage.googleapis.com/dart-archive/channels/stable/release/${VERSION}/sdk/dartsdk-windows-x64-release.zip"
echo "##vso[task.prependpath]$(cygpath -w /tmp/dart-sdk/bin)"
else
URL="https://storage.googleapis.com/dart-archive/channels/stable/release/${VERSION}/sdk/dartsdk-linux-x64-release.zip"
echo '##vso[task.prependpath]/tmp/dart-sdk/bin'
fi
curl --silent --location --output /tmp/dart.zip "$URL"
unzip -q -d /tmp /tmp/dart.zip
rm /tmp/dart.zip

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# This is a script used in CI to install swift
set -euxo pipefail
set -euo pipefail
. /etc/lsb-release
if [ "$DISTRIB_CODENAME" = "bionic" ]; then
@ -25,3 +25,5 @@ fi
mkdir -p /tmp/swift
tar -xf "$TGZ" --strip 1 --directory /tmp/swift
echo '##vso[task.prependpath]/tmp/swift/usr/bin'

View file

@ -0,0 +1,4 @@
- id: hello-world-dart
name: hello world dart
entry: hello-world-dart
language: dart

View file

@ -0,0 +1,6 @@
import 'package:ansicolor/ansicolor.dart';
void main() {
AnsiPen pen = new AnsiPen()..red();
print("hello hello " + pen("world"));
}

View file

@ -0,0 +1,10 @@
environment:
sdk: '>=2.10.0 <3.0.0'
name: hello_world_dart
executables:
hello-world-dart:
dependencies:
ansicolor: ^2.0.1

View file

@ -1,4 +1,4 @@
- id: dotnet example hook
- id: dotnet-example-hook
name: dotnet example hook
entry: testeroni
language: dotnet

View file

@ -1,4 +1,4 @@
- id: dotnet example hook
- id: dotnet-example-hook
name: dotnet example hook
entry: testeroni
language: dotnet