Build and deploy apks to our fdroid repo.
All packages are defined in the app/Packages.hs
file. You can add new packages by defining a PackageDesc
record and adding it to the packages
list. Take the moegirl dictionary as an example:
moegirl :: PackageDesc
moegirl =
PackageDesc
{ descProjectName = mkProjectName "pinyin-moegirl",
descPackageName = mkPackageName "pinyin_moegirl",
descVersionSource = GitHubRelease "outloudvi" "mw2fcitx",
descCreateVersionName = pure,
descCreateVersionCode = readInteger,
descPreBuild = \(_, dictVer, _) projectDir ->
downloadFile
(githubReleaseFileUrl "outloudvi" "mw2fcitx" dictVer "moegirl.dict")
(pinyinDictPath projectDir </> T.unpack dictVer <.> "dict"),
descAppNameDebug = "Fcitx5 for Android (moegirl dict | Debug)",
descAppNameRelease = "Fcitx5 for Android (moegirl dict)",
descPluginDesc = "Fcitx 5 Pinyin Dictionary from zh.moegirl.org.cn"
}
where:
descProjectName
: The project name of the package, starts withfcitx5-android-plugin-
(added bymkProjectName
).descPackageName
: The package name of the plugin, starts withorg.fcitx5.android.plugin.
(added bymkPackageName
).descVersionSource
: The nvchecker source for the package version. Seeapp/Nvchecker.hs
for more details.descCreateVersionName
: A function to create the version name from the nvchecker version string.descCreateVersionCode
: A function to create the version code from the nvchecker version string.descPreBuild
: A function to perform pre-build actions, such as downloading files. Version information is passed as(Nvchecker Version, Version Name, Version Code)
andprojectDir
is the directory where the project is built.
The following dependencies are required to run this project:
plugin-scaffold
nvchecker
unzip
rsync
You can use the nix develop
to enter a Nix shell with all dependencies. Once inside the shell, you can build and run with cabal:
cabal build
cabal run
If you don't want to use Nix, you can set up the Haskell environment and install the dependencies manually.
cabal run fdroid-build -- build
cabal run fdroid-build -- <package-name>
For example, to build moegirl dictionary:
cabal run fdroid-build -- org.fcitx.fcitx5.android.plugin.pinyin_moegirl
cabal run fdroid-build -- deploy
After running this command, the built APKs will be signed and deployed to our fdroid repository.
Build artifacts are stored in the _build/signed
directory. To clean these artifacts, run:
cabal run fdroid-build -- clean
By default, the build process checks our fdroid repository version to skip building if the version is already up to date. If you want to skip this check, you can use the -s
or --skip-fdroid
flag:
cabal run fdroid-build -- <target> -s