Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit f567f5a

Browse files
authored
[package_info] add support for macos to package_info plugin (#2618)
Shares implementation with iOS via symlinking. Fixes flutter/flutter#41727
1 parent ff3ed74 commit f567f5a

35 files changed

+1382
-33
lines changed

packages/package_info/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.1
2+
3+
* Add support for macOS.
4+
15
## 0.4.0+18
26

37
* Update lower bound of dart dependency to 2.1.0.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#import "FLTPackageInfoPlugin.h"
6+
7+
@implementation FLTPackageInfoPlugin
8+
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
9+
FlutterMethodChannel* channel =
10+
[FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/package_info"
11+
binaryMessenger:[registrar messenger]];
12+
FLTPackageInfoPlugin* instance = [[FLTPackageInfoPlugin alloc] init];
13+
[registrar addMethodCallDelegate:instance channel:channel];
14+
}
15+
16+
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
17+
if ([call.method isEqualToString:@"getAll"]) {
18+
result(@{
19+
@"appName" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]
20+
?: [NSNull null],
21+
@"packageName" : [[NSBundle mainBundle] bundleIdentifier] ?: [NSNull null],
22+
@"version" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
23+
?: [NSNull null],
24+
@"buildNumber" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
25+
?: [NSNull null],
26+
});
27+
} else {
28+
result(FlutterMethodNotImplemented);
29+
}
30+
}
31+
32+
@end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Flutter-related
2+
**/Flutter/ephemeral/
3+
**/Pods/
4+
5+
# Xcode-related
6+
**/xcuserdata/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"

packages/package_info/example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 653 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1000"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
18+
BuildableName = "Package Info Example.app"
19+
BlueprintName = "Runner"
20+
ReferencedContainer = "container:Runner.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<MacroExpansion>
31+
<BuildableReference
32+
BuildableIdentifier = "primary"
33+
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
34+
BuildableName = "Package Info Example.app"
35+
BlueprintName = "Runner"
36+
ReferencedContainer = "container:Runner.xcodeproj">
37+
</BuildableReference>
38+
</MacroExpansion>
39+
<Testables>
40+
<TestableReference
41+
skipped = "NO">
42+
<BuildableReference
43+
BuildableIdentifier = "primary"
44+
BlueprintIdentifier = "00380F9121DF178D00097171"
45+
BuildableName = "RunnerUITests.xctest"
46+
BlueprintName = "RunnerUITests"
47+
ReferencedContainer = "container:Runner.xcodeproj">
48+
</BuildableReference>
49+
</TestableReference>
50+
</Testables>
51+
</TestAction>
52+
<LaunchAction
53+
buildConfiguration = "Debug"
54+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
55+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
56+
launchStyle = "0"
57+
useCustomWorkingDirectory = "NO"
58+
ignoresPersistentStateOnLaunch = "NO"
59+
debugDocumentVersioning = "YES"
60+
debugServiceExtension = "internal"
61+
allowLocationSimulation = "YES">
62+
<BuildableProductRunnable
63+
runnableDebuggingMode = "0">
64+
<BuildableReference
65+
BuildableIdentifier = "primary"
66+
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
67+
BuildableName = "Package Info Example.app"
68+
BlueprintName = "Runner"
69+
ReferencedContainer = "container:Runner.xcodeproj">
70+
</BuildableReference>
71+
</BuildableProductRunnable>
72+
</LaunchAction>
73+
<ProfileAction
74+
buildConfiguration = "Release"
75+
shouldUseLaunchSchemeArgsEnv = "YES"
76+
savedToolIdentifier = ""
77+
useCustomWorkingDirectory = "NO"
78+
debugDocumentVersioning = "YES">
79+
<BuildableProductRunnable
80+
runnableDebuggingMode = "0">
81+
<BuildableReference
82+
BuildableIdentifier = "primary"
83+
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
84+
BuildableName = "Package Info Example.app"
85+
BlueprintName = "Runner"
86+
ReferencedContainer = "container:Runner.xcodeproj">
87+
</BuildableReference>
88+
</BuildableProductRunnable>
89+
</ProfileAction>
90+
<AnalyzeAction
91+
buildConfiguration = "Debug">
92+
</AnalyzeAction>
93+
<ArchiveAction
94+
buildConfiguration = "Release"
95+
revealArchiveInOrganizer = "YES">
96+
</ArchiveAction>
97+
</Scheme>

packages/package_info/example/macos/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

0 commit comments

Comments
 (0)