From be6798ff61188b70b38702b20af1947a7b8cebbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klemen=20Tu=C5=A1ar?= Date: Mon, 21 Mar 2022 22:42:23 +0000 Subject: [PATCH] :wrench: Update build script --- build.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index f5aaefe..e350056 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,23 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash + +# Function to build header +oss_header() { + first=$(printf '%.s#' {1..78}) + second=$( + printf '##' + printf '%.s ' {1..74} + printf '##' + ) + third=$( + printf '##' + printf '%.s ' {1..27} + printf 'OPEN-SOURCE LICENSES' + printf '%.s ' {1..27} + printf '##' + ) + printf "\n\n%s\n%s\n%s\n%s\n%s\n\n" "$first" "$second" "$third" "$second" "$first" +} + if [ -d "build/dist" ]; then rm -rf build/dist fi @@ -9,4 +28,12 @@ fi mkdir -p build/dist build/debug_info cp -r info.plist assets/* LICENSE README.md build/dist -dart compile exe bin/main.dart -o build/dist/docs -S build/debug_info/docs \ No newline at end of file + +if command -v dart-pubspec-licenses-lite; then + oss_header >>build/dist/LICENSE + dart-pubspec-licenses-lite --pubspec-lock pubspec.lock >>build/dist/LICENSE +else + echo 'Info: Unable to generate OSS LICENSES. Please install https://github.com/techouse/dart_pubspec_licenses_lite' +fi + +dart compile exe bin/main.dart -o build/dist/docs -S build/debug_info/docs