Skip to content

Commit cbd5d60

Browse files
committed
Output name formatting
Allows setting of "Project", "Shared" and "-" separator via Preferences.
1 parent 907368b commit cbd5d60

File tree

6 files changed

+128
-15
lines changed

6 files changed

+128
-15
lines changed

BuildSettingExtractor/AppDelegate.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ - (IBAction)presentPreferencesWindow:(id)sender {
7979
}
8080

8181
- (IBAction)dismissPreferencesWindow:(id)sender {
82+
// make sure current edit field gets bound
83+
[self.preferencesWindow makeFirstResponder:nil];
84+
8285
[self.window endSheet:self.preferencesWindow];
8386
}
8487

@@ -142,7 +145,13 @@ - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
142145
}
143146

144147
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
145-
NSDictionary *defaults = @{TPSOpenDirectoryInFinder:@(YES), TPSIncludeBuildSettingInfoComments:@(YES)};
148+
NSDictionary *defaults = @{
149+
TPSOpenDirectoryInFinder:@(YES),
150+
TPSIncludeBuildSettingInfoComments:@(YES),
151+
TPSOutputFileNameProject:@"Project",
152+
TPSOutputFileNameShared:@"Shared",
153+
TPSOutputFileNameSeparator:@"-",
154+
};
146155
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
147156
}
148157

BuildSettingExtractor/Base.lproj/MainMenu.xib

