mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-17 10:40:12 +02:00
import: generate skeleton build fields for react-native and flutter
This commit is contained in:
parent
1153ac24fd
commit
e037ee5972
@ -19,14 +19,21 @@
|
|||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
import glob
|
import glob
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
import yaml
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
try:
|
||||||
|
from yaml import CSafeLoader as SafeLoader
|
||||||
|
except ImportError:
|
||||||
|
from yaml import SafeLoader
|
||||||
|
|
||||||
from . import _
|
from . import _
|
||||||
from . import common
|
from . import common
|
||||||
from . import metadata
|
from . import metadata
|
||||||
@ -296,6 +303,36 @@ def main():
|
|||||||
if os.path.exists(os.path.join(subdir, 'build.gradle')):
|
if os.path.exists(os.path.join(subdir, 'build.gradle')):
|
||||||
build.gradle = ['yes']
|
build.gradle = ['yes']
|
||||||
|
|
||||||
|
package_json = os.path.join(build_dir, 'package.json') # react-native
|
||||||
|
pubspec_yaml = os.path.join(build_dir, 'pubspec.yaml') # flutter
|
||||||
|
if os.path.exists(package_json):
|
||||||
|
build.sudo = ['apt-get install npm', 'npm install -g react-native-cli']
|
||||||
|
build.init = ['npm install']
|
||||||
|
with open(package_json) as fp:
|
||||||
|
data = json.load(fp)
|
||||||
|
app.AutoName = data.get('name', app.AutoName)
|
||||||
|
app.License = data.get('license', app.License)
|
||||||
|
app.Description = data.get('description', app.Description)
|
||||||
|
app.WebSite = data.get('homepage', app.WebSite)
|
||||||
|
app_json = os.path.join(build_dir, 'app.json')
|
||||||
|
if os.path.exists(app_json):
|
||||||
|
with open(app_json) as fp:
|
||||||
|
data = json.load(fp)
|
||||||
|
app.AutoName = data.get('name', app.AutoName)
|
||||||
|
if os.path.exists(pubspec_yaml):
|
||||||
|
with open(pubspec_yaml) as fp:
|
||||||
|
data = yaml.load(fp, Loader=SafeLoader)
|
||||||
|
app.AutoName = data.get('name', app.AutoName)
|
||||||
|
app.License = data.get('license', app.License)
|
||||||
|
app.Description = data.get('description', app.Description)
|
||||||
|
build.srclibs = ['flutter@stable']
|
||||||
|
build.output = 'build/app/outputs/apk/release/app-release.apk'
|
||||||
|
build.build = [
|
||||||
|
'$$flutter$$/bin/flutter config --no-analytics',
|
||||||
|
'$$flutter$$/bin/flutter packages pub get',
|
||||||
|
'$$flutter$$/bin/flutter build apk',
|
||||||
|
]
|
||||||
|
|
||||||
metadata.post_metadata_parse(app)
|
metadata.post_metadata_parse(app)
|
||||||
|
|
||||||
app.builds.append(build)
|
app.builds.append(build)
|
||||||
|
Loading…
Reference in New Issue
Block a user