Skip to content

Commit 8754da2

Browse files
committed
- added static library target for building command line tools
1 parent 3a6dc6d commit 8754da2

File tree

5 files changed

+162
-16
lines changed

5 files changed

+162
-16
lines changed

Common/Tracery.swift

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ extension TraceryOptions {
3434
public static let defaultSet = TraceryOptions()
3535
}
3636

37-
public class Tracery {
37+
public class Tracery : NSObject {
3838

3939
var objects = [String: Any]()
40-
var ruleSet: [String: RuleMapping]
40+
var ruleSet: [String: RuleMapping] = [:]
4141
var runTimeRuleSet = [String: RuleMapping]()
42-
var mods: [String: (String,[String])->String]
42+
var mods: [String: (String,[String])->String] = [:]
4343
var tagStorage: TagStorage
4444
var contextStack: ContextStack
4545
var randomSource_: RandomSource = FallbackRandomSource.shared
@@ -58,14 +58,13 @@ public class Tracery {
5858
let options: TraceryOptions
5959

6060
public init(_ options: TraceryOptions = TraceryOptions.defaultSet, rules: () -> [String: Any]) {
61-
62-
self.options = options
63-
mods = [:]
64-
ruleSet = [:]
65-
tagStorage = options.tagStorageType.storage()
66-
contextStack = ContextStack()
67-
tagStorage.tracery = self
6861

62+
self.options = options
63+
self.tagStorage = options.tagStorageType.storage()
64+
self.contextStack = ContextStack()
65+
super.init()
66+
self.tagStorage.tracery = self
67+
6968
if options.isDeterministic {
7069
setSeed(options.seed)
7170
}

Tracery/.DS_Store

0 Bytes
Binary file not shown.

Tracery/Tracery Static Mac/Tracery.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,3 @@
88

99
#import <Foundation/Foundation.h>
1010

11-
@interface Tracery : NSObject
12-
13-
@end

Tracery/Tracery Static Mac/Tracery.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@
77
//
88

99
#import "Tracery.h"
10+
#import "Tracery-Swift.h"
1011

11-
@implementation Tracery
12-
13-
@end

Tracery/Tracery.xcodeproj/project.pbxproj

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@
1919
0E9D3C39218758CD00C77E64 /* EmptyRulesetDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC01F1E72F2B7008623B8 /* EmptyRulesetDetector.swift */; };
2020
0E9D3C3D21875B9900C77E64 /* RandomSources.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E9D3C3C21875B9900C77E64 /* RandomSources.swift */; };
2121
0E9D3C3E21875B9900C77E64 /* RandomSources.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E9D3C3C21875B9900C77E64 /* RandomSources.swift */; };
22+
0EA325152192FB4100C909D5 /* Tracery.h in Headers */ = {isa = PBXBuildFile; fileRef = 0EA325142192FB4100C909D5 /* Tracery.h */; };
23+
0EA325172192FB4200C909D5 /* Tracery.m in Sources */ = {isa = PBXBuildFile; fileRef = 0EA325162192FB4100C909D5 /* Tracery.m */; };
24+
0EA3251B2192FC6C00C909D5 /* Tracery.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC0281E72F2B7008623B8 /* Tracery.swift */; };
25+
0EA3251C2192FD5000C909D5 /* CyclicReferenceIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC01E1E72F2B7008623B8 /* CyclicReferenceIdentifier.swift */; };
26+
0EA3251D2192FD5000C909D5 /* EmptyRulesetDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC01F1E72F2B7008623B8 /* EmptyRulesetDetector.swift */; };
27+
0EA3251E2192FD5000C909D5 /* RuleSelfReferenceIdentifer.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC0241E72F2B7008623B8 /* RuleSelfReferenceIdentifer.swift */; };
28+
0EA3251F2192FD5000C909D5 /* RulesetAnalyser.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC0251E72F2B7008623B8 /* RulesetAnalyser.swift */; };
29+
0EA325202192FD5000C909D5 /* TagOverrideRuleIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC0261E72F2B7008623B8 /* TagOverrideRuleIdentifier.swift */; };
30+
0EA325212192FD5000C909D5 /* Lexer.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC0201E72F2B7008623B8 /* Lexer.swift */; };
31+
0EA325222192FD5000C909D5 /* Modifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E79B9EB216CA66600359AB3 /* Modifiers.swift */; };
32+
0EA325232192FD5000C909D5 /* Parser.Gen2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B99F305B1E869E08005B0808 /* Parser.Gen2.swift */; };
33+
0EA325242192FD5000C909D5 /* Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC0211E72F2B7008623B8 /* Parser.swift */; };
34+
0EA325252192FD5000C909D5 /* RandomSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E71B8362181CF70008F829A /* RandomSource.swift */; };
35+
0EA325262192FD5000C909D5 /* RuleCandidateSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC0221E72F2B7008623B8 /* RuleCandidateSelector.swift */; };
36+
0EA325272192FD5000C909D5 /* RuleCandidatesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC0231E72F2B7008623B8 /* RuleCandidatesProvider.swift */; };
37+
0EA325282192FD5000C909D5 /* TagStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B975BB7D1E75C91C0076A1EA /* TagStorage.swift */; };
38+
0EA325292192FD5000C909D5 /* Tracery.Eval.swift in Sources */ = {isa = PBXBuildFile; fileRef = B90E7E741E77C6A000C5BD17 /* Tracery.Eval.swift */; };
39+
0EA3252A2192FD5000C909D5 /* Tracery.Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96DC0271E72F2B7008623B8 /* Tracery.Logging.swift */; };
40+
0EA3252B2192FD5000C909D5 /* Tracery.Text.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9A248E51E817216004D60C9 /* Tracery.Text.swift */; };
41+
0EA3252C2192FD5000C909D5 /* Tracery.JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E79B9E6216CA65000359AB3 /* Tracery.JSON.swift */; };
2242
B90E7E751E77C6A000C5BD17 /* Tracery.Eval.swift in Sources */ = {isa = PBXBuildFile; fileRef = B90E7E741E77C6A000C5BD17 /* Tracery.Eval.swift */; };
2343
B90E7E761E77C71F00C5BD17 /* Tracery.Eval.swift in Sources */ = {isa = PBXBuildFile; fileRef = B90E7E741E77C6A000C5BD17 /* Tracery.Eval.swift */; };
2444
B9127FE51E77AEA40063D5A8 /* Tracery.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B96DBFED1E72B993008623B8 /* Tracery.framework */; };
@@ -117,6 +137,9 @@
117137
0E79B9EE216CA6B500359AB3 /* Modifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Modifiers.swift; sourceTree = "<group>"; };
118138
0E79BA1A2171D69200359AB3 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
119139
0E9D3C3C21875B9900C77E64 /* RandomSources.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RandomSources.swift; sourceTree = "<group>"; };
140+
0EA325122192FB4100C909D5 /* libTracery.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTracery.a; sourceTree = BUILT_PRODUCTS_DIR; };
141+
0EA325142192FB4100C909D5 /* Tracery.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Tracery.h; sourceTree = "<group>"; };
142+
0EA325162192FB4100C909D5 /* Tracery.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tracery.m; sourceTree = "<group>"; };
120143
B90E7E741E77C6A000C5BD17 /* Tracery.Eval.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tracery.Eval.swift; sourceTree = "<group>"; };
121144
B9127FE01E77AEA40063D5A8 /* Tracery Tests macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tracery Tests macOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
122145
B9127FE41E77AEA40063D5A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -164,6 +187,13 @@
164187
/* End PBXFileReference section */
165188

