Skip to content

Commit 51c4e60

Browse files
committed
修复在mac下无法读取用户目录&&添加mac的构建
1 parent 8629743 commit 51c4e60

File tree

8 files changed

+140
-4
lines changed

8 files changed

+140
-4
lines changed

.github/workflows/build-macos.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build macOS Release
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
build-macos:
7+
name: Build macOS Release
8+
runs-on: macos-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
- name: Set up Flutter
13+
uses: subosito/flutter-action@v2
14+
with:
15+
cache: true
16+
channel: stable
17+
flutter-version-file: pubspec.yaml
18+
- name: Install dependencies
19+
run: flutter pub get
20+
- name: Build macOS release
21+
run: flutter build macos --release
22+
- name: Upload macOS artifact
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: macos-release
26+
path: build/macos/Build/Products/Release/
27+
overwrite: true
28+
compression-level: 9
29+
retention-days: 90
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "ephemeral/Flutter-Generated.xcconfig"

macos/Runner.xcodeproj/project.pbxproj

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
2828
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
2929
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
30+
8ABE830B14B9632FE931803C /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2F2FD4C96CC78C752004D04 /* Pods_RunnerTests.framework */; };
31+
B16FD1A113AD7A7A125FDF6A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1720A61F27D5B0DA9A0328E /* Pods_Runner.framework */; };
3032
/* End PBXBuildFile section */
3133

3234
/* Begin PBXContainerItemProxy section */
@@ -60,11 +62,14 @@
6062
/* End PBXCopyFilesBuildPhase section */
6163

6264
/* Begin PBXFileReference section */
65+
0A7AEF751C8D6429BAD3E42A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
66+
250D47CBBA8A186E10DD411B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
67+
2BC75127C00470001C3B120D /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
6368
331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
6469
331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
6570
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
6671
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
67-
33CC10ED2044A3C60003C045 /* git_switcher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "git_switcher.app"; sourceTree = BUILT_PRODUCTS_DIR; };
72+
33CC10ED2044A3C60003C045 /* git_switcher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = git_switcher.app; sourceTree = BUILT_PRODUCTS_DIR; };
6873
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
6974
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
7075
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
@@ -76,22 +81,29 @@
7681
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
7782
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
7883
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
84+
3893F1E1DB69551E2597459A /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
85+
59B019D372F7AEB536A2A367 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
7986
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
87+
8BB8F4D26C27CCFDC712B0A1 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
8088
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
89+
A1720A61F27D5B0DA9A0328E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
90+
A2F2FD4C96CC78C752004D04 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8191
/* End PBXFileReference section */
8292

8393
/* Begin PBXFrameworksBuildPhase section */
8494
331C80D2294CF70F00263BE5 /* Frameworks */ = {
8595
isa = PBXFrameworksBuildPhase;
8696
buildActionMask = 2147483647;
8797
files = (
98+
8ABE830B14B9632FE931803C /* Pods_RunnerTests.framework in Frameworks */,
8899
);
89100
runOnlyForDeploymentPostprocessing = 0;
90101
};
91102
33CC10EA2044A3C60003C045 /* Frameworks */ = {
92103
isa = PBXFrameworksBuildPhase;
93104
buildActionMask = 2147483647;
94105
files = (
106+
B16FD1A113AD7A7A125FDF6A /* Pods_Runner.framework in Frameworks */,
95107
);
96108
runOnlyForDeploymentPostprocessing = 0;
97109
};
@@ -125,6 +137,7 @@
125137
331C80D6294CF71000263BE5 /* RunnerTests */,
126138
33CC10EE2044A3C60003C045 /* Products */,
127139
D73912EC22F37F3D000D13A0 /* Frameworks */,
140+
982379C87785ECCF2C7D0AE6 /* Pods */,
128141
);
129142
sourceTree = "<group>";
130143
};
@@ -172,9 +185,25 @@
172185
path = Runner;
173186
sourceTree = "<group>";
174187
};
188+
982379C87785ECCF2C7D0AE6 /* Pods */ = {
189+
isa = PBXGroup;
190+
children = (
191+
0A7AEF751C8D6429BAD3E42A /* Pods-Runner.debug.xcconfig */,
192+
2BC75127C00470001C3B120D /* Pods-Runner.release.xcconfig */,
193+
250D47CBBA8A186E10DD411B /* Pods-Runner.profile.xcconfig */,
194+
3893F1E1DB69551E2597459A /* Pods-RunnerTests.debug.xcconfig */,
195+
8BB8F4D26C27CCFDC712B0A1 /* Pods-RunnerTests.release.xcconfig */,
196+
59B019D372F7AEB536A2A367 /* Pods-RunnerTests.profile.xcconfig */,
197+
);
198+
name = Pods;
199+
path = Pods;
200+
sourceTree = "<group>";
201+
};
175202
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
176203
isa = PBXGroup;
177204
children = (
205+
A1720A61F27D5B0DA9A0328E /* Pods_Runner.framework */,
206+
A2F2FD4C96CC78C752004D04 /* Pods_RunnerTests.framework */,
178207
);
179208
name = Frameworks;
180209
sourceTree = "<group>";
@@ -186,6 +215,7 @@
186215
isa = PBXNativeTarget;
187216
buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
188217
buildPhases = (
218+
D2D7E4E68326A4C83BCCFBBB /* [CP] Check Pods Manifest.lock */,
189219
331C80D1294CF70F00263BE5 /* Sources */,
190220
331C80D2294CF70F00263BE5 /* Frameworks */,
191221
331C80D3294CF70F00263BE5 /* Resources */,
@@ -204,11 +234,13 @@
204234
isa = PBXNativeTarget;
205235
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
206236
buildPhases = (
237+
940BE326FC3EE3C06A404580 /* [CP] Check Pods Manifest.lock */,
207238
33CC10E92044A3C60003C045 /* Sources */,
208239
33CC10EA2044A3C60003C045 /* Frameworks */,
209240
33CC10EB2044A3C60003C045 /* Resources */,
210241
33CC110E2044A8840003C045 /* Bundle Framework */,
211242
3399D490228B24CF009A79C7 /* ShellScript */,
243+
AA3E9D1D4EC4DDB1014C6A4C /* [CP] Embed Pods Frameworks */,
212244
);
213245
buildRules = (
214246
);
@@ -329,6 +361,67 @@
329361
shellPath = /bin/sh;
330362
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
331363
};
364+
940BE326FC3EE3C06A404580 /* [CP] Check Pods Manifest.lock */ = {
365+
isa = PBXShellScriptBuildPhase;
366+
buildActionMask = 2147483647;
367+
files = (
368+
);
369+
inputFileListPaths = (
370+
);
371+
inputPaths = (
372+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
373+
"${PODS_ROOT}/Manifest.lock",
374+
);
375+
name = "[CP] Check Pods Manifest.lock";
376+
outputFileListPaths = (
377+
);
378+
outputPaths = (
379+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
380+
);
381+
runOnlyForDeploymentPostprocessing = 0;
382+
shellPath = /bin/sh;
383+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
384+
showEnvVarsInLog = 0;
385+
};
386+
AA3E9D1D4EC4DDB1014C6A4C /* [CP] Embed Pods Frameworks */ = {
387+
isa = PBXShellScriptBuildPhase;
388+
buildActionMask = 2147483647;
389+
files = (
390+
);
391+
inputFileListPaths = (
392+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
393+
);
394+
name = "[CP] Embed Pods Frameworks";
395+
outputFileListPaths = (
396+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
397+
);
398+
runOnlyForDeploymentPostprocessing = 0;
399+
shellPath = /bin/sh;
400+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
401+
showEnvVarsInLog = 0;
402+
};
403+
D2D7E4E68326A4C83BCCFBBB /* [CP] Check Pods Manifest.lock */ = {
404+
isa = PBXShellScriptBuildPhase;
405+
buildActionMask = 2147483647;
406+
files = (
407+
);
408+
inputFileListPaths = (
409+
);
410+
inputPaths = (
411+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
412+
"${PODS_ROOT}/Manifest.lock",
413+
);
414+
name = "[CP] Check Pods Manifest.lock";
415+
outputFileListPaths = (
416+
);
417+
outputPaths = (
418+
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
419+
);
420+
runOnlyForDeploymentPostprocessing = 0;
421+
shellPath = /bin/sh;
422+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
423+
showEnvVarsInLog = 0;
424+
};
332425
/* End PBXShellScriptBuildPhase section */
333426

