From b757801867d8545331b7e723f26a7c4c3b5e155f Mon Sep 17 00:00:00 2001 From: Aptivi Date: Sun, 13 Oct 2024 10:10:29 +0300 Subject: [PATCH] imp - Rolled out updated build scripts --- The build scripts have been updated. --- Type: imp Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- tools/build.sh | 50 +++++++++++++++++++++++++++++--------------- tools/docgen-pack.sh | 41 +++++++++++++++++++++++++++++------- tools/docgen.sh | 17 +++++++++++++++ tools/push.sh | 43 ++++++++++++++++++++++++------------- 4 files changed, 112 insertions(+), 39 deletions(-) diff --git a/tools/build.sh b/tools/build.sh index a1eadc6..b4e9951 100644 --- a/tools/build.sh +++ b/tools/build.sh @@ -1,5 +1,31 @@ #!/bin/bash +# VisualCard Copyright (C) 2021-2024 Aptivi +# +# This file is part of VisualCard +# +# VisualCard is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# VisualCard is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Convenience functions +checkerror() { + if [ $1 != 0 ] + then + printf "$2 - Error $1\n" >&2 + exit $1 + fi +} + # This script builds. Use when you have dotnet installed. releaseconf=$1 if [ -z $releaseconf ]; then @@ -8,27 +34,17 @@ fi # Check for dependencies dotnetpath=`which dotnet` -if [ ! $? == 0 ]; then - echo dotnet is not found. - exit 1 -fi +checkerror $? "dotnet is not found" # Download packages echo Downloading packages... -"$dotnetpath" restore "../VisualCard.sln" -p:Configuration=$releaseconf -if [ ! $? == 0 ]; then - echo Download failed. - exit 1 -fi +"$dotnetpath" restore "../VisualCard.sln" -p:Configuration=$releaseconf ${@:2} +checkerror $? "Failed to download packages" -# Build VisualCard -echo Building VisualCard... -"$dotnetpath" build "../VisualCard.sln" -p:Configuration=$releaseconf -if [ ! $? == 0 ]; then - echo Build failed. - exit 1 -fi +# Build +echo Building... +"$dotnetpath" build "../VisualCard.sln" -p:Configuration=$releaseconf ${@:2} +checkerror $? "Failed to build VisualCard" # Inform success echo Build successful. -exit 0 diff --git a/tools/docgen-pack.sh b/tools/docgen-pack.sh index 3eea554..aba2c3d 100644 --- a/tools/docgen-pack.sh +++ b/tools/docgen-pack.sh @@ -1,27 +1,52 @@ #!/bin/bash +# VisualCard Copyright (C) 2021-2024 Aptivi +# +# This file is part of VisualCard +# +# VisualCard is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# VisualCard is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Convenience functions +checkerror() { + if [ $1 != 0 ] + then + printf "$2 - Error $1\n" >&2 + exit $1 + fi +} + # This script builds KS and packs the artifacts. Use when you have MSBuild installed. ksversion=$(grep "" ../Directory.Build.props | cut -d "<" -f 2 | cut -d ">" -f 2) +checkerror $? "Failed to get version. Check to make sure that the version is specified correctly in D.B.props" # Check for dependencies zippath=`which zip` -if [ ! $? == 0 ]; then - echo zip is not found. - exit 1 -fi +checkerror $? "zip is not found" # Pack documentation echo Packing documentation... cd "../docs/" && "$zippath" -r /tmp/$ksversion-doc.zip . && cd - -if [ ! $? == 0 ]; then - echo Packing failed. - exit 1 -fi +checkerror $? "Failed to pack" # Inform success rm -rf "../DocGen/api" +checkerror $? "Failed to remove api folder" rm -rf "../DocGen/obj" +checkerror $? "Failed to remove obj folder" rm -rf "../docs" +checkerror $? "Failed to remove docs folder" mv /tmp/$ksversion-doc.zip . +checkerror $? "Failed to move archive from temporary folder" echo Pack successful. exit 0 diff --git a/tools/docgen.sh b/tools/docgen.sh index b650831..62e2051 100644 --- a/tools/docgen.sh +++ b/tools/docgen.sh @@ -1,5 +1,22 @@ #!/bin/bash +# VisualCard Copyright (C) 2021-2024 Aptivi +# +# This file is part of VisualCard +# +# VisualCard is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# VisualCard is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + # Check for dependencies msbuildpath=`which docfx` if [ ! $? == 0 ]; then diff --git a/tools/push.sh b/tools/push.sh index bb1e504..5f6f839 100644 --- a/tools/push.sh +++ b/tools/push.sh @@ -1,24 +1,39 @@ #!/bin/bash -# This script pushes. Use when you have dotnet installed. -releaseconf=$1 -if [ -z $releaseconf ]; then - releaseconf=Release -fi -# Check for dependencies +# VisualCard Copyright (C) 2021-2024 Aptivi +# +# This file is part of VisualCard +# +# VisualCard is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# VisualCard is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Convenience functions +checkerror() { + if [ $1 != 0 ] + then + printf "$2 - Error $1\n" >&2 + exit $1 + fi +} + +# This script pushes. Use when you have dotnet installed. dotnetpath=`which dotnet` -if [ ! $? == 0 ]; then - echo dotnet is not found. - exit 1 -fi +checkerror $? "dotnet is not found" # Push packages echo Pushing packages... find .. -type f -path "*/bin/$releaseconf/*.nupkg" -exec dotnet nuget push {} --api-key $NUGET_APIKEY --source "nuget.org" \; -if [ ! $? == 0 ]; then - echo Push failed. - exit 1 -fi +checkerror $? "Failed to push" # Inform success echo Push successful.