Skip to content

Commit

Permalink
transition to GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
jayudey-wf committed Oct 27, 2023
1 parent 30f3395 commit 8b520dd
Show file tree
Hide file tree
Showing 14 changed files with 290 additions and 101 deletions.
106 changes: 92 additions & 14 deletions .dart_tool/package_config.json
Original file line number Diff line number Diff line change
@@ -1,92 +1,170 @@
{
"configVersion": 2,
"packages": [
{
"name": "args",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/args-2.4.1",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "async",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/async-2.11.0",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/async-2.11.0",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "boolean_selector",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.1",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.1",
"packageUri": "lib/",
"languageVersion": "2.17"
},
{
"name": "build_config",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/build_config-1.1.1",
"packageUri": "lib/",
"languageVersion": "2.14"
},
{
"name": "checked_yaml",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/checked_yaml-2.0.2",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "collection",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/collection-1.17.2",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/collection-1.18.0",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "dependency_validator",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/dependency_validator-3.2.3",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "file",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/file-6.1.4",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "glob",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/glob-2.1.1",
"packageUri": "lib/",
"languageVersion": "2.15"
},
{
"name": "io",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/io-1.0.4",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "json_annotation",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/json_annotation-4.8.0",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "logging",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/logging-1.1.1",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "matcher",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.16",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.16",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "meta",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/meta-1.9.1",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/meta-1.11.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "package_config",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/package_config-2.1.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "path",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/path-1.8.3",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/path-1.8.3",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "pub_semver",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/pub_semver-2.1.4",
"packageUri": "lib/",
"languageVersion": "2.17"
},
{
"name": "pubspec_parse",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/pubspec_parse-1.2.3",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "quiver",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/quiver-3.2.1",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/quiver-3.2.1",
"packageUri": "lib/",
"languageVersion": "2.17"
},
{
"name": "source_span",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/source_span-1.10.0",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/source_span-1.10.0",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "stack_trace",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.11.0",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.11.1",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "stream_channel",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.1",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.1",
"packageUri": "lib/",
"languageVersion": "2.14"
},
{
"name": "string_scanner",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.2.0",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.2.0",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "term_glyph",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.1",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.1",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "test_api",
"rootUri": "file:///Users/pauldanner/.pub-cache/hosted/pub.dartlang.org/test_api-0.6.0",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/test_api-0.6.0",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "yaml",
"rootUri": "file:///Users/jayudey/.pub-cache/hosted/pub.dartlang.org/yaml-3.1.1",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "pdfjs",
"rootUri": "../",
"packageUri": "lib/",
"languageVersion": "2.12"
}
],
"generated": "2023-08-14T12:15:26.921467Z",
"generated": "2023-10-27T14:28:22.763516Z",
"generator": "pub",
"generatorVersion": "2.18.7"
}
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Dart CI

on:
push:
branches:
- 'master'
- 'test_consume_*'
pull_request:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [ 2.18.7, 2.19.6 ]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}

- id: install
name: Install dependencies
run: dart pub get

- name: Validate dependencies
run: dart run dependency_validator
if: always() && steps.install.outcome == 'success'

- name: Analyze project source
run: dart analyze
if: always() && steps.install.outcome == 'success'

format:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [ 2.18.7, 2.19.6 ]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
- id: install
name: Install dependencies
run: dart pub get

- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
22 changes: 14 additions & 8 deletions lib/src/document_init_parameters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class DocumentInitParameters {
_jsInternal?['initialData'] = initialData;
}

Map<String, dynamic>? get httpHeaders => _jsInternal?['httpHeaders'] as Map<String, dynamic>?;
Map<String, dynamic>? get httpHeaders =>
_jsInternal?['httpHeaders'] as Map<String, dynamic>?;
set httpHeaders(Map<String, dynamic>? httpHeaders) {
_jsInternal?['httpHeaders'] = httpHeaders;
}
Expand All @@ -54,9 +55,12 @@ class DocumentInitParameters {
}

NativeImageDecoderSupport? get nativeImageDecoderSupport =>
_nativeImageDecoderSupportPdfjsToDart[_jsInternal?['nativeImageDecoderSupport']];
set nativeImageDecoderSupport(NativeImageDecoderSupport? nativeImageDecoderSupport) {
_jsInternal?['nativeImageDecoderSupport'] = _nativeImageDecoderSupportDartToPdfjs[nativeImageDecoderSupport];
_nativeImageDecoderSupportPdfjsToDart[
_jsInternal?['nativeImageDecoderSupport']];
set nativeImageDecoderSupport(
NativeImageDecoderSupport? nativeImageDecoderSupport) {
_jsInternal?['nativeImageDecoderSupport'] =
_nativeImageDecoderSupportDartToPdfjs[nativeImageDecoderSupport];
}

String? get password => _jsInternal?['password'] as String?;
Expand Down Expand Up @@ -109,9 +113,11 @@ class DocumentInitParameters {
NativeImageDecoderSupport.none,
];

static Map<String, NativeImageDecoderSupport> _nativeImageDecoderSupportPdfjsToDart =
Map.fromIterables(_pdfjsNativeImageDecoderSupport, _dartNativeImageDecoderSupport);
static Map<String, NativeImageDecoderSupport>
_nativeImageDecoderSupportPdfjsToDart = Map.fromIterables(
_pdfjsNativeImageDecoderSupport, _dartNativeImageDecoderSupport);

static Map<NativeImageDecoderSupport, String> _nativeImageDecoderSupportDartToPdfjs =
Map.fromIterables(_dartNativeImageDecoderSupport, _pdfjsNativeImageDecoderSupport);
static Map<NativeImageDecoderSupport, String>
_nativeImageDecoderSupportDartToPdfjs = Map.fromIterables(
_dartNativeImageDecoderSupport, _pdfjsNativeImageDecoderSupport);
}
42 changes: 30 additions & 12 deletions lib/src/interfaces.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class AnnotationLayerBuilderOptions {
_pdfPage = pdfPage;
}

