brave / brave-ios

Brave iOS Browser
https://brave.com
Mozilla Public License 2.0
1.7k stars 441 forks source link

SwiftLint breaks building #3040

Closed krlbsk closed 3 years ago

krlbsk commented 3 years ago

Description:

I followed the instructions from README but failed to build the project because of SwiftLint script error.

Steps to reproduce

  1. Clone the project.
  2. Configure project following instructions from README.
  3. Choose Debug scheme and iPhone 12 simulator.
  4. Run the project.

Actual result:

Linting Swift files at paths 
No lintable files found at paths: ''
Command PhaseScriptExecution failed with a nonzero exit code

Expected result: Running the app.

Reproduces how often: [Easily reproduced, Intermittent Issue] Every build attempt.

Brave Version: development branch.

Additional information

Versions

bootstrap.sh log

Xcode SDK: 14
XCode 12 version detected! ••• Please ensure this is correct. •••
*** Checking out SwiftKeychainWrapper at "3.4.0"
*** Checking out SwiftyJSON at "5.0.0"
*** Checking out Static at "v4.0.0"
*** Checking out XCGLogger at "7.0.0"
*** Checking out SDWebImage at "4.4.6"
*** Checking out GCDWebServer at "3.5.2"
*** Checking out pop at "1.0.12"
*** Checking out Fuzi at "3.1.2"
*** Checking out SnapKit at "5.0.1"
*** Checking out lottie-ios at "1692cb4d0fcf0406dcaf61bf7cafea49dca51354"
*** Checking out onepassword-app-extension at "ad51de56e65af6ed3ede21e64de0cc91ffd92b0d"
*** No cache found for Fuzi, building with all downstream dependencies
*** No cache found for GCDWebServer, building with all downstream dependencies
*** No cache found for lottie-ios, building with all downstream dependencies
*** No cache found for onepassword-app-extension, building with all downstream dependencies
*** No cache found for pop, building with all downstream dependencies
*** No cache found for SDWebImage, building with all downstream dependencies
*** No cache found for SnapKit, building with all downstream dependencies
*** No cache found for Static, building with all downstream dependencies
*** No cache found for SwiftKeychainWrapper, building with all downstream dependencies
*** No cache found for SwiftyJSON, building with all downstream dependencies
*** No cache found for XCGLogger, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/mk/hvkpyxsd5y17tv58l59d8fw40000gn/T/carthage-xcodebuild.wZ8V1r.log
*** Building scheme "Fuzi" in Fuzi.xcworkspace
*** Building scheme "GCDWebServers (iOS)" in GCDWebServer.xcodeproj
*** Building scheme "Lottie_iOS" in Lottie.xcodeproj
*** Building scheme "OnePasswordExtension" in 1Password Extension Demos.xcworkspace
*** Building scheme "pop-ios-framework" in pop.xcworkspace
*** Building scheme "SDWebImage iOS" in SDWebImage.xcworkspace
*** Building scheme "SnapKit" in SnapKit.xcworkspace
*** Building scheme "Static-iOS" in Static.xcodeproj
*** Building scheme "SwiftKeychainWrapper" in SwiftKeychainWrapper.xcodeproj
*** Building scheme "SwiftyJSON iOS" in SwiftyJSON.xcworkspace
*** Building scheme "ObjcExceptionBridging (iOS)" in XCGLogger.xcodeproj
*** Building scheme "XCGLogger (iOS)" in XCGLogger.xcodeproj

added 668 packages, and audited 734 packages in 19s

found 0 vulnerabilities

> brave-ios@2.0.0 build
> webpack --config webpack.config.js

Hash: c76ba0aa84614460cd8e
Version: webpack 4.42.0
Time: 2565ms
Built at: 14.11.2020 11:33:54
                      Asset      Size  Chunks             Chunk Names
  AllFramesAtDocumentEnd.js  2.34 KiB       0  [emitted]  AllFramesAtDocumentEnd
AllFramesAtDocumentStart.js  10.1 KiB       1  [emitted]  AllFramesAtDocumentStart
  MainFrameAtDocumentEnd.js  23.1 KiB       2  [emitted]  MainFrameAtDocumentEnd
MainFrameAtDocumentStart.js  30.8 KiB       3  [emitted]  MainFrameAtDocumentStart
Entrypoint AllFramesAtDocumentStart = AllFramesAtDocumentStart.js
Entrypoint AllFramesAtDocumentEnd = AllFramesAtDocumentEnd.js
Entrypoint MainFrameAtDocumentStart = MainFrameAtDocumentStart.js
Entrypoint MainFrameAtDocumentEnd = MainFrameAtDocumentEnd.js
 [2] multi ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/__firefox__.js ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/AdsReporting.js ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/DownloadHelper.js ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/LoginsHelper.js ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/RewardsReporting.js 76 bytes {1} [built]
 [3] ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/__firefox__.js 783 bytes {1} [built]
 [4] ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/AdsReporting.js 1.2 KiB {1} [built]
 [5] ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/DownloadHelper.js 613 bytes {1} [built]
 [6] ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/LoginsHelper.js 25.4 KiB {1} [built]
 [7] ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/RewardsReporting.js 3.26 KiB {1} [built]
 [8] multi ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd/__firefox__.js ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd/ContextMenu.js ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd/FocusHelper.js ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd/PrintHandler.js 64 bytes {0} [built]
 [9] ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd/__firefox__.js 783 bytes {0} [built]
