Skip to content

Commit

Permalink
Add MacOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Ray committed Dec 10, 2024
1 parent ea5a784 commit 7b8ff7a
Show file tree
Hide file tree
Showing 31 changed files with 1,481 additions and 15 deletions.
57 changes: 43 additions & 14 deletions .github/workflows/build-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ jobs:
with:
name: pikatorrent-linux
path: app/build/linux/x64/release/bundle/**/*
android:
runs-on: ubuntu-24.04

windows:
runs-on: windows-2022
env:
# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/25936
TRANSMISSION_PREFIX: ${{ github.workspace }}/transmission-prefix
VCPKG_MANIFEST_DIR: ${{ github.workspace }}/app
defaults:
run:
Expand All @@ -42,20 +45,42 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: stable
- run: flutter build windows
- uses: actions/upload-artifact@v4
with:
name: pikatorrent-windows
path: app/build/windows/x64/runner/Release/**/*

macos:
runs-on: macos-14
defaults:
run:
working-directory: ./app
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build
- run: flutter build apk
brew install ninja
- name: Set up vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: ${{ github.workspace }}/app/vcpkg
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- run: flutter build macos
- uses: actions/upload-artifact@v4
with:
name: pikatorrent-android
path: app/build/app/outputs/apk/release/app-release.apk
windows:
runs-on: windows-2022
name: pikatorrent-macos
path: app/build/macos/Build/Products/Release/*app

android:
runs-on: ubuntu-24.04
env:
# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/25936
TRANSMISSION_PREFIX: ${{ github.workspace }}/transmission-prefix
VCPKG_MANIFEST_DIR: ${{ github.workspace }}/app
defaults:
run:
Expand All @@ -73,8 +98,12 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: stable
- run: flutter build windows
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build
- run: flutter build apk
- uses: actions/upload-artifact@v4
with:
name: pikatorrent-windows
path: app/build/windows/x64/runner/Release/**/*
name: pikatorrent-android
path: app/build/app/outputs/apk/release/app-release.apk
2 changes: 1 addition & 1 deletion app/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ migration:
- platform: root
create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
- platform: windows
- platform: macos
create_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668
base_revision: dec2ee5c1f98f8e84a7d5380c05eb8a3d0a81668

Expand Down
7 changes: 7 additions & 0 deletions app/macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/

# Xcode-related
**/dgph
**/xcuserdata/
2 changes: 2 additions & 0 deletions app/macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
2 changes: 2 additions & 0 deletions app/macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
26 changes: 26 additions & 0 deletions app/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Generated file. Do not edit.
//

import FlutterMacOS
import Foundation

import app_links
import device_info_plus
import flutter_local_notifications
import open_file_mac
import path_provider_foundation
import screen_retriever_macos
import shared_preferences_foundation
import window_manager

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
OpenFilePlugin.register(with: registry.registrar(forPlugin: "OpenFilePlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
}
43 changes: 43 additions & 0 deletions app/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
Loading

0 comments on commit 7b8ff7a

Please sign in to comment.