mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-26 15:26:17 +00:00
Logseq-like outliner (render/edit Markdown per block, Enter/Tab/Shift-Tab, backspace merge, arrow navigation, drag to reorder, collapse, [[ # (( autocomplete, TODO/DONE), journals feed with prev/next links, page view with linked references and related panel, virtualised CustomPainter timeline, Ctrl+K quick switcher, sidebar with recents, light/dark theme with bundled Inter, Noto Serif and Source Code Pro. Edits are optimistic and serialised to the core through one write queue. Cargokit builds synapse-ffi; its build tool is patched to use the library name (synapse_ffi) of hyphenated crates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
2.4 KiB
Dart
75 lines
2.4 KiB
Dart
/// This is copied from Cargokit (which is the official way to use it currently)
|
|
/// Details: https://fzyzcjy.github.io/flutter_rust_bridge/manual/integrate/builtin
|
|
|
|
import 'dart:io';
|
|
|
|
extension on String {
|
|
String resolveSymlink() => File(this).resolveSymbolicLinksSync();
|
|
}
|
|
|
|
class Environment {
|
|
/// Current build configuration (debug or release).
|
|
static String get configuration =>
|
|
_getEnv("CARGOKIT_CONFIGURATION").toLowerCase();
|
|
|
|
static bool get isDebug => configuration == 'debug';
|
|
static bool get isRelease => configuration == 'release';
|
|
|
|
/// Temporary directory where Rust build artifacts are placed.
|
|
static String get targetTempDir => _getEnv("CARGOKIT_TARGET_TEMP_DIR");
|
|
|
|
/// Final output directory where the build artifacts are placed.
|
|
static String get outputDir => _getEnvPath('CARGOKIT_OUTPUT_DIR');
|
|
|
|
/// Path to the crate manifest (containing Cargo.toml).
|
|
static String get manifestDir => _getEnvPath('CARGOKIT_MANIFEST_DIR');
|
|
|
|
/// Directory inside root project. Not necessarily root folder. Symlinks are
|
|
/// not resolved on purpose.
|
|
static String get rootProjectDir => _getEnv('CARGOKIT_ROOT_PROJECT_DIR');
|
|
|
|
// Pod
|
|
|
|
/// Platform name (macosx, iphoneos, iphonesimulator).
|
|
static String get darwinPlatformName =>
|
|
_getEnv("CARGOKIT_DARWIN_PLATFORM_NAME");
|
|
|
|
/// List of architectures to build for (arm64, armv7, x86_64).
|
|
static List<String> get darwinArchs =>
|
|
_getEnv("CARGOKIT_DARWIN_ARCHS").split(' ');
|
|
|
|
// Gradle
|
|
static String get minSdkVersion => _getEnv("CARGOKIT_MIN_SDK_VERSION");
|
|
static String get ndkVersion => _getEnv("CARGOKIT_NDK_VERSION");
|
|
static String get sdkPath => _getEnvPath("CARGOKIT_SDK_DIR");
|
|
static String get javaHome => _getEnvPath("CARGOKIT_JAVA_HOME");
|
|
static List<String> get targetPlatforms =>
|
|
_getEnv("CARGOKIT_TARGET_PLATFORMS").split(',');
|
|
|
|
static String? get ohosSdkHome => _getEnvOptional("CARGOKIT_OHOS_SDK_HOME");
|
|
|
|
// CMAKE
|
|
static String get targetPlatform => _getEnv("CARGOKIT_TARGET_PLATFORM");
|
|
|
|
static String _getEnv(String key) {
|
|
final res = Platform.environment[key];
|
|
if (res == null) {
|
|
throw Exception("Missing environment variable $key");
|
|
}
|
|
return res;
|
|
}
|
|
|
|
static String _getEnvPath(String key) {
|
|
final res = _getEnv(key);
|
|
if (Directory(res).existsSync()) {
|
|
return res.resolveSymlink();
|
|
} else {
|
|
return res;
|
|
}
|
|
}
|
|
|
|
static String? _getEnvOptional(String key) {
|
|
return Platform.environment[key];
|
|
}
|
|
}
|