bool? get renderInteractiveForms => _jsInternal['renderInteractiveForms'] as bool?;
bool? get renderInteractiveForms =>
_jsInternal['renderInteractiveForms'] as bool?;
set renderInteractiveForms(bool? renderInteractiveForms) {
_jsInternal['renderInteractiveForms'] = renderInteractiveForms;
}
Expand All @@ -54,9 +55,12 @@ class AnnotationLayerBuilder {
JsObject? _jsInternal;

AnnotationLayerBuilder(AnnotationLayerBuilderOptions options) {
_jsInternal = JsObject(PDFJS.versionSafePdfJsViewerContext?['AnnotationLayerBuilder'] as JsFunction, [
options,
]);
_jsInternal = JsObject(
PDFJS.versionSafePdfJsViewerContext?['AnnotationLayerBuilder']
as JsFunction,
[
options,
]);
}

AnnotationLayerBuilder._withJsInternal(this._jsInternal);
Expand All @@ -71,11 +75,13 @@ abstract class IPDFAnnotationLayerFactory {

IPDFAnnotationLayerFactory() {
_jsInternal?['createAnnotationLayerBuilder'] =
(DivElement pageDiv, JsObject jsPdfPage, [bool? renderInteractiveForms, JsObject? jsL10n]) {
(DivElement pageDiv, JsObject jsPdfPage,
[bool? renderInteractiveForms, JsObject? jsL10n]) {
PDFPageProxy pdfPage = PDFPageProxy._withJsInternal(jsPdfPage);
IL10n l10n = _JsIL10n._withJsInternal(jsL10n);

AnnotationLayerBuilder annotationLayerBuilder = createAnnotationLayerBuilder(
AnnotationLayerBuilder annotationLayerBuilder =
createAnnotationLayerBuilder(
pageDiv,
pdfPage,
l10n: l10n,
Expand All @@ -102,15 +108,21 @@ class DefaultTextLayerFactory implements IPDFTextLayerFactory {
JsObject? _jsInternal;

DefaultTextLayerFactory() {
_jsInternal = JsObject(PDFJS.versionSafePdfJsViewerContext?['DefaultTextLayerFactory'] as JsFunction, []);
_jsInternal = JsObject(
PDFJS.versionSafePdfJsViewerContext?['DefaultTextLayerFactory']
as JsFunction,
[]);
}
}

class DefaultAnnotationLayerFactory implements IPDFAnnotationLayerFactory {
JsObject? _jsInternal;

DefaultAnnotationLayerFactory() {
_jsInternal = JsObject(PDFJS.versionSafePdfJsViewerContext?['DefaultAnnotationLayerFactory'] as JsFunction, []);
_jsInternal = JsObject(
PDFJS.versionSafePdfJsViewerContext?['DefaultAnnotationLayerFactory']
as JsFunction,
[]);
}

AnnotationLayerBuilder createAnnotationLayerBuilder(
Expand All @@ -120,8 +132,12 @@ class DefaultAnnotationLayerFactory implements IPDFAnnotationLayerFactory {
bool? renderInteractiveForms = false,
}) {
JsObject? jsAnnotationLayerBuilder = _jsInternal?.callMethod(
'createAnnotationLayerBuilder', [pageDiv, pdfPage._jsInternal, renderInteractiveForms, l10n?._jsInternal])
as JsObject?;
'createAnnotationLayerBuilder', [
pageDiv,
pdfPage._jsInternal,
renderInteractiveForms,
l10n?._jsInternal
]) as JsObject?;

return AnnotationLayerBuilder._withJsInternal(jsAnnotationLayerBuilder);
}
Expand Down Expand Up @@ -149,13 +165,15 @@ class _JsIL10n implements IL10n {
}

Future<String> get(String key, Map args, String fallback) {
JsObject promise = _jsInternal?.callMethod('get', [key, JsObject.jsify(args), fallback]) as JsObject;
JsObject promise = _jsInternal
?.callMethod('get', [key, JsObject.jsify(args), fallback]) as JsObject;

return _promiseToFuture<String>(promise);
}

Future<Null> translate(HtmlElement element) {
JsObject promise = _jsInternal?.callMethod('translate', [element]) as JsObject;
JsObject promise =
_jsInternal?.callMethod('translate', [element]) as JsObject;

return _promiseToFuture<Null>(promise);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/page_viewport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class PageViewport {
JsObject? _jsInternal;

PageViewport() {
_jsInternal = JsObject(PDFJS.versionSafePdfJsContext?['PageViewport'] as JsFunction);
_jsInternal =
JsObject(PDFJS.versionSafePdfJsContext?['PageViewport'] as JsFunction);
}

PageViewport._withJsInternal(this._jsInternal);
Expand Down
3 changes: 2 additions & 1 deletion lib/src/pdf_data_range_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ abstract class PDFDataRangeTransport {
JsObject? _jsInternal;

PDFDataRangeTransport(int length, Uint8List initialData) {
_jsInternal = JsObject(PDFJS.versionSafePdfJsContext?['PDFDataRangeTransport'] as JsFunction, [
_jsInternal = JsObject(
PDFJS.versionSafePdfJsContext?['PDFDataRangeTransport'] as JsFunction, [
length,
initialData,
]);
Expand Down
Loading

0 comments on commit 8b520dd

Please sign in to comment.