hey24sheep / azure-flutter-tasks

Easily build and deploy with latest Flutter build tasks for Azure DevOps Pipelines Tasks
https://marketplace.visualstudio.com/items?itemName=Hey24sheep.flutter
MIT License
89 stars 22 forks source link

FlutterBuild - Set xCode version #98

Closed oyenigun closed 1 year ago

oyenigun commented 1 year ago

Hi @hey24sheep, We have a library dependency that has a build problem depending on the Xcode version. So we need to set xCode version. Is there any way to set XcodeVersion during FlutterBuild@0 ?

Error detail;

Swift Compiler Error (Xcode): Cannot find 'isInspectable' in scope
/Users/runner/.pub-cache/hosted/pub.dev/flutter_inappwebview-6.0.0-beta.24+1/ios/Classes/InAppWebView/InAppWebView.swift:478:16

Possible solution (set xCode version): https://github.com/pichillilorenzo/flutter_inappwebview/issues/1697#issuecomment-1596805795

Thank you.

hey24sheep commented 1 year ago

Hi, I will need more information than that.

where do you want to set the xcode version?

I think you should ask this on the attached issue link. How & where do they want it to be set.

oyenigun commented 1 year ago

Actually the first suggestion is what I need.. How exactly should I pass the xcode version as argument to FlutterBuild@0 Task?

Thank you.

hey24sheep commented 1 year ago

You should go through the readme once.

(Optional). Set extraArgs if you want to pass more official/custom command arguments, Space Separated. Example: "--no-tree-shake-icons --publish-to-play"

extraArgs can be passed to give custom arguments. If you are using yaml it will be like extraArgs: --xcode-version=1. If you are on classic editor then just pass in --xcode-version=1 to extraArgs input field.

Please close this issue if that helps you and resolves your problem.

oyenigun commented 1 year ago

I tried pass like below;

      - task: FlutterBuild@0
        inputs:
          target: 'ios'
          projectDirectory: '.'
          entryPoint: "lib/main.dart"
          iosCodesign: false
          extraArgs: '--no-sound-null-safety --xcode-version=14.3'

But it didn't work;

Starting: FlutterBuild
==============================================================================
Task         : Flutter Build Task
Description  : Build a Flutter application project.
Version      : 0.3.10
Author       : Hey24sheep
Help         : [More Information](https://github.com/hey24sheep/azure-flutter-tasks)
==============================================================================
/Users/runner/hostedtoolcache/Flutter/3.7.12/macos/flutter/bin/flutter build ios --no-codesign --target=lib/main.dart --no-sound-null-safety --xcode-version=14.3
Could not find an option named "xcode-version".
hey24sheep commented 1 year ago

Are you sure that Flutter SDK support this flag or you are just guessing?

Because I gave an example flag. It's not a real flag for Flutter. I think you should ask this question on Flutter or the inweb's git repository that you mentioned above.

Cteq3132 commented 1 year ago

Hey @oyenigun, you should define a step for your pipeline to select a specific version of Xcode:

- script: |
  sudo xcode-select -s /Applications/Xcode_14.3.app
  displayName: Use Xcode version 14.3
hey24sheep commented 1 year ago

@Cteq3132 thank you for the help. I have added your answer into a wiki.

oyenigun commented 1 year ago

Thank you @Cteq3132, @hey24sheep ; I defined a step in my pipeline as suggested and it worked for specify XCode version. I faced error below but it is completely about Azure Build machines don't have XCode 14.3, it was successfull when i tried to "XCode 14.2".

xcode-select: error: invalid developer directory '/Applications/Xcode_14.3.app/Contents/Developer'