Skip to content

Commit

Permalink
CocoaPods support (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPodymov authored Oct 21, 2020
1 parent 269931c commit 3c59e28
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 3 deletions.
20 changes: 20 additions & 0 deletions LispCore.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Pod::Spec.new do |s|
s.name = 'LispCore'
s.version = '0.1.0'
s.license = 'MIT'
s.summary = 'Common Lisp interpreter for macOS and iOS.'
s.homepage = 'https://github.com/puliaiev/LispMac'
s.authors = { 'Serhii Puliaiev' => 'http://puliaiev.com' }
s.social_media_url = 'https://twitter.com/spuliaiev'
s.source = { :git => 'https://github.com/puliaiev/LispMac.git', :tag => '0.1.0' }

s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.15'

s.source_files = 'Sources/LispCore/**/*.swift'
s.resource_bundles = {
'LispCore_LispCore' => ['Sources/LispCore/Resources/**/*.*']
}

s.swift_version = '5.3'
end
9 changes: 6 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ let package = Package(
name: "LispCore",
resources: [
Resource.copy("Resources/eval.lisp"),
]),
.testTarget(name: "LispCoreTests",
dependencies: ["LispCore"])
]
),
.testTarget(
name: "LispCoreTests",
dependencies: ["LispCore"]
)
]
)
40 changes: 40 additions & 0 deletions Sources/LispCore/custom_resource_bundle_accessor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// custom_resource_bundle_accessor.swift
// LispMac
//
// Created by Roman Podymov on 10/21/20.
// Copyright © 2020 Roman Podymov. All rights reserved.
//

import Foundation

#if SWIFT_PACKAGE
#else
private class BundleFinder {}

extension Foundation.Bundle {
/// Returns the resource bundle associated with the current Swift module.
static var module: Bundle = {
let bundleName = "LispCore_LispCore"

let candidates = [
// Bundle should be present here when the package is linked into an App.
Bundle.main.resourceURL,

// Bundle should be present here when the package is linked into a framework.
Bundle(for: BundleFinder.self).resourceURL,

// For command-line tools.
Bundle.main.bundleURL,
]

for candidate in candidates {
let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle")
if let bundle = bundlePath.flatMap(Bundle.init(url:)) {
return bundle
}
}
fatalError("unable to find bundle named LispCore_LispCore")
}()
}
#endif

0 comments on commit 3c59e28

Please sign in to comment.