google / prefab Goto Github PK
View Code? Open in Web Editor NEWPrefab is a tool for generating build system integrations for prebuilt C/C++ libraries.
Home Page: https://google.github.io/prefab/
License: Apache License 2.0
Prefab is a tool for generating build system integrations for prebuilt C/C++ libraries.
Home Page: https://google.github.io/prefab/
License: Apache License 2.0
Package name
FreeType
Package URL
https://www.freetype.org/index.html
https://www.freetype.org/download.html
Package source location
The source repository for the package.
https://download.savannah.gnu.org/releases/freetype/
https://download.savannah.gnu.org/releases/freetype/ft2412.zip
require
without a message doesn't show the failed expression, so we just get a useless error like
Exception in thread "main" java.lang.IllegalArgumentException: Failed requirement.
at com.google.prefab.api.Package.<init>(Package.kt:65)
...
Right now the latest version of OpenSSL on https://maven.google.com is 1.1.1.d while https://www.openssl.org/ published 1.1.1e and 1.1.1f in the meantime.
Do you plan on updating OpenSSL and other libraries regularly once you're out of the alpha stage?
I'm also curious what your thoughts are around responding to security issues in libraries.
Package name
POCO c++ library
Package URL
https://pocoproject.org/
Package source location
https://github.com/pocoproject/poco
Package name
GeographicLib
Package URL
https://geographiclib.sourceforge.io/
Package source location
https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.50.1.tar.gz
Package name
Boost C++ Libraries
Package URL
https://www.boost.org/
Package source location
https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz
The Android ABI info currently has STL info, but we're not checking it.
Capturing request from android/ndk#456 (comment)
Package name
WebRTC
Package URL
https://webrtc.org/
Package source location
https://webrtc.googlesource.com/
URL
https://google.github.io/prefab/#usage
Problem
The documentation refers to an executable called prefab
, however, after running gradlew installDist
the binary which gets created is called cli
. Additionally the output from cli
is:
Usage: prefab [OPTIONS] [PACKAGE_PATH]...
Suggest either updating docs or renaming CLI executable to prefab
Package name
mbedtls
Package URL
https://tls.mbed.org/
Package source location
https://github.com/ARMmbed/mbedtls
Package name
luajit
Package URL
http://luajit.org/
Package source location
http://luajit.org/download.html
Describe the bug
The CLI fails when encountering an invalid artifact i.e. an incorrectly named file under: modules/<library_name>/libs/
, however, the error output is sufficiently cryptic to make debugging difficult.
To Reproduce
On a Mac create the prefab package folder structure as described here: https://google.github.io/prefab/#package-structure
Wait for Mac OS to populate the newly created folders with .DS_Store
files
Execute the CLI e.g.
./cli --build-system cmake --platform android --os-version 21 --stl c++_static --ndk-version 21 --abi x86 --output ~/Code/workspace-android/oboe-prefab/output ~/Code/workspace-android/oboe-prefab
Expected behavior
Error output includes the filename of the invalid artifact folder
Actual behavior
Exception in thread "main" com.google.prefab.api.UnsupportedPlatformException: //oboe/oboe contains artifacts for unsupported platform "" at com.google.prefab.api.Module.<init>(Module.kt:115) at com.google.prefab.api.Package.<init>(Package.kt:77) at com.google.prefab.cli.Cli$packages$2.invoke(Cli.kt:125) at com.google.prefab.cli.Cli$packages$2.invoke(Cli.kt:96) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at com.google.prefab.cli.Cli.getPackages(Cli.kt) at com.google.prefab.cli.Cli.validate(Cli.kt:173) at com.google.prefab.cli.Cli.run(Cli.kt:190) at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:139) at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:14) at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:216) at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:213) at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:231) at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:250) at com.google.prefab.cli.AppKt.main(App.kt:29)
Environment:
Prefab version: v1.0.0-alpha5
Host OS:
Package name
OpenCV
Package URL
https://opencv.org/
Package source location
https://github.com/opencv/opencv
Platform-specific headers currently are used as a complete replacement for the module headers. Some libraries have a set of common headers and a set of platform-specific headers (ffmpeg, as an example: #71).
Adding an additive_platform_headers: true
option to module.json or possibly an alternative directory name to the library directory would solve this.
Package name
Skia
Package URL
https://skia.org/
Package source location
https://skia.googlesource.com/skia.git
Package name
ffmpeg
Package URL
https://www.ffmpeg.org/
Package source location
https://www.ffmpeg.org/download.html#get-sources
Describe the solution you'd like
I believe that most work is done with AAR packages. It would be nice if prefab command could transparently work with such archives, not expecting the user to extract the AAR manually.
Describe alternatives you've considered
I am afraid that manual extraction of the AAR may cause or hide some problems with some packages.
Package name
PJSIP
Package URL
https://www.pjsip.org
Package source location
https://github.com/pjsip/pjproject/archive/2.10.tar.gz
Package name
dav1d
Package URL
https://code.videolan.org/videolan/dav1d
Package source location
https://code.videolan.org/videolan/dav1d
Package name
basis_universal
Package URL
https://github.com/BinomialLLC/basis_universal
Package source location
https://github.com/BinomialLLC/basis_universal
We don't currently support libraries that need to expose different headers for each platform or subplatform. Adding an optional include
directory inside the library directory might be helpful for some libraries. I haven't encountered any yet, but it's possible.
Package name
libpng
Package URL
http://www.libpng.org/pub/png/libpng.html
Package source location
https://sourceforge.net/projects/libpng/files/ (packages)
git://git.code.sf.net/p/libpng/code (direct git link)
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/ (git browse)
The plugin API is there, we just need to add the code to load it.
Package name
SQLite
Package URL
https://www.sqlite.org/index.html
Package source location
https://www.sqlite.org/download.html
The CMake plugin wrongly makes all targets shared libraries. Fix that to detect the type of prebuilt like the ndk-build plugin does.
Some packages (ffmpeg, openssl) don't split up their headers by library and instead have one common include directory for all of their libraries. For these cases it would be nice to use a package-wide include directory rather than duplicating the headers into every module.
Hi @DanAlbert . Thank you for such a great library. Just wondering is there an example on how to use a custom build aar file. I have creating my own aar file in the same manner as this project. However when I import the library in android it fails.
.m2/repository/com/vcpkg/ndk/support/jsoncpp/1.9.2/jsoncpp-1.9.2.pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.vcpkg.ndk.support</groupId>
<artifactId>jsoncpp</artifactId>
<version>1.9.2</version>
<packaging>aar</packaging>
<description>The Vcpkg AAR for jsoncpp</description>
<url>https://github.com/microsoft/vcpkg.git</url>
<dependencies>
</dependencies>
</project>
The following is the file renamed to zip to allow uploading to GitHub
jsoncpp-1.9.2.zip
The test directory is confusing the GitHub dependency graph.
We currently emit the config file directly to the output directory. CMake's docs indicate that it will look in other places as well (https://cmake.org/cmake/help/latest/command/find_package.html#search-procedure), one of which is architecture specific which would make it easier to share the output directory among multi-arch builds.
I'd tried this first, but CMake didn't appear to be searching those other directories. Should spend some more time trying to figure out why.
Package name
IXWebSocket
Package URL
https://machinezone.github.io/IXWebSocket/
Package source location
https://github.com/machinezone/IXWebSocket
Package name
SDL2
Package URL
https://www.libsdl.org/index.php
Package source location
https://www.libsdl.org/release/
https://www.libsdl.org/release/SDL2-2.0.10.zip
NOTE: vcpkg seems to use this unofficial repository to pull the sources - https://github.com/SDL-mirror/SDL/releases
$ prefab --platform android --abi armeabi-v7a --os-version 21 --stl c++_shared --ndk-version 21 --output ffmpeg-out --build-system cmake ffmpeg/prefab
Exception in thread "main" java.lang.RuntimeException: Prebuilt directory contains no library artifacts: ffmpeg/prefab/modules/ffmpeg/libs/android.x86
at com.google.prefab.api.ElfKt.findElfLibrary(Elf.kt:44)
at com.google.prefab.api.Android.libraryFileFromDirectory(Android.kt:351)
at com.google.prefab.api.PrebuiltLibrary.<init>(PrebuiltLibrary.kt:48)
at com.google.prefab.api.Module.<init>(Module.kt:158)
at com.google.prefab.api.Package.<init>(Package.kt:77)
at com.google.prefab.cli.Cli$packages$2.invoke(Cli.kt:125)
at com.google.prefab.cli.Cli$packages$2.invoke(Cli.kt:96)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.google.prefab.cli.Cli.getPackages(Cli.kt)
at com.google.prefab.cli.Cli.validate(Cli.kt:173)
at com.google.prefab.cli.Cli.run(Cli.kt:190)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:139)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:14)
at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:216)
at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:213)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:231)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:250)
at com.google.prefab.cli.AppKt.main(App.kt:29)
$ ls ffmpeg/prefab/modules/ffmpeg/libs/android.x86
abi.json include libavcodec.so libavdevice.so libavfilter.so libavformat.so libavutil.so libswresample.so libswscale.so
The problem is actually that no library match libffmpeg.so or libffmpeg.a was found, but that's very unclear from the error message. This should print:
"Prebuilt directory $directory did not contain the expected library artifacts. Tried $name.a and $name.so."
Package name
Poco
Package URL
https://pocoproject.org/
Package source location
https://pocoproject.org/releases/poco-1.10.1/poco-1.10.1-all.tar.gz
Package name
OpenAL Soft
Package URL
https://github.com/kcat/openal-soft
Package source location
https://openal-soft.org/
What is the meaning of "ndk"
entry in abi.json? Should it be 20
, or 20.1.5948944
?
It's possible for more than one library to be a compatible match, and we currently just select the first match. We can do better in a few ways:
If the libraries differ by both of those criteria we'll need to decide a precedence order. I think the order above is probably best, but I haven't given it much thought yet.
Package name
Sodium
Package URL
https://libsodium.gitbook.io/doc/
Package source location
https://github.com/jedisct1/libsodium
Package name
GTestJNI
Package URL
https://github.com/DanAlbert/GTestJNI
Package source location
https://github.com/DanAlbert/GTestJNI
Package name
libunwindstack
Package URL
https://android.googlesource.com/platform/system/core/+/master/libunwindstack/
Package source location
https://android.googlesource.com/platform/system/core/+/master/libunwindstack/
Package name
Oboe
Package URL
https://github.com/google/oboe
Package source location
https://github.com/google/oboe
Package name
The Google cpu_features library
Package URL
https://developer.android.com/ndk/guides/cpu-features
Package source location
https://github.com/google/cpu_features
export_libraries
could be optional (actually the whole module.json could be optional).src/main/resources
of a library module.Well, include files may require special effort to be in sync with the source tree, but there are some tricks that make this easy on Android Studio.
Package name
Bullet
Package URL
https://pybullet.org/wordpress/
Package source location
https://github.com/bulletphysics/bullet3
We may be able to support source debugging of distributed binaries if we package the sources (and possibly separate debug info files, depending on the platform) alongside the binaries in a predictable manner.
See #71 (comment)
Capturing request from android/ndk#456 (comment)
Package name
libphonenumber
Package URL
https://github.com/google/libphonenumber
Package source location
https://github.com/google/libphonenumber
Describe the bug
If prefab encounters an error during a build it is not surfaced to the user in the Android Studio build log.
To Reproduce
arguments "-DANDROID_STL=c++_shared"
Expected behavior
Build fails with a clear description of why it failed
Actual behavior
Build fails with the following message:
executing external native build for cmake /Users/donturner/Code/workspace-android/ndk-samples/prefab/curl-ssl/app/src/main/cpp/CMakeLists.txt
Affected Modules: app
Environment:
Prefab version: (if not using the latest, please try the latest first)
Host OS:
Target platform:
Target ABI:
Target OS version:
Build system:
Additional context
It is possible to view the prefab output by opening the gradle tab then executing the curl-ssl > Tasks > build > build task. Not particularly easy to find.
Package name
libopus
Package URL
http://www.opus-codec.org/
Package source location
https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
Our CMake plugin doesn't currently emit version information: https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#package-version-file
This is probably a useful thing to have. This would require a schema change since we don't currently have the version information to provide, so this is probably something we'd want to tackle before 1.0.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.