Skip to main content

Utility to package and distribute Djinni libraries easily.

Project description

djinni_build.py 🦎

GitHub release (latest by date) GitHub PyPI - Downloads

Utility to package and distribute Djinni libraries easily.

Requirements

What it does

This utility automates the building & packaging for Djinni libraries.

It supports these platforms:

  • Android (AAR)
  • iOS (xcframework, Swiftpackage)
  • macOS (xcframework, Swiftpackage)
  • Windows (NuGet .NET package)
  • Linux (Conan)

DjinniBuild provides a CLI that allows the user to configure what the output should be.

The user is able to configure:

  • What target platform to build for (Android, iOS, macOS, Windows, Linux)
  • Which architectures to build for (x86, x86_64, armv7, armv8)
  • How to package the resulting binaries (AAR, NuGet, XCFramework, Swift Package, Conan)

For every target language, the following steps are executed:

  • Configure Project & Install Dependencies: Runs conan install for each target architecture & target platform to configure the CMake project and install all dependencies defined in the Conanfile.
  • Build: Runs conan build for each requested target architecture & platform
  • Package: Executes the platform specific packaging tasks. In some cases the packages will be built inside the source directory, but the results will be copied to the build directory once finished.

How to use

Install djinni_build from PYPi:

pip install djinni_build

Then import DjinniBuild and configure the project structure and then execute the main() function:

#!/usr/bin/env python3

from djinni_build import DjinniBuild

djinniBuild = DjinniBuild(
  version='1.0.0',
  darwin_target='MyDjinniLibrary',
  windows_target='MyDjinniLibrary',
  android_target='MyDjinniLibrary',
  android_module_name='MyDjinniLibrary',
  nupkg_name='MyDjinniLibrary',
  conan_user='jothepro',
  conan_channel='release'
)
djinniBuild.main()

In its current state not everything in the script is configurable and some things will only work if the correct directory structures and files are present. It is recommended to strictly stick with the project structure of jothepro/djinni-library-template to avoid compatibility issues!

CLI Interface

This example output from the CLI shows what the configuration options for the user are:

usage: build.py [-h] [--configuration {release,debug}] [--android [{x86_64,x86,armv8,armv7} ...]] [--macos [{armv8,x86_64} ...]]
                [--iphonesimulator [{armv8,x86_64} ...]] [--iphoneos [{armv8,armv7} ...]] [--windows [{x86_64,x86,armv8,armv7} ...]]
                [--linux [{x86_64,x86,armv8,armv7} ...]] [--build-directory BUILD_DIRECTORY] [--build-profile CONAN_BUILD_PROFILE]
                [--package [{xcframework,swiftpackage,conan,aar,nuget} ...]] [--clean]

Build & package library for different platforms

options:
  -h, --help            show this help message and exit
  --configuration {release,debug}
  --android [{x86_64,x86,armv8,armv7} ...]
                        list of architectures that the library should be built for android
  --macos [{armv8,x86_64} ...]
                        list of architectures to build for macOS
  --iphonesimulator [{armv8,x86_64} ...]
                        list of architectures to build for the iOS Simulator
  --iphoneos [{armv8,armv7} ...]
                        list of architectures to build for iOS
  --windows [{x86_64,x86,armv8,armv7} ...]
                        list of architectures to build for windows
  --linux [{x86_64,x86,armv8,armv7} ...]
                        list of architectures to build for linux
  --build-directory BUILD_DIRECTORY
  --build-profile CONAN_BUILD_PROFILE
  --package [{xcframework,swiftpackage,conan,aar,nuget} ...]
                        which packages to create. Packages that cannot be created for the selected target platforms will be ignored.
  --clean               clean all build artifacts outside of the build folder, that this script may have created

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djinni_build-1.0.0.tar.gz (11.8 kB view details)

Uploaded Source

File details

Details for the file djinni_build-1.0.0.tar.gz.

File metadata

  • Download URL: djinni_build-1.0.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for djinni_build-1.0.0.tar.gz
Algorithm Hash digest
SHA256 67d3efae5e2699e3931dbf6b848fc337f776a22543c9ca53825f560ba650e21d
MD5 18a1808e68b459188ba54afa3ea28697
BLAKE2b-256 94dec5ddccbec3324c661e1ae5a2ab7d64c69991eb276a9a96d8df4094c03996

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page