build: move build scripts and resources from src to build

This commit is contained in:
leo 2024-03-19 11:24:08 +08:00
parent 0f3e670dd4
commit b67cd693cd
11 changed files with 73 additions and 67 deletions

27
.gitignore vendored
View file

@ -1,9 +1,18 @@
.idea # IDE / System
.vs .idea
.vscode .vs
bin .vscode
build .DS_Store
obj
*.user # Output folders.
.DS_Store bin/
publish obj/
build/SourceGit/
build/SourceGit.app/
# Files
*.user
SourceGit.win-x64.zip
SourceGit.linux-x64.tar.gz
SourceGit.osx-x64.zip
SourceGit.osx-arm64.zip

View file

@ -37,8 +37,8 @@ You can download the latest stable from [Releases](https://github.com/sourcegit-
For **macOS** users: For **macOS** users:
* Download `SourceGit.macOS.zip` from Releases. * Download `SourceGit.osx-x64.zip` or `SourceGit.osx-arm64.zip` from Releases. `x64` for Intel and `arm64` for Apple Silicon.
* Choose the app that fits your system's CPU architecture and copy it to Applications. `x64` for Intel and `arm64` for Apple Silicon. * Move `SourceGit.app` to `Applications` folder.
* Make sure your mac trusts all software from anywhere. For more information, search `spctl --master-disable`. * Make sure your mac trusts all software from anywhere. For more information, search `spctl --master-disable`.
* You may need to run `sudo xattr -cr /Applications/SourceGit.app` to make sure the software works. * You may need to run `sudo xattr -cr /Applications/SourceGit.app` to make sure the software works.

6
build/build.linux.sh Normal file
View file

@ -0,0 +1,6 @@
#!/bin/sh
rm -rf SourceGit
dotnet publish ../src/SourceGit.csproj -c Release -r linux-x64 -o SourceGit -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
tar -zcvf SourceGit.linux-x64.tar.gz SourceGit --exclude=en --exclude=zh --exclude="*.dbg"
rm -rf SourceGit

17
build/build.osx.command Normal file
View file

@ -0,0 +1,17 @@
#!/bin/sh
rm -rf SourceGit.app
mkdir -p SourceGit.app/Contents/Resources
cp resources/App.plist SourceGit.app/Contents/Info.plist
cp resources/App.icns SourceGit.app/Contents/Resources/App.icns
mkdir -p SourceGit.app/Contents/MacOS
dotnet publish ../src/SourceGit.csproj -c Release -r osx-arm64 -o SourceGit.app/Contents/MacOS -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
zip SourceGit.osx-arm64.zip -r SourceGit -x "*/en/*" -x "*/zh/*" -x "*/*\.dsym/*"
rm -rf SourceGit.app/Contents/MacOS
mkdir -p SourceGit.app/Contents/MacOS
dotnet publish ../src/SourceGit.csproj -c Release -r osx-x64 -o SourceGit.app/Contents/MacOS -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
zip SourceGit.osx-arm64.zip -r SourceGit -x "*/en/*" -x "*/zh/*" -x "*/*\.dsym/*"

5
build/build.windows.bat Normal file
View file

@ -0,0 +1,5 @@
rmdir /S /Q SourceGit
dotnet publish ..\src\SourceGit.csproj -c Release -r win-x64 -o SourceGit -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
resources\7z.exe a SourceGit.win-x64.zip SourceGit "-xr!en/" "-xr!zh/" "-xr!*.pdb"
rmdir /S /Q SourceGit

BIN
build/resources/7z.exe Normal file

Binary file not shown.

View file

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>App.icns</string> <string>App.icns</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.sourcegit-scm.sourcegit</string> <string>com.sourcegit-scm.sourcegit</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>SourceGit</string> <string>SourceGit</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>8.4.0</string> <string>8.4.0</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>10.12</string> <string>10.12</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>SourceGit</string> <string>SourceGit</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>8.4</string> <string>8.4</string>
<key>NSHighResolutionCapable</key> <key>NSHighResolutionCapable</key>
<true/> <true/>
</dict> </dict>
</plist> </plist>

View file

@ -1,3 +0,0 @@
#!/bin/sh
dotnet publish -c Release -r linux-x64 -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained

View file

@ -1,27 +0,0 @@
#!/bin/sh
dotnet publish -c Release -r osx-x64 -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
dotnet publish -c Release -r osx-arm64 -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
rm -rf build
mkdir -p build/SourceGit
mkdir -p build/SourceGit/x64/SourceGit.app/Contents/MacOS
mkdir -p build/SourceGit/arm64/SourceGit.app/Contents/MacOS
mkdir -p build/SourceGit/x64/SourceGit.app/Contents/Resources
mkdir -p build/SourceGit/arm64/SourceGit.app/Contents/Resources
cp App.plist build/SourceGit/x64/SourceGit.app/Contents/Info.plist
cp App.plist build/SourceGit/arm64/SourceGit.app/Contents/Info.plist
cp App.icns build/SourceGit/x64/SourceGit.app/Contents/Resources/App.icns
cp App.icns build/SourceGit/arm64/SourceGit.app/Contents/Resources/App.icns
cp -r bin/Release/net8.0/osx-x64/publish/* build/SourceGit/x64/SourceGit.app/Contents/MacOS/
cp -r bin/Release/net8.0/osx-arm64/publish/* build/SourceGit/arm64/SourceGit.app/Contents/MacOS/
rm -rf build/SourceGit/x64/SourceGit.app/Contents/MacOS/SourceGit.dsym
rm -rf build/SourceGit/arm64/SourceGit.app/Contents/MacOS/SourceGit.dsym
cd build
zip SourceGit.macOS.zip -r SourceGit

View file

@ -1 +0,0 @@
dotnet publish -c Release -r win-x64 -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained