Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Alcatraz internals

Alcatraz internals

Talk given on NSLondon, April 2014

Marin Usalj

April 29, 2014
Tweet

More Decks by Marin Usalj

Other Decks in Programming

Transcript

  1. Alcatraz
    the package manager for Xcode

    View full-size slide

  2. how does this
    even

    View full-size slide

  3. ~/Library/Application\ Support\
    /Developer/Shared/Xcode/Plug-ins

    View full-size slide

  4. ./Plug-ins
    VVDocumenter.xcplugin
    BeginningOfLine.xcplugin
    OMColorSense.xcplugin
    BBUFullIssueNavigator.xcplugin

    View full-size slide

  5. ZOMG !
    PLUGINS!!!!11!!
    <3 <3

    View full-size slide

  6. + (void)pluginDidLoad:(NSBundle *)plugin {
    !
    if ([currentApplicationName isEqual:@"Xcode"]) {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
    sharedPlugin = [[self alloc] initWithBundle:plugin];
    });
    }
    !
    }

    View full-size slide

  7. Everything’s terrible
    Sincerely,
    FileMerge.app

    View full-size slide

  8. + (void)pluginDidLoad:(NSBundle *)plugin {
    !
    if ([currentApplicationName isEqual:@"Xcode"]) {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
    sharedPlugin = [[self alloc] initWithBundle:plugin];
    });
    }
    !
    }

    View full-size slide

  9. I’ll need you to
    come in
    tommmmoroooow

    View full-size slide

  10. and add these
    DVTPlugInCompatibility
    UUIDs

    View full-size slide

  11. that’d be
    GRRREEEEEAT

    View full-size slide

  12. Cou … l ..dn’t
    ww we use.
    Semantic Versioning?

    View full-size slide

  13. Oh,
    almost forgot…

    View full-size slide

  14. I’ll need you to
    stop filling radars

    View full-size slide

  15. and
    crashing Xcode

    View full-size slide

  16. otherwise we’ll
    disable plugins
    entirely

    View full-size slide

  17. Xcode UUID
    5.0 640F884E-CE55-4B40-87C0-8869546CAB7A
    5.0.1 640F884E-CE55-4B40-87C0-8869546CAB7A
    5.1 A2E4D43F-41F4-4FB9-BB94-7177011C9AED
    5.1.1 A2E4D43F-41F4-4FB9-BB94-7177011C9AED

    View full-size slide

  18. Xcode UUID
    5.0 640F884E-CE55-4B40-87C0-8869546CAB7A
    YOUR PLUGIN
    5.1 A2E4D43F-41F4-4FB9-BB94-7177011C9AED

    View full-size slide

  19. Xcode UUID
    5.0 640F884E-CE55-4B40-87C0-8869546CAB7A
    YOUR PLUGIN
    5.1 A2E4D43F-41F4-4FB9-BB94-7177011C9AED
    6.0 BASDSDII-JWM3-2987-KKHH-82890MSEBUEM

    View full-size slide

  20. Color scheme
    Templates
    Xcode Plugin

    View full-size slide

  21. Color scheme
    Templates
    Xcode Plugin

    View full-size slide

  22. -name
    -description
    -iconName
    -remotePath
    -isInstalled
    -screenshotPath
    ATZPackage.h

    View full-size slide

  23. @implementation ATZColorScheme
    !
    - (ATZInstaller *)installer {
    return [ATZColorSchemeInstaller sharedInstaller];
    }
    !
    - (NSString *)type {
    return COLOR_SCHEME;
    }
    !
    - (BOOL)requiresRestart {
    return YES;
    }
    !
    - (NSString *)extension {
    return DVTCOLORSCHEME;
    }
    !
    - (NSString *)iconName {
    return COLOR_SCHEME_ICON_NAME;
    }
    !
    @end

    View full-size slide

  24. @implementation ATZPlugin
    @synthesize requiresRestart;
    !
    - (ATZInstaller *)installer {
    return [ATZPluginInstaller sharedInstaller];
    }
    !
    - (NSString *)type {
    return PLUGIN;
    }
    !
    - (NSString *)extension {
    return XCPLUGIN;
    }
    !
    - (NSString *)iconName {
    return PLUGIN_ICON_NAME;
    }
    !
    @end

    View full-size slide

  25. @implementation ATZTemplate
    !
    - (ATZInstaller *)installer {
    @throw [NSException
    exceptionWithName:@"Abstract template"
    reason:@"Please use one of ATZTemplate subclasses"
    userInfo:nil];
    }
    !
    - (NSString *)type {
    return nil;
    }
    !
    - (BOOL)requiresRestart {
    return NO;
    }
    !
    - (NSString *)extension {
    return XCTEMPLATE;
    }
    !
    - (NSString *)iconName {
    return TEMPLATE_ICON_NAME;
    }
    !
    @end

    View full-size slide

  26. ATZInstaller.h
    -installPackage:progress:completion:
    -updatePackage:progress:completion:
    -removePackage:progress:completion:
    !
    -isPackageInstalled:

    View full-size slide

  27. ATZInstaller.h
    ATZColorSchemeInstaller.h
    ATZTemplateInstaller.h
    ATZPluginInstaller.h

    View full-size slide

  28. ATZPluginInstaller.h

    View full-size slide

  29. ATZTemplateInstaller.h

    View full-size slide

  30. ATZColorSchemeInstaller.h

    View full-size slide

  31. git fetch
    git reset —hard

    View full-size slide

  32. how do we update
    Alcatraz?

    View full-size slide

  33. Alcatraz is just a
    plugin

    View full-size slide

  34. ALCATRAZ USES ALCATRAZ
    TO UPDATE ALCATRAZ

    View full-size slide

  35. @kattrali
    KEYBOARDS
    KEYBOARDS

    View full-size slide

  36. @jurre
    KEYBOARDS
    KEYBOARDS

    View full-size slide

  37. many awesome contributors
    THE ORCHESTRA

    View full-size slide

  38. thank you
    Marin Usalj
    @supermarin | supermar.in

    View full-size slide