Skip to content

Commit

Permalink
Merge branch 'release/0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yulingtianxia committed Nov 30, 2021
2 parents 9bd7f13 + 90e771f commit 50e8226
Show file tree
Hide file tree
Showing 152 changed files with 3,310 additions and 6,362 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [macos-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: "12.x"
- uses: subosito/flutter-action@v1
with:
# same with pubspec.yaml
flutter-version: "1.22.3"
flutter-version: "2.5.3"
- run: flutter pub get
working-directory: dart_native
working-directory: dart_native/example
- run: flutter test --no-pub test/
working-directory: dart_native
working-directory: dart_native/example
- run: flutter build apk
working-directory: dart_native/example
- run: flutter build ios --release --no-codesign
working-directory: dart_native/example
12 changes: 8 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ on:
jobs:
release-to-gitHub:
name: release
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: "12.x"
- uses: subosito/flutter-action@v1
with:
# same with pubspec.yaml
flutter-version: "1.22.3"
flutter-version: "2.5.3"
- run: flutter pub get
working-directory: dart_native/example
- run: flutter analyze --no-pub --no-current-package lib/ test/
Expand All @@ -26,8 +26,12 @@ jobs:
working-directory: dart_native/example
- run: flutter build apk
working-directory: dart_native/example
- run: flutter build ios --release --no-codesign
working-directory: dart_native/example
- uses: softprops/action-gh-release@v1
with:
files: build/app/outputs/apk/release/app-release.apk
files: |
build/app/outputs/apk/release/app-release.apk
build/ios/iphoneos/Runner.app
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- unzip -qq gradle-3.5-bin.zip
- export GRADLE_HOME=$PWD/gradle-3.5
- export PATH=$GRADLE_HOME/bin:$PATH
- git clone https://github.com/flutter/flutter.git --depth 1 --branch 1.22.6
- git clone https://github.com/flutter/flutter.git --depth 1 --branch 2.5.3
- export PATH=./flutter/bin:$PATH
- flutter doctor
- yes | sdkmanager "platforms;android-29"
Expand All @@ -44,7 +44,7 @@ jobs:
- brew install libimobiledevice
- brew install ideviceinstaller
- brew install ios-deploy
- git clone https://github.com/flutter/flutter.git --depth 1 --branch 1.22.6
- git clone https://github.com/flutter/flutter.git --depth 1 --branch 2.5.3
- export PATH=./flutter/bin:$PATH
- flutter doctor
script:
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ This package is the blue part(DartNative Bridge):

## Requirements

| Dart_Native Version | Requirements |
| --- | --- |
| 0.3.0 | Flutter 1.20.0 (Dart 2.9.1) |
| 0.2.0 | Flutter 1.12.13 (Dart 2.7) |
| Dart_Native Version | Flutter Requirements | Codegen Version |
| --- | --- | --- |
| 0.4.x | Flutter 2.2.0 (Dart 2.13.0) | 2.x |
| 0.3.x | Flutter 1.20.0 (Dart 2.9.1) | 1.2.x |
| 0.2.x | Flutter 1.12.13 (Dart 2.7) | 1.x |

## Supported Platforms

Expand Down
2 changes: 1 addition & 1 deletion dart_native/.fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "1.22.6",
"flutterSdkVersion": "stable",
"flavors": {}
}
75 changes: 75 additions & 0 deletions dart_native/.pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
3 changes: 3 additions & 0 deletions dart_native/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": false
}
7 changes: 7 additions & 0 deletions dart_native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.4.0

* [Feature] Adapted to Flutter 2.2 and nullsafety.
* [Feature] Add example for Swift 5.
* [Feature] Enhanced type conversion.
* [Feature] Refactoring the interface and implementation.

## 0.3.23

* [Fix] Some issues on 32-bit Android.
Expand Down
31 changes: 1 addition & 30 deletions dart_native/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
# dart_native

