Skip to content

Commit a3a395b

Browse files
author
Sean Henry
committed
Removes JDK requirement
1 parent f2f1e4c commit a3a395b

File tree

9 files changed

+5
-125
lines changed

9 files changed

+5
-125
lines changed

MockGenerator.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,7 @@
15621562
SDKROOT = macosx;
15631563
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
15641564
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1565+
VERSION_NUMBER = 0.1;
15651566
};
15661567
name = Debug;
15671568
};
@@ -1605,6 +1606,7 @@
16051606
MTL_ENABLE_DEBUG_INFO = NO;
16061607
SDKROOT = macosx;
16071608
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
1609+
VERSION_NUMBER = 0.1;
16081610
};
16091611
name = Release;
16101612
};

MockGeneratorApp/AppDelegate.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
1-
//
2-
// AppDelegate.swift
3-
// MockGenerator
4-
//
5-
// Created by Sean Henry on 12/08/2017.
6-
// Copyright © 2017 Sean Henry. All rights reserved.
7-
//
8-
91
import Cocoa
102

113
@NSApplicationMain
124
class AppDelegate: NSObject, NSApplicationDelegate {
13-
14-
func applicationDidFinishLaunching(_ aNotification: Notification) {
15-
// Insert code here to initialize your application
16-
}
17-
18-
func applicationWillTerminate(_ aNotification: Notification) {
19-
// Insert code here to tear down your application
20-
}
21-
22-
235
}
246

MockGeneratorApp/Base.lproj/Main.storyboard

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -691,47 +691,8 @@
691691
<rect key="frame" x="0.0" y="0.0" width="480" height="240"/>
692692
<subviews>
693693
<stackView distribution="equalSpacing" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="s4D-w1-Fmx">
694-
<rect key="frame" x="8" y="130" width="464" height="102"/>
694+
<rect key="frame" x="8" y="185" width="464" height="47"/>
695695
<subviews>
696-
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="47P-jH-na3">
697-
<rect key="frame" x="-2" y="85" width="60" height="17"/>
698-
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="JDK path" id="dUB-AS-eZm">
699-
<font key="font" metaFont="system"/>
700-
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
701-
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
702-
</textFieldCell>
703-
</textField>
704-
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Dmz-7L-NLx">
705-
<rect key="frame" x="0.0" y="55" width="464" height="22"/>
706-
<subviews>
707-
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8UD-Dy-zJg">
708-
<rect key="frame" x="0.0" y="0.0" width="438" height="22"/>
709-
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" enabled="NO" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="" drawsBackground="YES" id="vsF-Pw-2PP">
710-
<font key="font" metaFont="system"/>
711-
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
712-
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
713-
</textFieldCell>
714-
</textField>
715-
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fnF-kc-3fu">
716-
<rect key="frame" x="446" y="2" width="18" height="21"/>
717-
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSPathTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="VgG-a2-iPC">
718-
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
719-
<font key="font" metaFont="system"/>
720-
</buttonCell>
721-
<connections>
722-
<action selector="didTapJDKPathButton:" target="VQz-9A-PX1" id="pxA-pc-6Tb"/>
723-
</connections>
724-
</button>
725-
</subviews>
726-
<visibilityPriorities>
727-
<integer value="1000"/>
728-
<integer value="1000"/>
729-
</visibilityPriorities>
730-
<customSpacing>
731-
<real value="3.4028234663852886e+38"/>
732-
<real value="3.4028234663852886e+38"/>
733-
</customSpacing>
734-
</stackView>
735696
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cnF-nW-tKi">
736697
<rect key="frame" x="-2" y="30" width="78" height="17"/>
737698
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Project path" id="OlE-51-ShT">
@@ -774,21 +735,15 @@
774735
</subviews>
775736
<constraints>
776737
<constraint firstItem="kf8-Tc-urf" firstAttribute="leading" secondItem="s4D-w1-Fmx" secondAttribute="leading" id="hMp-yZ-DWQ"/>
777-
<constraint firstAttribute="trailing" secondItem="Dmz-7L-NLx" secondAttribute="trailing" id="n1l-Xy-Ybn"/>
778-
<constraint firstItem="Dmz-7L-NLx" firstAttribute="leading" secondItem="s4D-w1-Fmx" secondAttribute="leading" id="wB3-E7-h6j"/>
779738
<constraint firstAttribute="trailing" secondItem="kf8-Tc-urf" secondAttribute="trailing" id="xca-EN-wqV"/>
780739
</constraints>
781740
<visibilityPriorities>
782741
<integer value="1000"/>
783742
<integer value="1000"/>
784-
<integer value="1000"/>
785-
<integer value="1000"/>
786743
</visibilityPriorities>
787744
<customSpacing>
788745
<real value="3.4028234663852886e+38"/>
789746
<real value="3.4028234663852886e+38"/>
790-
<real value="3.4028234663852886e+38"/>
791-
<real value="3.4028234663852886e+38"/>
792747
</customSpacing>
793748
</stackView>
794749
</subviews>
@@ -798,7 +753,6 @@
798753
<constraint firstAttribute="trailing" secondItem="s4D-w1-Fmx" secondAttribute="trailing" constant="8" id="YgM-cC-Zn4"/>
799754
</constraints>
800755
<connections>
801-
<outlet property="jdkPathField" destination="8UD-Dy-zJg" id="p1S-fJ-7K2"/>
802756
<outlet property="projectPathField" destination="GcX-IJ-g25" id="qVg-sR-LyD"/>
803757
</connections>
804758
</customView>

