Merge pull request #606 from kiwix/feature/xcodegen-brew

XcodeGen integration
This commit is contained in:
Kelson 2023-12-31 14:59:37 +01:00 committed by GitHub
commit 555491b614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 351 additions and 1848 deletions

View File

@ -1,4 +1,4 @@
name: Build with XCode name: Build with Xcode
description: Run xcodebuild for Kiwix description: Run xcodebuild for Kiwix
inputs: inputs:
@ -97,11 +97,9 @@ runs:
KEYCHAIN: ${{ inputs.KEYCHAIN }} KEYCHAIN: ${{ inputs.KEYCHAIN }}
KEYCHAIN_PASSWORD: ${{ inputs.KEYCHAIN_PASSWORD }} KEYCHAIN_PASSWORD: ${{ inputs.KEYCHAIN_PASSWORD }}
- name: Download CoreKiwix.xcframework - name: Download dependencies
env:
XCF_URL: https://download.kiwix.org/release/libkiwix/libkiwix_xcframework-${{ inputs.libkiwix-version }}.tar.gz
shell: bash shell: bash
run: curl -L -o - $XCF_URL | tar -x --strip-components 2 run: brew bundle
- name: Prepare Xcode - name: Prepare Xcode
shell: bash shell: bash

3
.gitignore vendored
View File

@ -70,3 +70,6 @@ fastlane/test_output
.DS_Store .DS_Store
xcuserdata xcuserdata
Libraries Libraries
# ignore xcode project files, they are now generated by XcodeGen
*.xcodeproj

12
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,12 @@
# docs: https://pre-commit.com
default_install_hook_types: [post-merge, post-checkout, post-rewrite]
repos:
- repo: local
hooks:
- id: xcodegen
name: Generate project files for Xcode
description: "Generate project file for Xcode"
entry: xcodegen
language: system
always_run: true
stages: [post-checkout, post-merge, post-rewrite]

9
Brewfile Normal file
View File

@ -0,0 +1,9 @@
brew "pre-commit"
brew "xcodegen"
brew "curl"
at_exit do
system "pre-commit install"
system "curl -L -o - https://download.kiwix.org/release/libkiwix/libkiwix_xcframework-13.0.0-1.tar.gz | tar -x --strip-components 2"
system "xcodegen"
end

145
Brewfile.lock.json Normal file
View File

@ -0,0 +1,145 @@
{
"entries": {
"brew": {
"pre-commit": {
"version": "3.6.0",
"bottle": {
"rebuild": 0,
"root_url": "https://ghcr.io/v2/homebrew/core",
"files": {
"arm64_sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:2bc88b06e4238db4b55e1af64cb7fef785ccec3b88bc8dd2c5814ebc8f55b0a1",
"sha256": "2bc88b06e4238db4b55e1af64cb7fef785ccec3b88bc8dd2c5814ebc8f55b0a1"
},
"arm64_ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:dc76862c28b49b83d7a15b484a5186cd6d20a03d60d3b0f9d3afba5d863526a7",
"sha256": "dc76862c28b49b83d7a15b484a5186cd6d20a03d60d3b0f9d3afba5d863526a7"
},
"arm64_monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:eb7abe34c1d15f3a96b258fbedcdbde6c24e89927e1b35610358db9e70204a44",
"sha256": "eb7abe34c1d15f3a96b258fbedcdbde6c24e89927e1b35610358db9e70204a44"
},
"sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:2e285ca1bbf5f86e53240c97041e1133d286e05256c5ca9658bb86ed5087b789",
"sha256": "2e285ca1bbf5f86e53240c97041e1133d286e05256c5ca9658bb86ed5087b789"
},
"ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:07dd83234a749a5307c506a5442ff2f818084aea2d1436e11797fb493447f0ca",
"sha256": "07dd83234a749a5307c506a5442ff2f818084aea2d1436e11797fb493447f0ca"
},
"monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:2b23e12b4fc2226d97830982b103f1b5be54707c1ebd638616cf0d614b9a2dd9",
"sha256": "2b23e12b4fc2226d97830982b103f1b5be54707c1ebd638616cf0d614b9a2dd9"
},
"x86_64_linux": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/pre-commit/blobs/sha256:1984c2637a432088c3d98ad10e9219afa6612387718a16cb076927ee39dc0ea5",
"sha256": "1984c2637a432088c3d98ad10e9219afa6612387718a16cb076927ee39dc0ea5"
}
}
}
},
"xcodegen": {
"version": "2.38.0",
"bottle": {
"rebuild": 0,
"root_url": "https://ghcr.io/v2/homebrew/core",
"files": {
"arm64_sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:422fb8dfbc7e2ed59125d22b4687bb54a1ab3f0ddef044a3875b624121f9be47",
"sha256": "422fb8dfbc7e2ed59125d22b4687bb54a1ab3f0ddef044a3875b624121f9be47"
},
"arm64_ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:5b2d9dfdf8bc9912ecef48ecc4a03cfb4ba68f35f03c4ab4fc9e893b077f8796",
"sha256": "5b2d9dfdf8bc9912ecef48ecc4a03cfb4ba68f35f03c4ab4fc9e893b077f8796"
},
"arm64_monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:7a239feca86c46f78ae91d631858d957cb2e7e63ea7230b30f3d618097774bff",
"sha256": "7a239feca86c46f78ae91d631858d957cb2e7e63ea7230b30f3d618097774bff"
},
"sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:346164300a7e835f8516c70b25793702bab2437d7e9fb606b5394ab757dab4f5",
"sha256": "346164300a7e835f8516c70b25793702bab2437d7e9fb606b5394ab757dab4f5"
},
"ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:2bca799f6fee1e679a3f826a9a977449a23f81f02896b22a525056f6cd4a07dd",
"sha256": "2bca799f6fee1e679a3f826a9a977449a23f81f02896b22a525056f6cd4a07dd"
},
"monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:3e306a4b9ad078c77b61d93090c224304c7dac35ca119808db87792edb983be8",
"sha256": "3e306a4b9ad078c77b61d93090c224304c7dac35ca119808db87792edb983be8"
}
}
}
},
"curl": {
"version": "8.5.0",
"bottle": {
"rebuild": 0,
"root_url": "https://ghcr.io/v2/homebrew/core",
"files": {
"arm64_sonoma": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/curl/blobs/sha256:f522b5617f23fc5254ca7af46f966ab4126f1e6bb807ef6b0a5d9a189401628c",
"sha256": "f522b5617f23fc5254ca7af46f966ab4126f1e6bb807ef6b0a5d9a189401628c"
},
"arm64_ventura": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/curl/blobs/sha256:bf6727235d2f3de1aaac9cd78a73de007c50370fbe8a617fa6274b5b0c11e17d",
"sha256": "bf6727235d2f3de1aaac9cd78a73de007c50370fbe8a617fa6274b5b0c11e17d"
},
"arm64_monterey": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/curl/blobs/sha256:30624bc555daa8181e3bceb3abe88fc83be0ccfdf4481e2333599fbeb45b7922",
"sha256": "30624bc555daa8181e3bceb3abe88fc83be0ccfdf4481e2333599fbeb45b7922"
},
"sonoma": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/curl/blobs/sha256:47c7c2bacab6e130e55fd34a0053062ad775801a4ed6b8f8d970226b89aaaef3",
"sha256": "47c7c2bacab6e130e55fd34a0053062ad775801a4ed6b8f8d970226b89aaaef3"
},
"ventura": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/curl/blobs/sha256:b38db0ec20251e89fcd2f71074a3ad3e9aa2bedafe9b9d4d7c368a8fbfea2e67",
"sha256": "b38db0ec20251e89fcd2f71074a3ad3e9aa2bedafe9b9d4d7c368a8fbfea2e67"
},
"monterey": {
"cellar": ":any",
"url": "https://ghcr.io/v2/homebrew/core/curl/blobs/sha256:4d68cb21a249d7cf410bf46ee419bb5159a8847507ecd29e4163db2feed0e1e3",
"sha256": "4d68cb21a249d7cf410bf46ee419bb5159a8847507ecd29e4163db2feed0e1e3"
},
"x86_64_linux": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/curl/blobs/sha256:6b2cd50eae98f85e4ba55b4379e2351ec4408d3c547a6bed782f1eb62a797ad4",
"sha256": "6b2cd50eae98f85e4ba55b4379e2351ec4408d3c547a6bed782f1eb62a797ad4"
}
}
}
}
}
},
"system": {
"macos": {
"ventura": {
"HOMEBREW_VERSION": "4.2.1",
"HOMEBREW_PREFIX": "/opt/homebrew",
"Homebrew/homebrew-core": "api",
"CLT": "15.0.0.0.1.1694021235",
"Xcode": "15.1",
"macOS": "13.6.1"
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -1,41 +0,0 @@
{
"pins" : [
{
"identity" : "defaults",
"kind" : "remoteSourceControl",
"location" : "https://github.com/sindresorhus/Defaults",
"state" : {
"revision" : "981ccb0a01c54abbe3c12ccb8226108527bbf115",
"version" : "6.3.0"
}
},
{
"identity" : "fuzi",
"kind" : "remoteSourceControl",
"location" : "https://github.com/cezheng/Fuzi",
"state" : {
"revision" : "f08c8323da21e985f3772610753bcfc652c2103f",
"version" : "3.1.3"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version" : "1.0.4"
}
},
{
"identity" : "swiftuibackports",
"kind" : "remoteSourceControl",
"location" : "https://github.com/shaps80/SwiftUIBackports.git",
"state" : {
"revision" : "4cab730480277c5ae6ac3ea8ee02b4845dee4903",
"version" : "1.6.3"
}
}
],
"version" : 2
}

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>classNames</key>
<dict>
<key>iOSUITests</key>
<dict>
<key>testLaunchPerformance()</key>
<dict>
<key>com.apple.dt.XCTMetric_ApplicationLaunch-AppLaunch.duration</key>
<dict>
<key>baselineAverage</key>
<real>1.8055</real>
<key>baselineIntegrationDisplayName</key>
<string>Local Baseline</string>
</dict>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>runDestinationsByUUID</key>
<dict>
<key>7C59A401-F1E8-48BA-8542-425634ADC0DB</key>
<dict>
<key>localComputer</key>
<dict>
<key>busSpeedInMHz</key>
<integer>400</integer>
<key>cpuCount</key>
<integer>1</integer>
<key>cpuKind</key>
<string>Unknown CPU</string>
<key>cpuSpeedInMHz</key>
<integer>3800</integer>
<key>logicalCPUCoresPerPackage</key>
<integer>24</integer>
<key>modelCode</key>
<string>MacPro7,1</string>
<key>physicalCPUCoresPerPackage</key>
<integer>12</integer>
<key>platformIdentifier</key>
<string>com.apple.platform.macosx</string>
</dict>
<key>targetArchitecture</key>
<string>x86_64</string>
<key>targetDevice</key>
<dict>
<key>modelCode</key>
<string>iPad8,9</string>
<key>platformIdentifier</key>
<string>com.apple.platform.iphonesimulator</string>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@ -1,104 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "972DE4A52814A3D8004FD9B9"
BuildableName = "Kiwix.app"
BlueprintName = "Kiwix"
ReferencedContainer = "container:Kiwix.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "972DE4A52814A3D8004FD9B9"
BuildableName = "Kiwix.app"
BlueprintName = "Kiwix"
ReferencedContainer = "container:Kiwix.xcodeproj">
</BuildableReference>
</MacroExpansion>
<CommandLineArguments>
<CommandLineArgument
argument = "testing"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97008AB92974A5BF0076E60C"
BuildableName = "Tests.xctest"
BlueprintName = "Tests"
ReferencedContainer = "container:Kiwix.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "972DE4A52814A3D8004FD9B9"
BuildableName = "Kiwix.app"
BlueprintName = "Kiwix"
ReferencedContainer = "container:Kiwix.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "972DE4A52814A3D8004FD9B9"
BuildableName = "Kiwix.app"
BlueprintName = "Kiwix"
ReferencedContainer = "container:Kiwix.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97B44893210FBC2C0004B056"
BuildableName = "WikiMed.app"
BlueprintName = "WikiMed"
ReferencedContainer = "container:Kiwix.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97B44893210FBC2C0004B056"
BuildableName = "WikiMed.app"
BlueprintName = "WikiMed"
ReferencedContainer = "container:Kiwix.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97B44893210FBC2C0004B056"
BuildableName = "WikiMed.app"
BlueprintName = "WikiMed"
ReferencedContainer = "container:Kiwix.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -6,7 +6,7 @@ This is the home for Kiwix apps for Apple iOS and macOS.
[![CI Build Status](https://github.com/kiwix/apple/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/kiwix/apple/actions/workflows/ci.yml?query=branch%3Amain) [![CI Build Status](https://github.com/kiwix/apple/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/kiwix/apple/actions/workflows/ci.yml?query=branch%3Amain)
[![CD Build Status](https://github.com/kiwix/apple/actions/workflows/cd.yml/badge.svg?branch=main)](https://github.com/kiwix/apple/actions/workflows/cd?query=branch%3Amain) [![CD Build Status](https://github.com/kiwix/apple/actions/workflows/cd.yml/badge.svg?branch=main)](https://github.com/kiwix/apple/actions/workflows/cd?query=branch%3Amain)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
<img src="https://img.shields.io/badge/Swift-5.2-orange.svg" alt="Drawing="/> <img src="https://img.shields.io/badge/Swift-5.9-orange.svg" alt="Drawing="/>
## Download ## Download
@ -18,7 +18,42 @@ downloadable for older versions of macOS and iOS on the Mac App Store.
## Develop ## Develop
Kiwix developers usually work with latest macOS and Xcode. Check our [Continuous Integration Workflow](https://github.com/kiwix/apple/blob/main/.github/workflows/ci.yml) to find out which XCode version we use on Github Actions. Kiwix developers usually work with latest macOS and Xcode. Check our [Continuous Integration Workflow](https://github.com/kiwix/apple/blob/main/.github/workflows/ci.yml) to find out which Xcode version we use on Github Actions.
### Get started
To get started, you will need the following:
* An [Apple Developer account](https://developer.apple.com) (doesn't require membership)
* [Xcode](https://developer.apple.com/xcode/) installed
* Its command-line utilities (`xcode-select --install`)
* [Homebrew](https://brew.sh) installed
### Steps
1) clone this repository
2) from the project folder **run the following command: `brew bundle`**
### Xcode settings
To compile and run Kiwix from Xcode locally, you will need to:
* Change the Bundle Identifier (in *Signing & Capabilities*)
* Select appropriate Signing Certificate/Profile.
### Dependencies installed for you
Our `Brewfile` will install all the necessary dependencies for you:
- our latest `CoreKiwix.xcframework` ([libkiwix](https://github.com/kiwix/libkiwix) and [libzim](https://github.com/openzim/libzim))
- [XcodeGen](https://github.com/yonaskolb/XcodeGen) which will create the project files for you
### How XcodeGen is working?
Xcode project files are not directly contained within this repository, instead they are generated for you automatically (as git hooks on post-merge, post-checkout, post-rewrite - see the `.pre-commit-config.yaml`).
This means, that you can work in Xcode as usual, but you don't need to worry about the project file changes anymore.
Contributors: please note, **changes to the Xcode project folder will not be tracked by git**.
If you wish to change any settings as part of your contribution, please **edit the `project.yml` file instead.**
Please refer to the [XcodeGen documentation](https://github.com/yonaskolb/XcodeGen) for further details.
### CPU Architectures ### CPU Architectures
@ -26,31 +61,15 @@ Kiwix compiles on both macOS architectures x86_64 and arm64 (Apple silicon).
Kiwix for iOS and macOS can run, in both cases, on x86_64 or arm64. Kiwix for iOS and macOS can run, in both cases, on x86_64 or arm64.
### Dependencies ### Switch to another version of the `CoreKiwix.xcframework`
To compile Kiwix you rely on the following compilation tools:
* An [Apple Developer account](https://developer.apple.com) (doesn't require membership)
* Latest Apple Developers Tools ([Xcode](https://developer.apple.com/xcode/))
* Its command-line utilities (`xcode-select --install`)
* `CoreKiwix.xcframework` ([libkiwix](https://github.com/kiwix/libkiwix) and [libzim](https://github.com/openzim/libzim))
### Steps
To compile Kiwix, follow these steps:
* Put `CoreKiwix/xcframework` at the root of this folder
* Open project with Xcode `open Kiwix.xcodeproj/project.xcworkspace/`
* Change the Bundle Identifier (in *Signing & Capabilities*)
* Select appropriate Signing Certificate/Profile.
### Getting `CoreKiwix.xcframework`
`CoreKiwix.xcframework` is published with all supported platforms and CPU architectures: `CoreKiwix.xcframework` is published with all supported platforms and CPU architectures:
- [latest release](https://download.kiwix.org/release/libkiwix/libkiwix_xcframework.tar.gz) - [latest release](https://download.kiwix.org/release/libkiwix/libkiwix_xcframework.tar.gz)
- [latest nightly](https://download.kiwix.org/nightly/libkiwix_xcframework.tar.gz): using `main` branch of both `libkiwix` and `libzim`. - [latest nightly](https://download.kiwix.org/nightly/libkiwix_xcframework.tar.gz): using `main` branch of both `libkiwix` and `libzim`.
In order to use another version of CoreKiwix, than the one pre-installed, you can simply replace the CoreKiwix.xcframework folder at the root of the project with the version downloaded, and unpacked.
#### Compiling `CoreKiwix.xcframework` #### Compiling `CoreKiwix.xcframework`
You may want to compile it yourself, to use different branches of said projects for instance. You may want to compile it yourself, to use different branches of said projects for instance.

139
project.yml Normal file
View File

@ -0,0 +1,139 @@
name: Kiwix
options:
xcodeVersion: 15.0
deploymentTarget: # the three latest major versions should be supported
iOS: 15.0
macOS: 12.0
generateEmptyDirectories: true
useTabs: false
groupSortPosition: top
settings:
base:
DEVELOPMENT_TEAM: L7HWM3SP3L
GENERATE_INFOPLIST_FILE: YES
CURRENT_PROJECT_VERSION: 133
ENABLE_USER_SCRIPT_SANDBOXING: NO
ENABLE_MODULE_VERIFIER: YES
MODULE_VERIFIER_SUPPORTED_LANGUAGES: "objective-c objective-c++"
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: YES
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED: YES
ENABLE_PREVIEWS: YES
INFOPLIST_KEY_LSApplicationCategoryType: public.app-category.reference
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone: UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad: UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight
INFOPLIST_KEY_NSPhotoLibraryUsageDescription: "Kiwix needs permission to saves images to your photos app."
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace: YES
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents: YES
SWIFT_OBJC_INTEROP_MODE: objcxx
SWIFT_OBJC_BRIDGING_HEADER: $(PROJECT_DIR)/Support/Kiwix-Bridging-Header.h
GCC_C_LANGUAGE_STANDARD: c11
CLANG_CXX_LANGUAGE_STANDARD: c++14
ENABLE_HARDENED_RUNTIME[sdk=macosx*]: YES
APP_STORE_ID: $(APP_STORE_ID)
INFOPLIST_KEY_UILaunchScreen_Generation: YES
INFOPLIST_KEY_UILaunchStoryboardName: LaunchKiwix.storyboard
configs:
debug:
DEAD_CODE_STRIPPING: YES
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS: "gnu11 gnu14++"
release:
DEAD_CODE_STRIPPING: YES
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS: "gnu11 gnu14++"
VALIDATE_PRODUCT: YES
packages:
Fuzi:
url: https://github.com/cezheng/Fuzi
majorVersion: 3.0.0
Defaults:
url: https://github.com/sindresorhus/Defaults
majorVersion: 6.0.0
SwiftUIBackports:
url: https://github.com/shaps80/SwiftUIBackports.git
majorVersion: 1.0.0
OrderedCollections:
url: https://github.com/apple/swift-collections.git
majorVersion: 1.0.4
targetTemplates:
ApplicationTemplate:
type: application
supportedDestinations: [iOS, macOS]
preBuildScripts:
- script: |
# Copy Clang module map to xcframework for Swift C++ Interoperability
cp Support/CoreKiwix.modulemap CoreKiwix.xcframework/ios-arm64/Headers/module.modulemap
cp Support/CoreKiwix.modulemap CoreKiwix.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap
cp Support/CoreKiwix.modulemap CoreKiwix.xcframework/macos-arm64_x86_64/Headers/module.modulemap
name: "Copy CoreKiwix module maps"
basedOnDependencyAnalysis: false
entitlements:
path: Support/Kiwix.entitlements
properties:
com.apple.security.app-sandbox: true
com.apple.security.files.downloads.read-write: true
com.apple.security.files.user-selected.read-only: true
com.apple.security.network.client: true
dependencies:
- framework: CoreKiwix.xcframework
embed: false
codeSign: true
- sdk: SwiftUI.framework
- sdk: MapKit.framework
- sdk: WebKit.framework
- sdk: NotificationCenter.framework
- sdk: QuickLook.framework
- package: Fuzi
- package: Defaults
- package: SwiftUIBackports
- package: OrderedCollections
sources:
- path: App
- path: Model
- path: SwiftUI
- path: ViewModel
- path: Views
targets:
Kiwix:
templates:
- ApplicationTemplate
settings:
base:
MARKETING_VERSION: "3.3"
PRODUCT_BUNDLE_IDENTIFIER: self.Kiwix
INFOPLIST_KEY_CFBundleDisplayName: Kiwix
INFOPLIST_FILE: Support/Info.plist
configFiles:
Debug: Support/kiwix.xcconfig
Release: Support/kiwix.xcconfig
sources:
- path: Support
excludes:
- "**/qqq.lproj"
UnitTests:
type: bundle.unit-test
platform: macOS
settings:
PRODUCT_BUNDLE_IDENTIFIER: org.kiwix.Tests
TEST_HOST: $(BUILT_PRODUCTS_DIR)/Kiwix.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Kiwix
BUNDLE_LOADER: $(TEST_HOST)
sources:
- path: Tests
dependencies:
- target: Kiwix
schemes:
Kiwix:
build:
targets:
Kiwix: all
test:
targets:
- UnitTests
commandLineArguments:
testing: true