Skip to content

Commit

Permalink
imp - Rolled out updated build scripts
Browse files Browse the repository at this point in the history
---

The build scripts have been updated.

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Oct 13, 2024
1 parent b5413f1 commit 1c9163e
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 47 deletions.
58 changes: 33 additions & 25 deletions tools/build.sh
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.

# 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
Expand All @@ -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
41 changes: 33 additions & 8 deletions tools/docgen-pack.sh
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.

# 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 "<Version>" ../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
17 changes: 17 additions & 0 deletions tools/docgen.sh
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.

# Check for dependencies
msbuildpath=`which docfx`
if [ ! $? == 0 ]; then
Expand Down
43 changes: 29 additions & 14 deletions tools/push.sh
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.

# 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.
Expand Down

0 comments on commit 1c9163e

Please # to comment.