From 1c9163ed2925373b5ae3934d10336fa90eba5bbb Mon Sep 17 00:00:00 2001 From: Aptivi Date: Sun, 13 Oct 2024 10:10:33 +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 | 58 +++++++++++++++++++++++++------------------- tools/docgen-pack.sh | 41 +++++++++++++++++++++++++------ tools/docgen.sh | 17 +++++++++++++ tools/push.sh | 43 +++++++++++++++++++++----------- 4 files changed, 112 insertions(+), 47 deletions(-) diff --git a/tools/build.sh b/tools/build.sh index da922f2..a0daa2d 100644 --- a/tools/build.sh +++ b/tools/build.sh @@ -1,5 +1,31 @@ #!/bin/bash +# Nettify Copyright (C) 2023-2024 Aptivi +# +# This file is part of Nettify +# +# Nettify 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. +# +# Nettify 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,35 +34,17 @@ fi # Check for dependencies dotnetpath=`which dotnet` -if [ ! $? == 0 ]; then - echo dotnet is not found. - exit 1 -fi - -# Download ISP info -echo Downloading ISP info... -bash ../Nettify/assets/IspInfo/getispinfo.sh -if [ ! $? == 0 ]; then - echo Download failed. - exit 1 -fi +checkerror $? "dotnet is not found" # Download packages echo Downloading packages... -"$dotnetpath" restore "../Nettify.sln" -p:Configuration=$releaseconf -if [ ! $? == 0 ]; then - echo Download failed. - exit 1 -fi +"$dotnetpath" restore "../Nettify.sln" -p:Configuration=$releaseconf ${@:2} +checkerror $? "Failed to download packages" -# Build Nettify -echo Building Nettify... -"$dotnetpath" build "../Nettify.sln" -p:Configuration=$releaseconf -if [ ! $? == 0 ]; then - echo Build failed. - exit 1 -fi +# Build +echo Building... +"$dotnetpath" build "../Nettify.sln" -p:Configuration=$releaseconf ${@:2} +checkerror $? "Failed to build Nettify" # Inform success echo Build successful. -exit 0 diff --git a/tools/docgen-pack.sh b/tools/docgen-pack.sh index 3eea554..da5576b 100644 --- a/tools/docgen-pack.sh +++ b/tools/docgen-pack.sh @@ -1,27 +1,52 @@ #!/bin/bash +# Nettify Copyright (C) 2023-2024 Aptivi +# +# This file is part of Nettify +# +# Nettify 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. +# +# Nettify 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..996d3f3 100644 --- a/tools/docgen.sh +++ b/tools/docgen.sh @@ -1,5 +1,22 @@ #!/bin/bash +# Nettify Copyright (C) 2023-2024 Aptivi +# +# This file is part of Nettify +# +# Nettify 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. +# +# Nettify 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..26c9479 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 +# Nettify Copyright (C) 2023-2024 Aptivi +# +# This file is part of Nettify +# +# Nettify 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. +# +# Nettify 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.