diff --git a/.github/workflows/flutter-macos.yml b/.github/workflows/flutter-macos.yml deleted file mode 100644 index 998ccdf4fb..0000000000 --- a/.github/workflows/flutter-macos.yml +++ /dev/null @@ -1,86 +0,0 @@ -# This file is part of BOINC. -# http://boinc.berkeley.edu -# Copyright (C) 2023 University of California -# -# BOINC is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, -# either version 3 of the License, or (at your option) any later version. -# -# BOINC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with BOINC. If not, see . - -name: Flutter-macOS -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - schedule: - - cron: '0 0 * * 0' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - build: - name: ${{ matrix.type }}-flutter-build - runs-on: macos-latest - strategy: - matrix: - type: [macos, ios] - fail-fast: false - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - fetch-depth: 2 - - - name: Setup xcode - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd - with: - xcode-version: '12.5.1' - - - name: Setup flutter - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 - with: - channel: 'beta' - - - name: Setup macos desktop - if: matrix.type == 'macos' - run: flutter config --enable-macos-desktop - - - name: Cache dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 - if: matrix.type == 'macos' - with: - path: 3rdParty/buildCache - key: osx-flutter-${{ hashFiles('3rdParty/*Mac*.sh', 'mac_build/setupForBOINC.sh', 'mac_build/dependencyNames.sh', 'mac_build/[bB]uild*.sh', '.github/workflows/flutter-macos.yml') }} - - - name: Build macos client - if: matrix.type == 'macos' - run: samples/flutter/ci_build_macos.sh - - - name: Install flutter dependencies - run: cd samples/flutter/boinc/ && flutter pub get - - - name: Build macos - if: matrix.type == 'macos' - run: | - cd samples/flutter/ - flutter create boinc - cd boinc/ - flutter build macos - - - name: Build ios - if: matrix.type == 'ios' - run: | - cd samples/flutter/ - flutter create boinc - cd boinc/ - flutter build ios --release --no-codesign diff --git a/.github/workflows/flutter-ubuntu.yml b/.github/workflows/flutter-ubuntu.yml deleted file mode 100644 index 4857cb1cec..0000000000 --- a/.github/workflows/flutter-ubuntu.yml +++ /dev/null @@ -1,147 +0,0 @@ -# This file is part of BOINC. -# http://boinc.berkeley.edu -# Copyright (C) 2023 University of California -# -# BOINC is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, -# either version 3 of the License, or (at your option) any later version. -# -# BOINC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with BOINC. If not, see . - -name: Flutter-Ubuntu -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - schedule: - - cron: '0 0 * * 0' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -env: - AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }} - AWS_DEFAULT_REGION: us-west-2 - -jobs: - build: - name: ${{ matrix.type }}-flutter-build - runs-on: ubuntu-latest - strategy: - matrix: - type: [linux, android] - fail-fast: false - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - fetch-depth: 1 - - - name: Setup Java - if: matrix.type == 'android' - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 - with: - distribution: 'zulu' - java-version: '17' - - - name: Setup android SDK - if: matrix.type == 'android' - uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 - - - name: Setup flutter - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 - with: - channel: 'beta' - - - name: Setup linux desktop - if: matrix.type == 'linux' - run: flutter config --enable-linux-desktop - - - name: Install linux dependencies - if: matrix.type == 'linux' - run: | - sudo apt update - sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev - - - name: Cache dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 - if: matrix.type == 'linux' - with: - path: | - 3rdParty/buildCache - !3rdParty/buildCache/linux/vcpkgcache/ - key: linux-flutter-client-vcpkg-${{ hashFiles('3rdParty/*Linux*.sh', 'linux/*.sh', '.github/workflows/flutter-ubuntu.yml') }} - - - name: Check if build is running from origin repo - if: ${{ success() && env.AWS_ACCESS_KEY_ID != 0 && env.AWS_SECRET_ACCESS_KEY != 0 }} - run: | - echo "VCPKG_BINARY_SOURCES=clear;x-aws,s3://vcpkg.cache.boinc/,readwrite" >> $GITHUB_ENV - - - name: Check if build is running from fork - if: ${{ success() && (env.AWS_ACCESS_KEY_ID == 0 || env.AWS_SECRET_ACCESS_KEY == 0) }} - run: | - echo "VCPKG_BINARY_SOURCES=clear;x-aws-config,no-sign-request;x-aws,s3://vcpkg.cache.boinc/,read" >> $GITHUB_ENV - - - name: Build linux client - if: matrix.type == 'linux' - run: samples/flutter/ci_build_linux.sh - - - name: Cache dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 - if: matrix.type == 'android' - with: - path: | - 3rdParty/buildCache - !3rdParty/buildCache/android/vcpkgcache/ - key: android-manager-vcpkg-${{ hashFiles('android/*.sh') }} - - - name: Build android client - if: matrix.type == 'android' - run: samples/flutter/ci_build_android.sh - - - name: Install flutter dependencies - run: cd samples/flutter/boinc/ && flutter pub get - - - name: Build linux - if: matrix.type == 'linux' - run: | - cd samples/flutter/ - flutter create boinc - cd boinc/ - flutter build linux - - - name: Build android - if: matrix.type == 'android' - run: | - cd samples/flutter/ - flutter create boinc --org edu.berkeley - cd boinc/ - flutter build apk - - - name: Prepare android - if: success() && matrix.type == 'android' - uses: edgarrc/action-7z@93485892b5468e89cfb2c28a8d1c0e3904906458 - with: - args: 7z a -t7z -mx=9 deploy/flutter_${{ matrix.type }}.7z -r0 samples/flutter/boinc/build/app/outputs/flutter-apk/app-release.apk - - - name: Prepare linux - if: success() && matrix.type == 'linux' - uses: edgarrc/action-7z@93485892b5468e89cfb2c28a8d1c0e3904906458 - with: - args: 7z a -t7z -mx=9 deploy/flutter_${{ matrix.type }}.7z -r0 samples/flutter/boinc/build/linux/x64/release/bundle/* - - - name: Upload ${{ matrix.type }} - if: success() - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a - with: - name: ${{ matrix.type }}_flutter_${{ github.event.pull_request.head.sha }} - path: deploy/flutter_${{ matrix.type }}.7z diff --git a/.github/workflows/flutter-windows.yml b/.github/workflows/flutter-windows.yml deleted file mode 100644 index 79dde7336b..0000000000 --- a/.github/workflows/flutter-windows.yml +++ /dev/null @@ -1,134 +0,0 @@ -# This file is part of BOINC. -# http://boinc.berkeley.edu -# Copyright (C) 2023 University of California -# -# BOINC is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, -# either version 3 of the License, or (at your option) any later version. -# -# BOINC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with BOINC. If not, see . - -name: Flutter-Windows -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - schedule: - - cron: '0 0 * * 0' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -env: - AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }} - AWS_DEFAULT_REGION: us-west-2 - -jobs: - build: - name: ${{ matrix.type }}-flutter-build - runs-on: windows-2019 - strategy: - matrix: - type: [windows, web, winuwp] - fail-fast: false - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - with: - fetch-depth: 2 - - - name: Setup msbuild - uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce - - - name: Setup flutter - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 - with: - channel: 'dev' - - - name: Setup winuwp Desktop - if: matrix.type == 'winuwp' - run: flutter config --enable-windows-uwp-desktop - - - name: Setup windows Desktop - if: matrix.type == 'windows' - run: flutter config --enable-windows-desktop - - - name: Cache dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 - if: matrix.type == 'windows' - with: - path: | - ${{ github.workspace }}\3rdParty\Windows\cuda\ - key: windows-flutter-x64-Release-${{ hashFiles('win_build/vcpkg_3rdparty_dependencies_vs2019.vcxproj', '.github/workflows/flutter-windows.yml') }} - - - name: Check if build is running from origin repo - if: ${{ success() && env.AWS_ACCESS_KEY_ID != 0 && env.AWS_SECRET_ACCESS_KEY != 0 }} - run: | - echo "VCPKG_BINARY_SOURCES=clear;x-aws,s3://vcpkg.cache.boinc/,readwrite" >> $GITHUB_ENV - - - name: Check if build is running from fork - if: ${{ success() && (env.AWS_ACCESS_KEY_ID == 0 || env.AWS_SECRET_ACCESS_KEY == 0) }} - run: | - echo "VCPKG_BINARY_SOURCES=clear;x-aws-config,no-sign-request;x-aws,s3://vcpkg.cache.boinc/,read" >> $GITHUB_ENV - - - name: Build windows client - if: matrix.type == 'windows' - run: samples\flutter\ci_build_windows.bat - - - name: Install flutter dependencies - run: cd samples/flutter/boinc/ && flutter pub get - - - name: Build winuwp - if: matrix.type == 'winuwp' - run: | - cd samples/flutter/ - flutter create boinc - cd boinc/ - flutter build winuwp - - - name: Build windows - if: matrix.type == 'windows' - run: | - cd samples/flutter/ - flutter create boinc - cd boinc/ - flutter build windows - - - name: Build web - if: matrix.type == 'web' - run: | - cd samples/flutter/ - flutter create boinc - cd boinc/ - flutter build web - - - name: Prepare windows - if: success() && matrix.type == 'windows' - run: | - 7z.exe a -t7z -mx=9 deploy/flutter_${{ matrix.type }}.7z -r0 samples/flutter/boinc/build/windows/runner/Release/* - - - name: Prepare web - if: success() && matrix.type == 'web' - run: | - 7z.exe a -t7z -mx=9 deploy/flutter_${{ matrix.type }}.7z -r0 samples/flutter/boinc/build/web/* - - - name: Prepare winuwp - if: success() && matrix.type == 'winuwp' - run: | - 7z.exe a -t7z -mx=9 deploy/flutter_${{ matrix.type }}.7z -r0 samples/flutter/boinc/build/winuwp/runner_uwp/Release/* - - - name: Upload ${{ matrix.type }} - if: success() - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a - with: - name: ${{ matrix.type }}_flutter_${{ github.event.pull_request.head.sha }} - path: deploy/flutter_${{ matrix.type }}.7z diff --git a/samples/flutter/boinc/.gitignore b/samples/flutter/boinc/.gitignore deleted file mode 100644 index 33a53eee1b..0000000000 --- a/samples/flutter/boinc/.gitignore +++ /dev/null @@ -1,59 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -/build/ - -# Web related -lib/generated_plugin_registrant.dart - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release - -# Windows -windows/ -winuwp/ -web/ - -# Linux -linux/ -android/ - -# MacOS -macos/ -ios/ diff --git a/samples/flutter/boinc/.metadata b/samples/flutter/boinc/.metadata deleted file mode 100644 index 6a04d0b342..0000000000 --- a/samples/flutter/boinc/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: b22742018b3edf16c6cadd7b76d9db5e7f9064b5 - channel: beta - -project_type: app diff --git a/samples/flutter/boinc/README.md b/samples/flutter/boinc/README.md deleted file mode 100644 index fc6fc5dee7..0000000000 --- a/samples/flutter/boinc/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# boinc - -boinc - -## Getting Started - -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) - -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. diff --git a/samples/flutter/boinc/analysis_options.yaml b/samples/flutter/boinc/analysis_options.yaml deleted file mode 100644 index 61b6c4de17..0000000000 --- a/samples/flutter/boinc/analysis_options.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# This file configures the analyzer, which statically analyzes Dart code to -# check for errors, warnings, and lints. -# -# The issues identified by the analyzer are surfaced in the UI of Dart-enabled -# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be -# invoked from the command line by running `flutter analyze`. - -# The following line activates a set of recommended lints for Flutter apps, -# packages, and plugins designed to encourage good coding practices. -include: package:flutter_lints/flutter.yaml - -linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. - rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options diff --git a/samples/flutter/boinc/android.yaml b/samples/flutter/boinc/android.yaml deleted file mode 100644 index 91f91de32c..0000000000 --- a/samples/flutter/boinc/android.yaml +++ /dev/null @@ -1,9 +0,0 @@ - - assets/arm64-v8a/boinc - - assets/armeabi/boinc - - assets/armeabi-v7a/boinc - - assets/x86/boinc - - assets/x86_64/boinc - - assets/all_projects_list.xml - - assets/ca-bundle.crt - - assets/cc_config.xml - - assets/nomedia diff --git a/samples/flutter/boinc/android/app/build.gradle b/samples/flutter/boinc/android/app/build.gradle deleted file mode 100644 index 3e283a1dfb..0000000000 --- a/samples/flutter/boinc/android/app/build.gradle +++ /dev/null @@ -1,69 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 31 - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "edu.berkeley.boinc" - minSdkVersion 16 - targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'commons-io:commons-io:2.7' -} diff --git a/samples/flutter/boinc/android/app/src/main/kotlin/edu/berkeley/boinc/MainActivity.kt b/samples/flutter/boinc/android/app/src/main/kotlin/edu/berkeley/boinc/MainActivity.kt deleted file mode 100644 index 2382f07a3b..0000000000 --- a/samples/flutter/boinc/android/app/src/main/kotlin/edu/berkeley/boinc/MainActivity.kt +++ /dev/null @@ -1,202 +0,0 @@ -package edu.berkeley.boinc - -import androidx.annotation.NonNull -import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugin.common.MethodChannel -import java.io.File -import java.io.IOException -import java.io.InputStream -import android.util.Log - -import org.apache.commons.io.FileUtils -import java.util.* - - -class MainActivity: FlutterActivity() { - private val CHANNEL = "edu.berkeley.boinc/client" - private val TAG = "Android kotlin FlutterActivity" - private val INSTALL_FAILED = "Failed to install: " - private val IOEXCEPTION_LOG = "IOException: " - private var isInstall = false - private val boincWorkingDir = "/data/data/edu.berkeley.boinc/client/" - private val fileNameClient = "boinc" - private val fileNameClientCmd = "boinccmd" - private val fileNameCABundle = "ca-bundle.crt" - private val fileNameClientConfig = "cc_config.xml" - private val fileNameAllProjectsList = "all_projects_list.xml" - private val fileNameNoMedia = "nomedia" - - internal fun InputStream.copyToFile(destFile: File) = FileUtils.copyInputStreamToFile(this, destFile) - internal fun CharSequence.containsAny(vararg sequences: CharSequence) = sequences.any { it in this } - - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - super.configureFlutterEngine(flutterEngine) - MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result -> - // Note: this methods is invoked on the main thread. - when (call.method) { - "runClient" -> { - val isRunning = runClient() - result.success(isRunning) - } - else -> { - result.notImplemented() - } - } - } - } - - private fun runClient(): Boolean { - var success = false - - if (!isInstall) { - success = installClient() - isInstall = success - } - - Log.i(TAG, "isInstall: $isInstall") - - if (isInstall) { - success = false - val param = "--allow_remote_gui_rpc" - val cmd = arrayOf(boincWorkingDir + fileNameClient, "--daemon", param) - try { - Log.i(TAG, "Launching '${cmd[0]}' from '$boincWorkingDir'") - - Runtime.getRuntime().exec(cmd, null, File(boincWorkingDir)) - success = true - } catch (e: IOException) { - Log.e(TAG, "Starting BOINC client failed with exception: " + e.message) - Log.e(TAG, "IOException", e) - } - } - return success - } - - - /** - * Copies given file from APK assets to internal storage. - * - * @param file name of file as it appears in assets directory - * @param executable set executable flag of file in internal storage - * @param targetFile name of target file - * @return Boolean success - */ - private fun installFile(file: String, executable: Boolean, targetFile: String): Boolean { - var success = false - val flutter_prefix = "flutter_assets/assets/" - // If file is executable, cpu architecture has to be evaluated - // and assets directory select accordingly - val source = flutter_prefix + if (executable) assetsDirForCpuArchitecture + file else file - val target = if (targetFile.isNotEmpty()) { - File(boincWorkingDir + targetFile) - } else { - File(boincWorkingDir + file) - } - try { - // Copy file from the asset manager to clientPath - applicationContext.assets.open(source).copyToFile(target) - success = true //copy succeeded without exception - - // Set executable, if requested - if (executable) { - success = target.setExecutable(true) // return false, if not executable - } - - Log.d(TAG, "Installation of " + source + " successful. Executable: " + - executable + "/" + success) - } catch (ioe: IOException) { - Log.e(TAG, IOEXCEPTION_LOG + ioe.message) - Log.e(TAG, "Install of $source failed.") - } - return success - } - - /** - * Installs required files from APK's asset directory to the applications' internal storage. - * File attributes override and executable are defined here - * - * @return Boolean success - */ - private fun installClient(): Boolean { - if (!installFile(fileNameClient, true, "")) { - Log.e(TAG, INSTALL_FAILED + fileNameClient) - - return false - } - if (!installFile(fileNameClientCmd, true, "")) { - Log.e(TAG, INSTALL_FAILED + fileNameClientCmd) - - return false - } - if (!installFile(fileNameCABundle, false, "")) { - Log.e(TAG, INSTALL_FAILED + fileNameCABundle) - - return false - } - if (!installFile(fileNameClientConfig, false, "")) { - Log.e(TAG, INSTALL_FAILED + fileNameClientConfig) - - return false - } - if (!installFile(fileNameAllProjectsList, false, "")) { - Log.e(TAG, INSTALL_FAILED + fileNameAllProjectsList) - - return false - } - if (!installFile(fileNameNoMedia, false, ".$fileNameNoMedia")) { - Log.e(TAG, INSTALL_FAILED + fileNameNoMedia) - - return false - } - return true - } - - /** - * Determines BOINC platform name corresponding to device's cpu architecture (ARM, x86). - * Defaults to ARM - * - * @return ID of BOINC platform name string in resources - */ - private val boincPlatform: String - get() { - val platformId: String - val arch = System.getProperty("os.arch") ?: "" - val normalizedArch = arch.toUpperCase(Locale.US) - platformId = when { - normalizedArch.containsAny("ARM64", "AARCH64") -> "ARM64" - "X86_64" in normalizedArch -> "X86_64" - "ARMV6" in normalizedArch -> "ARMV6" - "ARM" in normalizedArch -> "ARM" - "86" in normalizedArch -> "X86" - else -> { - Log.w(TAG, "could not map os.arch ($arch) to platform, default to arm.") - "" - } - } - - Log.i(TAG, "BOINC platform: $platformId for os.arch: $arch") - - return platformId - } - - /** - * Determines assets directory (contains BOINC client binaries) corresponding to device's cpu architecture (ARM, x86) - * - * @return name of assets directory for given platform, not an absolute path. - */ - private val assetsDirForCpuArchitecture: String - get() { - var archAssetsDirectory = "" - when (boincPlatform) { - "ARMV6" -> archAssetsDirectory = "armeabi/" - "ARM" -> archAssetsDirectory = "armeabi-v7a/" - "ARM64" -> archAssetsDirectory = "arm64-v8a/" - "X86" -> archAssetsDirectory = "x86/" - "X86_64" -> archAssetsDirectory = "x86_64/" - else -> { - } - } - return archAssetsDirectory - } -} diff --git a/samples/flutter/boinc/assets/.gitignore b/samples/flutter/boinc/assets/.gitignore deleted file mode 100644 index e736b8d722..0000000000 --- a/samples/flutter/boinc/assets/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -boinc -boinc.exe -ca-bundle.crt -all_projects_list.xml -nomedia diff --git a/samples/flutter/boinc/assets/arm64-v8a/placeholder.txt b/samples/flutter/boinc/assets/arm64-v8a/placeholder.txt deleted file mode 100644 index dd97f12778..0000000000 --- a/samples/flutter/boinc/assets/arm64-v8a/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -This file is used as a placeholder until real data files are created or copied from another location. \ No newline at end of file diff --git a/samples/flutter/boinc/assets/armeabi-v7a/placeholder.txt b/samples/flutter/boinc/assets/armeabi-v7a/placeholder.txt deleted file mode 100644 index dd97f12778..0000000000 --- a/samples/flutter/boinc/assets/armeabi-v7a/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -This file is used as a placeholder until real data files are created or copied from another location. \ No newline at end of file diff --git a/samples/flutter/boinc/assets/armeabi/placeholder.txt b/samples/flutter/boinc/assets/armeabi/placeholder.txt deleted file mode 100644 index dd97f12778..0000000000 --- a/samples/flutter/boinc/assets/armeabi/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -This file is used as a placeholder until real data files are created or copied from another location. \ No newline at end of file diff --git a/samples/flutter/boinc/assets/linux/placeholder.txt b/samples/flutter/boinc/assets/linux/placeholder.txt deleted file mode 100644 index dd97f12778..0000000000 --- a/samples/flutter/boinc/assets/linux/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -This file is used as a placeholder until real data files are created or copied from another location. \ No newline at end of file diff --git a/samples/flutter/boinc/assets/macos/placeholder.txt b/samples/flutter/boinc/assets/macos/placeholder.txt deleted file mode 100644 index dd97f12778..0000000000 --- a/samples/flutter/boinc/assets/macos/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -This file is used as a placeholder until real data files are created or copied from another location. \ No newline at end of file diff --git a/samples/flutter/boinc/assets/windows/placeholder.txt b/samples/flutter/boinc/assets/windows/placeholder.txt deleted file mode 100644 index dd97f12778..0000000000 --- a/samples/flutter/boinc/assets/windows/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -This file is used as a placeholder until real data files are created or copied from another location. \ No newline at end of file diff --git a/samples/flutter/boinc/assets/x86/placeholder.txt b/samples/flutter/boinc/assets/x86/placeholder.txt deleted file mode 100644 index dd97f12778..0000000000 --- a/samples/flutter/boinc/assets/x86/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -This file is used as a placeholder until real data files are created or copied from another location. \ No newline at end of file diff --git a/samples/flutter/boinc/assets/x86_64/placeholder.txt b/samples/flutter/boinc/assets/x86_64/placeholder.txt deleted file mode 100644 index dd97f12778..0000000000 --- a/samples/flutter/boinc/assets/x86_64/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -This file is used as a placeholder until real data files are created or copied from another location. \ No newline at end of file diff --git a/samples/flutter/boinc/boinc.iml b/samples/flutter/boinc/boinc.iml deleted file mode 100644 index ac273b3343..0000000000 --- a/samples/flutter/boinc/boinc.iml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/flutter/boinc/lib/linux.dart b/samples/flutter/boinc/lib/linux.dart deleted file mode 100644 index 933592868b..0000000000 --- a/samples/flutter/boinc/lib/linux.dart +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:ffi' as ffi; -import 'package:ffi/ffi.dart'; - - -int systemLinux(String command) { - var result = system(command); - return result; -} - -/* -#include -int system(const char *string); - -https://man.openbsd.org/system.3 -*/ - -// C header typedef: -typedef SystemC = ffi.Int32 Function(ffi.Pointer command); - -// Dart header typedef -typedef SystemDart = int Function(ffi.Pointer command); - -int system(String command) { - // Load `stdlib`. On MacOS this is in libSystem.dylib. - final dylib = ffi.DynamicLibrary.open('libc.so.6'); - - // Look up the `system` function. - final systemP = dylib.lookupFunction('system'); - - // Allocate a pointer to a Utf8 array containing our command. - final cmdP = command.toNativeUtf8(); - - // Invoke the command, and free the pointer. - int result = systemP(cmdP); - - calloc.free(cmdP); - - return result; -} diff --git a/samples/flutter/boinc/lib/macos.dart b/samples/flutter/boinc/lib/macos.dart deleted file mode 100644 index 0fbcf975f0..0000000000 --- a/samples/flutter/boinc/lib/macos.dart +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:ffi' as ffi; -import 'package:ffi/ffi.dart'; - - -int systemMacOS(String command) { - var result = system(command); - return result; -} - -/* -#include -int system(const char *string); - -https://man.openbsd.org/system.3 -*/ - -// C header typedef: -typedef SystemC = ffi.Int32 Function(ffi.Pointer command); - -// Dart header typedef -typedef SystemDart = int Function(ffi.Pointer command); - -int system(String command) { - // Load `stdlib`. On MacOS this is in libSystem.dylib. - final dylib = ffi.DynamicLibrary.open('/usr/lib/libSystem.dylib'); - - // Look up the `system` function. - final systemP = dylib.lookupFunction('system'); - - // Allocate a pointer to a Utf8 array containing our command. - final cmdP = command.toNativeUtf8(); - - // Invoke the command, and free the pointer. - int result = systemP(cmdP); - calloc.free(cmdP); - - return result; -} diff --git a/samples/flutter/boinc/lib/main.dart b/samples/flutter/boinc/lib/main.dart deleted file mode 100644 index 2d15fee585..0000000000 --- a/samples/flutter/boinc/lib/main.dart +++ /dev/null @@ -1,523 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter/foundation.dart' show kIsWeb; - -import 'package:flutter_svg/avd.dart'; -import 'package:neat_periodic_task/neat_periodic_task.dart'; -import 'package:path/path.dart' as path; -import 'package:http/http.dart' as http; -import 'package:xml/xml.dart'; -import 'package:convert/convert.dart'; -import 'package:crypto/crypto.dart'; - -import 'dart:convert'; -import 'dart:async'; -import 'dart:io'; -import 'dart:io' if (dart.library.io) 'package:boinc/windows.dart'; -import 'dart:io' if (dart.library.io) 'package:boinc/macos.dart'; -import 'dart:io' if (dart.library.io) 'package:boinc/linux.dart'; -import 'dart:io' if (dart.library.html) 'package:boinc/web.dart'; - - -void main() => runApp(MyApp()); - - -class MyApp extends StatefulWidget { - @override - MyAppState createState() => MyAppState(); - - static MyAppState? of(BuildContext context) => - context.findAncestorStateOfType(); -} - -enum Section -{ - Run, - Connect, - State, - Tasks, - Notices, - Projects, - Preference, - Help, - Report, - Event, -} - - -class MyAppState extends State { - static const String channel = 'edu.berkeley.boinc/client'; - static const platform = const MethodChannel(channel); - NeatPeriodicTaskScheduler? scheduler; - MyAppState(){ - scheduler = NeatPeriodicTaskScheduler( - interval: Duration(seconds: 1), - name: 'update_state', - timeout: Duration(seconds: 1), - task: () async => updateState(), - minCycle: Duration(milliseconds: 500), - ); - } - - /// 1) our themeMode "state" field - final String appName = 'Boinc'; - ThemeMode _themeMode = ThemeMode.system; - Section _section = Section.Preference; - String title = ""; - int? authId; - int authSeqno = 1; - String authSalt = ""; - Future password = () async {return "";}(); - bool isReadFile = false; - bool isClientRunning = false; - bool isSchedule = false; - Iterable _projects = []; - Iterable _results = []; - Iterable _workUnits = []; - - @override - Widget build(BuildContext context) { - - title = getSectionTitle(_section); - return MaterialApp( - title: appName, - theme: ThemeData(), - darkTheme: ThemeData.dark(), - themeMode: _themeMode, // 2) ← ← ← use "state" field here ////////////// - home: MyHomePage(title: title), - ); - } - - String getSectionTitle(Section section) { - return section.toString().substring(8); - } - - void changeSection(Section section) { - setState(() { - _section = section; - }); - } - - void changeState(Iterable projects, - Iterable results, - Iterable workUnits) { - setState(() { - _projects = projects; - _results = results; - _workUnits = workUnits; - }); - } - - Section getSection() { - return _section; - } - - /// 3) Call this to change theme from any context using "of" accessor - /// e.g.: - /// MyApp.of(context).changeTheme(ThemeMode.dark); - void changeTheme(ThemeMode themeMode) { - setState(() { - _themeMode = themeMode; - }); - } - - void runAndroidClient() async { - try { - final bool result = await platform.invokeMethod('runClient'); - } on PlatformException catch (e) { - print('${e.message}'); - } - } - - void runClient() { - if (kIsWeb) { - - } else { - final execuPath = path.dirname(Platform.resolvedExecutable); - final boincPath = path.join(execuPath, - "data", "flutter_assets", "assets"); - if (Platform.isAndroid) { - runAndroidClient(); - } - if (Platform.isLinux) { - systemLinux("chmod +x " + path.join(boincPath, "linux", "boinc")); - systemLinux(path.join(boincPath, "linux", "boinc") + " &"); - } - if (Platform.isWindows) { - systemWindows(path.join(boincPath, "windows", "boinc.exe")); - } - if (Platform.isMacOS) { - systemMacOS("chmod +x " + path.join(boincPath, "macos", "boinc")); - systemMacOS(path.join(boincPath, "macos", "boinc") + " &"); - } - } - isClientRunning = true; - } - - void updateState() { - guiRpc("get_state").then((String response) { - print("we got get_state!!"); - var document = XmlDocument.parse(response); - var projects = document.findAllElements("project"); - var workUnits = document.findAllElements("workunit"); - var results = document.findAllElements("result"); - print("projects: ${projects.length}"); - print("results: ${results.length}"); - print("workUnits: ${workUnits.length}"); - changeState(projects, results, workUnits); - // print(document); - }); - } - - Future guiRpc(String request) async { - final builder = XmlBuilder(); - builder.element('boinc_gui_rpc_request', nest: () { - builder.element(request); - }); - String requestXml = builder.buildDocument().toXmlString(); - - var url = Uri.parse('http://localhost:31416'); - Map headers = {}; - if (authId != null) { - var authHash = hex.encode(md5.convert(latin1.encode("$authSeqno"+"${await password}"+authSalt+requestXml)).bytes); - headers = {"Auth-ID": "$authId", "Auth-Seqno": "$authSeqno", "Auth-Hash": authHash}; - authSeqno++; - } - headers = { - ...headers, - "Content-Length": "${latin1.encode(requestXml).lengthInBytes}", - }; - print("url: $url"); - print("headers: $headers"); - print("requestXml: $requestXml"); - if (kIsWeb) { - http.Response response = await http.post(url, headers: headers, body: requestXml, encoding: latin1); - return response.body; - } else { - HttpClient client = HttpClient(); - return await client.postUrl(url) - .then((HttpClientRequest request) { - headers.forEach((key, value) { - request.headers.add(key, value, preserveHeaderCase: true); - }); - request.headers.set("Content-Length", "${latin1.encode(requestXml).lengthInBytes}", preserveHeaderCase: true); - request.headers.contentType = ContentType.parse("text/xml"); - request.write(requestXml); - return request.close(); - }).then((HttpClientResponse response) { - return response.transform(latin1.decoder).join(); - }); - } - } - - Future readFile(String filePath) async { - File cfg = File(filePath); - String content = ""; - try { - // Read the file - content = await cfg.readAsString(); - } catch(e) {} - return content.trim(); - } - - Future connectClient() { - var filePath = ""; - if (kIsWeb) { - - } else { - if (Platform.isWindows) { - // filePath = 'C:\\ProgramData\\BOINC\\gui_rpc_auth.cfg'; - } - if (Platform.isLinux) { - - } - if (Platform.isMacOS) { - - } - if (Platform.isAndroid) { - - } - } - - if (filePath != "" && !isReadFile) { - password = readFile(filePath); - isReadFile = true; - } - - return guiRpc("get_auth_id").then((String response) { - print("we got get_auth_id!!"); - var document = XmlDocument.parse(response); - authId = int.parse(document.findAllElements("auth_id").first.text); - authSalt = document.findAllElements("auth_salt").first.text; - print("authId: $authId"); - print("authSalt: $authSalt"); - }); - } -} - -class Preference extends StatelessWidget { - @override - Widget build(BuildContext context) { - var myAppContext = MyApp.of(context)!; - return Scaffold( - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'Choose your theme:', - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - /// ////////////////////////////////////////////////////// - /// Change theme & rebuild to show it using these buttons - ElevatedButton( - onPressed: () => myAppContext.changeTheme(ThemeMode.light), - child: Text('Light') - ), - ElevatedButton( - onPressed: () => myAppContext.changeTheme(ThemeMode.dark), - child: Text('Dark'), - ), - /// ////////////////////////////////////////////////////// - ], - ), - ], - ), - ), - ); - } -} - -class Projects extends StatelessWidget { - @override - Widget build(BuildContext context) { - var myAppContext = MyApp.of(context)!; - Iterable projects = myAppContext._projects; - return Scaffold( - body: ListView.builder - ( - itemCount: projects.length, - itemBuilder: (BuildContext context, int index) { - var projectName = projects.elementAt(index).findElements("project_name").first.text; - return Text("Name: $projectName"); - } - ) - ); - } -} - -class Tasks extends StatelessWidget { - @override - Widget build(BuildContext context) { - var myAppContext = MyApp.of(context)!; - Iterable results = myAppContext._results; - Iterable workUnits = myAppContext._workUnits; - print("results.length: ${results.length}"); - print("workUnits.length: ${workUnits.length}"); - print("results: $results"); - print("workUnits: $workUnits"); - return Scaffold( - body: ListView.builder - ( - itemCount: results.length, - itemBuilder: (BuildContext context, int index) { - var result = results.elementAt(index); - String wu_name = result.findElements("wu_name").first.text; - String appName = workUnits.firstWhere((workUnit) => workUnit.findElements("name").first.text == wu_name) - .findElements("app_name") - .first.text; - bool active = false; - String remain = "-1"; - try { - active = result.findAllElements("active_task_state").first.text == "1"; - remain = result.findElements("estimated_cpu_time_remaining").first.text; - } catch(e) {} - return Text("Name: $appName, Active: $active, Remain: $remain"); - } - ) - ); - } -} - -class MyHomePage extends StatelessWidget { - final String title; - - MyHomePage({Key? key, required this.title}) : super(key: key); - - @override - Widget build(BuildContext context) { - var appBar = AppBar(title: Text(title), centerTitle: true); - var textColor = Theme.of(context).textTheme.bodyText1!.color; - var myAppContext = MyApp.of(context)!; - Widget? body; - var section = myAppContext.getSection(); - - /// You can easily control the section for example inside the initState where you check - /// if the user logged in, or other related logic - switch (section) - { - case Section.Run: - break; - case Section.Connect: - break; - case Section.State: - break; - case Section.Tasks: - body = Tasks(); - break; - case Section.Notices: - break; - case Section.Projects: - body = Projects(); - break; - case Section.Preference: - body = Preference(); - break; - case Section.Help: - break; - case Section.Report: - break; - case Section.Event: - break; - default: - break; - } - - return Scaffold( - appBar: appBar, - body: body, - drawer: Drawer( - // Add a ListView to the drawer. This ensures the user can scroll - // through the options in the drawer if there isn't enough vertical - // space to fit everything. - child: ListView( - // Important: Remove any padding from the ListView. - padding: EdgeInsets.zero, - children: [ - Container( - height: appBar.preferredSize.height, - child: DrawerHeader( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - shape: BoxShape.rectangle, - ), - child: Text(myAppContext.appName), - )), - ListTile( - leading: SizedBox.fromSize( - size: Size.fromRadius(12), - child: FittedBox( - child: AvdPicture.asset("res/drawable/ic_boinc.xml"), - ), - ), - title: Text('Run Client'), - onTap: () { - myAppContext.changeSection(Section.Run); - myAppContext.runClient(); - - Navigator.pop(context); - }, - ), - ListTile( - leading: AvdPicture.asset("res/drawable/ic_baseline_wifi.xml", color: textColor), - title: Text('Connect Client'), - onTap: () { - myAppContext.changeSection(Section.Connect); - - myAppContext.connectClient().then((_) { - if (myAppContext.authId != null && !myAppContext.isSchedule) { - myAppContext.isSchedule = true; - myAppContext.scheduler!.start(); - } - }); - - Navigator.pop(context); - }, - ), - ListTile( - leading: AvdPicture.asset("res/drawable/ic_baseline_list.xml", color: textColor), - title: Text('Tasks'), - onTap: () { - myAppContext.changeSection(Section.Tasks); - - Navigator.pop(context); - }, - ), - ListTile( - leading: AvdPicture.asset('res/drawable/ic_baseline_email.xml', color: textColor), - title: Text('Notices'), - onTap: () { - myAppContext.changeSection(Section.Notices); - - Navigator.pop(context); - }, - ), - ListTile( - leading: SizedBox.fromSize( - size: Size.fromRadius(12), - child: FittedBox( - child: AvdPicture.asset("res/drawable/ic_projects.xml", color: textColor), - ), - ), - title: Text('Projects'), - onTap: () { - myAppContext.changeSection(Section.Projects); - - Navigator.pop(context); - }, - ), - ListTile( - leading: AvdPicture.asset('res/drawable/ic_baseline_add_box.xml', color: textColor), - title: Text('Add Project'), - onTap: () { - myAppContext.changeSection(Section.Projects); - - Navigator.pop(context); - }, - ), - ListTile( - leading: AvdPicture.asset('res/drawable/ic_baseline_settings.xml', color: textColor), - title: Text('Preference'), - onTap: () { - myAppContext.changeSection(Section.Preference); - - Navigator.pop(context); - }, - ), - ListTile( - leading: AvdPicture.asset('res/drawable/ic_baseline_help.xml', color: textColor), - title: Text('Help'), - onTap: () { - myAppContext.changeSection(Section.Help); - - Navigator.pop(context); - }, - ), - ListTile( - leading: AvdPicture.asset('res/drawable/ic_baseline_bug_report.xml', color: textColor), - title: Text('Report Issue'), - onTap: () { - myAppContext.changeSection(Section.Report); - - Navigator.pop(context); - }, - ), - ListTile( - leading: AvdPicture.asset('res/drawable/ic_baseline_warning.xml', color: textColor), - title: Text('Event log'), - onTap: () { - myAppContext.changeSection(Section.Event); - - Navigator.pop(context); - }, - ), - ], - ), - ), - ); - } -} - - diff --git a/samples/flutter/boinc/lib/web.dart b/samples/flutter/boinc/lib/web.dart deleted file mode 100644 index 36c1cd5436..0000000000 --- a/samples/flutter/boinc/lib/web.dart +++ /dev/null @@ -1,12 +0,0 @@ - -systemWindows(String command) { - -} - -int systemMacOS(String command) { - return 0; -} - -int systemLinux(String command) { - return 0; -} diff --git a/samples/flutter/boinc/lib/win32ui.dart b/samples/flutter/boinc/lib/win32ui.dart deleted file mode 100644 index 90449afa96..0000000000 --- a/samples/flutter/boinc/lib/win32ui.dart +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:ffi'; - -import 'package:ffi/ffi.dart'; - -main() { - messageBox('こんにちは窓', 'Hello Windows'); -} - -/* MessageBoxW is the UTF16 (wchar_t) version of MessageBox. -int MessageBoxW( - HWND hWnd, - LPCWSTR lpText, - LPCWSTR lpCaption, - UINT uType -); - */ -typedef MessageBoxC = Int32 Function( - Pointer hwnd, - Pointer lpText, - Pointer lpCaption, - Uint32 uType, -); -typedef MessageBoxDart = int Function( - Pointer parentWindow, - Pointer message, - Pointer caption, - int type, -); - -const MB_ABORTRETRYIGNORE = 0x00000002; -const MB_CANCELTRYCONTINUE = 0x00000006; -const MB_HELP = 0x00004000; -const MB_OK = 0x00000000; -const MB_OKCANCEL = 0x00000001; -const MB_RETRYCANCEL = 0x00000005; -const MB_YESNO = 0x00000004; -const MB_YESNOCANCEL = 0x00000003; - -const MB_ICONEXCLAMATION = 0x00000030; -const MB_ICONWARNING = 0x00000030; -const MB_ICONINFORMATION = 0x00000040; -const MB_ICONASTERISK = 0x00000040; -const MB_ICONQUESTION = 0x00000020; -const MB_ICONSTOP = 0x00000010; -const MB_ICONERROR = 0x00000010; -const MB_ICONHAND = 0x00000010; - -int messageBox(String message, String caption) { - // Load user32. - final user32 = DynamicLibrary.open('user32.dll'); - - // Look up the `MessageBoxW` function. - final messageBoxP = - user32.lookupFunction('MessageBoxW'); - - // Allocate pointers to Utf16 arrays containing the command arguments. - final messageP = message.toNativeUtf16(); - final captionP = caption.toNativeUtf16(); - - // Invoke the command, and free the pointers. - final result = - messageBoxP(nullptr, messageP, captionP, MB_OK | MB_ICONINFORMATION); - calloc.free(messageP); - calloc.free(captionP); - - return result; -} diff --git a/samples/flutter/boinc/lib/windows.dart b/samples/flutter/boinc/lib/windows.dart deleted file mode 100644 index 8e0c82fe41..0000000000 --- a/samples/flutter/boinc/lib/windows.dart +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:ffi' as ffi; -import 'package:ffi/ffi.dart'; - - -systemWindows(String command) { - shellExecute("open", "cmd", "/c " + command); -} - -/* -HINSTANCE ShellExecuteW( - HWND hwnd, - LPCWSTR lpOperation, - LPCWSTR lpFile, - LPCWSTR lpParameters, - LPCWSTR lpDirectory, - INT nShowCmd -); - -https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew -*/ -typedef ShellExecuteC = ffi.Int32 Function( - ffi.Pointer hwnd, - ffi.Pointer lpOperation, - ffi.Pointer lpFile, - ffi.Pointer lpParameters, - ffi.Pointer lpDirectory, - ffi.Uint32 nShowCmd); -typedef ShellExecuteDart = int Function( - ffi.Pointer parentWindow, - ffi.Pointer operation, - ffi.Pointer file, - ffi.Pointer parameters, - ffi.Pointer directory, - int showCmd); - -int shellExecute(String operation, String file, String params) { - // Load shell32. - final dylib = ffi.DynamicLibrary.open('shell32.dll'); - - // Look up the `ShellExecuteW` function. - final shellExecuteP = - dylib.lookupFunction('ShellExecuteW'); - - // Allocate pointers to Utf8 arrays containing the command arguments. - final operationP = operation.toNativeUtf16(); - final fileP = file.toNativeUtf16(); - final paramsP = params.toNativeUtf16(); - const int SW_SHOWNORMAL = 1; - - // Invoke the command, and free the pointers. - var result = shellExecuteP( - ffi.nullptr, operationP, fileP, paramsP, ffi.nullptr, SW_SHOWNORMAL); - calloc.free(operationP); - calloc.free(fileP); - - return result; -} diff --git a/samples/flutter/boinc/linux.yaml b/samples/flutter/boinc/linux.yaml deleted file mode 100644 index d5967f2dd2..0000000000 --- a/samples/flutter/boinc/linux.yaml +++ /dev/null @@ -1,2 +0,0 @@ - - assets/linux/boinc - - assets/linux/ca-bundle.crt diff --git a/samples/flutter/boinc/macos.yaml b/samples/flutter/boinc/macos.yaml deleted file mode 100644 index c032fbbe88..0000000000 --- a/samples/flutter/boinc/macos.yaml +++ /dev/null @@ -1,2 +0,0 @@ - - assets/macos/boinc - - assets/macos/ca-bundle.crt diff --git a/samples/flutter/boinc/pubspec.lock b/samples/flutter/boinc/pubspec.lock deleted file mode 100644 index 1d37d6e5a0..0000000000 --- a/samples/flutter/boinc/pubspec.lock +++ /dev/null @@ -1,198 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.8.2" - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0" - convert: - dependency: "direct main" - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - crypto: - dependency: "direct main" - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - ffi: - dependency: "direct main" - description: - name: ffi - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.2" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_svg: - dependency: "direct main" - description: - name: flutter_svg - url: "https://pub.dartlang.org" - source: hosted - version: "0.23.0+1" - http: - dependency: "direct main" - description: - name: http - url: "https://pub.dartlang.org" - source: hosted - version: "0.13.4" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.dartlang.org" - source: hosted - version: "4.0.0" - json_annotation: - dependency: transitive - description: - name: json_annotation - url: "https://pub.dartlang.org" - source: hosted - version: "4.3.0" - logging: - dependency: transitive - description: - name: logging - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - neat_periodic_task: - dependency: "direct main" - description: - name: neat_periodic_task - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - path: - dependency: "direct main" - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - path_drawing: - dependency: transitive - description: - name: path_drawing - url: "https://pub.dartlang.org" - source: hosted - version: "0.5.1+1" - path_parsing: - dependency: transitive - description: - name: path_parsing - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "4.4.0" - retry: - dependency: transitive - description: - name: retry - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - slugid: - dependency: transitive - description: - name: slugid - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.1" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - xml: - dependency: "direct main" - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "5.3.1" -sdks: - dart: ">=2.14.0 <3.0.0" - flutter: ">=1.24.0-7.0" diff --git a/samples/flutter/boinc/pubspec.yaml b/samples/flutter/boinc/pubspec.yaml deleted file mode 100644 index 8b168051d2..0000000000 --- a/samples/flutter/boinc/pubspec.yaml +++ /dev/null @@ -1,89 +0,0 @@ -name: boinc -description: boinc - -# The following line prevents the package from being accidentally published to -# pub.dev using `pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+1 - -environment: - sdk: ">=2.12.0 <3.0.0" - -dependencies: - flutter: - sdk: flutter - - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - flutter_svg: ^0.23.0 - path: ^1.8.0 - ffi: ^1.1.2 - xml: ^5.1.2 - http: ^0.13.4 - convert: ^3.0.0 - crypto: ^3.0.1 - neat_periodic_task: ^2.0.0 - -dev_dependencies: -# flutter_launcher_icons: ^0.9.0 -# rename: ^1.3.1 -# flutter_test: -# sdk: flutter -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec -#flutter_icons: -# android: "launcher_icon" -# ios: true -# image_path: "res/mipmap-xxxhdpi/ic_launcher.png" -# The following section is specific to Flutter. -flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. - uses-material-design: true - - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - assets: - - res/drawable/ - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages diff --git a/samples/flutter/boinc/res/drawable/ic_baseline_add_box.xml b/samples/flutter/boinc/res/drawable/ic_baseline_add_box.xml deleted file mode 100644 index 305f93b9ff..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_baseline_add_box.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/samples/flutter/boinc/res/drawable/ic_baseline_bug_report.xml b/samples/flutter/boinc/res/drawable/ic_baseline_bug_report.xml deleted file mode 100644 index f263beac76..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_baseline_bug_report.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/samples/flutter/boinc/res/drawable/ic_baseline_email.xml b/samples/flutter/boinc/res/drawable/ic_baseline_email.xml deleted file mode 100644 index ae37726a54..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_baseline_email.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - diff --git a/samples/flutter/boinc/res/drawable/ic_baseline_help.xml b/samples/flutter/boinc/res/drawable/ic_baseline_help.xml deleted file mode 100644 index beb919e081..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_baseline_help.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/samples/flutter/boinc/res/drawable/ic_baseline_list.xml b/samples/flutter/boinc/res/drawable/ic_baseline_list.xml deleted file mode 100644 index ab02d3d2bd..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_baseline_list.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/samples/flutter/boinc/res/drawable/ic_baseline_settings.xml b/samples/flutter/boinc/res/drawable/ic_baseline_settings.xml deleted file mode 100644 index 535f8ebf1e..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_baseline_settings.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/samples/flutter/boinc/res/drawable/ic_baseline_warning.xml b/samples/flutter/boinc/res/drawable/ic_baseline_warning.xml deleted file mode 100644 index 4404140c5d..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_baseline_warning.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - diff --git a/samples/flutter/boinc/res/drawable/ic_baseline_wifi.xml b/samples/flutter/boinc/res/drawable/ic_baseline_wifi.xml deleted file mode 100644 index c23e8e8031..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_baseline_wifi.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/samples/flutter/boinc/res/drawable/ic_boinc.xml b/samples/flutter/boinc/res/drawable/ic_boinc.xml deleted file mode 100644 index 097293d16f..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_boinc.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - diff --git a/samples/flutter/boinc/res/drawable/ic_projects.xml b/samples/flutter/boinc/res/drawable/ic_projects.xml deleted file mode 100644 index 188bb38b68..0000000000 --- a/samples/flutter/boinc/res/drawable/ic_projects.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - diff --git a/samples/flutter/boinc/test/widget_test.dart b/samples/flutter/boinc/test/widget_test.dart deleted file mode 100644 index 02bfef13eb..0000000000 --- a/samples/flutter/boinc/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:boinc/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/samples/flutter/boinc/windows.yaml b/samples/flutter/boinc/windows.yaml deleted file mode 100644 index aed9c04c9b..0000000000 --- a/samples/flutter/boinc/windows.yaml +++ /dev/null @@ -1 +0,0 @@ - - assets/windows/boinc.exe diff --git a/samples/flutter/ci_build_android.sh b/samples/flutter/ci_build_android.sh deleted file mode 100755 index c09fb80afb..0000000000 --- a/samples/flutter/ci_build_android.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -set -e - -# Script to compile everything BOINC needs for Android flutter - -# check working directory because the script needs to be called like: ./samples/flutter/ci_build_manager.sh -if [ ! -d "samples/flutter" ]; then - echo "start this script in the source root directory" - exit 1 -fi - -echo '===== BOINC Flutuer Android build start =====' -android/ci_build_vcpkg_client.sh -cp "android/BOINC/app/src/main/assets/arm64-v8a/boinc" "samples/flutter/boinc/assets/arm64-v8a/boinc" -cp "android/BOINC/app/src/main/assets/armeabi/boinc" "samples/flutter/boinc/assets/armeabi/boinc" -cp "android/BOINC/app/src/main/assets/armeabi-v7a/boinc" "samples/flutter/boinc/assets/armeabi-v7a/boinc" -cp "android/BOINC/app/src/main/assets/x86/boinc" "samples/flutter/boinc/assets/x86/boinc" -cp "android/BOINC/app/src/main/assets/x86_64/boinc" "samples/flutter/boinc/assets/x86_64/boinc" -cp "win_build/installerv2/redist/all_projects_list.xml" "samples/flutter/boinc/assets/all_projects_list.xml" -cp "curl/ca-bundle.crt" "samples/flutter/boinc/assets/ca-bundle.crt" -cp "android/BOINC/app/src/main/assets/cc_config.xml" "samples/flutter/boinc/assets/cc_config.xml" -cp "android/BOINC/app/src/main/assets/nomedia" "samples/flutter/boinc/assets/nomedia" -cat "samples/flutter/boinc/android.yaml" >> "samples/flutter/boinc/pubspec.yaml" -android/clear_environment.sh full -echo '===== BOINC Flutuer Android build done =====' diff --git a/samples/flutter/ci_build_linux.sh b/samples/flutter/ci_build_linux.sh deleted file mode 100755 index 30dd8304e2..0000000000 --- a/samples/flutter/ci_build_linux.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -set -e - -# Script to compile everything BOINC needs for Linux flutter - -# check working directory because the script needs to be called like: ./samples/flutter/ci_build_manager.sh -if [ ! -d "samples/flutter" ]; then - echo "start this script in the source root directory" - exit 1 -fi - -echo '===== BOINC Flutuer Linux build start =====' -./_autosetup -linux/ci_configure_client.sh -make -cp "client/boinc" "samples/flutter/boinc/assets/linux/boinc" -cp "client/boinccmd" "samples/flutter/boinc/assets/linux/boinccmd" -cp "curl/ca-bundle.crt" "samples/flutter/boinc/assets/linux/ca-bundle.crt" -cat "samples/flutter/boinc/linux.yaml" >> "samples/flutter/boinc/pubspec.yaml" -echo '===== BOINC Flutuer Linux build done =====' diff --git a/samples/flutter/ci_build_macos.sh b/samples/flutter/ci_build_macos.sh deleted file mode 100755 index 8410311e58..0000000000 --- a/samples/flutter/ci_build_macos.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -set -e - -# Script to compile everything BOINC needs for macOS flutter - -# check working directory because the script needs to be called like: ./samples/flutter/ci_build_manager.sh -if [ ! -d "samples/flutter" ]; then - echo "start this script in the source root directory" - exit 1 -fi - -echo '===== BOINC Flutuer macOS build start =====' -3rdParty/buildMacDependencies.sh -q -mac_build/buildMacBOINC-CI.sh --no_shared_headers - -cp "mac_build/build/Deployment/boinc" "samples/flutter/boinc/assets/macos/boinc" -cp "curl/ca-bundle.crt" "samples/flutter/boinc/assets/macos/ca-bundle.crt" -cat "samples/flutter/boinc/macos.yaml" >> "samples/flutter/boinc/pubspec.yaml" -echo '===== BOINC Flutuer macOS build done =====' diff --git a/samples/flutter/ci_build_windows.bat b/samples/flutter/ci_build_windows.bat deleted file mode 100644 index 8bd7778077..0000000000 --- a/samples/flutter/ci_build_windows.bat +++ /dev/null @@ -1,18 +0,0 @@ - - -REM # Script to compile everything BOINC needs for Windows flutter - -REM # check working directory because the script needs to be called like: ./samples/flutter/ci_build_manager.sh -if not exist "samples\flutter\" ( - echo "start this script in the source root directory" - exit 1 -) - - -echo '===== BOINC Flutuer Windows build start =====' -vcpkg.exe integrate remove -msbuild win_build\boinc_vs2019.sln -p:Configuration=Release -p:Platform=x64 -p:VcpkgTripletConfig=ci -m - -copy "win_build\Build\x64\Release\boinc.exe" "samples\flutter\boinc\assets\windows\boinc.exe" -type "samples\flutter\boinc\windows.yaml" >> "samples\flutter\boinc\pubspec.yaml" -echo '===== BOINC Flutuer Windows build done ====='