mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2025-12-17 06:34:21 +01:00
refactor: remove rust project
Removes rust directory containing the pubky library. Updates build scripts to include local and remote options. Updates README.md. Adds simple-git as a dev dependency.
This commit is contained in:
44
setup-local-android-bindings.js
Normal file
44
setup-local-android-bindings.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const fs = require('fs').promises;
|
||||
const path = require('path');
|
||||
|
||||
const ktPath = 'rust/bindings/android/pubkymobile.kt';
|
||||
const ktDestinationPath = 'android/src/main/java/uniffi/pubkymobile/';
|
||||
const jniPath = 'rust/bindings/android/jniLibs';
|
||||
const jniDestinationPath = 'android/src/main/jniLibs/';
|
||||
|
||||
async function runSetup() {
|
||||
try {
|
||||
console.log('Removing existing files...');
|
||||
// Remove destination directories if they exist
|
||||
await Promise.all([
|
||||
fs.rm(ktDestinationPath, { recursive: true, force: true }),
|
||||
fs.rm(jniDestinationPath, { recursive: true, force: true }),
|
||||
]);
|
||||
|
||||
console.log('Creating directories...');
|
||||
// Create destination directories if they don't exist
|
||||
await Promise.all([
|
||||
fs.mkdir(ktDestinationPath, { recursive: true }),
|
||||
fs.mkdir(jniDestinationPath, { recursive: true }),
|
||||
]);
|
||||
|
||||
console.log('Copying Kotlin file...');
|
||||
// Copy Kotlin file to destination
|
||||
const ktTargetPath = path.join(ktDestinationPath, 'pubkymobile.kt');
|
||||
await fs.copyFile(ktPath, ktTargetPath);
|
||||
|
||||
console.log('Copying JNI libraries...');
|
||||
// Copy JNI libraries directory
|
||||
await fs.cp(jniPath, jniDestinationPath, { recursive: true });
|
||||
|
||||
console.log('Android files copied successfully!');
|
||||
} catch (error) {
|
||||
console.error('Error during setup:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
runSetup().catch((error) => {
|
||||
console.error('Unhandled error:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user