[![pub package](https://img.shields.io/pub/v/dart_native.svg)](https://pub.dev/packages/dart_native)
[![Build Status](https://travis-ci.org/dart-native/dart_native.svg?branch=master)](https://travis-ci.org/dart-native/dart_native)


## Description

Write native code using Dart. This package liberates you from native code and low performance channel.

## Requirements

Flutter 1.20.2 (Dart 2.9.1)

## Usage

1. Generate Dart wrapper code using [@dartnative/codegen](https://www.npmjs.com/package/@dartnative/codegen) or write Dart code by yourself.

2. Generate code for automatic type conversion using [dart_native_gen](https://pub.dev/packages/dart_native_gen)

3. Enjoy it!

## Installation

Add packages to dependencies in your pubspec.yaml

example:

```yaml
dependencies:
dart_native: any
```
[See this.](https://github.com/dart-native/dart_native/blob/master/README.md)
75 changes: 38 additions & 37 deletions dart_native/android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
# Sets the minimum version of CMake required to build your native library.
# This ensures that a certain set of CMake features is available to
# your build.

# Sets the minimum version of CMake required to build your native library.
# This ensures that a certain set of CMake features is available to
# your build.
cmake_minimum_required(VERSION 3.4.1)

# Specifies a library name, specifies whether the library is STATIC or
# SHARED, and provides relative paths to the source code. You can
# define multiple libraries by adding multiple add_library() commands,
# and CMake builds them for you. When you build your app, Gradle
# automatically packages shared libraries with your APK.
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../android/src/libs/${ANDROID_ABI})

# Specifies a library name, specifies whether the library is STATIC or
# SHARED, and provides relative paths to the source code. You can
# define multiple libraries by adding multiple add_library() commands,
# and CMake builds them for you. When you build your app, Gradle
# automatically packages shared libraries with your APK.
add_library( # Specifies the name of the library.
dart_native

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
src/main/jni/include/dart_api_dl.c
src/main/jni/dart_native.cpp
src/main/jni/dn_type_convert.cpp
src/main/jni/dn_method_call.cpp
src/main/jni/dn_signature_helper.cpp
src/main/jni/dn_callback.cpp)

find_library( # Sets the name of the path variable.
log-lib

# Specifies the name of the NDK library that
# you want CMake to locate.
log )

target_link_libraries( # Specifies the target library.
dart_native

# Links the target library to the log library
# included in the NDK.
${log-lib} )

include_directories(src/main/jni/include)
dart_native

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
../ios/common/include/dart_api_dl.c
src/main/jni/dart_native.cpp
src/main/jni/dn_type_convert.cpp
src/main/jni/dn_method_call.cpp
src/main/jni/dn_signature_helper.cpp
src/main/jni/dn_callback.cpp
src/main/jni/dn_thread.cpp)

find_library( # Sets the name of the path variable.
log-lib

# Specifies the name of the NDK library that
# you want CMake to locate.
log)

target_link_libraries( # Specifies the target library.
dart_native
-landroid
# Links the target library to the log library
# included in the NDK.
${log-lib})

include_directories(../ios/common/include)
17 changes: 12 additions & 5 deletions dart_native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 28

// Fix CI error: https://stackoverflow.com/questions/61146248/github-actions-flutter-ci-error-no-version-of-ndk-matched
ndkVersion "18.1.5063045"
// Encapsulates your external native build configurations.
externalNativeBuild {

// Encapsulates your CMake build configurations.
cmake {
// Provides a relative path to your CMake build script.
path "CMakeLists.txt"
}
// open this to debug
// cmake {
// // Provides a relative path to your CMake build script.
// path "CMakeLists.txt"
// }
}

defaultConfig {
Expand All @@ -41,4 +43,9 @@ android {
lintOptions {
disable 'InvalidPackage'
}
sourceSets{
main {
jniLibs.srcDirs=['src/libs']
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 50e8226

Please sign in to comment.