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 64314bd commit b0883a9
Show file tree
Hide file tree
Showing 10 changed files with 745 additions and 23 deletions.
117 changes: 117 additions & 0 deletions lib/bindings/langs/flutter/scripts/pubspec.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
args:
dependency: "direct main"
description:
name: args
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
url: "https://pub.dev"
source: hosted
version: "2.5.0"
async:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.11.0"
charcode:
dependency: transitive
description:
name: charcode
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
url: "https://pub.dev"
source: hosted
version: "1.3.1"
cli_script:
dependency: "direct main"
description:
name: cli_script
sha256: "3463c6e8e57271faaf557eee56cb455522f1ab1ebe618bbfb7454f74fc793967"
url: "https://pub.dev"
source: hosted
version: "0.3.1"
collection:
dependency: transitive
description:
name: collection
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
version: "1.19.0"
file:
dependency: transitive
description:
name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
glob:
dependency: "direct main"
description:
name: glob
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
meta:
dependency: transitive
description:
name: meta
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
url: "https://pub.dev"
source: hosted
version: "1.16.0"
path:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
source_span:
dependency: transitive
description:
name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
url: "https://pub.dev"
source: hosted
version: "1.12.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted
version: "1.2.1"
tuple:
dependency: transitive
description:
name: tuple
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
url: "https://pub.dev"
source: hosted
version: "2.0.2"
sdks:
dart: ">=3.4.0 <4.0.0"
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
Loading

0 comments on commit b0883a9

Please sign in to comment.