Skip to content

Commit

Permalink
Fix CI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dangeross committed Oct 1, 2024
1 parent c758753 commit 651e063
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 27 deletions.
4 changes: 2 additions & 2 deletions lib/bindings/langs/flutter/scripts/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
version: "1.12.0"
string_scanner:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use uniffi_bindgen::{
ComponentInterface,
};

#[allow(dead_code)]
fn render_literal(literal: &Literal, inner: &Type, ci: &ComponentInterface) -> String {
match literal {
Literal::Null => "null".into(),
Expand Down
12 changes: 10 additions & 2 deletions lib/bindings/langs/react-native/src/gen_kotlin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mod object;
mod primitives;
mod record;

#[allow(dead_code)]
trait CodeType: Debug {
/// The language specific label used to reference this type. This will be used in
/// method signatures and property declarations.
Expand Down Expand Up @@ -121,6 +122,7 @@ impl<'a> ModuleGenerator<'a> {
#[derive(Clone)]
pub struct KotlinCodeOracle;

#[allow(dead_code)]
impl KotlinCodeOracle {
// Map `Type` instances to a `Box<dyn CodeType>` for that type.
//
Expand Down Expand Up @@ -409,7 +411,10 @@ pub mod filters {
Ok(IGNORED_FUNCTIONS.contains(nm))
}

pub fn rn_convert_type(type_: &impl AsType, _ci: &ComponentInterface) -> Result<String, askama::Error> {
pub fn rn_convert_type(
type_: &impl AsType,
_ci: &ComponentInterface,
) -> Result<String, askama::Error> {
match type_.as_type() {
Type::UInt8 | Type::UInt16 | Type::UInt32 => Ok(".toUInt()".to_string()),
Type::Int64 => Ok(".toLong()".to_string()),
Expand Down Expand Up @@ -437,7 +442,10 @@ pub mod filters {
}
}

pub fn rn_type_name(type_: &impl AsType, ci: &ComponentInterface) -> Result<String, askama::Error> {
pub fn rn_type_name(
type_: &impl AsType,
ci: &ComponentInterface,
) -> Result<String, askama::Error> {
match type_.as_type() {
Type::Boolean => Ok("Boolean".to_string()),
Type::Int8 | Type::UInt8 | Type::Int16 | Type::UInt16 | Type::Int32 | Type::UInt32 => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use uniffi_bindgen::{
ComponentInterface,
};

#[allow(dead_code)]
fn render_literal(literal: &Literal, _ci: &ComponentInterface) -> String {
fn typed_number(type_: &Type, num_str: String) -> String {
match type_ {
Expand Down
23 changes: 19 additions & 4 deletions lib/bindings/langs/react-native/src/gen_swift/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mod primitives;
mod record;

/// A trait tor the implementation.
#[allow(dead_code)]
trait CodeType: Debug {
/// The language specific label used to reference this type. This will be used in
/// method signatures and property declarations.
Expand Down Expand Up @@ -128,6 +129,7 @@ impl<'a> ModuleGenerator<'a> {
#[derive(Clone)]
pub struct SwiftCodeOracle;

#[allow(dead_code)]
impl SwiftCodeOracle {
// Map `Type` instances to a `Box<dyn CodeType>` for that type.
//
Expand Down Expand Up @@ -306,7 +308,10 @@ pub mod filters {
res
}

pub fn rn_convert_type(type_: &impl AsType, converted_var_name: &str) -> Result<String, askama::Error> {
pub fn rn_convert_type(
type_: &impl AsType,
converted_var_name: &str,
) -> Result<String, askama::Error> {
match type_.as_type() {
Type::Optional { inner_type } => {
let unboxed = inner_type.as_ref();
Expand Down Expand Up @@ -341,7 +346,11 @@ pub mod filters {
}
}

pub fn rn_return_type(type_: &impl AsType, name: &str, optional: bool) -> Result<String, askama::Error> {
pub fn rn_return_type(
type_: &impl AsType,
name: &str,
optional: bool,
) -> Result<String, askama::Error> {
let mut optional_suffix = "";
if optional {
optional_suffix = "!";
Expand Down Expand Up @@ -398,7 +407,10 @@ pub mod filters {
}
}

pub fn extern_type_name(type_: &impl AsType, ci: &ComponentInterface) -> Result<String, askama::Error> {
pub fn extern_type_name(
type_: &impl AsType,
ci: &ComponentInterface,
) -> Result<String, askama::Error> {
match type_.as_type() {
Type::Boolean => Ok("BOOL".to_string()),
Type::Int8 | Type::Int16 | Type::Int32 | Type::Int64 => Ok("NSInteger*".to_string()),
Expand All @@ -424,7 +436,10 @@ pub mod filters {
}
}

pub fn inline_optional_field(type_: &impl AsType, ci: &ComponentInterface) -> Result<bool, askama::Error> {
pub fn inline_optional_field(
type_: &impl AsType,
ci: &ComponentInterface,
) -> Result<bool, askama::Error> {
match type_.as_type() {
Type::Optional { inner_type } => {
let unboxed = inner_type.as_ref();
Expand Down
6 changes: 5 additions & 1 deletion lib/bindings/langs/react-native/src/gen_swift/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

use super::CodeType;
use paste::paste;
use uniffi_bindgen::{backend::{Literal, Type}, interface::Radix};
use uniffi_bindgen::{
backend::{Literal, Type},
interface::Radix,
};

#[allow(dead_code)]
fn render_literal(literal: &Literal) -> String {
fn typed_number(type_: &Type, num_str: String) -> String {
match type_ {
Expand Down
16 changes: 8 additions & 8 deletions lib/bindings/langs/react-native/src/gen_typescript/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,30 +232,30 @@ pub mod filters {
let re = Regex::new(r"\[([a-zA-Z0-9_:]+)\]").unwrap();
let replacement = |caps: &Captures| -> Result<String, askama::Error> {
let split: Vec<&str> = caps[1].split("::").collect();
if let Some(enum_def) = ci.get_enum_definition(&split[0]) {
if let Some(enum_def) = ci.get_enum_definition(split[0]) {
let name = type_name(enum_def)?;
if split.len() == 2 {
let v_name = enum_variant(&split[1])?;
let v_name = enum_variant(split[1])?;
return Ok(format!("{{@link {}.{}}}", name, v_name));
}
return Ok(format!("{{@link {}}}", name));
} else if let Some(fn_def) = ci.get_function_definition(&split[0]) {
} else if let Some(fn_def) = ci.get_function_definition(split[0]) {
let name = fn_name(fn_def.name())?;
return Ok(format!("{{@link {}}}", name));
} else if let Some(obj_def) = ci.get_object_definition(&split[0]) {
} else if let Some(obj_def) = ci.get_object_definition(split[0]) {
let mut name = type_name(obj_def)?;
if split.len() == 2 {
name = fn_name(&split[1])?;
name = fn_name(split[1])?;
}
return Ok(format!("{{@link {}}}", name));
} else if let Some(rec_def) = ci.get_record_definition(&split[0]) {
} else if let Some(rec_def) = ci.get_record_definition(split[0]) {
let name = type_name(rec_def)?;
if split.len() == 2 {
let v_name = var_name(&split[1])?;
let v_name = var_name(split[1])?;
return Ok(format!("{{@link {}.{}}}", name, v_name));
}
return Ok(format!("{{@link {}}}", name));
} else if let Some(cb_def) = ci.get_callback_interface_definition(&split[0]) {
} else if let Some(cb_def) = ci.get_callback_interface_definition(split[0]) {
let name = type_name(cb_def)?;
return Ok(format!("{{@link {}}}", name));
}
Expand Down
14 changes: 7 additions & 7 deletions lib/bindings/langs/react-native/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use askama::Template;
use camino::Utf8Path;
use camino::Utf8PathBuf;
use serde::*;
use uniffi_bindgen::ComponentInterface;
use std::fs;
use std::fs::File;
use std::io::Write;
use std::process::Command;
use uniffi_bindgen::BindingsConfig;
use uniffi_bindgen::BindingGenerator;
use uniffi_bindgen::BindingsConfig;
use uniffi_bindgen::ComponentInterface;

use crate::gen_kotlin;
use crate::gen_swift;
Expand All @@ -30,7 +30,7 @@ impl ReactNativeBindingGenerator {
write!(f, "{}", bindings_output)?;
Ok(bindings_path)
}

fn write_kotlin_mapper_bindings(
&self,
ci: &ComponentInterface,
Expand Down Expand Up @@ -256,12 +256,12 @@ impl BindingGenerator for ReactNativeBindingGenerator {
self.write_kotlin_module_bindings(ci, config.clone(), out_dir)?;

// generate ios
self.write_swift_mapper_bindings(&ci, config.clone(), out_dir)?;
self.write_swift_extern_bindings(&ci, config.clone(), out_dir)?;
self.write_swift_module_bindings(&ci, config.clone(), out_dir)?;
self.write_swift_mapper_bindings(ci, config.clone(), out_dir)?;
self.write_swift_extern_bindings(ci, config.clone(), out_dir)?;
self.write_swift_module_bindings(ci, config.clone(), out_dir)?;

// generate typescript
self.write_typescript_bindings(&ci, config.clone(), out_dir)?;
self.write_typescript_bindings(ci, config.clone(), out_dir)?;
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion packages/dart/lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ class ReceivePaymentRequest {
/// Returned when calling [crate::sdk::LiquidSdk::receive_payment].
class ReceivePaymentResponse {
/// Either a BIP21 URI (Liquid or Bitcoin), a Liquid address
/// or an invoice, depending on the [PrepareReceivePaymentResponse] parameters
/// or an invoice, depending on the [PrepareReceiveResponse] parameters
final String destination;

const ReceivePaymentResponse({
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ packages:
path: "../../dart"
relative: true
source: path
version: "0.3.2"
version: "0.3.4"
build_cli_annotations:
dependency: transitive
description:
Expand Down Expand Up @@ -139,7 +139,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.3.2"
version: "0.3.4"
flutter_lints:
dependency: "direct dev"
description:
Expand Down

0 comments on commit 651e063

Please sign in to comment.