Lines changed: 103 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7702"/>
66
</dependencies>
77
<objects>
88
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -677,7 +677,7 @@
677677
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
678678
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
679679
<rect key="contentRect" x="335" y="390" width="436" height="210"/>
680-
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
680+
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
681681
<view key="contentView" id="EiT-Mj-1SZ">
682682
<rect key="frame" x="0.0" y="0.0" width="436" height="210"/>
683683
<autoresizingMask key="autoresizingMask"/>
@@ -715,16 +715,16 @@
715715
<userDefaultsController representsSharedInstance="YES" id="Czo-a1-luY"/>
716716
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="Preferences" animationBehavior="default" id="fKt-mn-0WB">
717717
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
718-
<rect key="contentRect" x="985" y="795" width="320" height="122"/>
719-
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
720-
<value key="minSize" type="size" width="320" height="122"/>
721-
<value key="maxSize" type="size" width="320" height="122"/>
718+
<rect key="contentRect" x="985" y="795" width="320" height="265"/>
719+
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
720+
<value key="minSize" type="size" width="320" height="265"/>
721+
<value key="maxSize" type="size" width="320" height="265"/>
722722
<view key="contentView" id="1kK-jA-VrG">
723-
<rect key="frame" x="0.0" y="0.0" width="320" height="122"/>
723+
<rect key="frame" x="0.0" y="0.0" width="320" height="265"/>
724724
<autoresizingMask key="autoresizingMask"/>
725725
<subviews>
726726
<button translatesAutoresizingMaskIntoConstraints="NO" id="jJF-zo-xje">
727-
<rect key="frame" x="18" y="86" width="260" height="18"/>
727+
<rect key="frame" x="18" y="229" width="260" height="18"/>
728728
<buttonCell key="cell" type="check" title="Open destination folder when finished " bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="bOl-XK-mYp">
729729
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
730730
<font key="font" metaFont="system"/>
@@ -734,7 +734,7 @@
734734
</connections>
735735
</button>
736736
<button translatesAutoresizingMaskIntoConstraints="NO" id="PO3-kF-2C5">
737-
<rect key="frame" x="18" y="59" width="242" height="18"/>
737+
<rect key="frame" x="18" y="202" width="242" height="18"/>
738738
<buttonCell key="cell" type="check" title="Include build setting info comments" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Miy-u0-wrI">
739739
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
740740
<font key="font" metaFont="system"/>
@@ -743,6 +743,95 @@
743743
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSIncludeBuildSettingInfoComments" id="UHb-Q1-xEE"/>
744744
</connections>
745745
</button>
746+
<box autoresizesSubviews="NO" title="Output Filenames" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="D53-ZA-yMZ">
747+
<rect key="frame" x="17" y="58" width="286" height="132"/>
748+
<view key="contentView">
749+
<rect key="frame" x="1" y="1" width="284" height="116"/>
750+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
751+
<subviews>
752+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pgR-Eo-bSj">
753+
<rect key="frame" x="30" y="86" width="90" height="17"/>
754+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Project name:" id="55p-LX-tEF">
755+
<font key="font" metaFont="system"/>
756+
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
757+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
758+
</textFieldCell>
759+
</textField>
760+
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TQC-44-oLj">
761+
<rect key="frame" x="126" y="84" width="141" height="22"/>
762+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="dJU-oN-41s">
763+
<font key="font" metaFont="system"/>
764+
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
765+
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
766+
<connections>
767+
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSOutputFileNameProject" id="5kc-lr-9mt"/>
768+
</connections>
769+
</textFieldCell>
770+
<connections>
771+
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSOutputFileNameProject" id="XH0-ns-RBF"/>
772+
</connections>
773+
</textField>
774+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="c24-WP-E9A">
775+
<rect key="frame" x="29" y="54" width="90" height="17"/>
776+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Shared name:" id="3PN-eT-YAf">
777+
<font key="font" metaFont="system"/>
778+
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
779+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
780+
</textFieldCell>
781+
</textField>
782+
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YO9-cX-mlT">
783+
<rect key="frame" x="125" y="52" width="141" height="22"/>
784+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="d9j-HG-UH4">
785+
<font key="font" metaFont="system"/>
786+
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
787+
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
788+
</textFieldCell>
789+
<connections>
790+
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSOutputFileNameShared" id="Fbq-Gw-ZPD"/>
791+
</connections>
792+
</textField>
793+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="e1H-r8-PZJ">
794+
<rect key="frame" x="16" y="20" width="103" height="17"/>
795+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Word separator:" id="Ioq-vO-Qxk">
796+
<font key="font" metaFont="system"/>
797+
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
798+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
799+
</textFieldCell>
800+
</textField>
801+
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YBk-cU-i8C">
802+
<rect key="frame" x="126" y="20" width="141" height="22"/>
803+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="kDQ-0L-kg5">
804+
<font key="font" metaFont="system"/>
805+
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
806+
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
807+
</textFieldCell>
808+
<connections>
809+
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSOutputFileNameSeparator" id="kC4-be-U04"/>
810+
</connections>
811+
</textField>
812+
</subviews>
813+
</view>
814+
<constraints>
815+
<constraint firstItem="c24-WP-E9A" firstAttribute="baseline" secondItem="YO9-cX-mlT" secondAttribute="baseline" id="0Qd-MA-H0j"/>
816+
<constraint firstItem="e1H-r8-PZJ" firstAttribute="baseline" secondItem="YBk-cU-i8C" secondAttribute="baseline" constant="2" id="0Qj-zm-fY4"/>
817+
<constraint firstItem="YO9-cX-mlT" firstAttribute="trailing" secondItem="TQC-44-oLj" secondAttribute="trailing" constant="-1" id="0SR-I5-7WK"/>
818+
<constraint firstItem="TQC-44-oLj" firstAttribute="baseline" secondItem="pgR-Eo-bSj" secondAttribute="baseline" id="3c7-zm-QP7"/>
819+
<constraint firstItem="YBk-cU-i8C" firstAttribute="width" secondItem="YO9-cX-mlT" secondAttribute="width" id="5Dx-zY-jIo"/>
820+
<constraint firstAttribute="height" constant="128" id="5al-5J-sc7"/>
821+
<constraint firstItem="YO9-cX-mlT" firstAttribute="width" secondItem="TQC-44-oLj" secondAttribute="width" id="6Hd-ey-NCe"/>
822+
<constraint firstItem="TQC-44-oLj" firstAttribute="top" secondItem="D53-ZA-yMZ" secondAttribute="top" constant="25" id="7El-hr-JRE"/>
823+
<constraint firstAttribute="trailing" secondItem="TQC-44-oLj" secondAttribute="trailing" constant="15" id="KhQ-ac-M2K"/>
824+
<constraint firstItem="TQC-44-oLj" firstAttribute="leading" secondItem="pgR-Eo-bSj" secondAttribute="trailing" constant="8" id="LgO-tt-PBC"/>
825+
<constraint firstItem="TQC-44-oLj" firstAttribute="leading" secondItem="D53-ZA-yMZ" secondAttribute="leading" constant="124" id="TBL-Ak-gZJ"/>
826+
<constraint firstItem="c24-WP-E9A" firstAttribute="trailing" secondItem="pgR-Eo-bSj" secondAttribute="trailing" constant="-1" id="VOB-ZI-2YJ"/>
827+
<constraint firstItem="YBk-cU-i8C" firstAttribute="top" secondItem="YO9-cX-mlT" secondAttribute="bottom" constant="10" id="cH3-4L-VJa"/>
828+
<constraint firstItem="YBk-cU-i8C" firstAttribute="trailing" secondItem="YO9-cX-mlT" secondAttribute="trailing" constant="1" id="n0A-Fk-ZGN"/>
829+
<constraint firstItem="e1H-r8-PZJ" firstAttribute="trailing" secondItem="c24-WP-E9A" secondAttribute="trailing" id="nGW-Og-7Ey"/>
830+
<constraint firstItem="YO9-cX-mlT" firstAttribute="top" secondItem="TQC-44-oLj" secondAttribute="bottom" constant="10" id="nOF-Ce-kQB"/>
831+
</constraints>
832+
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
833+
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
834+
</box>
746835
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Hfn-iA-xua">
747836
<rect key="frame" x="224" y="13" width="82" height="32"/>
748837
<constraints>
@@ -763,13 +852,16 @@ DQ
763852
<constraints>
764853
<constraint firstAttribute="bottom" secondItem="Hfn-iA-xua" secondAttribute="bottom" constant="20" symbolic="YES" id="4qv-Vd-eta"/>
765854
<constraint firstItem="PO3-kF-2C5" firstAttribute="top" secondItem="jJF-zo-xje" secondAttribute="bottom" constant="13" id="SBZ-jh-KMn"/>
855+
<constraint firstAttribute="trailing" secondItem="D53-ZA-yMZ" secondAttribute="trailing" constant="20" symbolic="YES" id="Sa3-Y2-5hp"/>
856+
<constraint firstItem="D53-ZA-yMZ" firstAttribute="leading" secondItem="PO3-kF-2C5" secondAttribute="leading" id="Sut-si-RXA"/>
766857
<constraint firstItem="jJF-zo-xje" firstAttribute="leading" secondItem="PO3-kF-2C5" secondAttribute="leading" id="Tk0-KE-6NX"/>
858+
<constraint firstItem="D53-ZA-yMZ" firstAttribute="top" secondItem="PO3-kF-2C5" secondAttribute="bottom" constant="14" id="api-Tj-crN"/>
767859
<constraint firstAttribute="trailing" secondItem="Hfn-iA-xua" secondAttribute="trailing" constant="20" symbolic="YES" id="lga-uZ-nGU"/>
768860
<constraint firstItem="jJF-zo-xje" firstAttribute="top" secondItem="1kK-jA-VrG" secondAttribute="top" constant="20" symbolic="YES" id="tW5-wZ-DRa"/>
769861
<constraint firstItem="jJF-zo-xje" firstAttribute="leading" secondItem="1kK-jA-VrG" secondAttribute="leading" constant="20" symbolic="YES" id="tlz-a7-foM"/>
770862
</constraints>
771863
</view>
772-
<point key="canvasLocation" x="196" y="42"/>
864+
<point key="canvasLocation" x="187.5" y="69"/>
773865
</window>
774866
</objects>
775867
</document>

