Explorar o código

Update macOS build

Ruben hai 9 meses
pai
achega
cec2ebca9b

+ 35 - 28
.github/workflows/BuildMacOS.yml

@@ -39,34 +39,41 @@ jobs:
         
         
       - name: Prepare and Sign arm64 App Bundle
       - name: Prepare and Sign arm64 App Bundle
         run: |
         run: |
-          # Create entitlements file
-          cat > entitlements.plist << EOF
-          <?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">
-          <plist version="1.0">
-          <dict>
-              <key>com.apple.security.cs.allow-jit</key>
-              <true/>
-              <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
-              <true/>
-              <key>com.apple.security.cs.disable-library-validation</key>
-              <true/>
-          </dict>
-          </plist>
-          EOF
-          
-          # Sign all dylibs and binaries
-          find "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app" -type f -name "*.dylib" -o -name "PicView.Avalonia.MacOS" | while read file; do
-            codesign --force --options runtime --sign - --entitlements entitlements.plist "$file"
-          done
-          
-          # Sign the app bundle
-          codesign --force --options runtime --sign - --entitlements entitlements.plist "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app"
-        
-      # Step 5: Create DMG for arm64
-      - name: Create DMG for arm64
-        run: |
-          hdiutil create -volname "PicView" -srcfolder "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app" -ov -format UDZO "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64.dmg"
+            # Create entitlements file
+            cat > entitlements.plist << EOF
+            <?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">
+            <plist version="1.0">
+            <dict>
+                <key>com.apple.security.cs.allow-jit</key>
+                <true/>
+                <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
+                <true/>
+                <key>com.apple.security.cs.disable-library-validation</key>
+                <true/>
+            </dict>
+            </plist>
+            EOF
+            
+            APP_PATH="${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app"
+            
+            # Verify bundle structure
+            if [ ! -f "$APP_PATH/Contents/Info.plist" ]; then
+              echo "Error: Info.plist not found in the expected location"
+              exit 1
+            fi
+            
+            # Sign all dylibs and binaries
+            find "$APP_PATH/Contents/MacOS" -type f \( -name "*.dylib" -o -name "PicView.Avalonia.MacOS" \) | while read file; do
+              codesign --force --options runtime --sign - --entitlements entitlements.plist "$file"
+            done
+            
+            # Sign the app bundle
+            codesign --force --options runtime --sign - --entitlements entitlements.plist "$APP_PATH"
+              # Step 5: Create DMG for arm64
+              - name: Create DMG for arm64
+                run: |
+                  hdiutil create -volname "PicView" -srcfolder "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app" -ov -format UDZO "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64.dmg"
 
 
 
 
       # Step 6: Upload arm64 artifacts
       # Step 6: Upload arm64 artifacts

+ 4 - 1
Build/Build Avalonia.MacOS.ps1

@@ -60,6 +60,7 @@ New-Item -ItemType Directory -Force -Path $macOSPath
 New-Item -ItemType Directory -Force -Path $resourcesPath
 New-Item -ItemType Directory -Force -Path $resourcesPath
 
 
 # Create Info.plist
 # Create Info.plist
+$infoPlistPath = Join-Path -Path $contentsPath -ChildPath "Info.plist"  # Add this line to specify the correct path
 $infoPlistContent = @"
 $infoPlistContent = @"
 <?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">
@@ -78,7 +79,7 @@ $infoPlistContent = @"
     <key>CFBundleSignature</key>
     <key>CFBundleSignature</key>
     <string>????</string>
     <string>????</string>
     <key>CFBundleExecutable</key>
     <key>CFBundleExecutable</key>
-    <string>PicView.Avalonia.MacOS</string>
+    <string>PicView</string>
     <key>CFBundleIconFile</key>
     <key>CFBundleIconFile</key>
     <string>AppIcon.icns</string>
     <string>AppIcon.icns</string>
     <key>CFBundleShortVersionString</key>
     <key>CFBundleShortVersionString</key>
@@ -97,6 +98,8 @@ $infoPlistContent = @"
     </array>
     </array>
     <key>NSRequiresAquaSystemAppearance</key>
     <key>NSRequiresAquaSystemAppearance</key>
     <false/>
     <false/>
+	<key>LSApplicationCategoryType</key>
+    <string>public.app-category.graphics-design</string>
 </dict>
 </dict>
 </plist>
 </plist>
 "@
 "@

+ 2 - 3
src/PicView.Avalonia.MacOS/PicView.Avalonia.MacOS.csproj

@@ -1,9 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
   <PropertyGroup>
     <OutputType>WinExe</OutputType>
     <OutputType>WinExe</OutputType>
-    <!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
-    One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.-->
-    <TargetFramework>net9.0</TargetFramework>
+	<TargetFramework>net9.0</TargetFramework>
     <Platforms>x64;arm64</Platforms>
     <Platforms>x64;arm64</Platforms>
     <Nullable>enable</Nullable>
     <Nullable>enable</Nullable>
     <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
     <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
@@ -20,6 +18,7 @@
     <Copyright>© Ruben Hyldgaard Negendahl</Copyright>
     <Copyright>© Ruben Hyldgaard Negendahl</Copyright>
     <ImplicitUsings>enable</ImplicitUsings>
     <ImplicitUsings>enable</ImplicitUsings>
     <Product>PicView</Product>
     <Product>PicView</Product>
+    <AssemblyName>PicView</AssemblyName>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
     <DebugType>none</DebugType>
     <DebugType>none</DebugType>