Skip to content

Commit

Permalink
Merge pull request #15 from handsomecode/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
enmiller authored Feb 8, 2018
2 parents 6fe9ee5 + 75ad283 commit 1d55992
Show file tree
Hide file tree
Showing 9 changed files with 1,033 additions and 1,028 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TOOL_NAME = UnityBuildKit
VERSION = 1.1.3
VERSION = 1.1.4

PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(TOOL_NAME)
Expand Down
12 changes: 6 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"repositoryURL": "https://github.com/onevcat/Rainbow.git",
"state": {
"branch": null,
"revision": "f407235c7e473c3cb2d2907bb6822616d22a0b78",
"version": "3.0.3"
"revision": "f69961599ad524251d677fbec9e4bac57385d6fc",
"version": "3.1.1"
}
},
{
Expand All @@ -69,8 +69,8 @@
"repositoryURL": "https://github.com/yonaskolb/XcodeGen.git",
"state": {
"branch": null,
"revision": "1153e020e18408f8f2c77597450adc8f7e924cc8",
"version": "1.5.0"
"revision": "af9104bb91d3b7696a115da6203b0e0984586a29",
"version": "1.6.0"
}
},
{
Expand All @@ -87,8 +87,8 @@
"repositoryURL": "https://github.com/xcodeswift/xcproj.git",
"state": {
"branch": null,
"revision": "1b0864a4417efc35c21fdc7d98d3c9bb0152eaf9",
"version": "1.8.0"
"revision": "5f68ad74627a537cdd3d022644edd0fa7a80d4a7",
"version": "4.0.0"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let package = Package(
.library(name: "UBKit", targets: ["UBKit"]),
],
dependencies: [
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "1.4.0")
.package(url: "https://github.com/yonaskolb/XcodeGen.git", .upToNextMinor(from: "1.6.0"))
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="Assets/ubk_logo.png">
</p>
<p align="center">
<img src="https://img.shields.io/badge/version-1.1.3-blue.svg?style=flat-square" />
<img src="https://img.shields.io/badge/version-1.1.4-blue.svg?style=flat-square" />
<a href="https://github.com/handsomecode/UnityBuildKit/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square"/>
</a>
Expand Down
12 changes: 6 additions & 6 deletions Sources/UBKit/Files/Xcode/SpecFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ extension File {
It is specifically indented and formatted in order
to work once the data is written to the spec file.
*/
class func specFile(projectName: String, bundleIdentifier: String, unityVersion: String) -> Data? {
class func specFile(iOSProjectName: String, bundleIdentifier: String, unityProjectName: String, unityVersion: String) -> Data? {
let file = """
name: \(projectName)
name: \(iOSProjectName)
configs:
Debug: debug
Release: release
targets:
\(projectName):
\(iOSProjectName):
type: application
platform: iOS
sources:
- \(projectName)
- \(iOSProjectName)
- Vendor
settings:
PRODUCT_BUNDLE_IDENTIFIER: \(bundleIdentifier)
IOS_DEPLOYMENT_TARGET: 11.0
IPHONEOS_DEPLOYMENT_TARGET: 11.0
UNITY_RUNTIME_VERSION: \(unityVersion)
UNITY_SCRIPTING_BACKEND: il2cpp
UNITY_IOS_EXPORT_PATH: ${SRCROOT}/../Unity/\(projectName)/ios_build
UNITY_IOS_EXPORT_PATH: ${SRCROOT}/../Unity/\(unityProjectName)/ios_build
GCC_PREFIX_HEADER: $(UNITY_IOS_EXPORT_PATH)/Classes/Prefix.pch
OTHER_LDFLAGS: -weak-lSystem -liconv.2 -liPhone-lib -weak_framework CoreMotion -weak_framework iAd -framework OpenGLES
HEADER_SEARCH_PATHS: $(UNITY_IOS_EXPORT_PATH)/Classes $(UNITY_IOS_EXPORT_PATH)/Classes/Native $(UNITY_IOS_EXPORT_PATH)/Libraries/libil2cpp/include
Expand All @@ -58,7 +58,7 @@ extension File {
OTHER_CFLAGS: $(inherited) -DINIT_SCRIPTING_BACKEND=1 -fno-strict-overflow -DRUNTIME_IL2CPP=1
CLANG_CXX_LANGUAGE_STANDARD: c++11
CLANG_CXX_LIBRARY: libc++
SWIFT_OBJC_BRIDGING_HEADER: \(projectName)/UnityBridge/UnityBridge.h
SWIFT_OBJC_BRIDGING_HEADER: \(iOSProjectName)/UnityBridge/UnityBridge.h
CLANG_ENABLE_MODULES: NO
CLANG_WARN_BOOL_CONVERSION: NO
CLANG_WARN_CONSTANT_CONVERSION: NO
Expand Down
29 changes: 4 additions & 25 deletions Sources/UBKit/Workers/FileCopier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ private extension FileCopier {
return .failure(UBKitError.invalidXcodeProject("Missing main target"))
}

let frameworksBuildPhase = PBXFrameworksBuildPhase(reference: generateUUID(PBXFrameworksBuildPhase.self,
"frameworks".appending(nameSalt)))
mainTarget.value.buildPhases.append(frameworksBuildPhase.reference)
project.pbxproj.objects.addObject(frameworksBuildPhase)
let frameworksBuildPhase = PBXFrameworksBuildPhase()
let frameworksBuildPhaseReference = project.pbxproj.objects.generateReference(frameworksBuildPhase, "frameworks".appending(nameSalt))
mainTarget.value.buildPhases.append(frameworksBuildPhaseReference)
project.pbxproj.objects.addObject(frameworksBuildPhase, reference: frameworksBuildPhaseReference)

return .success
}
Expand Down Expand Up @@ -275,24 +275,3 @@ private extension FileCopier {
return .success
}
}

/**
The following private methods are credited to XcodeGenKit and
are used with little to no modifications.
*/
private extension FileCopier {

func generateUUID<T: PBXObject>(_ element: T.Type, _ id: String) -> String {
var uuid: String = ""
var counter: UInt = 0
let className: String = String(describing: T.self).replacingOccurrences(of: "PBX", with: "")
let classAcronym = className.filter({ String($0).lowercased() != String($0) })
let stringID = String(abs(id.hashValue).description.prefix(10 - classAcronym.utf8.count))
repeat {
counter += 1
uuid = "\(classAcronym)\(stringID)\(String(format: "%02d", counter))"
} while (uuids.contains(uuid))
uuids.insert(uuid)
return uuid
}
}
3 changes: 2 additions & 1 deletion Sources/UBKit/Workers/XcodeProject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ private extension XcodeProject {
}

let contents = File.specFile(
projectName: config.iOS.projectName,
iOSProjectName: config.iOS.projectName,
bundleIdentifier: config.iOS.bundleId,
unityProjectName: config.unity.projectName,
unityVersion: config.unity.version
)

Expand Down
2 changes: 1 addition & 1 deletion UnityBuildKit.xcodeproj/UBKit_Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.1</string>
<string>1.1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
Loading

0 comments on commit 1d55992

Please sign in to comment.