Skip to content

Commit

Permalink
Support building on Windows
Browse files Browse the repository at this point in the history
- Published as v0.1.0
- Use Flutter and java action in build workflow
- Build on x86_64 and ARM64 versions of macOS in workflow
  • Loading branch information
PeteClubSeven committed Feb 9, 2024
1 parent 408e1fa commit 8ba1d65
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 61 deletions.
57 changes: 19 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,40 @@ jobs:
build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
flutter: ["3.7.12", "3.16.7"] # Flutter 3.7.12 is to maintain Breez support
runs-on: ${{matrix.os}}
env:
FLUTTER_VERSION: ${{ matrix.flutter }}
os: [macos-latest, ubuntu-latest, windows-latest]
flutter: ['3.7.12', '3.16.5', 'any']
include:
- os: macos-14 # macOS-latest is x86_64 and macOS 14 is ARM64
flutter: '3.7.12' # Flutter 3.7.12 is to maintain Breez support
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.channel == 'any' }}
steps:
- uses: actions/checkout@v4

- name: Set up Java
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> "$GITHUB_ENV"

- id: cache-deps
uses: actions/cache@v3
- uses: actions/setup-java@v4
with:
key: ${{ matrix.os }}-build-${{ matrix.flutter }}-${{ hashFiles('**/pubspec.yaml', '**/pubspec.lock') }}
path: |
.deps
- if: steps.cache-deps.outputs.cache-hit != 'true' && matrix.os == 'macos-latest'
name: Download & extract Flutter (Mac)
run: |
mkdir -p .deps
curl -o flutter.zip https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_$FLUTTER_VERSION-stable.zip
unzip flutter.zip -d .deps/
- if: steps.cache-deps.outputs.cache-hit != 'true' && matrix.os == 'ubuntu-latest'
name: Download & extract Flutter (Linux)
run: |
mkdir -p .deps
curl -o flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_$FLUTTER_VERSION-stable.tar.xz
tar -C .deps/ -xvf flutter.tar.xz
distribution: 'zulu'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter }}

- if: matrix.os == 'macos-latest'
name: Install tap-protocol dependencies (Mac)
run: brew install cmake coreutils
- if: matrix.os == 'macos-12' || matrix.os == 'macos-latest'
name: Install dependencies (macOS 12)
run: brew install coreutils

- name: Set up Flutter
run: |
export PATH="$(pwd)/.deps/flutter/bin:$PATH"
export PUB_CACHE="$(pwd)/.deps/pub_cache"
flutter config --no-analytics
flutter doctor
flutter doctor -v
flutter pub get
echo "PATH=$PATH" >> "$GITHUB_ENV"
echo "PUB_CACHE=$PUB_CACHE" >> "$GITHUB_ENV"
- if: matrix.os == 'macos-latest'
- if: startsWith(matrix.os, 'macos')
name: Build iOS frameworks
run: |
cd example
flutter build ios-framework
- if: matrix.os == 'macos-latest'
- if: startsWith(matrix.os, 'macos')
name: Build iOS example
run: |
cd example
Expand Down
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
## 0.1.0

* Support building on Windows

## 0.0.1

* Android & iOS support with [nfc_manager](https://pub.dev/packages/nfc_manager)
* Support building on macOS
* Support building on Linux
* Reading Satscards
* Reading Tapsigners
* Performing every Satscard-specific NFC operation
* Read Satscards
* Read Tapsigners
* Perform every Satscard-specific NFC operation
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ The project is currently under development. It is being developed primarily to a

### Platform Support
- [x] Android
- [x] iOS
- [ ] macOS
- [ ] Linux
- [ ] Web
- [ ] Windows

### Feature support

- [ ] Support building on Windows
- [x] Support building on macOS
- [x] Support building on Linux
- [x] Reading Satscards
- [x] Reading Tapsigners
- [x] iOS (macOS only)

### Feature Support
- [x] Build on Windows
- [x] Build on macOS
- [x] Build on Linux
- [x] Read Satscards
- [x] Read Tapsigners
- [x] Perform every Satscard-specific NFC operation

### Todo
- [ ] Support macOS
- [ ] Support Linux
- [ ] Support Web
- [ ] Support Windows
- [ ] Performing every CKTapCard NFC operation
- [x] Performing every Satscard-specific NFC operation
- [ ] Performing every Tapsigner-specific NFC operation
- [ ] Exposing the tap-protocol utility functions
- [ ] Exposing the alternative Tapsigner HWI API
Expand All @@ -32,13 +33,13 @@ The project is currently under development. It is being developed primarily to a

You must have the tools required for tap-protocol and libsecp256k1 to build, please follow these instructions:
- All platforms
- Make sure the Android SDK is installed and $ANDROID_HOME points to a valid location with the command line tools installed
- Make sure the Android SDK is installed and $ANDROID_HOME points to a valid location with the command line tools installed.
- macOS 13 or newer
- `brew install cmake`
- macOS 12 or older
- `brew install cmake coreutils`

## Project stucture
## Project Stucture

This template uses the following structure:

Expand Down
1 change: 0 additions & 1 deletion example/.pubignore

This file was deleted.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cktap_protocol
description: A flutter library implementing the Coinkite tap protocol for use with the Satscard and Tapsigner. The plugin is effectively a wrapper around Nunchuk's tap-protocol library.
version: 0.0.1
version: 0.1.0
license: MIT
repository: https://github.com/PeteClubSeven/cktap-protocol-flutter
funding:
Expand Down
8 changes: 8 additions & 0 deletions scripts/update_submodules.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SET scriptDir=%~dp0
SET rootDir="%scriptDir%\.."

IF EXIST "%rootDir%\.git" IF EXIST "%rootDir%\.git\HEAD" (
PUSHD "%rootDir%"
git submodule update --init --recursive
POPD
)
4 changes: 2 additions & 2 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ target_compile_definitions(cktap_protocol PRIVATE "CKTAP_PLATFORM_${CMAKE_SYSTEM

# Flutter by default doesn't initialize submodules for plugins. We must make
# sure tap-protocol is available
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "WINDOWS")
# TODO: Add Windows command
if(CMAKE_HOST_WIN32)
execute_process(COMMAND cmd.exe /c "${PROJECT_SOURCE_DIR}\\..\\..\\scripts\\update_submodules.bat")
else()
execute_process(COMMAND "${PROJECT_SOURCE_DIR}/../../scripts/update_submodules.sh")
endif()
Expand Down

0 comments on commit 8ba1d65

Please sign in to comment.