166189
/* Begin PBXFrameworksBuildPhase section */
190+
0EA325102192FB4100C909D5 /* Frameworks */ = {
191+
isa = PBXFrameworksBuildPhase;
192+
buildActionMask = 2147483647;
193+
files = (
194+
);
195+
runOnlyForDeploymentPostprocessing = 0;
196+
};
167197
B9127FDD1E77AEA40063D5A8 /* Frameworks */ = {
168198
isa = PBXFrameworksBuildPhase;
169199
buildActionMask = 2147483647;
@@ -209,6 +239,15 @@
209239
path = Analyzer;
210240
sourceTree = "<group>";
211241
};
242+
0EA325132192FB4100C909D5 /* Tracery Static Mac */ = {
243+
isa = PBXGroup;
244+
children = (
245+
0EA325142192FB4100C909D5 /* Tracery.h */,
246+
0EA325162192FB4100C909D5 /* Tracery.m */,
247+
);
248+
path = "Tracery Static Mac";
249+
sourceTree = "<group>";
250+
};
212251
B9127FE11E77AEA40063D5A8 /* Tracery Tests macOS */ = {
213252
isa = PBXGroup;
214253
children = (
@@ -258,6 +297,7 @@
258297
B96DBFEE1E72B993008623B8 /* Tracery Mac */,
259298
B9FCA8081E73D6FA0069F8B6 /* Tracery Tests iOS */,
260299
B9127FE11E77AEA40063D5A8 /* Tracery Tests macOS */,
300+
0EA325132192FB4100C909D5 /* Tracery Static Mac */,
261301
B96DBFBD1E72B630008623B8 /* Products */,
262302
);
263303
sourceTree = "<group>";
@@ -269,6 +309,7 @@
269309
B96DBFED1E72B993008623B8 /* Tracery.framework */,
270310
B9FCA8071E73D6FA0069F8B6 /* Tracery Tests iOS.xctest */,
271311
B9127FE01E77AEA40063D5A8 /* Tracery Tests macOS.xctest */,
312+
0EA325122192FB4100C909D5 /* libTracery.a */,
272313
);
273314
name = Products;
274315
sourceTree = "<group>";
@@ -325,6 +366,14 @@
325366
/* End PBXGroup section */
326367

