| // Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file | |
| // for details. All rights reserved. Use of this source code is governed by a | |
| // BSD-style license that can be found in the LICENSE file. | |
| import 'dart:io'; | |
| import 'package:ffigen/ffigen.dart'; | |
| Future<void> main() async { | |
| final packageRoot = Platform.script.resolve('../'); | |
| final generator = FfiGenerator( | |
| input: Input( | |
| entryPoints: [packageRoot.resolve('third_party/sqlite/sqlite3.h')], | |
| ), | |
| visitors: [ | |
| Visitor( | |
| func: (node) { | |
| node.isIncluded = node.name == 'sqlite3_libversion'; | |
| node.recordUse = true; | |
| }, | |
| ), | |
| ], | |
| output: Output( | |
| dart: DartOutput( | |
| path: packageRoot.resolve('lib/src/third_party/sqlite3.g.dart'), | |
| ), | |
| recordUseMapping: packageRoot.resolve( | |
| 'lib/src/third_party/record_use_mapping.dart', | |
| ), | |
| preamble: ''' | |
| // The author disclaims copyright to this source code. In place of | |
| // a legal notice, here is a blessing: | |
| // | |
| // May you do good and not evil. | |
| // May you find forgiveness for yourself and forgive others. | |
| // May you share freely, never taking more than you give. | |
| ''', | |
| ), | |
| ); | |
| await generator.generate(); | |
| } |