• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dart-lang / ffigen / 5844146996

01 Aug 2023 11:10PM CUT coverage: 92.332%. Remained the same
5844146996

push

github

web-flow
Bump coverallsapp/github-action from 2.2.0 to 2.2.1 (#596)

Bumps [coverallsapp/github-action](https://github.com/coverallsapp/github-action) from 2.2.0 to 2.2.1.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/coverallsapp/github-action/commit/<a class=hub.com/dart-lang/ffigen/commit/95b1a2355bd0e526ad2fd62da9fd386ad4c98474">95b1a2355<a href="https://github.com/dart-lang/ffigen/commit/daa06036c457277aa7ddbf734123bf76ec921e44">&quot;&gt;&lt;code&gt;95b1a23&lt;/code&gt;&lt;/a&gt; feat: add files option (&lt;a href=&quot;https://redirect.github.com/coverallsapp/github-action/issues/185">#185</a>)</li>
<li><a href="https://github.com/coverallsapp/github-action/commit/<a class="double-link" href="https://github.com/dart-lang/ffigen/commit/12d23ccd512af6f292f5eaf42c191d64928b135c">12d23ccd5</a><a href="https://github.com/dart-lang/ffigen/commit/daa06036c457277aa7ddbf734123bf76ec921e44">&quot;&gt;&lt;code&gt;12d23cc&lt;/code&gt;&lt;/a&gt; feat: add fail-on-error option (&lt;a href=&quot;https://redirect.github.com/coverallsapp/github-action/issues/184&quot;&gt;#184&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/coverallsapp/github-action/commit/</a><a class="double-link" href="https://github.com/dart-lang/ffigen/commit/8e1cba00ac8bb526c6a1b96b810071687e5e8310">8e1cba00a</a><a href="https://github.com/dart-lang/ffigen/commit/daa06036c457277aa7ddbf734123bf76ec921e44">&quot;&gt;&lt;code&gt;8e1cba0&lt;/code&gt;&lt;/a&gt; feat: add measure option (&lt;a href=&quot;https://redirect.github.com/coverallsapp/github-action/issues/183&quot;&gt;#183&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/coverallsapp/github-action/commit/</a><a class="double-link" href="https://github.com/dart-lang/ffigen/commit/cb1c78cc8dd8522acce1a460c643e67515393ef6">cb1c78cc8</a><a href="https://github.com/dart-lang/ffigen/commit/daa06036c457277aa7ddbf734123bf76ec921e44">&quot;&gt;&lt;code&gt;cb1c78c&lt;/code&gt;&lt;/a&gt; docs: clarify coveralls repo permissions (&lt;a href=&quot;https://redirect.github.com/coverallsapp/github-action/issues/182&quot;&gt;#182&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/coverallsapp/github-action/commit/3b7440a0f"><code>3b7440a</code></a> Update README.md (<a href="https://redirect.github.com/coverallsapp/github-action/issues/181">#181</a>)</li>
<li>See full diff in <a href="https://github.com/coverallsapp/github-action/compare/c7885c00c...95b1a2355bd0e526ad2fd62da9fd386ad4c98474">compare view



[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=coverallsapp/github-action&package-manager=github_actions&previous-version=2.2.0&new-version=2.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabo... (continued)

3576 of 3873 relevant lines covered (92.33%)

28.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.43
/lib/src/strings.dart
1
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2
// for details. All rights reserved. Use of this source code is governed by a
3
// BSD-style license that can be found in the LICENSE file.
4
import 'dart:io';
5

6
import 'package:ffigen/src/code_generator.dart';
7
import 'package:ffigen/src/header_parser/clang_bindings/clang_bindings.dart'
8
    as clang;
9

10
/// Name of the dynamic library file according to current platform.
11
String get dylibFileName {
50✔
12
  String name;
13
  if (Platform.isLinux) {
50✔
14
    name = libclang_dylib_linux;
15
  } else if (Platform.isMacOS) {
50✔
16
    name = libclang_dylib_macos;
17
  } else if (Platform.isWindows) {
×
18
    name = libclang_dylib_windows;
19
  } else {
20
    throw Exception('Unsupported Platform.');
×
21
  }
22
  return name;
23
}
24

25
const llvmPath = 'llvm-path';
26

27
/// Name of the parent folder of dynamic library `lib` or `bin` (on windows).
28
String get dynamicLibParentName => Platform.isWindows ? 'bin' : 'lib';
×
29

30
const output = 'output';
31

32
// Sub-keys of output.
33
const bindings = "bindings";
34
const symbolFile = 'symbol-file';
35

36
const language = 'language';
37

38
// String mappings for the Language enum.
39
const langC = 'c';
40
const langObjC = 'objc';
41

42
// Clang command line args for Objective C.
43
const clangLangObjC = ['-x', 'objective-c'];
44
const clangObjCBoolDefine = '__OBJC_BOOL_IS_BOOL';
45
const clangInclude = '-include';
46

47
// Special objective C types.
48
const objcBOOL = 'BOOL';
49
const objcInstanceType = 'instancetype';
50

51
const headers = 'headers';
52

53
// Sub-fields of headers
54
const entryPoints = 'entry-points';
55
const includeDirectives = 'include-directives';
56

57
const compilerOpts = 'compiler-opts';
58

59
const compilerOptsAuto = 'compiler-opts-automatic';
60
// Sub-fields of compilerOptsAuto.
61
const macos = 'macos';
62
// Sub-fields of macos.
63
const includeCStdLib = 'include-c-standard-library';
64

65
// Declarations.
66
const functions = 'functions';
67
const structs = 'structs';
68
const unions = 'unions';
69
const enums = 'enums';
70
const unnamedEnums = 'unnamed-enums';
71
const globals = 'globals';
72
const macros = 'macros';
73
const typedefs = 'typedefs';
74
const objcInterfaces = 'objc-interfaces';
75

76
const excludeAllByDefault = 'exclude-all-by-default';
77

78
// Sub-fields of Declarations.
79
const include = 'include';
80
const exclude = 'exclude';
81
const rename = 'rename';
82
const memberRename = 'member-rename';
83
const symbolAddress = 'symbol-address';
84

85
// Nested under `functions`
86
const exposeFunctionTypedefs = 'expose-typedefs';
87
const leafFunctions = 'leaf';
88
const varArgFunctions = 'variadic-arguments';
89

90
// Nested under varArg entries
91
const postfix = "postfix";
92
const types = "types";
93

94
// Sub-fields of ObjC interfaces.
95
const objcModule = 'module';
96

97
const dependencyOnly = 'dependency-only';
98
// Values for `compoundDependencies`.
99
const fullCompoundDependencies = 'full';
100
const opaqueCompoundDependencies = 'opaque';
101

102
const structPack = 'pack';
103
const Map<Object, int?> packingValuesMap = {
104
  'none': null,
105
  1: 1,
106
  2: 2,
107
  4: 4,
108
  8: 8,
109
  16: 16,
110
};
111

112
// Sizemap values.
113
const SChar = 'char';
114
const UChar = 'unsigned char';
115
const Short = 'short';
116
const UShort = 'unsigned short';
117
const Int = 'int';
118
const UInt = 'unsigned int';
119
const Long = 'long';
120
const ULong = 'unsigned long';
121
const LongLong = 'long long';
122
const ULongLong = 'unsigned long long';
123
const Enum = 'enum';
124

125
// Used for validation and extraction of sizemap.
126
const sizemap_native_mapping = <String, int>{
127
  SChar: clang.CXTypeKind.CXType_SChar,
128
  UChar: clang.CXTypeKind.CXType_UChar,
129
  Short: clang.CXTypeKind.CXType_Short,
130
  UShort: clang.CXTypeKind.CXType_UShort,
131
  Int: clang.CXTypeKind.CXType_Int,
132
  UInt: clang.CXTypeKind.CXType_UInt,
133
  Long: clang.CXTypeKind.CXType_Long,
134
  ULong: clang.CXTypeKind.CXType_ULong,
135
  LongLong: clang.CXTypeKind.CXType_LongLong,
136
  ULongLong: clang.CXTypeKind.CXType_ULongLong,
137
  Enum: clang.CXTypeKind.CXType_Enum
138
};
139

140
// Library imports.
141
const libraryImports = 'library-imports';
142

143
// Sub Keys of symbol file.
144
const symbols = 'symbols';
145

146
// Symbol file yaml.
147
const formatVersion = "format_version";
148

149
/// Current symbol file format version.
150
///
151
/// This is generated when generating any symbol file. When importing any other
152
/// symbol file, this version is compared according to `semantic` versioning
153
/// to determine compatibility.
154
const symbolFileFormatVersion = "1.0.0";
155
const files = "files";
156
const usedConfig = "used-config";
157

158
const import = 'import';
159
const defaultSymbolFileImportPrefix = 'imp';
160

161
// Sub keys of import.
162
const symbolFilesImport = 'symbol-files';
163
// Sub-Sub keys of symbolFilesImport.
164
const importPath = 'import-path';
165

166
final predefinedLibraryImports = {
9✔
167
  ffiImport.name: ffiImport,
9✔
168
  ffiPkgImport.name: ffiPkgImport
9✔
169
};
170

171
const typeMap = 'type-map';
172

173
// Sub-fields for type-map.
174
const typeMapTypedefs = 'typedefs';
175
const typeMapStructs = 'structs';
176
const typeMapUnions = 'unions';
177
const typeMapNativeTypes = 'native-types';
178

179
// Sub-sub-keys for fields under typeMap.
180
const lib = 'lib';
181
const cType = 'c-type';
182
const dartType = 'dart-type';
183

184
const supportedNativeType_mappings = <String, SupportedNativeType>{
185
  'Void': SupportedNativeType.Void,
186
  'Uint8': SupportedNativeType.Uint8,
187
  'Uint16': SupportedNativeType.Uint16,
188
  'Uint32': SupportedNativeType.Uint32,
189
  'Uint64': SupportedNativeType.Uint64,
190
  'Int8': SupportedNativeType.Int8,
191
  'Int16': SupportedNativeType.Int16,
192
  'Int32': SupportedNativeType.Int32,
193
  'Int64': SupportedNativeType.Int64,
194
  'IntPtr': SupportedNativeType.IntPtr,
195
  'Float': SupportedNativeType.Float,
196
  'Double': SupportedNativeType.Double,
197
};
198

199
// Boolean flags.
200
const sort = 'sort';
201
const useSupportedTypedefs = 'use-supported-typedefs';
202
const useDartHandle = 'use-dart-handle';
203

204
const comments = 'comments';
205
// Sub-fields of comments.
206
const style = 'style';
207
const length = 'length';
208

209
// Sub-fields of style.
210
const doxygen = 'doxygen';
211
const any = 'any';
212
// Sub-fields of length.
213
const brief = 'brief';
214
const full = 'full';
215
// Cmd line comment option.
216
const fparseAllComments = '-fparse-all-comments';
217

218
// Library input.
219
const name = 'name';
220
const description = 'description';
221
const preamble = 'preamble';
222

223
// Dynamic library names.
224
const libclang_dylib_linux = 'libclang.so';
225
const libclang_dylib_macos = 'libclang.dylib';
226
const libclang_dylib_windows = 'libclang.dll';
227

228
// Dynamic library default locations.
229
const linuxDylibLocations = {
230
  '/usr/lib/llvm-9/lib/',
231
  '/usr/lib/llvm-10/lib/',
232
  '/usr/lib/llvm-11/lib/',
233
  '/usr/lib/llvm-12/lib/',
234
  '/usr/lib/llvm-13/lib/',
235
  '/usr/lib/llvm-14/lib/',
236
  '/usr/lib/llvm-15/lib/',
237
  '/usr/lib/',
238
  '/usr/lib64/',
239
};
240
const windowsDylibLocations = {
241
  r'C:\Program Files\LLVM\bin\',
242
};
243
const macOsDylibLocations = {
244
  // Default Xcode commandline tools installation.
245
  '/Library/Developer/CommandLineTools/usr/',
246
  // Default path for LLVM installed with apt-get.
247
  '/usr/local/opt/llvm/lib/',
248
  // Default path for LLVM installed with brew.
249
  '/opt/homebrew/opt/llvm/lib/',
250
  // Default Xcode installation.
251
  // Last because it does not include ObjectiveC headers by default.
252
  // See https://github.com/dart-lang/ffigen/pull/402#issuecomment-1154348670.
253
  '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/',
254
};
255
const xcodeDylibLocation = 'Toolchains/XcodeDefault.xctoolchain/usr/lib/';
256

257
// Writen doubles.
258
const doubleInfinity = 'double.infinity';
259
const doubleNegativeInfinity = 'double.negativeInfinity';
260
const doubleNaN = 'double.nan';
261

262
/// USR for struct `_Dart_Handle`.
263
const dartHandleUsr = 'c:@S@_Dart_Handle';
264

265
const ffiNative = 'ffi-native';
266
const ffiNativeAsset = 'asset';
267

268
Directory? _tmpDir;
269

270
/// A path to a unique temporary directory that should be used for files meant
271
/// to be discarded after the current execution is finished.
272
String get tmpDir {
26✔
273
  if (Platform.environment.containsKey('TEST_TMPDIR')) {
52✔
274
    return Platform.environment['TEST_TMPDIR']!;
×
275
  }
276

277
  _tmpDir ??= Directory.systemTemp.createTempSync();
52✔
278
  return _tmpDir!.path;
26✔
279
}
280

281
const ffigenJsonSchemaIndent = '  ';
282
const ffigenJsonSchemaId = "https://json.schemastore.org/ffigen";
283
const ffigenJsonSchemaFileName = "ffigen.schema.json";
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc