Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"tools/winrt-meta",
]
resolver = "2"
license = "MIT"

[profile.release]
opt-level = 3
Expand Down
3 changes: 3 additions & 0 deletions bench-electron/electron.vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
Expand Down
1 change: 1 addition & 0 deletions bench-electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "dynwinrt-bench-electron",
"version": "1.0.0",
"license": "MIT",
"description": "Electron benchmark for dynwinrt WinRT dynamic invocation",
"main": "./out/main/index.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions bench-electron/src/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { app, BrowserWindow, ipcMain } from 'electron'
import { join } from 'path'
import { createRequire } from 'module'
Expand Down
3 changes: 3 additions & 0 deletions bench-electron/src/preload/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

declare global {
interface Window {
api: {
Expand Down
3 changes: 3 additions & 0 deletions bench-electron/src/preload/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { contextBridge, ipcRenderer } from 'electron'

const api = {
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/__test__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import test from 'ava'

import {
Expand Down
3 changes: 2 additions & 1 deletion bindings/js/__test__/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"type": "module"
"type": "module",
"license": "MIT"
}
3 changes: 3 additions & 0 deletions bindings/js/benchmark/bench.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { Bench } from 'tinybench'

import { plus100 } from '../index.js'
Expand Down
3 changes: 2 additions & 1 deletion bindings/js/benchmark/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"type": "module"
"type": "module",
"license": "MIT"
}
3 changes: 3 additions & 0 deletions bindings/js/samples/array_struct.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/**
* Test: Array and Struct bindings for dynwinrt-js
*
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/samples/bench_3way.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/**
* 4-way benchmark: C++ static vs Rust raw N-API vs Rust napi-rs vs Dynamic
*
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/samples/benchmark.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/**
* Benchmark: JS → C++/WinRT static projection vs JS → dynwinrt (end-to-end)
*
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/samples/ocr.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/**
* OCR Demo: Pure dynamic WinRT calls using registerInterface + invoke.
* Requires WinAppSDK with AI features and package identity.
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/samples/picker.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import {
initWinappsdk,
DynWinRtValue,
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/samples/test_progress.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/**
* Test: IAsyncOperationWithProgress progress handler
* Uses InMemoryRandomAccessStream.WriteAsync → IAsyncOperationWithProgress<u32, u32>
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/samples/test_register_interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/**
* Test: registerInterface + addMethod + method/methodByName + invoke
* Uses Windows.Foundation.Uri (no WinAppSDK needed)
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#![deny(clippy::all)]
#![allow(clippy::missing_safety_doc)]

Expand Down
3 changes: 3 additions & 0 deletions bindings/js/static-bench-cpp/find_sdk.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// Finds the C++/WinRT include directory from the latest Windows SDK.
const fs = require('fs');
const path = require('path');
Expand Down
1 change: 1 addition & 0 deletions bindings/js/static-bench-cpp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "static-bench-cppwinrt",
"version": "1.0.0",
"private": true,
"license": "MIT",
"description": "C++/WinRT static projection benchmark addon (pure C++, no Rust)",
"scripts": {
"build": "node-gyp rebuild --release",
Expand Down
1 change: 1 addition & 0 deletions bindings/js/static-bench-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "static-bench-rust"
version = "0.1.0"
edition = "2021"
license = "MIT"

[lib]
crate-type = ["cdylib"]
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/static-bench-rust/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

fn main() {
// Link against node.lib so N-API symbols resolve at load time.
// node-gyp puts node.lib in the node-gyp cache; napi-build finds it.
Expand Down
3 changes: 3 additions & 0 deletions bindings/js/static-bench-rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! Raw N-API Rust static benchmark — minimal overhead, no napi-rs macros.
//! Matches the C++ static-bench-cpp addon 1:1.

Expand Down
3 changes: 3 additions & 0 deletions bindings/py/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use pyo3::prelude::*;

mod runtime;
Expand Down
3 changes: 3 additions & 0 deletions bindings/py/src/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use std::sync::Arc;

use dynwinrt;
Expand Down
3 changes: 3 additions & 0 deletions bindings/py/src/values.rs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// Value conversion utilities — currently handled inline in runtime.rs
3 changes: 3 additions & 0 deletions bindings/py/tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import dynwinrt_py
from dynwinrt_py import (
DynWinRTType,
Expand Down
3 changes: 3 additions & 0 deletions bindings/py/tests/test_runtime.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

import dynwinrt_py

def test_winrt_method():
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! Benchmarks: dynwinrt dynamic invocation vs windows-rs static projection.
//!
//! Groups:
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/build.rs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

fn main() {}
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/abi.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AbiType {
Bool,
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/array.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use core::ffi::c_void;
use windows_core::{IUnknown, Interface};

Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/call.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use core::ffi::c_void;
use libffi::middle::{Arg, arg};
use windows_core::{HRESULT, Interface};
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/com_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#![allow(unsafe_op_in_unsafe_fn)]
//! Shared COM boilerplate macros and helpers for dynamic WinRT collection implementations.
//!
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/dasync.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use std::future::{Future, IntoFuture};
use std::pin::Pin;
use std::sync::{Arc, Mutex};
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/delegate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! Dynamic WinRT delegate (callback) implementation.
//!
//! A delegate is a COM object with IUnknown + a single `Invoke` method.
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/interfaces.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use std::sync::Arc;
use crate::signature::{InterfaceSignature, MethodSignature};
use crate::metadata_table::MetadataTable;
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use windows::core::*;

mod abi;
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/map.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#![allow(unsafe_op_in_unsafe_fn)]
//! Dynamic WinRT IMap<K,V> / IMapView<K,V> / IKeyValuePair<K,V> / IIterable implementation.
//!
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/meta.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#[cfg(test)]
mod tests {
#[test]
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/metadata_table/arena.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use std::alloc::Layout;

use windows_core::GUID;
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/metadata_table/iid.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use windows_core::GUID;

use super::MetadataTable;
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/metadata_table/method_handle.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use std::sync::Arc;

use crate::value::WinRTValue;
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/metadata_table/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

mod type_kind;
mod type_handle;
mod value_data;
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/metadata_table/type_handle.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use std::alloc::Layout;
use std::sync::Arc;

Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/metadata_table/type_kind.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use windows_core::{GUID, Interface};

// ===========================================================================
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/metadata_table/value_data.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use core::ffi::c_void;
use windows_core::{IUnknown, Interface};

Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/result.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use crate::metadata_table::TypeKind;
use crate::abi::AbiType;

Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/roapi.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use windows::Win32::System::WinRT::{IActivationFactory, RoGetActivationFactory};
use windows::Win32::System::LibraryLoader::{LoadLibraryW, GetProcAddress};
use windows_core::{HSTRING, HRESULT, IUnknown, Interface, PCSTR};
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/signature.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use libffi::middle::Cif;
use std::sync::Arc;
use windows::core::{GUID, HSTRING, Interface};
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use libffi::middle::Arg;
use windows::Win32::System::WinRT::IActivationFactory;
use windows_core::{GUID, IUnknown, Interface};
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/vector.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#![allow(unsafe_op_in_unsafe_fn)]
//! Dynamic WinRT IVector<T> / IIterable<T> / IVectorView<T> / IIterator<T> implementation.
//!
Expand Down
3 changes: 3 additions & 0 deletions crates/dynwinrt/src/winapp.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use std::ffi::CString;

use windows::ApplicationModel::PackageVersion;
Expand Down
1 change: 1 addition & 0 deletions tests/sample/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"private": true,
"license": "MIT",
"dependencies": {
"dynwinrt-js": "file:./dynwinrt-js"
}
Expand Down
3 changes: 3 additions & 0 deletions tests/sample/test_picker.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/**
* End-to-end test using 100% winrt-meta generated bindings + dynwinrt-js.
* Tests: create picker, set properties, use IVector_String.append(), open dialog.
Expand Down
3 changes: 3 additions & 0 deletions tests/sample/test_uri.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

/**
* Basic test using Windows SDK only — no WinAppSDK needed.
* Run: ./winrt-meta.exe generate --namespace "Windows.Foundation" --class-name "Uri" --output ./generated-uri
Expand Down
3 changes: 3 additions & 0 deletions tests/test_simple_array.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// Simple test for PropertyValue.CreateInt32Array
// This is the SIMPLEST possible array API to test with

Expand Down
Loading
Loading