BuildSettingExtractor/BuildSettingExtractor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
// The name that will be used to name the project configuration. Default is "Project".
1818
@property (copy) NSString *projectConfigName;
1919

20+
// The string that will separate filename components. Default is "-" hyphen-case.
21+
@property (copy) NSString *nameSeparator;
22+
2023
// Should each build setting be commented with title and description, if available.
2124
@property (assign) BOOL includeBuildSettingInfoComments;
2225

BuildSettingExtractor/BuildSettingExtractor.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ @implementation BuildSettingExtractor
2424
- (instancetype)init {
2525
self = [super init];
2626
if (self) {
27-
_sharedConfigName = @"Shared";
28-
_projectConfigName = @"Project";
27+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
28+
_sharedConfigName = [defaults stringForKey:TPSOutputFileNameShared];
29+
_projectConfigName = [defaults stringForKey:TPSOutputFileNameProject];
30+
_nameSeparator = [defaults stringForKey:TPSOutputFileNameSeparator];
2931
_buildSettingsByTarget = [[NSMutableDictionary alloc] init];
3032
_buildSettingInfoSource = [[BuildSettingInfoSource alloc] init];
3133
}
@@ -150,7 +152,8 @@ - (void)writeConfigFilesToDestinationFolder:(NSURL *)destinationURL {
150152

151153
// Given the target name and config name returns the xcconfig filename to be used.
152154
- (NSString *)configFilenameWithTargetName:(NSString *)targetName configName:(NSString *)configName {
153-
return [NSString stringWithFormat:@"%@-%@.xcconfig", targetName, configName];
155+
NSString *separator = configName.length ? self.nameSeparator: @"";
156+
return [NSString stringWithFormat:@"%@%@%@.xcconfig", targetName, separator, configName];
154157
}
155158

156159
// Given the filename generate the header comment

BuildSettingExtractor/Constants+Categories.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ typedef NS_ENUM(NSUInteger, AppErrorCodes) {
1515

1616
extern NSString *const TPSOpenDirectoryInFinder;
1717
extern NSString *const TPSIncludeBuildSettingInfoComments;
18+
extern NSString *const TPSOutputFileNameProject;
19+
extern NSString *const TPSOutputFileNameShared;
20+
extern NSString *const TPSOutputFileNameSeparator;
1821

1922

2023
#pragma mark -

BuildSettingExtractor/Constants+Categories.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
NSString *const TPSOpenDirectoryInFinder = @"TPSOpenDirectoryInFinder";
1212
NSString *const TPSIncludeBuildSettingInfoComments = @"TPSIncludeBuildSettingInfoComments";
13+
NSString *const TPSOutputFileNameProject = @"TPSOutputFileNameProject";
14+
NSString *const TPSOutputFileNameShared = @"TPSOutputFileNameShared";
15+
NSString *const TPSOutputFileNameSeparator = @"TPSOutputFileNameSeparator";
1316

1417
#pragma mark -
1518

0 commit comments

Comments
 (0)