-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add AppScope support, switch to commonjs #13
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,5 @@ | ||
| extern crate napi_build; | ||
|
|
||
| use std::env; | ||
|
|
||
| fn main() { | ||
| napi_build::setup(); | ||
|
|
||
| // 仅当显式开启时才在 Linux GNU 的 arm64/armv7 目标上链接 libbsd,避免交叉工具链找不到 -lbsd | ||
| // 通过设置环境变量 LINK_LIBBSD=1 开启 | ||
| if env::var("LINK_LIBBSD").map(|v| v == "1").unwrap_or(false) { | ||
| let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); | ||
| let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default(); | ||
| let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); | ||
|
|
||
| if target_os == "linux" && target_env == "gnu" && (target_arch == "aarch64" || target_arch == "arm") { | ||
| println!("cargo:rustc-link-lib=bsd"); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "app": { | ||
| "bundleName": "cc.naily.demo1", | ||
| "vendor": "example", | ||
| "versionCode": 1000000, | ||
| "versionName": "1.0.0", | ||
| "icon": "$media:layered_image", | ||
| "label": "$string:app_name" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "string": [ | ||
| { | ||
| "name": "app_name", | ||
| "value": "YesPlayNext" | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "layered-image": | ||
| { | ||
| "background" : "$media:background", | ||
| "foreground" : "$media:foreground" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "app": { | ||
| "bundleName": "cc.naily.demo2", | ||
| "vendor": "example", | ||
| "versionCode": 1000000, | ||
| "versionName": "1.0.0", | ||
| "icon": "$media:layered_image", | ||
| "label": "$string:app_name" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "string": [ | ||
| { | ||
| "name": "app_name", | ||
| "value": "YesPlayNext" | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "layered-image": | ||
| { | ||
| "background" : "$media:background", | ||
| "foreground" : "$media:foreground" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,26 @@ | ||||||
| import type { Uri } from '../../index' | ||||||
| import type { Project } from './project' | ||||||
| import type { ProjectDetector } from './project-detector' | ||||||
| import { signal } from 'alien-signals' | ||||||
| import { AppScope as RustAppScope } from '../../index' | ||||||
| import { DisposableSignal } from './types' | ||||||
|
|
||||||
| export interface AppScope extends RustAppScope {} | ||||||
|
|
||||||
| export namespace AppScope { | ||||||
| export function from(project: Project): DisposableSignal<AppScope | null> { | ||||||
| const appScope = signal<AppScope | null>(RustAppScope.from(project.getUnderlyingProject())) | ||||||
|
|
||||||
| const handle = (_event: keyof ProjectDetector.EventMap, uri: Uri) => { | ||||||
| if (project.getBuildProfileUri().isEqual(uri) || project.getUri().isEqual(uri)) { | ||||||
| appScope(RustAppScope.from(project.getUnderlyingProject())) | ||||||
| } | ||||||
| else if (uri.fsPath.endsWith('app.json5')) { | ||||||
|
||||||
| else if (uri.fsPath.endsWith('app.json5')) { | |
| else if (uri.isEqual(project.getAppJson5Uri())) { |
Uh oh!
There was an error while loading. Please reload this page.