Skip to content

Commit 13f8732

Browse files
committed
minor changes and documenattion enhancements
1 parent 358a5af commit 13f8732

File tree

4 files changed

+48
-17
lines changed

4 files changed

+48
-17
lines changed

DVTCompatibilitizer.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ It watches certain (which)? places for changes in your
2727
#define kXcodePluginSuffix @"xcplugin"
2828
#define kPluginsDirectoryPath @"~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/"
2929
#define kCompatibilityUUIDKey @"DVTPlugInCompatibilityUUID"
30+
#define kNotifierProxyAppName @"DVTCompatibilitizerNotificationProxy"
3031
#define kCompatibilityUUIDsKey kCompatibilityUUIDKey @"s"
3132
#define kInfoPlistComponent @"Contents/Info.plist"
3233
#define ARGV ((NSArray<NSString*>*)NSProcessInfo.processInfo.arguments)
@@ -120,9 +121,9 @@ + (NSArray*) fixPlugins { // check and fix out little babies. (TESTABLE)
120121

121122
+ (void) _notify:reason { // Posts notifications on our behalf!
122123

123-
id notifier = [[[NSBundle bundleForClass:self]
124-
pathForAuxiliaryExecutable:@"DVTCompatibilitizer.notfier.app"]
125-
stringByAppendingPathComponent:@"Contents/MacOS/applet"];
124+
static id notifier; notifier = notifier ?: [[[NSBundle bundleForClass:self]
125+
pathForAuxiliaryExecutable:kNotifierProxyAppName]
126+
stringByAppendingPathComponent:@"Contents/MacOS/applet"];
126127

127128
system([[NSString stringWithFormat:@"title=\"%@\" message=\"%@\" \"%@\"", NSStringFromClass(self),
128129
reason ?: @"DVTCompatibilitized!",
@@ -132,6 +133,7 @@ + (void) _notify:reason { // Posts notifications on our behalf!
132133
+ (BOOL) _keysAreOK:(NSArray*)pluginIDs { // Checks a single plugin's list of UUIDS making sure all of OUR Xcodes are there.
133134

134135
__block BOOL missingUUID = NO;
136+
135137
[self.installedXcodes enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
136138

137139
if (![pluginIDs containsObject:obj]) missingUUID = *stop = YES;
@@ -244,7 +246,7 @@ int main() { @autoreleasepool {
244246

245247
if (ARGV.count == 1) return DVTCompatibilitizer._watchAndFixPluginsAsNeeded;
246248

247-
id arg = ARGV[1].lowercaseString;
249+
id arg = ARGV[1].lowercaseString; // special launch!
248250

249251
return [arg containsString: @"dog"] ? launchWatchDog() // on first run
250252
: [arg containsString:@"help"] ? usage()

DVTPlugInCompatibilityUUIDifier.m

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11

2-
/*! @brief This class loads - when Xcode decides it wants to allow this plugin to startup.
3-
@note Please see enclosed README for important implementation details.
2+
/*! @brief This class loads - when Xcode decides it wants to allow this plugin to startup.
3+
@note Please see enclosed README for important implementation details.
4+
@discussion Theoretically, this plugin doesn't need to do ANYTHING.
5+
The watchdog should theoretically ALWAYS be running after first installed.
6+
This plug-in simply ensures it IS running, every time Xcode launches.
47
*/
58

6-
@import Foundation;
7-
8-
extern BOOL launchWatchDog();
9+
@import Foundation;
10+
extern BOOL launchWatchDog(); // Installs launch agent, etc.
911

1012
@interface DVTPlugInCompatibilityUUIDifier : NSObject @end
1113
@implementation DVTPlugInCompatibilityUUIDifier
1214

1315
+ (void) pluginDidLoad:(NSBundle*)me {
1416

15-
static id x = nil; static dispatch_once_t token; dispatch_once(&token,^{ x = self.new; });
17+
static dispatch_once_t tkn; dispatch_once(&tkn,^{ launchWatchDog(); });
18+
19+
// static id x = nil; static dispatch_once_t tkn; dispatch_once(&tkn,^{ x = self.new; });
1620
}
1721

18-
- init { return self = super.init ? launchWatchDog(), self : nil; }
22+
//- init { return self = super.init ? launchWatchDog(), self : nil; }
1923

2024
@end
2125

DVTPlugInCompatibilityUUIDifier.xcodeproj/project.pbxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
7B2693851C56C8A200D626B5 /* AHLaunchJob.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A68081BE046D80023C7D8 /* AHLaunchJob.m */; };
1212
7B2693861C56C8A200D626B5 /* AHServiceManagement.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A680C1BE046D80023C7D8 /* AHServiceManagement.m */; };
1313
7B2693871C56C8A200D626B5 /* NSString+ah_versionCompare.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A68111BE046D80023C7D8 /* NSString+ah_versionCompare.m */; };
14+
7B2C222E1CA9EF200064B31E /* DVTCompatibilitizerNotificationProxy.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7B2C222D1CA9EF190064B31E /* DVTCompatibilitizerNotificationProxy.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1415
7B6A67C81BE02CFA0023C7D8 /* DVTCompatibilitizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B91FE911BE023E200F3BF55 /* DVTCompatibilitizer.m */; };
1516
7B6A67CE1BE03FED0023C7D8 /* DVTPlugInCompatibilityWatchdog in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7B6A67C21BE02C980023C7D8 /* DVTPlugInCompatibilityWatchdog */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
16-
7B6A67D01BE0400E0023C7D8 /* DVTCompatibilitizer.notfier.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7B6A67CF1BE0400A0023C7D8 /* DVTCompatibilitizer.notfier.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1717
7B6A68131BE046D80023C7D8 /* AHLaunchCtl.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A68061BE046D80023C7D8 /* AHLaunchCtl.m */; };
1818
7B6A68141BE046D80023C7D8 /* AHLaunchJob.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A68081BE046D80023C7D8 /* AHLaunchJob.m */; };
1919
7B6A68161BE046D80023C7D8 /* AHServiceManagement.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A680C1BE046D80023C7D8 /* AHServiceManagement.m */; };
@@ -48,17 +48,17 @@
4848
dstSubfolderSpec = 6;
4949
files = (
5050
7B6A67CE1BE03FED0023C7D8 /* DVTPlugInCompatibilityWatchdog in CopyFiles */,
51-
7B6A67D01BE0400E0023C7D8 /* DVTCompatibilitizer.notfier.app in CopyFiles */,
51+
7B2C222E1CA9EF200064B31E /* DVTCompatibilitizerNotificationProxy.app in CopyFiles */,
5252
);
5353
runOnlyForDeploymentPostprocessing = 0;
5454
};
5555
/* End PBXCopyFilesBuildPhase section */
5656

5757
/* Begin PBXFileReference section */
58-
7B2153371BE0545900BDE9AE /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
58+
7B2153371BE0545900BDE9AE /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; wrapsLines = 1; };
5959
7B2693811C56C70800D626B5 /* WatchDogLauncher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WatchDogLauncher.m; sourceTree = "<group>"; };
60+
7B2C222D1CA9EF190064B31E /* DVTCompatibilitizerNotificationProxy.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = DVTCompatibilitizerNotificationProxy.app; sourceTree = "<group>"; };
6061
7B6A67C21BE02C980023C7D8 /* DVTPlugInCompatibilityWatchdog */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DVTPlugInCompatibilityWatchdog; sourceTree = BUILT_PRODUCTS_DIR; };
61-
7B6A67CF1BE0400A0023C7D8 /* DVTCompatibilitizer.notfier.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = DVTCompatibilitizer.notfier.app; sourceTree = "<group>"; };
6262
7B6A68021BE046D80023C7D8 /* AHAuthorizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AHAuthorizer.h; sourceTree = "<group>"; };
6363
7B6A68031BE046D80023C7D8 /* AHAuthorizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AHAuthorizer.m; sourceTree = "<group>"; };
6464
7B6A68041BE046D80023C7D8 /* AHLaunchCtl-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AHLaunchCtl-Prefix.pch"; sourceTree = "<group>"; };
@@ -141,8 +141,8 @@
141141
7B8BD8D11C99F8BA00C6B44A /* Plug-In */ = {
142142
isa = PBXGroup;
143143
children = (
144+
7B2C222D1CA9EF190064B31E /* DVTCompatibilitizerNotificationProxy.app */,
144145
D2E2D2E016D42CCC00447430 /* DVTPlugInCompatibilityUUIDifier-Info.plist */,
145-
7B6A67CF1BE0400A0023C7D8 /* DVTCompatibilitizer.notfier.app */,
146146
7B953EEE1BE00F0500EB7F15 /* DVTPlugInCompatibilityUUIDifier.m */,
147147
);
148148
name = "Plug-In";

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
![Sreneity Now](https://github.com/mralexgray/DVTPlugInCompatibilityUUIDifier/raw/master/Screenshots/alcatraz.art.png)
55

6-
## _Permanent, automatic, and hassle-free_ `Xcode`/`Alcatraz` "compatibility" upgrades.
6+
## _Permanent, automatic, and hassle-free_ `Xcode`/`Alcatraz` "`UUID compatibility`" "upgrades".
77

88
- [x] Are you *sick and tired* of thinking about / dealing with `Alcatraz` / all your `Xcode` plugins breaking with each `Xcode` release?
99

@@ -63,6 +63,26 @@ and restart `Xcode`.
6363

6464
## Big picture / implementation details.
6565

66+
DVTPlugInCompatibilityUUIDifier.xcplugin
67+
└── Contents
68+
├── Info.plist
69+
└── MacOS
70+
├── DVTPlugInCompatibilityUUIDifier // The bundle's executable.
71+
├── DVTPlugInCompatibilityWatchdog // The LaunchAgent that will always run.
72+
└── DVTCompatibilitizer.notfier.app // This bunlded app handles notifications
73+
   └── Contents
74+
   ├── Info.plist
75+
   ├── MacOS
76+
   │   └── applet
77+
   ├── PkgInfo
78+
  └── Resources
79+
   ├── Scripts
80+
   │   └── main.scpt
81+
   ├── applet.icns
82+
   ├── applet.rsrc
83+
   └── description.rtfd
84+
   └── TXT.rtf
85+
6686
First of all, this project requires [AHLaunchCTL](https://github.com/mralexgray/AHLaunchCTL). However, if you forget to update/init your submodules, there is a pre-build step,
6787

6888
if [ ! -d AHLaunchCTL ]; then git submodule update --init --recursive; fi
@@ -85,6 +105,11 @@ The solution is a bit hacky.. but again, inside of Xcode's build settings, I've
85105

86106
which simply brute-force launches the included watchdog. This way.. EVEN if Xcode NEVER has loaded this plugin (due to it being fucking UUID incompatible)... it won't matter. Simply by being built successfully... the watchdog will be running.. and you will be protectced from the ravages of small inconvenience!
87107

108+
## Tests
109+
110+
Not only does the watchdog protect you from Alcatraz's refusal to self-update, and Apple's Nazi-esque "compatibility" police.. but it can ALSO test itself... This isn't more than an internal mechanisms, but I might as well document it here, for my own benfit.
111+
112+
88113
## Twitter
89114

90115
I'm [@mralexgray](http://twitter.com/mralexgray) on Twitter. Please [tweet](https://twitter.com/intent/tweet?button_hashtag=DVTPlugInCompatibilityUUIDifier&text=Permanent%2C+automatic%2C+and+hassle-free+Xcode%2FAlcatraz+upgrades.%20http%3A%2F%2Flinks.mrgray.com%2FMoPluginsMoProblems&via=mralexgray) about the plugin.

0 commit comments

Comments
 (0)