334427
/* Begin PBXSourcesBuildPhase section */
@@ -380,6 +473,7 @@
380473
/* Begin XCBuildConfiguration section */
381474
331C80DB294CF71000263BE5 /* Debug */ = {
382475
isa = XCBuildConfiguration;
476+
baseConfigurationReference = 3893F1E1DB69551E2597459A /* Pods-RunnerTests.debug.xcconfig */;
383477
buildSettings = {
384478
BUNDLE_LOADER = "$(TEST_HOST)";
385479
CURRENT_PROJECT_VERSION = 1;
@@ -394,6 +488,7 @@
394488
};
395489
331C80DC294CF71000263BE5 /* Release */ = {
396490
isa = XCBuildConfiguration;
491+
baseConfigurationReference = 8BB8F4D26C27CCFDC712B0A1 /* Pods-RunnerTests.release.xcconfig */;
397492
buildSettings = {
398493
BUNDLE_LOADER = "$(TEST_HOST)";
399494
CURRENT_PROJECT_VERSION = 1;
@@ -408,6 +503,7 @@
408503
};
409504
331C80DD294CF71000263BE5 /* Profile */ = {
410505
isa = XCBuildConfiguration;
506+
baseConfigurationReference = 59B019D372F7AEB536A2A367 /* Pods-RunnerTests.profile.xcconfig */;
411507
buildSettings = {
412508
BUNDLE_LOADER = "$(TEST_HOST)";
413509
CURRENT_PROJECT_VERSION = 1;

macos/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

macos/Runner/DebugProfile.entitlements

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>com.apple.security.app-sandbox</key>
6-
<true/>
6+
<false/>
77
<key>com.apple.security.cs.allow-jit</key>
88
<true/>
99
<key>com.apple.security.network.server</key>

macos/Runner/Info.plist

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,11 @@
2828
<string>MainMenu</string>
2929
<key>NSPrincipalClass</key>
3030
<string>NSApplication</string>
31+
<key>NSDocumentsFolderUsageDescription</key>
32+
<string>需要访问您的文档文件夹以管理Git配置文件</string>
33+
<key>NSDesktopFolderUsageDescription</key>
34+
<string>需要访问您的桌面文件夹以管理Git配置文件</string>
35+
<key>NSDownloadsFolderUsageDescription</key>
36+
<string>需要访问您的下载文件夹以管理Git配置文件</string>
3137
</dict>
32-
</plist>
38+
</plist>

macos/Runner/Release.entitlements

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>com.apple.security.app-sandbox</key>
6-
<true/>
6+
<false/>
77
<key>com.apple.security.files.user-selected.read-write</key>
88
<true/>
99
</dict>

0 commit comments

Comments
 (0)