Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

feat(noosphere): Introduce noosphere crate #123

Merged
merged 3 commits into from
Nov 3, 2022
Merged

Conversation

cdata
Copy link
Collaborator

@cdata cdata commented Nov 2, 2022

The noosphere crate is the highest level entrypoint into Noosphere APIs that we offer. It re-exports the functionality of most of our other crates, and offers FFI interfaces for C and JS/WASM consumers.

In addition to the noosphere crate, this change introduces some major improvements to our Github Actions workflows. Workflows now let you build associated artifacts on demand, and are also assembled into a larger release orchestration.

NOTE: The noosphere crate is currently barebones because we just needed to get it to a point where we could compile it for different Apple targets and expose a trivial FFI. The focus of this change is on establishing our automation workflow for these kinds of artifacts.

The `noosphere` crate is the highest level entrypoint into Noosphere
APIs that we offer. It re-exports the functionality of most of our other
crates, and offers FFI interfaces for C and JS/WASM consumers.

In addition to the `noosphere` crate, this change introduces some major
improvements to our Github Actions workflows. Workflows now let you
build associated artifacts on demand, and are also assembled into a
larger release orchestration.
jsantell
jsantell previously approved these changes Nov 3, 2022
Copy link
Contributor

@jsantell jsantell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start on the FFI work!

#[ffi_export]
pub fn noosphere_set_global_storage_path(path: char_p::Ref<'_>) {
unsafe {
GLOBAL_STORAGE_PATH = Some(path.to_string());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet relevant for the scope of the FFI interface, but are rust's mutable statics thread safe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not on their own, you need to use a Mutex or something with effectively the same guarantees.

// noosphere_

// #[no_mangle]
// pub unsafe extern "C" fn create_key()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra comments

},
Offline,
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 excited to see where this interface goes

@@ -2,3 +2,4 @@ target
optimized_wasm
dist
.DS_Store
noosphere.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't mind vendoring the header file once a ffi helper (safer-ffi, cbindgen, uniffi) if at least to link to the C API

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make it trivial to generate it locally. I'm not opposed to checking it in, but it really should never be modified by hand.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

module Noosphere {
header "noosphere.h"
export *
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for swift? How is this used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is for XCode packaging ceremony. It is required for... reasons I don't fully understand, TBH. You need it to exist at the .xcframework generation step.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants