Skip to content

Commit e6d76d9

Browse files
committed
Update configurations
1 parent 202b96d commit e6d76d9

File tree

10 files changed

+59
-21
lines changed

10 files changed

+59
-21
lines changed

Config.debug.xcconfig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#include "Version.xcconfig"
22
SLASH = /
33

4-
PRODUCT_NAME = Copilot for Xcode Dev
54
HOST_APP_NAME = Copilot for Xcode Dev
65
BUNDLE_IDENTIFIER_BASE = dev.com.intii.CopilotForXcode
7-
EXTENSION_BUNDLE_NAME = Copilot Dev
86
SPARKLE_FEED_URL = http:$(SLASH)$(SLASH)127.0.0.1:9433/appcast.xml
97
SPARKLE_PUBLIC_KEY = WDzm5GHnc6c8kjeJEgX5GuGiPpW6Lc/ovGjLnrrZvPY=
108
APPLICATION_SUPPORT_FOLDER = dev.com.intii.CopilotForXcode
9+
EXTENSION_BUNDLE_NAME = Copilot
10+
EXTENSION_BUNDLE_DISPLAY_NAME = Copilot Dev
11+
EXTENSION_SERVICE_NAME = CopilotForXcodeExtensionService
12+
13+
// see also target Configs

Config.xcconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ SLASH = /
33

44
HOST_APP_NAME = Copilot for Xcode
55
BUNDLE_IDENTIFIER_BASE = com.intii.CopilotForXcode
6-
EXTENSION_BUNDLE_NAME = Copilot
76
SPARKLE_FEED_URL = https:$(SLASH)$(SLASH)raw.githubusercontent.com/intitni/CopilotForXcode/main/appcast.xml
87
SPARKLE_PUBLIC_KEY = WDzm5GHnc6c8kjeJEgX5GuGiPpW6Lc/ovGjLnrrZvPY=
98
APPLICATION_SUPPORT_FOLDER = com.intii.CopilotForXcode
9+
EXTENSION_BUNDLE_NAME = Copilot
10+
EXTENSION_BUNDLE_DISPLAY_NAME = Copilot
11+
EXTENSION_SERVICE_NAME = CopilotForXcodeExtensionService
12+
13+
// see also target Configs

Copilot for Xcode.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@
754754
MARKETING_VERSION = "$(APP_VERSION)";
755755
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_IDENTIFIER_BASE)";
756756
PRODUCT_MODULE_NAME = Copilot_for_Xcode;
757-
PRODUCT_NAME = "Copilot for Xcode Dev";
757+
PRODUCT_NAME = "$(HOST_APP_NAME)";
758758
SWIFT_EMIT_LOC_STRINGS = YES;
759759
SWIFT_VERSION = 5.0;
760760
};
@@ -785,7 +785,7 @@
785785
MACOSX_DEPLOYMENT_TARGET = 12.0;
786786
MARKETING_VERSION = "$(APP_VERSION)";
787787
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_IDENTIFIER_BASE)";
788-
PRODUCT_NAME = "Copilot for Xcode";
788+
PRODUCT_NAME = "$(HOST_APP_NAME)";
789789
SWIFT_EMIT_LOC_STRINGS = YES;
790790
SWIFT_VERSION = 5.0;
791791
};
@@ -842,7 +842,7 @@
842842
MACOSX_DEPLOYMENT_TARGET = 12.0;
843843
MARKETING_VERSION = "$(APP_VERSION)";
844844
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_IDENTIFIER_BASE).ExtensionService";
845-
PRODUCT_NAME = "CopilotForXcode$(TARGET_NAME)";
845+
PRODUCT_NAME = "$(EXTENSION_SERVICE_NAME)";
846846
SKIP_INSTALL = YES;
847847
SWIFT_EMIT_LOC_STRINGS = YES;
848848
SWIFT_VERSION = 5.0;
@@ -874,7 +874,7 @@
874874
MACOSX_DEPLOYMENT_TARGET = 12.0;
875875
MARKETING_VERSION = "$(APP_VERSION)";
876876
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_IDENTIFIER_BASE).ExtensionService";
877-
PRODUCT_NAME = "CopilotForXcode$(TARGET_NAME)";
877+
PRODUCT_NAME = "$(EXTENSION_SERVICE_NAME)";
878878
SKIP_INSTALL = YES;
879879
SWIFT_EMIT_LOC_STRINGS = YES;
880880
SWIFT_VERSION = 5.0;

Core/Package.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ let package = Package(
115115
"SuggestionService",
116116
]
117117
),
118-
.target(name: "Preferences"),
118+
.target(name: "Preferences", dependencies: ["Configs"]),
119119

120120
// MARK: - Host App
121121

@@ -202,6 +202,7 @@ let package = Package(
202202

203203
// MARK: - Helpers
204204

205+
.target(name: "Configs"),
205206
.target(name: "CGEventObserver"),
206207
.target(name: "Logger"),
207208
.target(name: "FileChangeChecker"),
@@ -261,7 +262,8 @@ let package = Package(
261262
"SuggestionModel",
262263
"Preferences",
263264
"KeychainAccess",
264-
"Terminal"
265+
"Terminal",
266+
"Configs",
265267
]
266268
),
267269
]

