diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 56735e2172..226667d925 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,7 +52,7 @@ Please read the [General Recommendations](#general-recommendations) before you s 1. Add a new file by clicking on the plus sign and choosing _"New file"_. 1. Set the file name in the following schema: `.yml`. So an example would be _"com.app.example.yml"_. 1. Write down the metadata. The [Build Metadata Reference](https://f-droid.org/en/docs/Build_Metadata_Reference) - as well as the [templates from the wiki](https://gitlab.com/fdroid/wiki/-/wikis/Metadata/YAML-Metadata) + as well as the [templates](./templates/README.md) will help you. 1. Choose a smart commit message and commit your changes. 1. Continue with the [Common steps for both methods](#common-steps-for-both-methods) @@ -65,7 +65,7 @@ Please read the [General Recommendations](#general-recommendations) before you s 1. Create a new file in the the `metadata` directory named after the following schema: `.yml`. So an example would be _"com.app.example.yml"_. 1. Write down the metadata in that file. The [Build Metadata Reference](https://f-droid.org/en/docs/Build_Metadata_Reference) - as well as the [templates from the wiki](https://gitlab.com/fdroid/wiki/-/wikis/Metadata/YAML-Metadata) + as well as the [templates](./templates/README.md) will help you. 1. Commit and push to your upstream fork. 1. Continue with the [Common steps for both methods](#common-steps-for-both-methods) diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 0000000000..4b225c1afa --- /dev/null +++ b/templates/README.md @@ -0,0 +1,7 @@ +This directory contains some templates for different kinds of apps. + +- [Gradle](./build-gradle.yml) +- [Flutter](./build-flutter.yml) +- [Ant](./build-ant.yml) +- [Maven](./build-maven.yml) +- [React Native](./build-react-native.yml) diff --git a/templates/app-minimal b/templates/app-minimal deleted file mode 100644 index 400b240d57..0000000000 --- a/templates/app-minimal +++ /dev/null @@ -1,18 +0,0 @@ -Categories: - - -License: -WebSite: -SourceCode: -IssueTracker: - -Summary: -Description: |- - -RepoType: -Repo: - -Builds: - - commit: - -UpdateCheckMode: - diff --git a/templates/build-ant b/templates/build-ant deleted file mode 100644 index d87938b5bf..0000000000 --- a/templates/build-ant +++ /dev/null @@ -1,8 +0,0 @@ -Builds: - - versionName: 1.0 - commit: v1.0 - -# As with all build methods, use `subdir: app` if the app resides under a -# subdirectory called "app". -# -# Use `target: android-X` if no target is defined in project.properties. diff --git a/templates/build-ant.yml b/templates/build-ant.yml new file mode 100644 index 0000000000..ab8eb53314 --- /dev/null +++ b/templates/build-ant.yml @@ -0,0 +1,17 @@ +Builds: + - versionName: '1.0' + versionCode: 1 + commit: v1.0 + sudo: + - apt-get update + # Ant is not installed by default + - apt-get install -y ant + # New build-tools are installed by default which doesn't work with ant + - rm -fr /opt/android-sdk/build-tools/* + prebuild: + # The default target is generally too old + - echo -e 'java.target=1.8\njava.source=1.8' > ant.properties + # Ant can't install build-tools automatically + - sdkmanager 'build-tools;30.0.3' + # Use `target: android-X` if no target is defined in project.properties. + target: android-21 diff --git a/templates/build-flutter b/templates/build-flutter.yml similarity index 85% rename from templates/build-flutter rename to templates/build-flutter.yml index c9233b87f1..9ad6a18706 100644 --- a/templates/build-flutter +++ b/templates/build-flutter.yml @@ -5,10 +5,12 @@ Builds: - versionName: '1.0' - versionCode: 1 + versionCode: 11 commit: v1.0 # Flutter should be added as a git submodule at e.g. .flutter submodules: true + # This must be set else the build will fail. + # The output path can be found in the log. output: build/app/outputs/flutter-apk/app-release.apk # Deletes unrelated directories, # remove those not needed from the list. @@ -35,7 +37,8 @@ Builds: build: # Make Flutter use the scanned cache - export PUB_CACHE=$(pwd)/.pub-cache - # Split per abi to reduce the apk size + # Split per abi to reduce the apk size. + # This is only for one abi. Please added other build blocks accordingly. - .flutter/bin/flutter build apk --release --split-per-abi --target-platform="android-arm64" AutoUpdateMode: Version @@ -47,5 +50,5 @@ VercodeOperation: - '%c * 10 + 3' UpdateCheckData: pubspec.yaml|version:\s.+\+(\d+)|.|version:\s(.+)\+ CurrentVersion: '1.0' -CurrentVersionCode: 1 +CurrentVersionCode: 11 diff --git a/templates/build-gradle b/templates/build-gradle deleted file mode 100644 index 11062a1a0e..0000000000 --- a/templates/build-gradle +++ /dev/null @@ -1,14 +0,0 @@ -Builds: - - versionName: 1.0 - commit: v1.0 - gradle: - - yes - -# As with all build methods, use `subdir: app` if the app resides under a -# subdirectory called "app". -# -# You must use -# gradle: -# - flavour -# - name -# to build a specific flavour if the app has multiple flavours. diff --git a/templates/build-gradle.yml b/templates/build-gradle.yml new file mode 100644 index 0000000000..11eaf40108 --- /dev/null +++ b/templates/build-gradle.yml @@ -0,0 +1,10 @@ +Builds: + - versionName: '1.0' + versionCode: 1 + commit: v1.0 + # The `subdir` is the parent dir of `src/main` which is generally `app`. + subdir: app + gradle: + # If flavor is used, the flavor name needs to be specified. + # If no flavor is used, set `yes` here and `assembleRelease` is used. + - yes diff --git a/templates/build-maven b/templates/build-maven deleted file mode 100644 index b90b94b915..0000000000 --- a/templates/build-maven +++ /dev/null @@ -1,7 +0,0 @@ -Builds: - - versionName: 1.0 - commit: v1.0 - maven: 'yes' - -# As with all build methods, use `subdir: app` if the app resides under a -# subdirectory called "app". diff --git a/templates/build-maven.yml b/templates/build-maven.yml new file mode 100644 index 0000000000..810599ae36 --- /dev/null +++ b/templates/build-maven.yml @@ -0,0 +1,12 @@ +Builds: + - versionName: '1.0' + versionCode: 1 + commit: v1.0 + sudo: + - apt-get update + # Maven is not installed by default + - apt-get install -y maven + maven: 'yes' + +# As with all build methods, use `subdir: app` if the app resides under a +# subdirectory called "app". diff --git a/templates/build-native-script.yml b/templates/build-native-script.yml new file mode 100644 index 0000000000..64aaf8e8f9 --- /dev/null +++ b/templates/build-native-script.yml @@ -0,0 +1,51 @@ +Builds: + - versionName: 2.0.2 + versionCode: 3 + commit: v2.0.2 + sudo: + # Install dependencies and NativeScript-CLI + - apt-get update || apt-get update + - apt-get install -y lib32z1 nodejs + - npm -g install nativescript + init: + # Please adjust the versions as needed + - $$SDK$$/tools/bin/sdkmanager "platforms;android-30" "build-tools;30.0.3" "emulator" + > /dev/null + - npm install --unsafe-perm + output: platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk + srclibs: + # Please use the latest releases available + - NativeScript_android-runtime@v8.2.2 + - NativeScript_NativeScript@8.2.1-core + scandelete: + - node_modules + build: + # Build NativeScript UI blob + - pushd $$NativeScript_NativeScript$$/packages/ui-mobile-base/android/widgets + - gradle assembleRelease + - popd + - mkdir -p node_modules/@nativescript/core/platforms/android + - cp $$NativeScript_NativeScript$$/packages/ui-mobile-base/android/widgets/build/outputs/aar/widgets-release.aar + node_modules/@nativescript/core/platforms/android/widgets-release.aar + - rm -rf $$NativeScript_NativeScript$$ + # Build NativeScript Android Runtime blobs + - pushd $$NativeScript_android-runtime$$ + - export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") + - cp $$SDK$$/build-tools/30.0.3/lib/dx.jar test-app/build-tools/android-metadata-generator/src/libs/dx.jar + # Please adjust the NDK version as needed, sync these [1] + - gradle -PndkVersion=20.1.5948944 + - popd + - mkdir -p node_modules/@nativescript/android + - rm -rf node_modules/@nativescript/android/framework + - cp -r $$NativeScript_android-runtime$$/dist/framework node_modules/@nativescript/android + - rm -rf $$NativeScript_android-runtime$$ + # Build the app itself + - ns prepare android + # Configure the app not to produce a signed APK when building + - sed -i 's/\(signingConfig[[:space:]]\)signingConfigs\.release/\1null/' platforms/android/app/build.gradle + - ns build android --gradlePath /opt/gradle/bin/gradle --release --env.uglify --key-store-path /dev/null --key-store-alias + NULL --key-store-password NULL --key-store-alias-password NULL || (cd platforms/android/app/build/outputs/apk/release + - echo "The following files were found:" + - find -maxdepth 1 -type f -name "*.apk") + # Please adjust the NDK version as needed, sync these [1] + ndk: r20b \ No newline at end of file diff --git a/templates/build-nodejs b/templates/build-react-native.yml similarity index 64% rename from templates/build-nodejs rename to templates/build-react-native.yml index 7f088a3d83..ef364c5145 100644 --- a/templates/build-nodejs +++ b/templates/build-react-native.yml @@ -2,6 +2,7 @@ # Starting from the following template and grep for "npm" in the metadata # directory to see other examples. +# See also https://f-droid.org/2020/10/14/adding-react-native-app-to-f-droid.html Builds: - versionName: '1.0' @@ -11,11 +12,12 @@ Builds: sudo: - sysctl fs.inotify.max_user_watches=524288 || true # Find the nodejs download URL at https://nodejs.org/en/download/releases/ - - curl -Lo node.tar.xz https://nodejs.org/download/release/v16.17.0/node-v16.17.0-linux-x64.tar.xz + # Download the gz tarball because xz-utils is not installed by default + - curl -Lo node.tar.xz https://nodejs.org/download/release/v19.3.0/node-v19.3.0-linux-x64.tar.gz # Find the checksum at https://nodejs.org/dist/v${VERSION}/SHASUMS256.txt.asc - - echo "f0867d7a17a4d0df7dbb7df9ac3f9126c2b58f75450647146749ef296b31b49b node.tar.xz" + - echo "b525028ae5bb71b5b32cb7fce903ccce261dbfef4c7dd0f3e0ffc27cd6fc0b3f node.tar.xz" | sha256sum -c - - - tar xJf node.tar.xz --strip-components=1 -C /usr/local/ + - tar xzf node.tar.gz --strip-components=1 -C /usr/local/ # If you use yarn - npm -g install yarn init: @@ -29,11 +31,13 @@ Builds: gradle: - yes scanignore: + # Add other build.gradle files here is local maven repo for react-native is used + # Binaries for react-native, JSC and Hermes can be ignored currently - android/build.gradle scandelete: - - node_modules/ + - node_modules -AutoUpdateMode: Version %v +AutoUpdateMode: Version UpdateCheckMode: Tags CurrentVersion: '1.0' CurrentVersionCode: 1 diff --git a/templates/app-full b/templates/general.yml similarity index 55% rename from templates/app-full rename to templates/general.yml index 1b56823507..520bde7e0f 100644 --- a/templates/app-full +++ b/templates/general.yml @@ -1,6 +1,6 @@ # F-Droid metadata template # -# See http://f-droid.org/manual for more details +# See https://f-droid.org/docs/ for more details # and the Metadata reference # https://f-droid.org/docs/Build_Metadata_Reference/ # @@ -8,6 +8,7 @@ # # Single-line fields start right after the colon (with a whitespace). +# These items are the metadata for the app. Please fill as many as possible. Categories: # Use those which apply - Connectivity - Development @@ -27,7 +28,9 @@ Categories: # Use those which apply - Time - Writing License: (identifier from https://spdx.org/licenses) - +# AuthorName: (web link) +# AuthorEmail: (web link) +# AuthorWebSite: (web link) # WebSite: (web link) SourceCode: (web link) # IssueTracker: (web link) @@ -38,29 +41,9 @@ SourceCode: (web link) # LiberapayID: (number) # Bitcoin: (bitcoin address) -# You may not need to add Summary and Description here, -# if you want to translate them. For details on other locations, see -# https://f-droid.org/en/docs/All_About_Descriptions_Graphics_and_Screenshots/ -Summary: (one sentence, no more than 30-50 chars, no trailing punctuation) -Description: |- - Description of what the app does, starting on a new line. It should be as - objective as possible and wrapped at 80 chars (except links and list - items). - - A blank line means a line break, i.e. the end of a paragraph. - - Bulleted lists can be used: - - * Item 1 - * Item 2 - - Links can be added like this: - [https://github.com/org/project/raw/HEAD/res/raw/changelog.xml Changelog] - - Links to other apps too: [[some.other.app]] - RepoType: (git, git-svn, svn, hg or bzr) Repo: (repo url, preferably https) +Binaries: (Upstream binary link for reproducible build) # At least one for new apps Builds: @@ -69,12 +52,11 @@ Builds: commit: v1.0 subdir: app # submodules: true - gradle: - - yes # output: some.apk # prebuild: sed -i -e + # build: make -# For a complete list of possible flags, see the manual +# For a complete list of possible flags, see the docs # MaintainerNotes: |- # Here go the notes to take into account for future updates, builds, etc. @@ -82,7 +64,7 @@ Builds: # The following options are described at this location: # https://f-droid.org/docs/Build_Metadata_Reference/#UpdateCheckMode -AutoUpdateMode: (see the manual) -UpdateCheckMode: (see the manual) -CurrentVersion: (current version name) -CurrentVersionCode: (current version code, i.e. number) +AutoUpdateMode: Version +UpdateCheckMode: Tags +CurrentVersion: '1.0' +CurrentVersionCode: 1