diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 99a3cd2..6154c0f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -129,3 +129,18 @@ pages: - public only: - main + +# Adds license-scanning job. Because Gitlab does not support pub.dev +# we added https://github.com/oss-review-toolkit/ort + +include: + - template: Security/License-Scanning.gitlab-ci.yml + +license_scanning: + stage: coverage + image: + name: "registry.gitlab.com/gitlab-org/security-products/analyzers/ort/ort:latest" + script: + - /opt/ort/bin/ort analyze -i $CI_PROJECT_DIR -o $CI_PROJECT_DIR/ --allow-dynamic-versions + - /opt/ort/bin/ort scan -i $CI_PROJECT_DIR/analyzer-result.yml -o $CI_PROJECT_DIR/ || true + - /opt/ort/bin/ort report -f GitLabLicenseModel -i $CI_PROJECT_DIR/scan-result.yml -o $CI_PROJECT_DIR/ diff --git a/lib/src/utils/run_in_background.dart b/lib/src/utils/run_in_background.dart index cbc5a40..8d837bb 100644 --- a/lib/src/utils/run_in_background.dart +++ b/lib/src/utils/run_in_background.dart @@ -21,7 +21,13 @@ import 'dart:async'; Future runInBackground( FutureOr Function(U arg) function, U arg) async { - final isolate = await IsolateRunner.spawn(); + IsolateRunner isolate; + try { + isolate = await IsolateRunner.spawn(); + } on UnsupportedError { + // web does not support isolates (yet), so we fall back to calling the method directly + return await function(arg); + } try { return await isolate.run(function, arg); } finally {