Changeset 290

Show
Ignore:
Timestamp:
02/03/08 10:07:22 (1 year ago)
Author:
wolf
Message:

[NEW] Xmod 1.8: Now compatible with Xcode 3.0. Now fires off osascript off an NSTask to give Xmod.scpt a nonweird script execution environment.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cocoa/mogenerator/Xmod/Xmod.applescript

    r262 r290  
    22        if not (exists active project document) then  
    33                error "No active project. Please open an Xcode project and re-run the script." 
    4         my updateProjectXmod(project of active project document) 
     4        try 
     5                my updateProjectXmod(project of active project document) 
     6        on error errMsg 
     7                my logger("Xmod.scpt exception: " & errMsg) 
     8        end try 
    59end tell 
    610 
     
    8084        return text 1 thru -2 of (POSIX path of (modelSrcFolder as alias)) -- kill the trailing slash 
    8185end modelSrcDirPath 
     86 
     87on logger(msg) 
     88        do shell script "logger '" & msg & "'" 
     89end logger 
  • trunk/cocoa/mogenerator/Xmod/Xmod.m

    r289 r290  
    11#import "Xmod.h" 
    22#import "JRSwizzle.h" 
     3 
     4/* 
     5Xcode 2.4 
     6        10.4 SDK        ppc, i386 
     7Xcode 2.5 
     8        10.5 SDK        ppc, i386 
     9Xcode 3.0 
     10        10.5 SDK        ppc GC, ppc64 GC, i386 GC, x86_64 GC 
     11*/ 
    312 
    413@interface NSObject (xmod_saveModelToFile) 
     
    4756        } else if ([xcodeVersion isEqualToString:@"2.5"]) { 
    4857                coreDataPlugin = [NSBundle bundleWithPath:@"/Xcode2.5/Library/Xcode/Plug-ins/XDCoreDataModel.xdplugin"]; 
     58        } else if ([xcodeVersion isEqualToString:@"3.0"]) { 
     59                coreDataPlugin = [NSBundle bundleWithPath:@"/Developer/Library/Xcode/Plug-ins/XDCoreDataModel.xdplugin"]; 
    4960        } else { 
    5061                NSLog(@"Xmod: unknown Xcode version (%@), exiting.", xcodeVersion); 
     
    8192        NSString *scriptPath = [bundle pathForResource:scriptName_ ofType:@"scpt" inDirectory:@"Scripts"]; 
    8293        NSAssert1(scriptPath, @"failed to find %@.scpt", scriptName_); 
     94#if 1 
     95        NSTask *osascriptTask = [[[NSTask alloc] init] autorelease]; 
     96        [osascriptTask setLaunchPath:@"/usr/bin/osascript"]; 
     97        [osascriptTask setArguments:[NSArray arrayWithObject:scriptPath]]; 
     98        [osascriptTask launch]; 
     99#else 
     100        //  Executing an AppleScript inside Xcode's context is weird. 
     101        //  Scripts like `tell app "Finder" to get folder of file` simply fail. I suspect rogue 
     102        //      coercion handlers or namespace bugs. So now I just fire off an osascript invocation 
     103        //      to give the script a clean nonweird enironment. 
    83104        NSDictionary *scriptInitError = nil; 
    84105        NSAppleScript *script = [[[NSAppleScript alloc] initWithContentsOfURL:[NSURL fileURLWithPath:scriptPath] 
     
    90111                NSAssert2(!scriptInitError, @"failed to execute %@.scpt: %@", scriptName_, scriptExecuteError); 
    91112        } 
     113#endif 
    92114} 
    93115 
  • trunk/cocoa/mogenerator/Xmod/Xmod.xcodeproj/wolf.mode1v3

    r289 r290  
    278278                                                        <array> 
    279279                                                                <array> 
     280                                                                        <integer>8</integer> 
     281                                                                        <integer>7</integer> 
    280282                                                                        <integer>0</integer> 
    281283                                                                </array> 
     
    301303                                                </array> 
    302304                                                <key>RubberWindowFrame</key> 
    303                                                 <string>537 534 853 471 0 0 1680 1028 </string> 
     305                                                <string>799 479 853 471 0 0 1680 1028 </string> 
    304306                                        </dict> 
    305307                                        <key>Module</key> 
     
    338340                                                                <string>{{0, 0}, {645, 0}}</string> 
    339341                                                                <key>RubberWindowFrame</key> 
    340                                                                 <string>537 534 853 471 0 0 1680 1028 </string> 
     342                                                                <string>799 479 853 471 0 0 1680 1028 </string> 
    341343                                                        </dict> 
    342344                                                        <key>Module</key> 
     
    358360                                                                <string>{{0, 5}, {645, 425}}</string> 
    359361                                                                <key>RubberWindowFrame</key> 
    360                                                                 <string>537 534 853 471 0 0 1680 1028 </string> 
     362                                                                <string>799 479 853 471 0 0 1680 1028 </string> 
    361363                                                        </dict> 
    362364                                                        <key>Module</key> 
     
    382384                        <key>TableOfContents</key> 
    383385                        <array> 
    384                                 <string>791E10A60D56394C0043AD7E</string> 
     386                                <string>79A40F110D56713F003978D3</string> 
    385387                                <string>1CE0B1FE06471DED0097A5F4</string> 
    386                                 <string>791E10A70D56394C0043AD7E</string> 
     388                                <string>79A40F120D56713F003978D3</string> 
    387389                                <string>1CE0B20306471E060097A5F4</string> 
    388390                                <string>1CE0B20506471E060097A5F4</string> 
     
    516518        <key>WindowOrderList</key> 
    517519        <array> 
    518                 <string>79E65E2C0D56333100B09941</string> 
     520                <string>79EAFC590D5670CD00578856</string> 
     521                <string>79EAFC5C0D5670CD00578856</string> 
     522                <string>79EAFC620D5670CD00578856</string> 
    519523                <string>/Users/wolf/code/trac/cocoa/mogenerator/Xmod/Xmod.xcodeproj</string> 
    520524        </array> 
    521525        <key>WindowString</key> 
    522         <string>537 534 853 471 0 0 1680 1028 </string> 
     526        <string>799 479 853 471 0 0 1680 1028 </string> 
    523527        <key>WindowToolsV3</key> 
    524528        <array> 
     
    597601                        <array> 
    598602                                <string>79E65E2C0D56333100B09941</string> 
    599                                 <string>791E10A80D56394C0043AD7E</string> 
     603                                <string>79EAFBEB0D56422400578856</string> 
    600604                                <string>1CD0528F0623707200166675</string> 
    601605                                <string>XCMainBuildResultsModuleGUID</string> 
  • trunk/cocoa/mogenerator/Xmod/Xmod.xcodeproj/wolf.pbxuser

    r289 r290  
    7878                                ); 
    7979                        }; 
    80                         PBXPerProjectTemplateStateSaveDate = 223754547; 
    81                         PBXWorkspaceStateSaveDate = 223754547; 
     80                        PBXPerProjectTemplateStateSaveDate = 223768887; 
     81                        PBXWorkspaceStateSaveDate = 223768887; 
    8282                }; 
    8383                sourceControlManager = 79DFC1170B59B8870056C80E /* Source Control */; 
     
    115115        79DFC11E0B59B8C80056C80E /* Xmod.m */ = { 
    116116                uiCtxt = { 
    117                         sepNavIntBoundsRect = "{{0, 0}, {862, 1330}}"; 
    118                         sepNavSelRange = "{0, 0}"; 
    119                         sepNavVisRange = "{0, 2028}"; 
     117                        sepNavIntBoundsRect = "{{0, 0}, {862, 1638}}"; 
     118                        sepNavSelRange = "{3850, 0}"; 
     119                        sepNavVisRange = "{1817, 2608}"; 
    120120                        sepNavVisRect = "{{0, 0}, {882, 799}}"; 
    121121                        sepNavWindowFrame = "{{396, 112}, {921, 904}}";