From f0ea18115ea2e99674821d092919eedeacd7a7c5 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 15 Feb 2023 17:24:33 +0100 Subject: [PATCH] fix: Fix CI for V3 (#1475) * fix: Fix CI for "Build Android" * update versions * Update Gemfile.lock * format swift * fix: Fix swift lint * Update .swiftlint.yml * Use C++17 for lint * fix: Fix C++ lints --- .github/workflows/build-android.yml | 2 - .github/workflows/build-ios.yml | 2 +- android/src/main/cpp/CameraView.cpp | 1 - android/src/main/cpp/JSIJNIConversion.cpp | 2 - .../src/main/cpp/VisionCameraScheduler.cpp | 2 +- android/src/main/cpp/VisionCameraScheduler.h | 6 +- example/ios/Gemfile | 2 +- example/ios/Gemfile.lock | 67 ++++++++++--------- ios/.swiftlint.yml | 5 +- ios/CameraView+AVAudioSession.swift | 3 +- ios/CameraView+RecordVideo.swift | 2 +- ios/CameraViewManager.swift | 2 +- 12 files changed, 47 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 07de84633e..ea0ed807f7 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -55,7 +55,5 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- - - name: Run Gradle Build for android/ - run: cd android && ./gradlew assembleDebug --build-cache && cd .. - name: Run Gradle Build for example/android/ run: cd example/android && ./gradlew assembleDebug --build-cache && cd ../.. diff --git a/.github/workflows/build-ios.yml b/.github/workflows/build-ios.yml index 8fbf15aa5f..e8e775c4cd 100644 --- a/.github/workflows/build-ios.yml +++ b/.github/workflows/build-ios.yml @@ -47,7 +47,7 @@ jobs: - name: Setup Ruby (bundle) uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6 + ruby-version: 2.6.8 bundler-cache: true working-directory: example/ios diff --git a/android/src/main/cpp/CameraView.cpp b/android/src/main/cpp/CameraView.cpp index 665bd312b5..f2e5439d68 100644 --- a/android/src/main/cpp/CameraView.cpp +++ b/android/src/main/cpp/CameraView.cpp @@ -10,7 +10,6 @@ #include #include -#include namespace vision { diff --git a/android/src/main/cpp/JSIJNIConversion.cpp b/android/src/main/cpp/JSIJNIConversion.cpp index a3a0d7087d..d34308f6a2 100644 --- a/android/src/main/cpp/JSIJNIConversion.cpp +++ b/android/src/main/cpp/JSIJNIConversion.cpp @@ -90,7 +90,6 @@ jobject JSIJNIConversion::convertJSIValueToJNIObject(jsi::Runtime &runtime, cons auto dynamic = jsi::dynamicFromValue(runtime, value); auto map = react::ReadableNativeMap::createWithContents(std::move(dynamic)); return map.release(); - } } else { // unknown jsi type! @@ -98,7 +97,6 @@ jobject JSIJNIConversion::convertJSIValueToJNIObject(jsi::Runtime &runtime, cons auto stringRepresentation = value.toString(runtime).utf8(runtime); auto message = "Received unknown JSI value! (" + stringRepresentation + ") Cannot convert to a JNI value."; throw std::runtime_error(message); - } } diff --git a/android/src/main/cpp/VisionCameraScheduler.cpp b/android/src/main/cpp/VisionCameraScheduler.cpp index 4369edb0e0..790ef07380 100644 --- a/android/src/main/cpp/VisionCameraScheduler.cpp +++ b/android/src/main/cpp/VisionCameraScheduler.cpp @@ -41,4 +41,4 @@ void VisionCameraScheduler::registerNatives() { }); } -} // namespace vision \ No newline at end of file +} // namespace vision diff --git a/android/src/main/cpp/VisionCameraScheduler.h b/android/src/main/cpp/VisionCameraScheduler.h index f306708e82..59f48e8038 100644 --- a/android/src/main/cpp/VisionCameraScheduler.h +++ b/android/src/main/cpp/VisionCameraScheduler.h @@ -24,7 +24,7 @@ using namespace facebook; * 4. `trigger()` is a C++ function here that just calls the passed C++ Method from step 1. */ class VisionCameraScheduler : public jni::HybridClass { -public: + public: static auto constexpr kJavaDescriptor = "Lcom/mrousavy/camera/frameprocessor/VisionCameraScheduler;"; static jni::local_ref initHybrid(jni::alias_ref jThis); static void registerNatives(); @@ -32,7 +32,7 @@ class VisionCameraScheduler : public jni::HybridClass { // schedules the given job to be run on the VisionCamera FP Thread at some future point in time void dispatchAsync(std::function job); -private: + private: friend HybridBase; jni::global_ref javaPart_; std::queue> _jobs; @@ -47,4 +47,4 @@ class VisionCameraScheduler : public jni::HybridClass { void trigger(); }; -} // namespace vision \ No newline at end of file +} // namespace vision diff --git a/example/ios/Gemfile b/example/ios/Gemfile index 1c6e2865e9..80cfa7556e 100644 --- a/example/ios/Gemfile +++ b/example/ios/Gemfile @@ -1,4 +1,4 @@ source "https://rubygems.org" -gem 'cocoapods', '1.10.2' +gem 'cocoapods', '1.11.3' gem 'cocoapods-check' diff --git a/example/ios/Gemfile.lock b/example/ios/Gemfile.lock index 4d7c2b8859..b93ee93975 100644 --- a/example/ios/Gemfile.lock +++ b/example/ios/Gemfile.lock @@ -1,24 +1,25 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.4) + CFPropertyList (3.0.6) rexml - activesupport (5.2.6) + activesupport (6.1.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) - claide (1.0.3) - cocoapods (1.10.2) - addressable (~> 2.6) + claide (1.1.0) + cocoapods (1.11.3) + addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.10.2) + cocoapods-core (= 1.11.3) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.4.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -29,24 +30,24 @@ GEM escape (~> 0.0.4) fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.6) + molinillo (~> 0.8.0) nap (~> 1.0) - ruby-macho (~> 1.4) - xcodeproj (>= 1.19.0, < 2.0) + ruby-macho (>= 1.0, < 3.0) + xcodeproj (>= 1.21.0, < 2.0) cocoapods-check (1.1.0) cocoapods (~> 1.0) - cocoapods-core (1.10.2) - activesupport (> 5.0, < 6) - addressable (~> 2.6) + cocoapods-core (1.11.3) + activesupport (>= 5.0, < 7) + addressable (~> 2.8) algoliasearch (~> 1.0) concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) netrc (~> 0.11) - public_suffix + public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.5.1) + cocoapods-downloader (1.6.3) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) @@ -55,45 +56,45 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.9) + concurrent-ruby (1.2.0) escape (0.0.4) - ethon (0.14.0) + ethon (0.16.0) ffi (>= 1.15.0) - ffi (1.15.4) + ffi (1.15.5) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.8.10) + i18n (1.12.0) concurrent-ruby (~> 1.0) - json (2.5.1) - minitest (5.14.4) - molinillo (0.6.6) + json (2.6.3) + minitest (5.17.0) + molinillo (0.8.0) nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) - public_suffix (4.0.6) + public_suffix (4.0.7) rexml (3.2.5) - ruby-macho (1.4.0) - thread_safe (0.3.6) + ruby-macho (2.5.1) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (1.2.9) - thread_safe (~> 0.1) - xcodeproj (1.21.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + xcodeproj (1.22.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) rexml (~> 3.2.4) + zeitwerk (2.6.7) PLATFORMS ruby x86_64-darwin-19 DEPENDENCIES - cocoapods (= 1.10.2) + cocoapods (= 1.11.3) cocoapods-check BUNDLED WITH diff --git a/ios/.swiftlint.yml b/ios/.swiftlint.yml index 9ed53b6db6..5ff2f00c83 100644 --- a/ios/.swiftlint.yml +++ b/ios/.swiftlint.yml @@ -22,8 +22,6 @@ opt_in_rules: - vertical_whitespace_opening_braces - vertical_whitespace_closing_braces - vertical_parameter_alignment_on_call - - unused_import - - unused_declaration - untyped_error_in_catch - unowned_variable_capture - unavailable_function @@ -37,7 +35,10 @@ opt_in_rules: - redundant_nil_coalescing - attributes - convenience_type +analyzer_rules: - explicit_self + - unused_declaration + - unused_import excluded: # paths to ignore during linting. Takes precedence over `included`. - Pods diff --git a/ios/CameraView+AVAudioSession.swift b/ios/CameraView+AVAudioSession.swift index 57d0ed574a..a14de3dac9 100644 --- a/ios/CameraView+AVAudioSession.swift +++ b/ios/CameraView+AVAudioSession.swift @@ -144,7 +144,8 @@ extension CameraView { } else { ReactLogger.log(level: .error, message: "Cannot resume interrupted Audio Session!") } - @unknown default: () + @unknown default: + () } } } diff --git a/ios/CameraView+RecordVideo.swift b/ios/CameraView+RecordVideo.swift index 43d9619f18..d81a3e0e09 100644 --- a/ios/CameraView+RecordVideo.swift +++ b/ios/CameraView+RecordVideo.swift @@ -212,7 +212,7 @@ extension CameraView: AVCaptureVideoDataOutputSampleBufferDelegate, AVCaptureAud if let frameProcessor = frameProcessorCallback, captureOutput is AVCaptureVideoDataOutput { // Call the JavaScript Frame Processor func (worklet) - let frame = Frame(buffer: sampleBuffer, orientation: self.bufferOrientation) + let frame = Frame(buffer: sampleBuffer, orientation: bufferOrientation) frameProcessor(frame) } } diff --git a/ios/CameraViewManager.swift b/ios/CameraViewManager.swift index 7c48efc782..c405369a54 100644 --- a/ios/CameraViewManager.swift +++ b/ios/CameraViewManager.swift @@ -34,7 +34,7 @@ final class CameraViewManager: RCTViewManager { // Runs on JS Thread runtimeManager = FrameProcessorRuntimeManager() runtimeManager!.installFrameProcessorBindings() - return NSNumber(booleanLiteral: true) + return true as NSNumber } @objc