Skip to content

Commit

Permalink
Fix cargokit update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
temeddix committed Oct 17, 2023
1 parent 9c74263 commit fde721a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion flutter_package/cargokit/build_pod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export CARGOKIT_DARWIN_ARCHS=$ARCHS
export CARGOKIT_CONFIGURATION=$CONFIGURATION

# Path to directory containing Cargo.toml.
export CARGOKIT_MANIFEST_DIR=$PODS_TARGET_SRCROOT/$1
export CARGOKIT_MANIFEST_DIR=$1 #Different from upstream

# Temporary directory for build artifacts.
export CARGOKIT_TARGET_TEMP_DIR=$TARGET_TEMP_DIR
Expand Down
1 change: 0 additions & 1 deletion flutter_package/cargokit/build_tool/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ linter:
rules:
- prefer_relative_imports
- directives_ordering

# analyzer:
# exclude:
# - path/to/excluded/files/**
Expand Down
2 changes: 1 addition & 1 deletion flutter_package/cargokit/cmake/cargokit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function(apply_cargokit target manifest_dir lib_name any_symbol_name)
set(CARGOKIT_ENV
"CARGOKIT_CMAKE=${CMAKE_COMMAND}"
"CARGOKIT_CONFIGURATION=$<CONFIG>"
"CARGOKIT_MANIFEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${manifest_dir}"
"CARGOKIT_MANIFEST_DIR=${manifest_dir}" # Different from upstream
"CARGOKIT_TARGET_TEMP_DIR=${CARGOKIT_TEMP_DIR}"
"CARGOKIT_OUTPUT_DIR=${CARGOKIT_OUTPUT_DIR}"
"CARGOKIT_TARGET_PLATFORM=${CARGOKIT_TARGET_PLATFORM}"
Expand Down
3 changes: 2 additions & 1 deletion flutter_package/cargokit/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This is invoked from plugin's podspec `script_phase` through `build_pod.sh`. Bun

Cargokit will build binaries for all active architectures from XCode build and lipo them togherer.

When using Cargokit to integrate Rust code with an application (not a plugin) you can also configure the `Cargo.toml` to just build a dynamic library. When Cargokit finds that the crate only built a dylib and no static lib, it will attempt to replace the Cocoapod framework binary with the dylib. In this case the script `:execution_position` must be set to `:after_compile`. This is *not* recommended for plugins and it's quite experimental.
When using Cargokit to integrate Rust code with an application (not a plugin) you can also configure the `Cargo.toml` to just build a dynamic library. When Cargokit finds that the crate only built a dylib and no static lib, it will attempt to replace the Cocoapod framework binary with the dylib. In this case the script `:execution_position` must be set to `:after_compile`. This is _not_ recommended for plugins and it's quite experimental.

### gen-key, precompile-binaries, verify-binaries

Expand All @@ -57,6 +57,7 @@ Instead the `run_build_tool` script creates a minimal Dart command line package
Cargokit can be configured through a `cargokit.yaml` file, which can be used to control the build of the Rust package and is placed into the Rust crate next to `Cargo.toml`.

Here is an example `cargokit.yaml` with comments:

```yaml
cargo:
debug: # Configuration of cargo execution during debug builds
Expand Down
3 changes: 1 addition & 2 deletions flutter_package/cargokit/docs/precompiled_binaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The action needs two secrets - private key for signing binaries and GitHub token
```yaml
on:
push:
branches: [ main ]
branches: [main]

name: Precompile Binaries

Expand Down Expand Up @@ -92,4 +92,3 @@ jobs:
By default the `built_tool precompile-binaries` commands build and uploads the binaries for all targets buildable from current host. This can be overriden using the `--target <rust-triple>` argument.

Android binaries will be built when `--android-sdk-location` and `--android-ndk-version` arguments are provided.

2 changes: 1 addition & 1 deletion flutter_package/cargokit/gradle/plugin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract class CargoKitBuildTask extends DefaultTask {
def executableName = Os.isFamily(Os.FAMILY_WINDOWS) ? "run_build_tool.cmd" : "run_build_tool.sh"
def path = Paths.get(new File(pluginFile).parent, "..", executableName);

def manifestDir = Paths.get(project.buildscript.sourceFile.parent, project.cargokit.manifestDir)
def manifestDir = project.cargokit.manifestDir // Different from upstream

def rootProjectDir = project.rootProject.projectDir

Expand Down

0 comments on commit fde721a

Please sign in to comment.