Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CocoaPods support #12

Merged
merged 7 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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