Core/Sources/CodeiumService/CodeiumAuthService.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Configs
12
import Foundation
23
import KeychainAccess
34

@@ -6,10 +7,7 @@ public final class CodeiumAuthService {
67
let codeiumKeyKey = "codeiumKey"
78
let keychain: Keychain = {
89
let info = Bundle.main.infoDictionary
9-
return Keychain(
10-
service: info?["BUNDLE_IDENTIFIER_BASE"] as? String ?? "",
11-
accessGroup: "\(info?["APP_ID_PREFIX"] as? String ?? "")\(info?["BUNDLE_IDENTIFIER_BASE"] as? String ?? "").Shared"
12-
)
10+
return Keychain(service: keychainService, accessGroup: keychainAccessGroup)
1311
}()
1412

1513
var key: String? { try? keychain.getString(codeiumKeyKey) }
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Foundation
2+
3+
public var userDefaultSuiteName: String {
4+
"5YKZ4Y3DAW.group.com.intii.CopilotForXcode"
5+
}
6+
7+
public var keychainAccessGroup: String {
8+
#if DEBUG
9+
return "5YKZ4Y3DAW.dev.com.intii.CopilotForXcode.Shared"
10+
#else
11+
return "5YKZ4Y3DAW.com.intii.CopilotForXcode.Shared"
12+
#endif
13+
}
14+
15+
public var keychainService: String {
16+
#if DEBUG
17+
return "dev.com.intii.CopilotForXcode"
18+
#else
19+
return "com.intii.CopilotForXcode"
20+
#endif
21+
}
22+

Core/Sources/GitHubCopilotService/GitHubCopilotService.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protocol GitHubCopilotLSP {
4040

4141
enum GitHubCopilotError: Error, LocalizedError {
4242
case languageServerNotInstalled
43-
43+
4444
var errorDescription: String? {
4545
switch self {
4646
case .languageServerNotInstalled:
@@ -68,7 +68,7 @@ public class GitHubCopilotBaseService {
6868
}
6969
let executionParams: Process.ExecutionParameters
7070
let runner = UserDefaults.shared.value(for: \.runNodeWith)
71-
71+
7272
let agentJSURL = urls.executableURL.appendingPathComponent("copilot/dist/agent.js")
7373
guard FileManager.default.fileExists(atPath: agentJSURL.path) else {
7474
throw GitHubCopilotError.languageServerNotInstalled
@@ -141,7 +141,11 @@ public class GitHubCopilotBaseService {
141141

142142
return InitializeParams(
143143
processId: Int(ProcessInfo.processInfo.processIdentifier),
144-
clientInfo: .init(name: "Copilot for Xcode"),
144+
clientInfo: .init(
145+
name: Bundle.main
146+
.object(forInfoDictionaryKey: "HOST_APP_NAME") as? String
147+
?? "Copilot for Xcode"
148+
),
145149
locale: nil,
146150
rootPath: projectRootURL.path,
147151
rootUri: projectRootURL.path,

Core/Sources/HostApp/GeneralView.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ struct AppInfoView: View {
2626
var body: some View {
2727
VStack(alignment: .leading) {
2828
HStack(alignment: .top) {
29-
Text("Copilot For Xcode")
30-
.font(.title)
29+
Text(
30+
Bundle.main
31+
.object(forInfoDictionaryKey: "HOST_APP_NAME") as? String
32+
?? "Copilot for Xcode"
33+
)
34+
.font(.title)
3135
Text(appVersion ?? "")
3236
.font(.footnote)
3337
.foregroundColor(.secondary)
@@ -228,7 +232,7 @@ struct GeneralSettingsView: View {
228232
)) {
229233
Text("Automatically Check for Update")
230234
}
231-
235+
232236
Picker(selection: $settings.suggestionWidgetPositionMode) {
233237
ForEach(SuggestionWidgetPositionMode.allCases, id: \.rawValue) {
234238
switch $0 {

Core/Sources/Preferences/UserDefaults.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import Foundation
2+
import Configs
23

34
public extension UserDefaults {
4-
static var shared = UserDefaults(suiteName: "5YKZ4Y3DAW.group.com.intii.CopilotForXcode")!
5+
static var shared = UserDefaults(suiteName: userDefaultSuiteName)!
56

67
static func setupDefaultSettings() {
78
shared.setupDefaultValue(for: \.quitXPCServiceOnXcodeAndAppQuit)

EditorExtension/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<key>CFBundleDevelopmentRegion</key>
1010
<string>$(DEVELOPMENT_LANGUAGE)</string>
1111
<key>CFBundleDisplayName</key>
12-
<string>$(EXTENSION_BUNDLE_NAME)</string>
12+
<string>$(EXTENSION_BUNDLE_DISPLAY_NAME)</string>
1313
<key>CFBundleExecutable</key>
1414
<string>$(EXECUTABLE_NAME)</string>
1515
<key>CFBundleIdentifier</key>

0 commit comments

Comments
 (0)