From 8244e70151dba13224dfb2ebee022ea2d42f53f7 Mon Sep 17 00:00:00 2001 From: Luigi Rosso Date: Fri, 5 Mar 2021 16:54:23 -0800 Subject: [PATCH] Fixing resolve for format_7 --- .../macos/Runner.xcodeproj/project.pbxproj | 24 +++++-------------- .../xcshareddata/xcschemes/Runner.xcscheme | 22 ++++------------- example/macos/Runner/Configs/AppInfo.xcconfig | 6 ++--- lib/src/core/core.dart | 18 ++++++++++---- lib/src/core/importers/artboard_importer.dart | 3 ++- .../core/importers/keyed_object_importer.dart | 2 +- .../importers/keyed_property_importer.dart | 2 +- .../core/importers/layer_state_importer.dart | 2 +- .../importers/linear_animation_importer.dart | 3 ++- .../importers/state_machine_importer.dart | 3 +-- .../state_machine_layer_importer.dart | 3 ++- .../importers/state_transition_importer.dart | 2 +- lib/src/rive_file.dart | 8 +++---- 13 files changed, 43 insertions(+), 55 deletions(-) diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 2e5079f..cc89c87 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -54,7 +54,7 @@ /* Begin PBXFileReference section */ 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* rive_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "rive_example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -105,7 +105,7 @@ 33CC10EE2044A3C60003C045 /* Products */ = { isa = PBXGroup; children = ( - 33CC10ED2044A3C60003C045 /* rive_example.app */, + 33CC10ED2044A3C60003C045 /* example.app */, ); name = Products; sourceTree = ""; @@ -172,7 +172,7 @@ ); name = Runner; productName = Runner; - productReference = 33CC10ED2044A3C60003C045 /* rive_example.app */; + productReference = 33CC10ED2044A3C60003C045 /* example.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -183,7 +183,7 @@ attributes = { LastSwiftUpdateCheck = 0920; LastUpgradeCheck = 0930; - ORGANIZATIONNAME = "The Flutter Authors"; + ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { CreatedOnToolsVersion = 9.2; @@ -202,7 +202,7 @@ }; }; buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 8.0"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -268,7 +268,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh\ntouch Flutter/ephemeral/tripwire\n"; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; /* End PBXShellScriptBuildPhase section */ @@ -361,10 +361,6 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter/ephemeral", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -491,10 +487,6 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter/ephemeral", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -515,10 +507,6 @@ CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter/ephemeral", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index ac06267..ae8ff59 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -15,7 +15,7 @@ @@ -27,23 +27,11 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - - - @@ -66,7 +54,7 @@ @@ -75,7 +63,7 @@ diff --git a/example/macos/Runner/Configs/AppInfo.xcconfig b/example/macos/Runner/Configs/AppInfo.xcconfig index 37afbe8..cf9be60 100644 --- a/example/macos/Runner/Configs/AppInfo.xcconfig +++ b/example/macos/Runner/Configs/AppInfo.xcconfig @@ -5,10 +5,10 @@ // 'flutter create' template. // The application's name. By default this is also the title of the Flutter window. -PRODUCT_NAME = rive_example +PRODUCT_NAME = example // The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.example.riveExample +PRODUCT_BUNDLE_IDENTIFIER = com.example.example // The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2020 com.example. All rights reserved. +PRODUCT_COPYRIGHT = Copyright © 2021 com.example. All rights reserved. diff --git a/lib/src/core/core.dart b/lib/src/core/core.dart index 6b3a6d5..e1e6b78 100644 --- a/lib/src/core/core.dart +++ b/lib/src/core/core.dart @@ -44,7 +44,7 @@ abstract class CoreContext { // ignore: one_member_abstracts abstract class ImportStackObject { - void resolve(); + bool resolve(); } /// Stack to help the RiveFile locate latest ImportStackObject created of a @@ -59,17 +59,27 @@ class ImportStack { return null; } - void makeLatest(int coreType, ImportStackObject importObject) { + bool makeLatest(int coreType, ImportStackObject importObject) { + var latest = _latests[coreType]; + if (latest != null) { + if (!latest.resolve()) { + return false; + } + } if (importObject != null) { _latests[coreType] = importObject; } else { _latests.remove(coreType); } + return true; } - void resolve() { + bool resolve() { for (final object in _latests.values) { - object.resolve(); + if (!object.resolve()) { + return false; + } } + return true; } } diff --git a/lib/src/core/importers/artboard_importer.dart b/lib/src/core/importers/artboard_importer.dart index 105613f..a6f98d8 100644 --- a/lib/src/core/importers/artboard_importer.dart +++ b/lib/src/core/importers/artboard_importer.dart @@ -18,7 +18,7 @@ class ArtboardImporter extends ImportStackObject { void addStateMachine(StateMachine animation) => addAnimation(animation); @override - void resolve() { + bool resolve() { for (final object in artboard.objects.skip(1)) { if (object is Component && object.parentId == null) { object.parent = artboard; @@ -34,5 +34,6 @@ class ArtboardImporter extends ImportStackObject { object.onAdded(); } artboard.clean(); + return true; } } diff --git a/lib/src/core/importers/keyed_object_importer.dart b/lib/src/core/importers/keyed_object_importer.dart index 06f97e6..67d990c 100644 --- a/lib/src/core/importers/keyed_object_importer.dart +++ b/lib/src/core/importers/keyed_object_importer.dart @@ -13,5 +13,5 @@ class KeyedObjectImporter extends ImportStackObject { } @override - void resolve() {} + bool resolve() => true; } diff --git a/lib/src/core/importers/keyed_property_importer.dart b/lib/src/core/importers/keyed_property_importer.dart index 515343d..1d9d7c2 100644 --- a/lib/src/core/importers/keyed_property_importer.dart +++ b/lib/src/core/importers/keyed_property_importer.dart @@ -16,5 +16,5 @@ class KeyedPropertyImporter extends ImportStackObject { } @override - void resolve() {} + bool resolve() => true; } diff --git a/lib/src/core/importers/layer_state_importer.dart b/lib/src/core/importers/layer_state_importer.dart index 55f52cc..8f30dbf 100644 --- a/lib/src/core/importers/layer_state_importer.dart +++ b/lib/src/core/importers/layer_state_importer.dart @@ -12,5 +12,5 @@ class LayerStateImporter extends ImportStackObject { } @override - void resolve() {} + bool resolve() => true; } diff --git a/lib/src/core/importers/linear_animation_importer.dart b/lib/src/core/importers/linear_animation_importer.dart index fc56910..f5e62a7 100644 --- a/lib/src/core/importers/linear_animation_importer.dart +++ b/lib/src/core/importers/linear_animation_importer.dart @@ -16,9 +16,10 @@ class LinearAnimationImporter extends ImportStackObject { } @override - void resolve() { + bool resolve() { for (final keyedObject in keyedObjects) { keyedObject?.objectId ??= linearAnimation.artboard.id; } + return true; } } diff --git a/lib/src/core/importers/state_machine_importer.dart b/lib/src/core/importers/state_machine_importer.dart index cdeb6a9..881a6dd 100644 --- a/lib/src/core/importers/state_machine_importer.dart +++ b/lib/src/core/importers/state_machine_importer.dart @@ -12,6 +12,5 @@ class StateMachineImporter extends ImportStackObject { } @override - void resolve() { - } + bool resolve() => true; } diff --git a/lib/src/core/importers/state_machine_layer_importer.dart b/lib/src/core/importers/state_machine_layer_importer.dart index 27b440e..fe6b20e 100644 --- a/lib/src/core/importers/state_machine_layer_importer.dart +++ b/lib/src/core/importers/state_machine_layer_importer.dart @@ -16,7 +16,7 @@ class StateMachineLayerImporter extends ImportStackObject { } @override - void resolve() { + bool resolve() { for (final state in importedStates) { for (final transition in state.transitions) { // At import time the stateToId is an index relative to the entire layer @@ -34,5 +34,6 @@ class StateMachineLayerImporter extends ImportStackObject { // transition.stateTo = importedStates[transition.stateToId]; } } + return true; } } diff --git a/lib/src/core/importers/state_transition_importer.dart b/lib/src/core/importers/state_transition_importer.dart index 60ebde3..3367040 100644 --- a/lib/src/core/importers/state_transition_importer.dart +++ b/lib/src/core/importers/state_transition_importer.dart @@ -11,5 +11,5 @@ class StateTransitionImporter extends ImportStackObject { } @override - void resolve() {} + bool resolve() => true; } diff --git a/lib/src/rive_file.dart b/lib/src/rive_file.dart index 60560d4..040128a 100644 --- a/lib/src/rive_file.dart +++ b/lib/src/rive_file.dart @@ -118,7 +118,9 @@ class RiveFile { break; } - importStack.makeLatest(stackType, stackObject); + if (!importStack.makeLatest(stackType, stackObject)) { + return false; + } if (object?.import(importStack) ?? true) { switch (object.coreType) { @@ -132,9 +134,7 @@ class RiveFile { } } } - importStack.resolve(); - - return true; + return importStack.resolve(); } }