327368
/* Begin PBXHeadersBuildPhase section */
369+
0EA3250E2192FB4100C909D5 /* Headers */ = {
370+
isa = PBXHeadersBuildPhase;
371+
buildActionMask = 2147483647;
372+
files = (
373+
0EA325152192FB4100C909D5 /* Tracery.h in Headers */,
374+
);
375+
runOnlyForDeploymentPostprocessing = 0;
376+
};
328377
B96DBFB91E72B630008623B8 /* Headers */ = {
329378
isa = PBXHeadersBuildPhase;
330379
buildActionMask = 2147483647;
@@ -344,6 +393,23 @@
344393
/* End PBXHeadersBuildPhase section */
345394

346395
/* Begin PBXNativeTarget section */
396+
0EA325112192FB4100C909D5 /* Tracery */ = {
397+
isa = PBXNativeTarget;
398+
buildConfigurationList = 0EA3251A2192FB4200C909D5 /* Build configuration list for PBXNativeTarget "Tracery" */;
399+
buildPhases = (
400+
0EA3250E2192FB4100C909D5 /* Headers */,
401+
0EA3250F2192FB4100C909D5 /* Sources */,
402+
0EA325102192FB4100C909D5 /* Frameworks */,
403+
);
404+
buildRules = (
405+
);
406+
dependencies = (
407+
);
408+
name = Tracery;
409+
productName = Tracery;
410+
productReference = 0EA325122192FB4100C909D5 /* libTracery.a */;
411+
productType = "com.apple.product-type.library.static";
412+
};
347413
B9127FDF1E77AEA40063D5A8 /* Tracery Tests macOS */ = {
348414
isa = PBXNativeTarget;
349415
buildConfigurationList = B9127FE81E77AEA40063D5A8 /* Build configuration list for PBXNativeTarget "Tracery Tests macOS" */;
@@ -426,6 +492,11 @@
426492
LastUpgradeCheck = 1000;
427493
ORGANIZATIONNAME = "Benzi Ahamed";
428494
TargetAttributes = {
495+
0EA325112192FB4100C909D5 = {
496+
CreatedOnToolsVersion = 10.0;
497+
DevelopmentTeam = 3FJFA95D6E;
498+
ProvisioningStyle = Automatic;
499+
};
429500
B9127FDF1E77AEA40063D5A8 = {
430501
CreatedOnToolsVersion = 8.2.1;
431502
DevelopmentTeam = 4QL7N5894Y;
@@ -465,6 +536,7 @@
465536
B96DBFEC1E72B993008623B8 /* Tracery macOS */,
466537
B9FCA8061E73D6FA0069F8B6 /* Tracery Tests iOS */,
467538
B9127FDF1E77AEA40063D5A8 /* Tracery Tests macOS */,
539+
0EA325112192FB4100C909D5 /* Tracery */,
468540
);
469541
};
470542
/* End PBXProject section */
@@ -503,6 +575,32 @@
503575
/* End PBXResourcesBuildPhase section */
504576

505577
/* Begin PBXSourcesBuildPhase section */
578+
0EA3250F2192FB4100C909D5 /* Sources */ = {
579+
isa = PBXSourcesBuildPhase;
580+
buildActionMask = 2147483647;
581+
files = (
582+
0EA3252A2192FD5000C909D5 /* Tracery.Logging.swift in Sources */,
583+
0EA325272192FD5000C909D5 /* RuleCandidatesProvider.swift in Sources */,
584+
0EA3251C2192FD5000C909D5 /* CyclicReferenceIdentifier.swift in Sources */,
585+
0EA325242192FD5000C909D5 /* Parser.swift in Sources */,
586+
0EA3251B2192FC6C00C909D5 /* Tracery.swift in Sources */,
587+
0EA3251D2192FD5000C909D5 /* EmptyRulesetDetector.swift in Sources */,
588+
0EA3251F2192FD5000C909D5 /* RulesetAnalyser.swift in Sources */,
589+
0EA3251E2192FD5000C909D5 /* RuleSelfReferenceIdentifer.swift in Sources */,
590+
0EA325202192FD5000C909D5 /* TagOverrideRuleIdentifier.swift in Sources */,
591+
0EA325252192FD5000C909D5 /* RandomSource.swift in Sources */,
592+
0EA325282192FD5000C909D5 /* TagStorage.swift in Sources */,
593+
0EA325212192FD5000C909D5 /* Lexer.swift in Sources */,
594+
0EA3252B2192FD5000C909D5 /* Tracery.Text.swift in Sources */,
595+
0EA325262192FD5000C909D5 /* RuleCandidateSelector.swift in Sources */,
596+
0EA3252C2192FD5000C909D5 /* Tracery.JSON.swift in Sources */,
597+
0EA325222192FD5000C909D5 /* Modifiers.swift in Sources */,
598+
0EA325292192FD5000C909D5 /* Tracery.Eval.swift in Sources */,
599+
0EA325172192FB4200C909D5 /* Tracery.m in Sources */,
600+
0EA325232192FD5000C909D5 /* Parser.Gen2.swift in Sources */,
601+
);
602+
runOnlyForDeploymentPostprocessing = 0;
603+
};
506604
B9127FDC1E77AEA40063D5A8 /* Sources */ = {
507605
isa = PBXSourcesBuildPhase;
508606
buildActionMask = 2147483647;
@@ -625,6 +723,51 @@
625723
/* End PBXTargetDependency section */
626724

627725
/* Begin XCBuildConfiguration section */
726+
0EA325182192FB4200C909D5 /* Debug */ = {
727+
isa = XCBuildConfiguration;
728+
buildSettings = {
729+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
730+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
731+
CLANG_ENABLE_OBJC_WEAK = YES;
732+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
733+
CODE_SIGN_IDENTITY = "Mac Developer";
734+
CODE_SIGN_STYLE = Automatic;
735+
DEFINES_MODULE = YES;
736+
DEVELOPMENT_TEAM = 3FJFA95D6E;
737+
EXECUTABLE_PREFIX = lib;
738+
GCC_C_LANGUAGE_STANDARD = gnu11;
739+
MACOSX_DEPLOYMENT_TARGET = 10.13;
740+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
741+
MTL_FAST_MATH = YES;
742+
PRODUCT_NAME = "$(TARGET_NAME)";
743+
SDKROOT = macosx;
744+
SKIP_INSTALL = YES;
745+
SWIFT_VERSION = 4.0;
746+
};
747+
name = Debug;
748+
};
749+
0EA325192192FB4200C909D5 /* Release */ = {
750+
isa = XCBuildConfiguration;
751+
buildSettings = {
752+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
753+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
754+
CLANG_ENABLE_OBJC_WEAK = YES;
755+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
756+
CODE_SIGN_IDENTITY = "Mac Developer";
757+
CODE_SIGN_STYLE = Automatic;
758+
DEFINES_MODULE = YES;
759+
DEVELOPMENT_TEAM = 3FJFA95D6E;
760+
EXECUTABLE_PREFIX = lib;
761+
GCC_C_LANGUAGE_STANDARD = gnu11;
762+
MACOSX_DEPLOYMENT_TARGET = 10.13;
763+
MTL_FAST_MATH = YES;
764+
PRODUCT_NAME = "$(TARGET_NAME)";
765+
SDKROOT = macosx;
766+
SKIP_INSTALL = YES;
767+
SWIFT_VERSION = 4.0;
768+
};
769+
name = Release;
770+
};
628771
B9127FE91E77AEA40063D5A8 /* Debug */ = {
629772
isa = XCBuildConfiguration;
630773
buildSettings = {
@@ -893,6 +1036,15 @@
8931036
/* End XCBuildConfiguration section */
8941037

8951038
/* Begin XCConfigurationList section */
1039+
0EA3251A2192FB4200C909D5 /* Build configuration list for PBXNativeTarget "Tracery" */ = {
1040+
isa = XCConfigurationList;
1041+
buildConfigurations = (
1042+
0EA325182192FB4200C909D5 /* Debug */,
1043+
0EA325192192FB4200C909D5 /* Release */,
1044+
);
1045+
defaultConfigurationIsVisible = 0;
1046+
defaultConfigurationName = Release;
1047+
};
8961048
B9127FE81E77AEA40063D5A8 /* Build configuration list for PBXNativeTarget "Tracery Tests macOS" */ = {
8971049
isa = XCConfigurationList;
8981050
buildConfigurations = (

0 commit comments

Comments
 (0)