mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-26 05:27:03 +00:00
Added: Creating project with symlinks
Previously it wasn't possible to create project with symlink. Now you can set in the preferences of xCodeCapp if you want to create your project with symlink or not with a radioButton. When launching xCodeCapp, the system will check if $CAPP_BUILD is defined or not. If not, the button in the preference will be disabled and a toolTip will advice how to create a $CAPP_BUILD variable.
This commit is contained in:
@@ -150,7 +150,8 @@ AppController *SharedAppControllerInstance = nil;
|
||||
kDefaultMaxRecentProjects: @20,
|
||||
kDefaultLogLevel: [NSNumber numberWithInt:LOG_LEVEL_WARN],
|
||||
kDefaultAutoOpenXcodeProject: @YES,
|
||||
kDefaultShowProcessingNotices: @YES
|
||||
kDefaultShowProcessingNotices: @YES,
|
||||
kDefaultUseSymlinkWhenCreatingProject: @YES
|
||||
};
|
||||
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
@@ -26,5 +26,6 @@ extern NSString * const kDefaultMaxRecentProjects;
|
||||
extern NSString * const kDefaultLogLevel;
|
||||
extern NSString * const kDefaultAutoOpenXcodeProject;
|
||||
extern NSString * const kDefaultShowProcessingNotices;
|
||||
extern NSString * const kDefaultUseSymlinkWhenCreatingProject;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,3 +24,4 @@ NSString * const kDefaultMaxRecentProjects = @"maxRecentProjects";
|
||||
NSString * const kDefaultLogLevel = @"logLevel";
|
||||
NSString * const kDefaultAutoOpenXcodeProject = @"autoOpenXcodeProject";
|
||||
NSString * const kDefaultShowProcessingNotices = @"showProcessingNotices";
|
||||
NSString * const kDefaultUseSymlinkWhenCreatingProject = @"useSymlinkWhenCreatingProject";
|
||||
|
||||
@@ -79,6 +79,9 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
// Full path to pbxprojModifier.py
|
||||
@property NSString *pbxModifierScriptPath;
|
||||
|
||||
// Tooltip for the radio button symlink
|
||||
@property NSString *toolTipSymlinkRadioButton;
|
||||
|
||||
// Full paths to the executables we rely on: jsc, objj, nib2cib, python
|
||||
@property NSMutableDictionary *executablePaths;
|
||||
|
||||
@@ -97,6 +100,9 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
// Whether we are currently processing source files
|
||||
@property BOOL isProcessing;
|
||||
|
||||
// Whether $CAPP_BUILD is defined or not
|
||||
@property BOOL isCappBuildDefined;
|
||||
|
||||
// A mapping from full paths to project-relative paths
|
||||
@property NSMutableDictionary *projectPathsForSourcePaths;
|
||||
|
||||
|
||||
@@ -187,6 +187,8 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
self.pbxOperations = [NSMutableDictionary new];
|
||||
self.executablePaths = [NSMutableDictionary new];
|
||||
self.projectPathFileDescriptor = -1;
|
||||
self.isCappBuildDefined = YES;
|
||||
self.toolTipSymlinkRadioButton = @"If this is checked, when a Cappuccino project is created, the frameworks of the new project will be symlinked from the $CAPP_BUILD";
|
||||
|
||||
[self initTaskEnvironment];
|
||||
|
||||
@@ -240,6 +242,28 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
self.environment[@"NARWHAL_ENGINE"] = @"jsc";
|
||||
|
||||
self.executables = @[@"python", @"narwhal-jsc", @"objj", @"nib2cib", @"capp"];
|
||||
|
||||
// This is used to get the env var of $CAPP_BUILD
|
||||
NSDictionary *processEnvironment = [[NSProcessInfo processInfo] environment];
|
||||
NSArray *arguments = [NSArray arrayWithObjects:@"-l", @"-c", @"echo $CAPP_BUID", nil];
|
||||
|
||||
NSDictionary *taskResult = [self runTaskWithLaunchPath:[processEnvironment objectForKey:@"SHELL"]
|
||||
arguments:arguments
|
||||
returnType:kTaskReturnTypeStdOut];
|
||||
|
||||
// Make sure to remove the \n at the end of the response
|
||||
NSString *response = [taskResult[@"response"] stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
|
||||
|
||||
self.environment[@"CAPP_BUILD"] = response;
|
||||
|
||||
// Make sure we have found a CAPP_BUILD
|
||||
if ([response length] == 0 || [taskResult[@"status"] intValue] == -1)
|
||||
{
|
||||
self.toolTipSymlinkRadioButton = @"To use this option you need to have the variable $CAPP_BUILD in your environement (export CAPP_BUILD='path/to/your/cappuccino/build')";
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults setObject:@NO forKey:kDefaultUseSymlinkWhenCreatingProject];
|
||||
self.isCappBuildDefined = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)initObservers
|
||||
@@ -576,15 +600,20 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
- (NSDictionary*)createProject:(NSString*)aPath
|
||||
{
|
||||
NSDictionary *taskResult;
|
||||
NSMutableArray *arguments = [NSMutableArray arrayWithObjects:@"gen", aPath ,@"-t", @"NibApplication", nil];
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
// This is used when an user wants to replace an existing project
|
||||
NSArray *argumentsRemove = [NSArray arrayWithObjects:@"-rf", aPath, nil];
|
||||
[self runTaskWithLaunchPath:@"/bin/rm" arguments:argumentsRemove returnType:kTaskReturnTypeAny];
|
||||
|
||||
// Don't know if we have to use the argument -l or not. In this case we should add $CAPP_BUILD in the taskEnv
|
||||
NSArray *arguments = [NSArray arrayWithObjects:@"gen", aPath ,@"-t", @"NibApplication", nil];
|
||||
NSDictionary *taskResult = [self runTaskWithLaunchPath:self.executablePaths[@"capp"]
|
||||
arguments:arguments
|
||||
returnType:kTaskReturnTypeStdOut];
|
||||
if ([defaults boolForKey:kDefaultUseSymlinkWhenCreatingProject])
|
||||
[arguments addObject:@"-l"];
|
||||
|
||||
taskResult = [self runTaskWithLaunchPath:self.executablePaths[@"capp"]
|
||||
arguments:arguments
|
||||
returnType:kTaskReturnTypeStdOut];
|
||||
|
||||
NSInteger status = [taskResult[@"status"] intValue];
|
||||
NSString *response = taskResult[@"response"];
|
||||
|
||||
@@ -241,17 +241,17 @@ Original Cocoa version developed by:
|
||||
</window>
|
||||
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="xcc-prefs" animationBehavior="default" id="542">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||
<rect key="contentRect" x="1964" y="505" width="431" height="292"/>
|
||||
<rect key="contentRect" x="1964" y="505" width="431" height="321"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
|
||||
<view key="contentView" id="558">
|
||||
<rect key="frame" x="0.0" y="0.0" width="431" height="292"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="431" height="321"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<box autoresizesSubviews="NO" title="Projects" borderType="line" id="847">
|
||||
<rect key="frame" x="17" y="149" width="397" height="128"/>
|
||||
<rect key="frame" x="17" y="151" width="397" height="155"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<view key="contentView">
|
||||
<rect key="frame" x="1" y="1" width="395" height="112"/>
|
||||
<rect key="frame" x="1" y="1" width="395" height="139"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button id="563">
|
||||
@@ -284,6 +284,23 @@ Original Cocoa version developed by:
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<button id="1qI-ol-J5k">
|
||||
<rect key="frame" x="16" y="109" width="298" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Symlink frameworks when creating projects" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="272-W8-Ygy">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="545" name="enabled" keyPath="isCappBuildDefined" id="HUA-hI-eLR"/>
|
||||
<binding destination="545" name="toolTip" keyPath="toolTipSymlinkRadioButton" id="bWz-Mw-z56"/>
|
||||
<binding destination="544" name="value" keyPath="values.useSymlinkWhenCreatingProject" id="aRN-Fd-MPN">
|
||||
<dictionary key="options">
|
||||
<bool key="NSValidatesImmediately" value="YES"/>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" id="801">
|
||||
<rect key="frame" x="15" y="20" width="106" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
@@ -298,7 +315,7 @@ Original Cocoa version developed by:
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" title="30" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="808" id="804">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" title="OtherViews" id="805">
|
||||
<items>
|
||||
<menuItem title="10" id="806"/>
|
||||
@@ -393,7 +410,7 @@ Original Cocoa version developed by:
|
||||
<rect key="frame" x="0.0" y="0.0" width="716" height="654"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<pdfView autoresizesSubviews="NO" displaysPageBreaks="NO" scaleFactor="1.1454248428344727" autoScales="YES" id="857">
|
||||
<pdfView autoresizesSubviews="NO" displaysPageBreaks="NO" autoScales="YES" id="857">
|
||||
<rect key="frame" x="0.0" y="0.0" width="716" height="654"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
</pdfView>
|
||||
@@ -408,6 +425,7 @@ Original Cocoa version developed by:
|
||||
<action selector="save:" destination="839" id="841"/>
|
||||
<action selector="save:" destination="803" id="849"/>
|
||||
<action selector="save:" destination="843" id="854"/>
|
||||
<action selector="save:" destination="1qI-ol-J5k" id="Qld-lL-7rM"/>
|
||||
</connections>
|
||||
</userDefaultsController>
|
||||
<customObject id="545" userLabel="XCodeCapp" customClass="XcodeCapp">
|
||||
@@ -421,6 +439,7 @@ Original Cocoa version developed by:
|
||||
<outlet property="errorListController" destination="759" id="760"/>
|
||||
<outlet property="errorTable" destination="587" id="748"/>
|
||||
<outlet property="errorsPanel" destination="541" id="775"/>
|
||||
<outlet property="symlinkRadioButton" destination="1qI-ol-J5k" id="UhG-7c-NP8"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<arrayController selectsInsertedObjects="NO" avoidsEmptySelection="NO" id="759" userLabel="Errors Controller">
|
||||
@@ -436,4 +455,40 @@ Original Cocoa version developed by:
|
||||
<resources>
|
||||
<image name="icon_128x128" width="128" height="128"/>
|
||||
</resources>
|
||||
<classes>
|
||||
<class className="AppController" superclassName="NSObject">
|
||||
<source key="sourceIdentifier" type="project" relativePath="./Classes/AppController.h"/>
|
||||
<relationships>
|
||||
<relationship kind="action" name="createProject:"/>
|
||||
<relationship kind="action" name="loadProject:"/>
|
||||
<relationship kind="action" name="openAbout:"/>
|
||||
<relationship kind="action" name="openHelp:"/>
|
||||
<relationship kind="action" name="openPreferences:"/>
|
||||
<relationship kind="action" name="showInFinder:"/>
|
||||
<relationship kind="outlet" name="aboutWindow" candidateClass="NSPanel"/>
|
||||
<relationship kind="outlet" name="helpView" candidateClass="PDFView"/>
|
||||
<relationship kind="outlet" name="helpWindow" candidateClass="NSWindow"/>
|
||||
<relationship kind="outlet" name="menuItemHistory" candidateClass="NSMenuItem"/>
|
||||
<relationship kind="outlet" name="menuItemOpenProject" candidateClass="NSMenuItem"/>
|
||||
<relationship kind="outlet" name="menuItemShowInFinder" candidateClass="NSMenuItem"/>
|
||||
<relationship kind="outlet" name="preferencesController" candidateClass="NSUserDefaultsController"/>
|
||||
<relationship kind="outlet" name="preferencesWindow" candidateClass="NSWindow"/>
|
||||
<relationship kind="outlet" name="statusMenu" candidateClass="NSMenu"/>
|
||||
<relationship kind="outlet" name="xcc" candidateClass="XcodeCapp"/>
|
||||
</relationships>
|
||||
</class>
|
||||
<class className="XcodeCapp" superclassName="NSObject">
|
||||
<source key="sourceIdentifier" type="project" relativePath="./Classes/XcodeCapp.h"/>
|
||||
<relationships>
|
||||
<relationship kind="action" name="clearErrors:"/>
|
||||
<relationship kind="action" name="openErrorInEditor:"/>
|
||||
<relationship kind="action" name="openErrorsPanel:"/>
|
||||
<relationship kind="action" name="openXcodeProject:"/>
|
||||
<relationship kind="action" name="synchronizeProject:"/>
|
||||
<relationship kind="outlet" name="errorListController" candidateClass="NSArrayController"/>
|
||||
<relationship kind="outlet" name="errorTable" candidateClass="NSTableView"/>
|
||||
<relationship kind="outlet" name="errorsPanel" candidateClass="NSPanel"/>
|
||||
</relationships>
|
||||
</class>
|
||||
</classes>
|
||||
</document>
|
||||
Reference in New Issue
Block a user