diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfa87166a..dfd5415a1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,10 +21,10 @@ jobs: python-version: '3.8' - name: Preprocess run: | - cd lib/server - wget -q ${{ secrets.SECRET_SALT }} - wget -q ${{ secrets.SECRET_WSALT }} - cd ../.. + # cd lib/server + # wget -q ${{ secrets.SECRET_SALT }} + # wget -q ${{ secrets.SECRET_WSALT }} + # cd ../.. python3 preprocess-ios.py - name: Podfile run: | @@ -48,6 +48,46 @@ jobs: name: ipa-build path: Payload.ipa + linux-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: dev + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + - uses: subosito/flutter-action@v1 + with: + # flutter-version: '2.5.2' + channel: 'stable' + - uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Preprocess + run: | + # cd lib/server + # wget -q ${{ secrets.SECRET_SALT }} + # wget -q ${{ secrets.SECRET_WSALT }} + # cd ../.. + python3 preprocess-linux.py + - name: Build + run: | + sudo apt-get update -y + sudo apt-get install cmake -y + sudo apt-get install ninja-build -y + sudo apt-get install clang -y + flutter clean + flutter build linux --release + wget -O appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage + chmod +x appimage-builder-x86_64.AppImage + ls + # - name: Upload AppImage + # uses: actions/upload-artifact@v2 + # with: + # name: appimage-build + # path: ./build/linux/x64/release/bundle + android-build: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index 0efcc6c57..a4ae24dcc 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,9 @@ migrate_working_dir/ .pub-cache/ .pub/ /build/ +/AppDir/ +*.AppImage +*.appimage # Web related lib/generated_plugin_registrant.dart @@ -62,4 +65,4 @@ emulator.bat img/* test/db test/*.7z -test/rawdata-korean \ No newline at end of file +test/rawdata-korean diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml new file mode 100644 index 000000000..56b1b6877 --- /dev/null +++ b/AppImageBuilder.yml @@ -0,0 +1,73 @@ +# appimage-builder recipe see https://appimage-builder.readthedocs.io for details +version: 1 +script: + - rm -rf AppDir || true + - cp -r build/linux/x64/release/bundle AppDir + - mkdir -p AppDir/usr/share/icons/hicolor/64x64/apps/ + - cp assets/images/logo.png AppDir/usr/share/icons/hicolor/64x64/apps/ +AppDir: + path: ./AppDir + app_info: + id: org.appimagecrafters.hello-flutter + name: Hello Flutter + icon: logo + version: latest + exec: hello_flutter + exec_args: $@ + apt: + arch: amd64 + allow_unauthenticated: true + sources: + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic main restricted + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic universe + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic multiverse + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse + - sourceline: deb http://security.ubuntu.com/ubuntu bionic-security main restricted + - sourceline: deb http://security.ubuntu.com/ubuntu bionic-security universe + - sourceline: deb http://security.ubuntu.com/ubuntu bionic-security multiverse + include: + - libgtk-3-0 + exclude: + - humanity-icon-theme + - hicolor-icon-theme + - adwaita-icon-theme + - ubuntu-mono + files: + exclude: + - usr/share/man + - usr/share/doc/*/README.* + - usr/share/doc/*/changelog.* + - usr/share/doc/*/NEWS.* + - usr/share/doc/*/TODO.* + runtime: + env: + GIO_MODULE_DIR: $APPDIR/usr/lib/x86_64-linux-gnu/gio/modules/ + test: + fedora: + image: appimagecrafters/tests-env:fedora-30 + command: ./AppRun + use_host_x: true + debian: + image: appimagecrafters/tests-env:debian-stable + command: ./AppRun + use_host_x: true + arch: + image: appimagecrafters/tests-env:archlinux-latest + command: ./AppRun + use_host_x: true + centos: + image: appimagecrafters/tests-env:centos-7 + command: ./AppRun + use_host_x: true + ubuntu: + image: appimagecrafters/tests-env:ubuntu-xenial + command: ./AppRun + use_host_x: true +AppImage: + arch: x86_64 + update-information: guess + sign-key: None + diff --git a/preprocess-android.py b/preprocess-android.py index 74a339b2c..50c94a9e5 100644 --- a/preprocess-android.py +++ b/preprocess-android.py @@ -108,5 +108,5 @@ def create_dummy_valid(path): elif filename.endswith(".yaml"): process_yaml(root + '/' + filename) -# create_dummy_valid('./lib/server/salt.dart') -# create_dummy_valid('./lib/server/wsalt.dart') +create_dummy_valid('./lib/server/salt.dart') +create_dummy_valid('./lib/server/wsalt.dart') diff --git a/preprocess-ios.py b/preprocess-ios.py index 961247eae..f3a612857 100644 --- a/preprocess-ios.py +++ b/preprocess-ios.py @@ -108,5 +108,5 @@ def create_dummy_valid(path): elif filename.endswith(".yaml"): process_yaml(root + '/' + filename) -# create_dummy_valid('./lib/server/salt.dart') -# create_dummy_valid('./lib/server/wsalt.dart') \ No newline at end of file +create_dummy_valid('./lib/server/salt.dart') +create_dummy_valid('./lib/server/wsalt.dart') diff --git a/preprocess-linux.py b/preprocess-linux.py new file mode 100644 index 000000000..6e6e8fb96 --- /dev/null +++ b/preprocess-linux.py @@ -0,0 +1,112 @@ +# This source code is a part of Project Violet. +# Copyright (C) 2021.violet-team. Licensed under the Apache-2.0 License. + +import sys +import os +import os.path +import re + +target = 'linux' + +def process_dart(path): + f = open(path, 'r') + w = [] + nl = False + op = False + for line in f.readlines(): + if '//' in line: + annote = re.split(r': |, | ',line.split('//')[-1].strip()) + + if not annote[0].startswith('@dependent'): + if nl or op: + nl = False + else: + w.append(line) + continue + + if annote[1] == target: + w.append(line) + continue + + if len(annote) == 2: + continue + + if annote[2] == '=>': + nl = True + continue + + if annote[2] == '[': + op = True + continue + + if annote[2] == ']': + op = False + continue + else: + if nl or op: + nl = False + else: + w.append(line) + f.close() + f = open(path, 'w+') + f.writelines(w) + f.close() + +def process_yaml(path): + f = open(path, 'r') + w = [] + nl = False + op = False + for line in f.readlines(): + if '#' in line: + annote = re.split(r': |, | ', line.split('#')[-1].strip()) + + if not annote[0].startswith('@dependent'): + if nl or op: + nl = False + else: + w.append(line) + continue + + if annote[1] == target: + w.append(line) + continue + + if len(annote) == 2: + continue + + if annote[2] == '=>': + nl = True + continue + + if annote[2] == '[': + op = True + continue + + if annote[2] == ']': + op = False + continue + else: + if nl or op: + nl = False + else: + w.append(line) + f.close() + f = open(path, 'w+') + f.writelines(w) + f.close() + +def create_dummy_valid(path): + f = open(path, 'w') + f.writelines(['String getValid(foo) {return foo;}']) + f.close() + +for root, subdirs, files in os.walk('./'): + for filename in files: + if filename.endswith(".dart"): + process_dart(root + '/' + filename) + elif filename.endswith(".yaml"): + process_yaml(root + '/' + filename) + +create_dummy_valid('./lib/server/salt.dart') +create_dummy_valid('./lib/server/wsalt.dart')