diff --git a/fdroidserver/import_subcommand.py b/fdroidserver/import_subcommand.py index 03c36539..16c00f5b 100644 --- a/fdroidserver/import_subcommand.py +++ b/fdroidserver/import_subcommand.py @@ -239,7 +239,7 @@ def main(): git_repo = git.Repo(tmp_importer_dir) if not options.omit_disable: - build.disable = 'Generated by import.py - check/set version fields and commit id' + build.disable = 'Generated by `fdroid import` - check version fields and commitid' write_local_file = False else: raise FDroidException("Specify project url.") @@ -290,8 +290,14 @@ def main(): package_json = tmp_importer_dir / 'package.json' # react-native pubspec_yaml = tmp_importer_dir / 'pubspec.yaml' # flutter if package_json.exists(): - build.sudo = ['apt-get update || apt-get update', 'apt-get install npm', 'npm install -g react-native-cli'] - build.init = ['npm install'] + build.sudo = [ + 'sysctl fs.inotify.max_user_watches=524288 || true', + 'curl -Lo node.tar.gz https://nodejs.org/download/release/v19.3.0/node-v19.3.0-linux-x64.tar.gz', + 'echo "b525028ae5bb71b5b32cb7fce903ccce261dbfef4c7dd0f3e0ffc27cd6fc0b3f node.tar.gz" | sha256sum -c -', + 'tar xzf node.tar.gz --strip-components=1 -C /usr/local/', + 'npm -g install yarn', + ] + build.init = ['npm install --build-from-source'] with package_json.open() as fp: data = json.load(fp) app.AutoName = data.get('name', app.AutoName) @@ -299,6 +305,8 @@ def main(): app.Description = data.get('description', app.Description) app.WebSite = data.get('homepage', app.WebSite) app_json = tmp_importer_dir / 'app.json' + build.scanignore = ['android/build.gradle'] + build.scandelete = ['node_modules'] if app_json.exists(): with app_json.open() as fp: data = json.load(fp) @@ -309,13 +317,21 @@ def main(): app.AutoName = data.get('name', app.AutoName) app.License = data.get('license', app.License) app.Description = data.get('description', app.Description) + app.UpdateCheckData = 'pubspec.yaml|version:\\s.+\\+(\\d+)|.|version:\\s(.+)\\+' build.srclibs = ['flutter@stable'] - build.output = 'build/app/outputs/apk/release/app-release-unsigned.apk' + build.output = 'build/app/outputs/flutter-apk/app-release.apk' build.subdir = None build.gradle = None - build.build = [ + build.prebuild = [ + 'export PUB_CACHE=$(pwd)/.pub-cache', '$$flutter$$/bin/flutter config --no-analytics', '$$flutter$$/bin/flutter packages pub get', + ] + build.scandelete = [ + '.pub-cache', + ] + build.build = [ + 'export PUB_CACHE=$(pwd)/.pub-cache', '$$flutter$$/bin/flutter build apk', ]