-
Notifications
You must be signed in to change notification settings - Fork 173
/
aspnet_pack.sh
86 lines (70 loc) · 3.13 KB
/
aspnet_pack.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
83
84
85
86
#!/usr/bin/env sh
set -e
echo "======================================="
echo "= JR Cms .NET ! packer ="
echo "======================================="
echo 'Warning: plese make sure build project JR.Cms.AspNet.App first. '
RELEASE_DIR=$(pwd)/out/aspnet
echo "setup1: prepare.." \
&& rm -rf out && mkdir -p ${RELEASE_DIR} \
&& cd src/NetFx/JR.Cms.AspNet.App
if [ $(uname) != 'Windows' ]; then
echo "build on others system:"$(uname)
rm -rf bin
fi
# copy assets from project: jr.cms.app
cp -r ../../JR.Cms.App/install ../../JR.Cms.App/oem \
../../JR.Cms.App/public ../../JR.Cms.App/templates \
../../JR.Cms.App/root .
echo "setup2: building.." && \
#xbuild *.csproj /p:Configuration=Release
mkdir ${RELEASE_DIR}/root \
&& cp -r root/*.md ${RELEASE_DIR}/root \
&& mkdir ${RELEASE_DIR}/templates \
&& cp -r templates/default ${RELEASE_DIR}/templates \
&& cp -r public oem install plugins ${RELEASE_DIR} \
&& cp Global.asax Web.config ${RELEASE_DIR}
# optimize Web.config file
sed -i 's/compilation debug="true"/compilation debug="false"/g' Web.config \
&& sed -i 's/\s*targetFramework="[^"]*"//g' Web.config
# if bin folder not exists. such on linux platform, use prebuild dll files to package.
if [ -d bin ];then
cp -r bin ${RELEASE_DIR}
else
echo 'package on others system'
mkdir ${RELEASE_DIR}/bin \
&& cd ${RELEASE_DIR}/bin \
&& unzip ../../../dll/aspnet_bin.zip >/dev/null
# clear history version
rm -rf JR.Cms.dll JR.Stand.*
# replace cms core dll
# 需要注意在vs下,可能会拷贝到其他目录的dll
find ../../../src/JR.Cms.App/bin/Release -name "JR*.dll" | xargs -I {} cp {} .
# remove net core entrypoint dll
rm -rf JR.Cms.App.dll
fi
cd ${RELEASE_DIR} \
&& echo "setup3: clean assemblies.." \
&& cd bin && rm -rf *.pdb *.xml *.json *.config roslyn zh-Hans \
System.Text.Encoding.CodePages.dll \
Microsoft.Extensions.DependencyInjection.Abstractions.dll \
Google.Protobuf.dll Microsoft.DotNet.PlatformAbstractions.dll \
Microsoft.Extensions.WebEncoders.dll Microsoft.Extensions.Options.dll \
Microsoft.Extensions.ObjectPool.dll Microsoft.Extensions.Localization* \
Microsoft.Extensions.FileProviders.Abstractions.dll Microsoft.Extensions.Dependency* \
Microsoft.Extensions.Configuration.Abstractions.dll Microsoft.Extensions.Caching* \
Microsoft.Win32.Registry.dll Microsoft.Web.Infrastructure.dll Microsoft.Net.Http.Headers.dll \
Microsoft.AspNetCore.WebUtilities.dll \
Microsoft.AspNetCore.JsonPatch.dll Microsoft.AspNetCore.Http.Extensions.dll \
Microsoft.AspNetCore.Http.dll Microsoft.AspNetCore.Http.Abstractions.dll \
Microsoft.AspNetCore.Html.Abstractions.dll Microsoft.AspNetCore.Hosting* \
Microsoft.AspNetCore.A* Microsoft.AspNetCore.C* Microsoft.AspNetCore.D* \
Microsoft.AspNetCore.Mvc* Microsoft.AspNetCore.M* Microsoft.AspNetCore.R*
echo 'setup4: upgrade dll..' \
&& cp ../../../dll/aspnet/* . \
&& cp ../../../dll/fx/* . \
&& cd ..
echo 'setup5: packing..' \
&& cp ../../LICENSE ../../README.md . \
&& tar czf ../../jrcms-aspnet-latest.tar.gz *
echo "package finished!"