Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.39 #51

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open

1.39 #51

Changes from 1 commit
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
bf33f28
driver
octaltree Jul 30, 2022
3f9f201
api.json 1.25
octaltree Jul 30, 2022
04e3ea8
find commit
octaltree Jul 31, 2022
6613826
channels
octaltree Jul 31, 2022
e7e3066
protocol.yml
octaltree Jul 31, 2022
be65435
tmp
octaltree Jul 31, 2022
cdfd728
tmp
octaltree Jul 31, 2022
55ce61b
parse api.json
octaltree Aug 2, 2022
d1403bd
todo
octaltree Aug 2, 2022
b7c14a0
parse protocol.yml
octaltree Aug 2, 2022
bc47322
all_types
octaltree Aug 2, 2022
7dd0f9a
fix
octaltree Aug 2, 2022
f816f42
collect_unnamed
octaltree Aug 3, 2022
688b805
tmp
octaltree Aug 3, 2022
9785288
tmp
octaltree Aug 3, 2022
3110961
tmp
octaltree Aug 7, 2022
9815a9b
fix
octaltree Aug 7, 2022
191a83f
tmp
octaltree Aug 7, 2022
235e21c
tmp
octaltree Aug 8, 2022
6d37aee
tmp
octaltree Aug 10, 2022
7deba2f
tmp
octaltree Aug 11, 2022
c0dc4b1
generate_protocol
octaltree Aug 13, 2022
f94daf8
fix
octaltree Aug 13, 2022
c567bb2
add generated protocol
octaltree Aug 13, 2022
30d661d
borrow
octaltree Aug 14, 2022
821b239
handle messages before shutdown
octaltree Aug 14, 2022
cb3f67d
initializer based on protocol
octaltree Aug 14, 2022
2a925fb
initialization success
octaltree Aug 14, 2022
ac86372
tmp
octaltree Aug 15, 2022
13aa2ea
tmp
octaltree Aug 20, 2022
4a72d5a
Added `commit` Document state
Aug 19, 2022
e7a8ada
Using LifecycleEvent
Aug 19, 2022
a81c7a1
Using LifecycleEvent
Aug 20, 2022
8088b0d
playwright can return response without any `params` which would break…
Aug 21, 2022
82c59b9
Fixed Page Events not detected correctly
Aug 23, 2022
7768d0b
Merge pull request #35 from tmahmood/dev
octaltree Aug 25, 2022
3960388
tmp
octaltree Aug 28, 2022
48b9788
Update utils.rs
tmahmood Aug 31, 2022
e934041
Added mime_type to File structure.
Sep 3, 2022
c7210d8
Large file upload api is now implemented. It does not replace the exi…
Sep 5, 2022
a4c4073
Fixed issue with not being able to spawn multiple playwright instances.
Sep 11, 2022
153494f
Fixed issue with not being able to spawn multiple playwright instances.
Sep 11, 2022
305f7ae
driver
octaltree Jul 30, 2022
1a965d0
api.json 1.25
octaltree Jul 30, 2022
bd65ec4
find commit
octaltree Jul 31, 2022
9dec59f
channels
octaltree Jul 31, 2022
46ee2de
protocol.yml
octaltree Jul 31, 2022
369c2ec
tmp
octaltree Jul 31, 2022
e592202
tmp
octaltree Jul 31, 2022
f4c7e6c
parse api.json
octaltree Aug 2, 2022
38de16d
todo
octaltree Aug 2, 2022
87ef5e1
parse protocol.yml
octaltree Aug 2, 2022
d0bca33
all_types
octaltree Aug 2, 2022
92b4335
fix
octaltree Aug 2, 2022
5f73be5
collect_unnamed
octaltree Aug 3, 2022
6204604
tmp
octaltree Aug 3, 2022
89027b7
tmp
octaltree Aug 3, 2022
13a91cd
tmp
octaltree Aug 7, 2022
587ea2d
fix
octaltree Aug 7, 2022
706783e
tmp
octaltree Aug 7, 2022
7a3aa88
tmp
octaltree Aug 8, 2022
fdf760a
tmp
octaltree Aug 10, 2022
0047014
tmp
octaltree Aug 11, 2022
c6eb34b
generate_protocol
octaltree Aug 13, 2022
5fb7a5d
fix
octaltree Aug 13, 2022
695f43b
add generated protocol
octaltree Aug 13, 2022
107a1d5
borrow
octaltree Aug 14, 2022
2fd9c36
handle messages before shutdown
octaltree Aug 14, 2022
a4161b8
initializer based on protocol
octaltree Aug 14, 2022
213ed4f
initialization success
octaltree Aug 14, 2022
42c9a9b
tmp
octaltree Aug 15, 2022
ecc6b09
tmp
octaltree Aug 20, 2022
a349ef1
Added `commit` Document state
Aug 19, 2022
89b429b
Using LifecycleEvent
Aug 19, 2022
aa9e8a5
Using LifecycleEvent
Aug 20, 2022
116d9a2
playwright can return response without any `params` which would break…
Aug 21, 2022
9bbef7c
Fixed Page Events not detected correctly
Aug 23, 2022
24a49c9
tmp
octaltree Aug 28, 2022
b4d1d29
tmp
octaltree Sep 4, 2022
39176ae
tmp
octaltree Sep 11, 2022
8e45f86
tmp
octaltree Sep 18, 2022
31cd955
model
octaltree Sep 19, 2022
0ca7aac
builder
octaltree Sep 24, 2022
2d2073e
builder
octaltree Sep 24, 2022
7285f5a
impl builder
octaltree Sep 25, 2022
9e97665
Merge branch '1.25' into dev
Oct 14, 2022
cdeabd2
Updated ConsoleMessage Structure to match with latest playwright version
tmahmood Apr 19, 2023
cde0f1c
Incorporated Randall's Windows Related Changes
tmahmood Apr 19, 2023
8e5e8d6
Update playwright version to: 1.31.0-alpha-feb-1-2023
Oct 14, 2022
d4cd5ea
Fixed: When using `persistent_context_launcher` `set_input_file_paths…
tmahmood Mar 14, 2023
27e1401
Incorporated Randall's Windows bug fix
tmahmood Apr 8, 2023
03d2970
Updated ConsoleMessage Structure to match with latest playwright version
tmahmood Apr 18, 2023
836ddbc
Updated connection.rs to fix parking_lot related issue
tmahmood Apr 19, 2023
9425bc3
Update github action, using nightly
tmahmood May 1, 2023
c7e8ee8
Removed a println!
tmahmood May 12, 2023
c82b2c0
Prepare 1.39 upgrade ; fix base64 deprecation error ; rustfmt
SamuelMarks Oct 30, 2023
a73c5b9
Run scripts make and fix rustfmt issues in generate_api.rs
SamuelMarks Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tmp
octaltree committed Sep 19, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 8e45f86c3b1835b76d7fbc20b905fcbfea1debc8
79 changes: 58 additions & 21 deletions scripts/src/api/types.rs
Original file line number Diff line number Diff line change
@@ -8,27 +8,34 @@ use std::{
};

#[derive(Debug, Clone, PartialEq, Eq)]
enum Model {
pub enum Model {
Struct {
name: String,
orig: Type,
fields: Vec<(String, Rc<Model>)>
fields: Vec<(String, Rc<Model>)>,
/// memoization
has_reference: bool
},
Enum {
name: String,
orig: Type,
variants: Vec<Variant>
variants: Vec<Variant>,
has_reference: bool
},
Option(Rc<Model>),
Vec(Rc<Model>),
Map(Rc<Model>, Rc<Model>)
Map(Rc<Model>, Rc<Model>),
Known {
name: &'static str,
reference: bool
}
}

#[derive(Debug, Clone, PartialEq, Eq)]
struct Variant {
label: String,
orig: String,
data: Option<Rc<Model>>
pub struct Variant {
pub label: String,
pub orig: String,
pub data: Option<Rc<Model>>
}

impl Model {
@@ -39,12 +46,17 @@ impl Model {
_ => None
}
}
}

struct QueueFrame<'a> {
scope: Vec<&'a str>,
ty: &'a Type,
borrow: bool
fn has_reference(&self) -> bool {
match self {
Model::Struct { has_reference, .. } => *has_reference,
Model::Enum { has_reference, .. } => *has_reference,
Model::Option(x) => x.has_reference(),
Model::Vec(x) => x.has_reference(),
Model::Map(k, v) => k.has_reference() || v.has_reference(),
Model::Known { name, reference } => *reference
}
}
}

pub fn is_action_csharp(a: &Arg) -> bool {
@@ -56,7 +68,7 @@ pub fn is_action_csharp(a: &Arg) -> bool {
a.name == "action" && for_csharp
}

fn collect_types(x: &Interface) -> Vec<Rc<Model>> {
pub fn collect_types(x: &Interface) -> Vec<Rc<Model>> {
let mut top = Vec::new();
for member in &x.members {
for arg in &member.args {
@@ -89,6 +101,7 @@ fn collect_types(x: &Interface) -> Vec<Rc<Model>> {
que.push_back(k.clone());
que.push_back(x.clone());
}
Model::Known { name, reference } => {}
}
}
all.into_iter()
@@ -104,20 +117,24 @@ fn collect_types(x: &Interface) -> Vec<Rc<Model>> {
Model::Struct {
name: _,
orig,
fields
fields,
has_reference
} => Rc::new(Model::Struct {
name: orig.name.to_string(),
orig: orig.clone(),
fields: fields.clone()
fields: fields.clone(),
has_reference: *has_reference
}),
Model::Enum {
name: _,
orig,
variants
variants,
has_reference
} => Rc::new(Model::Enum {
name: orig.name.to_string(),
orig: orig.clone(),
variants: variants.clone()
variants: variants.clone(),
has_reference: *has_reference
}),
_ => unreachable!()
}
@@ -129,9 +146,29 @@ fn collect_types(x: &Interface) -> Vec<Rc<Model>> {
fn declare_ty<'a>(scope: Vec<&'a str>, ty: &'a Type, allow_borrow: bool) -> Rc<Model> {
if ty.union.is_empty() {
match (ty.properties.is_empty(), ty.templates.is_empty()) {
(true, true) => {
todo! {}
}
(true, true) => Rc::new(match &*ty.name {
"binary" => Model::Array {
data: Rc::new(Model::Struct {
name: "u8".to_string(),
has_reference: false,
orig: todo!(),
fields: vec![]
}),
reference: allow_borrow
},
"number" => quote!(serde_json::Number),
"float" => quote!(f64),
"json" if allow_borrow => quote!(&'a str),
"json" => quote!(String),
"string" if allow_borrow => quote!(&'a str),
"string" => quote!(String),
"boolean" => quote!(bool),
"void" => quote!(()),
x => {
let ident = format_ident!("{}", utils::loud_to_camel(x));
quote!(#ident)
}
}),
(false, true) => {
let name = scope
.iter()
84 changes: 81 additions & 3 deletions scripts/src/generate_api.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use case::CaseExt;
use proc_macro2::{Ident, TokenStream};
use quote::{format_ident, quote, ToTokens, TokenStreamExt};
use scripts::{api::*, utils};
use scripts::{
api::{types::Model, *},
utils
};
use std::collections::{HashMap, VecDeque};

fn main() {
@@ -56,15 +59,90 @@ fn body(x: &Interface) -> TokenStream {
event_tokens(xs)
}
};
let sub = collect_types(x);
let sub = types::collect_types(x);
let sub = sub.into_iter().map(|m| format_ty(&*m));
quote! {
mod #mod_name {
#extends
impl #name {
#(#methods)*
}
#events
#sub
#(#sub)*
}
}
}

fn format_ty(x: &types::Model) -> TokenStream {
match x {
Model::Struct { name, orig, fields } => {
let n = format_ident!("{}", name);
let fields = fields.iter().map(|(k, v)| {
let n = format_ident!("{}", k);
let v = format_use_ty(v);
quote! {
#n: #v
}
});
quote! {
struct #n {
#(#fields),*
}
}
}
Model::Enum {
name,
orig,
variants
} => {
let n = format_ident!("{}", name);
let variants = variants.iter().map(|variant| {
let n = format_ident!("{}", variant.label);
if let Some(x) = &variant.data {
let v = format_use_ty(x);
quote! {
#n (v)
}
} else {
quote! {
#n
}
}
});
quote! {
enum #n {
#(#variants),*
}
}
}
_ => {
quote! {}
}
}
}

fn format_use_ty(x: &types::Model) -> TokenStream {
match x {
Model::Struct { name, .. } => {
let n = format_ident!("{}", name);
quote!(#n)
}
Model::Enum { name, .. } => {
let n = format_ident!("{}", name);
quote!(#n)
}
Model::Option(y) => {
let y = format_use_ty(y);
quote!(Option<#y>)
}
Model::Vec(y) => {
let y = format_use_ty(y);
quote!(Vec<#y>)
}
Model::Map(y, z) => {
let y = format_use_ty(y);
let z = format_use_ty(z);
quote!(HashMap<#y, #z>)
}
}
}