[10] ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd/ContextMenu.js 1.29 KiB {0} [built]
[11] ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd/FocusHelper.js 1.4 KiB {0} [built]
[12] ./Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentEnd/PrintHandler.js 530 bytes {0} [built]
[13] multi ./Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentStart/BraveGetUA.js ./Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentStart/NoImageModeHelper.js ./Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentStart/ReaderMode.js ./Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentStart/TrackingProtectionStats.js 64 bytes {3} [built]
[14] ./Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentStart/BraveGetUA.js 513 bytes {3} [built]
[15] ./Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentStart/NoImageModeHelper.js 2.47 KiB {3} [built]
[19] multi ./Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentEnd/CustomSearchHandler.js ./Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentEnd/FindInPage.js ./Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentEnd/MetadataHelper.js 52 bytes {2} [built]
    + 16 hidden modules

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
Building sync

> brave-ios@2.0.0 build:sync
> cd node_modules/brave-sync; npm install && npm run build; cd node_modules/brave-crypto; npm run build

npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated mkdirp@0.3.5: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated istanbul@0.4.5: This module is no longer maintained, try this instead:
npm WARN deprecated   npm i nyc
npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives.

added 820 packages, and audited 821 packages in 27s

33 packages are looking for funding
  run `npm fund` for details

9 low severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

> brave-sync@1.4.3 build
> npm run build-proto && browserify client/sync.js | uglifyjs > bundles/bundle.js && cpr client/constants bundles/constants -o

> brave-sync@1.4.3 build-proto
> pbjs --target=static-module lib/api.proto > lib/api.proto.js

installing semver@^7.1.2
installing chalk@^4.0.0
installing jsdoc@^3.6.3
installing escodegen@^1.13.0
installing estraverse@^5.1.0

> brave-crypto@0.2.4 build
> browserify ./index.js -o browser/crypto.js

Creating 'Local' directory
Attempting to copy Client/Configuration/Local.templates/BuildId.xcconfig
Attempting to copy Client/Configuration/Local.templates/BundleId.xcconfig
Attempting to copy Client/Configuration/Local.templates/DevTeam.xcconfig
Attempting to copy Client/Configuration/Local.templates/Version.xcconfig
Cloning into 'Carthage/Checkouts/yubikit-ios'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 1027 (delta 0), reused 3 (delta 0), pack-reused 1024
Receiving objects: 100% (1027/1027), 1.23 MiB | 3.87 MiB/s, done.
Resolving deltas: 100% (623/623), done.
Note: switching to '0ffe60a3dedbdd3d80b196cd2d6f986c260fb5bf'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

~/Documents/Open Source/Brave/brave-ios/Carthage/Checkouts/yubikit-ios/YubiKit ~/Documents/Open Source/Brave/brave-ios
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
iccub commented 3 years ago

Does it work for you when you call swiftlint from terminal in project's directory? should get msg like Done linting! Found 1 violation, 0 serious in 608 files.

krlbsk commented 3 years ago

Yeah, I have

Done linting! Found 8 violations, 0 serious in 608 files.
iccub commented 3 years ago

Interesting, really all this script do is call the same command, see https://github.com/brave/brave-ios/blob/development/swiftlint.sh

As a workaround you can remove Run swiftlint build phase

Zrzut ekranu 2020-11-16 o 18 10 21
krlbsk commented 3 years ago

After deleting lint script I have another error:

/Users/x/Documents/Open Source/test/brave-ios/Client/Application/Client-Bridging-Header.h:18:9: error: 'YubiKit/YubiKit.h' file not found

import <YubiKit/YubiKit.h>

^ 1 error generated.

:0: error: failed to emit precompiled header '/Users/x/Library/Developer/Xcode/DerivedData/Client-csfqllblbguoilbwyaisaahkykui/Build/Intermediates.noindex/PrecompiledHeaders/Client-Bridging-Header-swift_181VTNEQLNHIL-clang_3VKA04DFLWPGR.pch' for bridging header '/Users/x/Documents/Open Source/test/brave-ios/Client/Application/Client-Bridging-Header.h'

Maybe something wrong with some of the configs on my machine?

soner-yuksel commented 3 years ago

Can you please try cleaning Carthage Cache and also Carthage Temporary Items and give another try?

rm -rf ~/Library/Caches/org.carthage.CarthageKit
rm -rf ${TMPDIR}/TemporaryItems/*carthage*
krlbsk commented 3 years ago

Unfortunately that didn't help.

kylehickinson commented 3 years ago

@krlbsk If you are getting a YubiKit error then your bootstrap must have not completed.

Checking your previous comments it looks like it did fail on the copy:

~/Documents/Open Source/Brave/brave-ios/Carthage/Checkouts/yubikit-ios/YubiKit ~/Documents/Open Source/Brave/brave-ios
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory

My guess is it doesn't like the space you have in your directory ("Open Source"), for now maybe try moving it to a directory without spaces and try again :)

krlbsk commented 3 years ago

@kylehickinson Yes, it was problem with directory named "Open Source". Changing that to "Open-Source" solved the case.

Thanks everyone, I am closing the issue.