Skip to content

fix: generate metadata per arch #4

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

Merged
merged 6 commits into from
Dec 3, 2024
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
10 changes: 10 additions & 0 deletions examples/appkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

import "@nativescript/macos-node-api";

console.log(
"NSTextAlignment.Center:",
NSTextAlignment.Center,
"arch:",
Deno.build.arch,
);

/**
* @implements {NSApplicationDelegate}
*/
Expand Down Expand Up @@ -36,6 +43,9 @@ export class Window extends NSWindow {
NativeClass(this);
}

/**
* @override
*/
init() {
const menu = NSMenu.new();
NSApp.mainMenu = menu;
Expand Down
3 changes: 3 additions & 0 deletions examples/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class MyClass extends NSObject {
NativeClass(this);
}

/**
* @override
*/
init() {
super.init();
console.log("MyClass.init()", this);
Expand Down
3 changes: 3 additions & 0 deletions examples/gamecontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class Observer extends NSObject {
NativeClass(this);
}

/**
* @override
*/
init() {
super.init();
NSNotificationCenter.defaultCenter.addObserverSelectorNameObject(
Expand Down
Binary file added metadata/metadata.ios.arm64.nsmd
Binary file not shown.
Binary file removed metadata/metadata.ios.nsmd
Binary file not shown.
Binary file added metadata/metadata.ios.x86_64.nsmd
Binary file not shown.
Binary file added metadata/metadata.macos.arm64.nsmd
Binary file not shown.
Binary file removed metadata/metadata.macos.nsmd
Binary file not shown.
Binary file added metadata/metadata.macos.x86_64.nsmd
Binary file not shown.
Binary file removed metadata/metadata.nsmd
Binary file not shown.
2 changes: 1 addition & 1 deletion metadata/src/MetadataWriter/TypeSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ MDTypeInfo *MDMetadataWriter::getTypeInfo(TypeSpec &type) {
} else {
info->structOffset = MD_SECTION_OFFSET_NULL;
std::cout << "Unknown record: " << type.recordName << std::endl;
assert(false && "Unknown record: not found in structs or unions");
// assert(false && "Unknown record: not found in structs or unions");
}
break;

Expand Down
8 changes: 4 additions & 4 deletions metadata/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
#include <clang-c/Index.h>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

Expand Down Expand Up @@ -84,6 +80,10 @@ int main(int argc, char **argv) {
outputFile = arg.substr(7);
} else if (arg.find("types=") == 0) {
outputTypesDir = arg.substr(6);
} else if (arg.find("arch=") == 0) {
std::string arch = arg.substr(5);
args.emplace_back("-arch");
args.emplace_back(arch);
} else {
std::cout << "Unknown argument: " << arg << std::endl;
std::exit(1);
Expand Down
132 changes: 67 additions & 65 deletions packages/ios/types/AVFAudio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ declare const AVAudio3DMixingSourceMode: {
AmbienceBed: 3,
};

declare const AVAudioSessionCategoryOptions: {
MixWithOthers: 1,
DuckOthers: 2,
AllowBluetooth: 4,
DefaultToSpeaker: 8,
InterruptSpokenAudioAndMixWithOthers: 17,
AllowBluetoothA2DP: 32,
AllowAirPlay: 64,
OverrideMutedMicrophoneInterruption: 128,
declare const AVAudio3DMixingRenderingAlgorithm: {
EqualPowerPanning: 0,
SphericalHead: 1,
HRTF: 2,
SoundField: 3,
StereoPassThrough: 5,
HRTFHQ: 6,
Auto: 7,
};

declare const AVAudioEnvironmentOutputType: {
Expand All @@ -26,14 +25,15 @@ declare const AVAudioEnvironmentOutputType: {
ExternalSpeakers: 3,
};

declare const AVAudio3DMixingRenderingAlgorithm: {
EqualPowerPanning: 0,
SphericalHead: 1,
HRTF: 2,
SoundField: 3,
StereoPassThrough: 5,
HRTFHQ: 6,
Auto: 7,
declare const AVAudioSessionCategoryOptions: {
MixWithOthers: 1,
DuckOthers: 2,
AllowBluetooth: 4,
DefaultToSpeaker: 8,
InterruptSpokenAudioAndMixWithOthers: 17,
AllowBluetoothA2DP: 32,
AllowAirPlay: 64,
OverrideMutedMicrophoneInterruption: 128,
};

declare const AVAudioSessionPortOverride: {
Expand Down Expand Up @@ -601,36 +601,6 @@ declare class AVAudioChannelLayout extends NSObject implements NSSecureCoding {
initWithCoder(coder: NSCoder): this;
}

declare class AVAudioNode extends NSObject {
reset(): void;

inputFormatForBus(bus: number): AVAudioFormat;

outputFormatForBus(bus: number): AVAudioFormat;

nameForInputBus(bus: number): string;

nameForOutputBus(bus: number): string;

installTapOnBusBufferSizeFormatBlock(bus: number, bufferSize: number, format: AVAudioFormat | null, tapBlock: (p1: AVAudioPCMBuffer, p2: AVAudioTime) => void): void;

removeTapOnBus(bus: number): void;

readonly engine: AVAudioEngine;

readonly numberOfInputs: number;

readonly numberOfOutputs: number;

readonly lastRenderTime: AVAudioTime;

readonly AUAudioUnit: AUAudioUnit;

readonly latency: number;

readonly outputPresentationLatency: number;
}

declare class AVAudioEngine extends NSObject {
init(): this;

Expand Down Expand Up @@ -762,24 +732,6 @@ declare class AVAudioFormat extends NSObject implements NSSecureCoding {
initWithCoder(coder: NSCoder): this;
}

declare class AVAudioSessionDataSourceDescription extends NSObject {
readonly dataSourceID: NSNumber;

readonly dataSourceName: string;

readonly location: string;

readonly orientation: string;

readonly supportedPolarPatterns: NSArray;

readonly selectedPolarPattern: string;

readonly preferredPolarPattern: string;

setPreferredPolarPatternError(pattern: string | null, outError: interop.PointerConvertible): boolean;
}

declare class AVAudioEnvironmentNode extends AVAudioNode implements AVAudioMixing {
init(): this;

Expand All @@ -801,6 +753,8 @@ declare class AVAudioEnvironmentNode extends AVAudioNode implements AVAudioMixin

readonly applicableRenderingAlgorithms: NSArray;

isListenerHeadTrackingEnabled: boolean;

destinationForMixerBus(mixer: AVAudioNode, bus: number): AVAudioMixingDestination;

volume: number;
Expand Down Expand Up @@ -864,6 +818,54 @@ declare class AVAudioEnvironmentNode extends AVAudioNode implements AVAudioMixin
position: AVAudio3DPoint;
}

declare class AVAudioNode extends NSObject {
reset(): void;

inputFormatForBus(bus: number): AVAudioFormat;

outputFormatForBus(bus: number): AVAudioFormat;

nameForInputBus(bus: number): string;

nameForOutputBus(bus: number): string;

installTapOnBusBufferSizeFormatBlock(bus: number, bufferSize: number, format: AVAudioFormat | null, tapBlock: (p1: AVAudioPCMBuffer, p2: AVAudioTime) => void): void;

removeTapOnBus(bus: number): void;

readonly engine: AVAudioEngine;

readonly numberOfInputs: number;

readonly numberOfOutputs: number;

readonly lastRenderTime: AVAudioTime;

readonly AUAudioUnit: AUAudioUnit;

readonly latency: number;

readonly outputPresentationLatency: number;
}

declare class AVAudioSessionDataSourceDescription extends NSObject {
readonly dataSourceID: NSNumber;

readonly dataSourceName: string;

readonly location: string;

readonly orientation: string;

readonly supportedPolarPatterns: NSArray;

readonly selectedPolarPattern: string;

readonly preferredPolarPattern: string;

setPreferredPolarPatternError(pattern: string | null, outError: interop.PointerConvertible): boolean;
}

declare class AVAudioSessionPortDescription extends NSObject {
readonly portType: string;

Expand Down
Loading