-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.sh
executable file
·82 lines (65 loc) · 3.44 KB
/
dev.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# PREREQ:
# Ensure you've run `setup.sh` at least once before running this
# This script will be run many times as you develop.
# Anytime you need to test a change with new code you've written
# locally, you should run this script.
#
# It will...
# 1. build all the projects that result in Nuget packages,
# 2. publish them locally to the local package feed
# 3. update the local templates
# 4. install the latest CLI globally
# 5. invalidate the nuget cache for local beamable dev packages, which
# means that downstream projects will need to run a `dotnet restore`.
echo "Hello, you stalwart Beamable"
# the .dev.env file hosts some common variables
source ./.dev.env
# construct a build number
NEXT_BUILD_NUMBER=`cat build-number.txt`
PREVIOUS_BUILD_NUMBER=$NEXT_BUILD_NUMBER
((NEXT_BUILD_NUMBER+=1))
echo $NEXT_BUILD_NUMBER > build-number.txt
# the version is the nuget package version that will be built
VERSION=0.0.123.$NEXT_BUILD_NUMBER
PREVIOUS_VERSION=0.0.123.$PREVIOUS_BUILD_NUMBER
# the build solution only has references to the projects that we actually want to publish
SOLUTION=./build/LocalBuild/LocalBuild.sln
TMP_BUILD_OUTPUT="TempBuild"
BUILD_ARGS="--configuration Release -p:PackageVersion=$VERSION -p:CombinedVersion=$VERSION -p:InformationalVersion=$VERSION -p:Warn=0" #-
PACK_ARGS="--configuration Release --no-build -o $TMP_BUILD_OUTPUT -p:PackageVersion=$VERSION -p:CombinedVersion=$VERSION -p:InformationalVersion=$VERSION -p:SKIP_GENERATION=true"
PUSH_ARGS="--source $FEED_NAME"
dotnet restore $SOLUTION
dotnet build $SOLUTION $BUILD_ARGS
dotnet build cli/beamable.common -t:CopyCodeToUnity -p:BEAM_COPY_CODE_TO_UNITY=true
dotnet build cli/beamable.server.common -t:CopyCodeToUnity -p:BEAM_COPY_CODE_TO_UNITY=true
dotnet pack $SOLUTION $PACK_ARGS
dotnet nuget push $TMP_BUILD_OUTPUT/*.$VERSION.nupkg $PUSH_ARGS
# remove the old package from the nuget feed, so that we don't accumulate millions of packages over time.
DELETE_ARGS="$PREVIOUS_VERSION --source $FEED_NAME --non-interactive"
echo "Deleting package! ------ $DELETE_ARGS"
dotnet nuget delete Beamable.Common $DELETE_ARGS
dotnet nuget delete Beamable.Server.Common $DELETE_ARGS
dotnet nuget delete Beamable.Microservice.Runtime $DELETE_ARGS
dotnet nuget delete Beamable.Microservice.SourceGen $DELETE_ARGS
dotnet nuget delete Beamable.Tooling.Common $DELETE_ARGS
dotnet nuget delete Beamable.UnityEngine $DELETE_ARGS
dotnet nuget delete Beamable.UnityEngine.Addressables $DELETE_ARGS
dotnet nuget delete Beamable.Tools $DELETE_ARGS
# install the latest templates.
# frustratingly, it seems like the version of the install command
# that accepts a nuget feed does not work for local package feeds.
dotnet new uninstall Beamable.Templates || true
dotnet new install $TMP_BUILD_OUTPUT/Beamable.Templates.$VERSION.nupkg --force
# clean up the build artifacts...
rm -rf $TMP_BUILD_OUTPUT
# remove the cache keys for beamable projects. This makes them break until a restore operation happens.
rm -rf $HOME/.nuget/packages/beamable.*/$PREVIOUS_VERSION
# install the latest CLI globally.
dotnet tool install Beamable.Tools --version $VERSION --global --allow-downgrade --no-cache
# restore the nuget packages (and CLI) for a sample project, thus restoring the
# nuget-cache for all projects.
cd cli/beamable.templates/templates/BeamService
dotnet tool update Beamable.Tools --version $VERSION --allow-downgrade
dotnet restore BeamService.csproj --no-cache --force
# TODO: update the unreal sandbox