MockGeneratorApp/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.0</string>
20+
<string>$(VERSION_NUMBER)</string>
2121
<key>CFBundleVersion</key>
2222
<string>1</string>
2323
<key>LSMinimumSystemVersion</key>

MockGeneratorApp/PreferencesView.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,13 @@ import AppKit
22

33
class PreferencesView: NSView {
44

5-
@IBOutlet var jdkPathField: NSTextField!
65
@IBOutlet var projectPathField: NSTextField!
76

87
override func viewDidMoveToWindow() {
98
super.viewDidMoveToWindow()
10-
jdkPathField.stringValue = Preferences().jdkPath?.path ?? ""
119
projectPathField.stringValue = Preferences().projectPath?.path ?? ""
1210
}
1311

14-
@IBAction func didTapJDKPathButton(_ sender: Any?) {
15-
let panel = NSOpenPanel()
16-
panel.allowsMultipleSelection = false
17-
panel.canChooseDirectories = true
18-
panel.canChooseFiles = false
19-
var startingDirectory = jdkPathField.stringValue
20-
if startingDirectory == "" {
21-
startingDirectory = "/Library/Java/JavaVirtualMachines"
22-
}
23-
panel.directoryURL = URL(fileURLWithPath: startingDirectory)
24-
if panel.runModal() == NSModalResponseOK {
25-
Preferences().jdkPath = panel.directoryURL
26-
jdkPathField.stringValue = panel.directoryURL?.path ?? ""
27-
}
28-
}
29-
3012
@IBAction func didTapProjectPathButton(_ sender: Any?) {
3113
let panel = NSOpenPanel()
3214
panel.allowsMultipleSelection = false
Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
1-
//
2-
// ViewController.swift
3-
// MockGenerator
4-
//
5-
// Created by Sean Henry on 12/08/2017.
6-
// Copyright © 2017 Sean Henry. All rights reserved.
7-
//
8-
91
import Cocoa
102

113
class ViewController: NSViewController {
12-
13-
override func viewDidLoad() {
14-
super.viewDidLoad()
15-
16-
// Do any additional setup after loading the view.
17-
}
18-
19-
override var representedObject: Any? {
20-
didSet {
21-
// Update the view, if already loaded.
22-
}
23-
}
24-
25-
264
}
275

MockGeneratorAppTests/PreferencesTests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,4 @@ class PreferencesTests: XCTestCase {
2222
preferences.projectPath = testURL
2323
XCTAssertEqual(Preferences().projectPath, testURL)
2424
}
25-
26-
// MARK: - jdkPath
27-
28-
func test_jdkPath_shouldRememberJDKPath() {
29-
preferences.jdkPath = testURL
30-
XCTAssertEqual(Preferences().jdkPath, testURL)
31-
}
3225
}

Shared/Preferences.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ class Preferences {
44

55
private lazy var userDefaults = UserDefaults(suiteName: "group.codes.seanhenry.MockGenerator")!
66
private let projectPathKey = "project.path"
7-
private let jdkPathKey = "jdk.path"
87

98
var projectPath: URL? {
109
set {
@@ -15,14 +14,4 @@ class Preferences {
1514
return userDefaults.url(forKey: projectPathKey)
1615
}
1716
}
18-
19-
var jdkPath: URL? {
20-
set {
21-
userDefaults.set(newValue, forKey: jdkPathKey)
22-
userDefaults.synchronize()
23-
}
24-
get {
25-
return userDefaults.url(forKey: jdkPathKey)
26-
}
27-
}
2817
}

XcodePlugin/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>XPC!</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.0</string>
20+
<string>$(VERSION_NUMBER)</string>
2121
<key>CFBundleVersion</key>
2222
<string>1</string>
2323
<key>LSMinimumSystemVersion</key>

0 commit comments

Comments
 (0)