Skip to content

Commit

Permalink
Resolve build issues with generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
mac-cain13 committed Oct 5, 2016
1 parent 7bbdacd commit d35baaa
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion R.swift/Generators/ImageGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct ImageGenerator: ExternalOnlyStructGenerator {
isStatic: true,
name: SwiftIdentifier(name: name),
typeDefinition: .inferred(Type.ImageResource),
value: "Rswift.ImageResource(bundle: _R.hostingBundle, name: \"\(name)\")"
value: "Rswift.ImageResource(bundle: R.hostingBundle, name: \"\(name)\")"
)
}

Expand Down
2 changes: 1 addition & 1 deletion R.swift/Generators/NibGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ struct NibGenerator: StructGenerator {
isStatic: false,
name: "bundle",
typeDefinition: .inferred(Type._Bundle),
value: "_R.hostingBundle"
value: "R.hostingBundle"
)

let nameVar = Let(
Expand Down
2 changes: 1 addition & 1 deletion R.swift/Generators/ResourceFileGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct ResourceFileGenerator: ExternalOnlyStructGenerator {
isStatic: true,
name: SwiftIdentifier(name: $0.fullname),
typeDefinition: .inferred(Type.FileResource),
value: "Rswift.FileResource(bundle: _R.hostingBundle, name: \"\($0.filename)\", pathExtension: \"\($0.pathExtension)\")"
value: "Rswift.FileResource(bundle: R.hostingBundle, name: \"\($0.filename)\", pathExtension: \"\($0.pathExtension)\")"
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion R.swift/Generators/StoryboardGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct StoryboardGenerator: StructGenerator {
var functions: [Function] = []
var properties: [Let] = [
Let(comments: [], accessModifier: externalAccessLevel, isStatic: false, name: "name", typeDefinition: .inferred(Type._String), value: "\"\(storyboard.name)\""),
Let(comments: [], accessModifier: externalAccessLevel, isStatic: false, name: "bundle", typeDefinition: .inferred(Type._Bundle), value: "_R.hostingBundle")
Let(comments: [], accessModifier: externalAccessLevel, isStatic: false, name: "bundle", typeDefinition: .inferred(Type._Bundle), value: "R.hostingBundle")
]

// Initial view controller
Expand Down
8 changes: 4 additions & 4 deletions R.swift/Generators/StringsGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ struct StringsGenerator: ExternalOnlyStructGenerator {
isStatic: true,
name: SwiftIdentifier(name: values.key),
typeDefinition: .inferred(Type.StringResource),
value: "Rswift.StringResource(key: \"\(escapedKey)\", tableName: \"\(values.tableName)\", bundle: _R.hostingBundle, locales: [\(locales)], comment: nil)"
value: "Rswift.StringResource(key: \"\(escapedKey)\", tableName: \"\(values.tableName)\", bundle: R.hostingBundle, locales: [\(locales)], comment: nil)"
)
}

Expand Down Expand Up @@ -223,7 +223,7 @@ struct StringsGenerator: ExternalOnlyStructGenerator {
parameters: params,
doesThrow: false,
returnType: Type._String,
body: "return String(format: \(values.localizedString), locale: _R.applicationLocale, \(args))"
body: "return String(format: \(values.localizedString), locale: R.applicationLocale, \(args))"
)
}

Expand Down Expand Up @@ -252,10 +252,10 @@ private struct StringValues {
let escapedKey = key.escapedStringLiteral

if tableName == "Localizable" {
return "NSLocalizedString(\"\(escapedKey)\", bundle: _R.hostingBundle, comment: \"\")"
return "NSLocalizedString(\"\(escapedKey)\", bundle: R.hostingBundle, comment: \"\")"
}
else {
return "NSLocalizedString(\"\(escapedKey)\", tableName: \"\(tableName)\", bundle: _R.hostingBundle, comment: \"\")"
return "NSLocalizedString(\"\(escapedKey)\", tableName: \"\(tableName)\", bundle: R.hostingBundle, comment: \"\")"
}
}

Expand Down
4 changes: 2 additions & 2 deletions R.swift/Generators/ValidatedStructGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class ValidatedStructGenerator: StructGenerator {

let validationStruct = Struct(
comments: [],
accessModifier: .Private,
accessModifier: .FilePrivate,
type: Type(module: .host, name: "intern"),
implements: [TypePrinter(type: Type.Validatable)],
typealiasses: [],
properties: [],
functions: [
Function(
comments: [],
accessModifier: .Private,
accessModifier: .FilePrivate,
isStatic: true,
name: "validate",
generics: nil,
Expand Down
6 changes: 3 additions & 3 deletions R.swift/SwiftTypes/Struct.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ struct Struct: UsedTypesProvider, SwiftCodeConverible {
.joined(separator: "\n\n")


// Private `init`, so that struct can't be initialized
let privateInit = "private init() {}"
// File private `init`, so that struct can't be initialized from the outside world
let fileprivateInit = "fileprivate init() {}"

let bodyComponents = [typealiasString, varsString, functionsString, structsString, privateInit].filter { $0 != "" }
let bodyComponents = [typealiasString, varsString, functionsString, structsString, fileprivateInit].filter { $0 != "" }
let bodyString = bodyComponents.joined(separator: "\n\n").indentWithString(IndentationString)

return "\(commentsString)\(accessModifierString)struct \(type)\(implementsString) {\n\(bodyString)\n}"
Expand Down
2 changes: 1 addition & 1 deletion ResourceApp/ResourceApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
DEF559AB1CA48892009B8C51 /* ResourceAppTests-tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ResourceAppTests-tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
DEF559AD1CA48892009B8C51 /* ResourceAppTests_tvOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResourceAppTests_tvOS.swift; sourceTree = "<group>"; };
DEF559AF1CA48892009B8C51 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DEF559B61CA48DC2009B8C51 /* R.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = R.generated.swift; sourceTree = "<group>"; };
DEF559B61CA48DC2009B8C51 /* R.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = R.generated.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
DEF559B81CA4932F009B8C51 /* Rswift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Rswift.framework; path = "../R.swift.Library/build/Debug-appletvos/Rswift.framework"; sourceTree = "<group>"; };
E20983231D585E78005ACBAA /* SegueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SegueTests.swift; sourceTree = "<group>"; };
E20983251D585F8C005ACBAA /* Xib with ViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Xib with ViewController.xib"; sourceTree = "<group>"; };
Expand Down

0 comments on commit d35baaa

Please sign in to comment.