Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicts and compatibility with different flutter versions #5

Open
xiaobeibeinihao opened this issue Jul 24, 2019 · 29 comments
Open
Labels
knowledge Knowledge to share

Comments

@xiaobeibeinihao
Copy link

环境:Flutter 1.5.4-hotfix.2 , Dart 2.3.0
git apply --3way /Users/cuikuangye/rong360work/androiddemo/aspectd-master/0001-aspectd.patch 我在执行这个命令行的时候报错:
error: patch failed: packages/flutter_tools/lib/src/commands/build_aot.dart:5
error: repository lacks the necessary blob to fall back on 3-way merge.
error: packages/flutter_tools/lib/src/commands/build_aot.dart: patch does not apply
error: patch failed: packages/flutter_tools/lib/src/commands/build_bundle.dart:4
error: repository lacks the necessary blob to fall back on 3-way merge.
error: packages/flutter_tools/lib/src/commands/build_bundle.dart: patch does not apply

@kangwang1988
Copy link
Contributor

This problem happens as the patch is created using the latest master, and might fail when applying to other flutter version.
However, it's quite simple to resolve it. The patch contains three parts,
a. build_aot.dart

Screen Shot 2019-07-23 at 4 34 49 PM

b.build_bundle.dart
Screen Shot 2019-07-23 at 4 34 57 PM

c.aspectd.dart
Not a problem as totally new.

So @xiaobeibeinihao , though the main logic remains, the patch could vary a bit for different flutter versions. For flutter v1.5.4-hotfix2, you can solve it with commands below:
wget https://gist.githubusercontent.com/kangwang1988/e422673f85a2be5a8e43d4b4b745da21/raw/d2f6c4cb3e6a6dbd5ae95d65a25961e0594e9bf1/0001-aspectd-v1.5.4.patch && git apply --3way 0001-aspectd-v1.5.4.patch

It will work as expected.

@xiaobeibeinihao
Copy link
Author

1、我用你给的patch已经,能执行成功,不会报错。但是我通过正常的编译给的demo,并没有看到print打印KWLM-called 。
2、下载的demo中我用aop.dart编译报错
image

@kangwang1988
Copy link
Contributor

@xiaobeibeinihao
I think it might be a flutter issue instead of aspectd one. Probably related to flutter/flutter#36326

@newkisky
Copy link

newkisky commented Sep 6, 2019

你好,想请教下是什么原因?
git apply --3way path-for-aspectd-package/0001-aspectd.patch
执行这一步的时候报错
error: packages/flutter_tools/lib/src/commands/build_aot.dart: does not match index
error: packages/flutter_tools/lib/src/commands/build_bundle.dart: does not match index

@kangwang1988
Copy link
Contributor

@newkisky
这个问题现在还有么,有的话麻烦贴一下你的环境(flutter doctor -v)。

@kangwang1988
Copy link
Contributor

kangwang1988 commented Sep 20, 2019

This patch issue will remain until flutter/flutter#36738 is resolved and merged into flutter master.

@Code-Yeong
Copy link

Error
Falling back to three-way merge...
Applied patch to 'packages/flutter_tools/lib/src/aspectd.dart' cleanly.
error: packages/flutter_tools/lib/src/commands/build_aot.dart: does not exist in index
error: patch failed: packages/flutter_tools/lib/src/commands/build_bundle.dart:4
Falling back to three-way merge...
Applied patch to 'packages/flutter_tools/lib/src/commands/build_bundle.dart' cleanly.

Flutter
[✓] Flutter (Channel v1.7.8-hotfixes, v1.7.8+hotfix.4, on Mac OS X 10.14.6 18G87, locale en-CN)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✓] iOS tools - develop for iOS devices
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] Proxy Configuration
[✓] Connected device (4 available)

@kangwang1988 kangwang1988 changed the title build_tools patch Conflicts and compatibility with different flutter versions Oct 15, 2019
@kangwang1988
Copy link
Contributor

@Code-Yeong
https://github.com/alibaba-flutter/aspectd/tree/v1.7.8 is compatible with v1.7.8
You can have a try.

@kangwang1988
Copy link
Contributor

@kangwang1988
Copy link
Contributor

@maheshmnj
https://github.com/alibaba-flutter/aspectd/tree/v1.9.1 is compatible with v1.9.1

@maheshj01
Copy link

maheshj01 commented Nov 12, 2019

@maheshmnj
https://github.com/alibaba-flutter/aspectd/tree/v1.9.1 is compatible with v1.9.1

So I don't have to change flutter channel I can use aspectd on stable channel right?

@kangwang1988
Copy link
Contributor

@maheshmnj
If you're using flutter 1.9.1, just use aspectd 1.9.1.
It's expected to work fine.

@LinLeyang
Copy link

image
flutter 1.9.1 aspectd 1.9.1
切换成master一样的问题

@kangwang1988
Copy link
Contributor

@LinLeyang
The log you pasted is not a problem. The patch has been applied successfully in your git apply action.

kylewong@KyleWongdeMacBook-Pro flutter % git apply --3way /Users/kylewong/Codes/Flutter/alibaba-flutter/aspectd/0001-aspectd.patch
error: patch failed: packages/flutter_tools/lib/src/commands/build_bundle.dart:140
Falling back to three-way merge...
Applied patch to 'packages/flutter_tools/lib/src/commands/build_bundle.dart' cleanly.
kylewong@KyleWongdeMacBook-Pro flutter % rm bin/cache/flutter_tools.stamp 
kylewong@KyleWongdeMacBook-Pro flutter % rm bin/cache/flutter_tools.stamp
rm: bin/cache/flutter_tools.stamp: No such file or directory
kylewong@KyleWongdeMacBook-Pro flutter % flutter doctor -v
Building flutter tool...
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this
source!
Downloading libimobiledevice...  

@kangwang1988
Copy link
Contributor

https://github.com/alibaba-flutter/aspectd/tree/v1.12.13
is compatible with v1.12.13+hotfix.7

@hongpp
Copy link

hongpp commented May 25, 2020

执行:git apply --3way命令报错:

$ git apply --3way D:/FlutterAspectD/0001-aspectd.patch
D:/FlutterAspectD/0001-aspectd.patch:42: trailing whitespace.
// Copyright 2018 The Chromium Authors. All rights reserved.
D:/FlutterAspectD/0001-aspectd.patch:43: trailing whitespace.
// Use of this source code is governed by a BSD-style license that can be
D:/FlutterAspectD/0001-aspectd.patch:44: trailing whitespace.
// found in the LICENSE file.
D:/FlutterAspectD/0001-aspectd.patch:45: trailing whitespace.

D:/FlutterAspectD/0001-aspectd.patch:46: trailing whitespace.
import 'dart:io';
error: packages/flutter_tools/lib/src/aot.dart: does not match index
error: packages/flutter_tools/lib/src/build_system/targets/dart.dart: does not match index
error: packages/flutter_tools/lib/src/commands/build_bundle.dart: does not match index
error: packages/flutter_tools/lib/src/compile.dart: does not match index

>flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18363.778], locale zh-CN)
• Flutter version 1.12.13+hotfix.9 at C:\flutter\flutter_windows_v1.9.1+hotfix.4-stable\flutter
• Framework revision f139b11009 (8 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\hongpanpan.SAICMOBILITY\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.

[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[!] IntelliJ IDEA Community Edition (version 2019.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.2
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins

[!] VS Code (version 1.37.1)
• VS Code at C:\Users\hongpanpan.SAICMOBILITY\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (1 available)
• Mi Note 3 • 7382ac78 • android-arm64 • Android 9 (API 28)

! Doctor found issues in 2 categories.

@sj1910
Copy link

sj1910 commented Sep 18, 2020

执行 git apply --3way ~/Github/aspectd/0001-aspectd.patch
报错
error: packages/flutter_tools/lib/src/build_system/targets/dart.dart: does not exist in index
error: patch failed: packages/flutter_tools/lib/src/commands/build_bundle.dart:138
Falling back to three-way merge...
Applied patch to 'packages/flutter_tools/lib/src/commands/build_bundle.dart' cleanly.

执行 flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.20.2, on Mac OS X 10.15.5 19F101, locale
zh-Hans-CN)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

@sj1910
Copy link

sj1910 commented Sep 21, 2020

请问有1.20.2版本的嘛

@kangwang1988
Copy link
Contributor

kangwang1988 commented Oct 9, 2020

Check aspectd's tag 0.9.8->1.0.0
They supports flutter @ stable v1.17.5->v1.22.1
@sj1910

@kangwang1988
Copy link
Contributor

If the flutter version you want is not supported yet, see UPGRADE.md for more.

@arvinwli
Copy link

arvinwli commented Nov 6, 2020

flutter version:
image
aspectd version:
image
when i patched . error
image

@rebecaa-xl
Copy link

git apply --3way ~/src/github/aspectd/0001-aspectd.patch
error: packages/flutter_tools/lib/src/build_system/targets/common.dart: does not match index

Flutter 1.22.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f30b7f4db9 (5 weeks ago) • 2020-10-08 10:06:30 -0700
Engine • revision 75bef9f6c8
Tools • Dart 2.10.1

aspectd: stable/v1.22.1

请问这个怎么解决

@ameryzhu
Copy link

发现命令行patch不上的时候,用tortoise git右键可以patch上
image

@kangwang1988
Copy link
Contributor

因为我本地使用的是mac系统,如果有windows等其他系统上patch apply的异常,诸位可以手动处理下。
其实patch很简单,一个是新增文件aspectd.dart
另一个是对于构建kernel相关的common.dart的修改如下:
image

@DeveKing7
Copy link

Building flutter tool...
../../flutter_wechat-master/aspectd_impl/flutter/packages/flutter_tools/lib/src/aspectd.dart:65:47: Error: Getter not found: 'globalPackagesPath'.
.join(aspectdDirectory.absolute.path, globalPackagesPath);
^^^^^^^^^^^^^^^^^^
../../flutter_wechat-master/aspectd_impl/flutter/packages/flutter_tools/lib/src/aspectd.dart:76:61: Error: Getter not found: 'globalPackagesPath'.
globals.fs.path.join(aspectdDirectory.path, globalPackagesPath))
^^^^^^^^^^^^^^^^^^
../../flutter_wechat-master/aspectd_impl/flutter/packages/flutter_tools/lib/src/aspectd.dart:160:42: Error: Getter not found: 'globalPackagesPath'.
globals.fs.path.join(aspectdDir, globalPackagesPath), 'kernel');
^^^^^^^^^^^^^^^^^^
MacBook-Pro-4:example DeveWang$ cd /Users/DeveWang/Downloads/aspectd-master\ 2
MacBook-Pro-4:aspectd-master 2 DeveWang$ flutter pub get
Building flutter tool...
../flutter_wechat-master/aspectd_impl/flutter/packages/flutter_tools/lib/src/aspectd.dart:65:47: Error: Getter not found: 'globalPackagesPath'.
.join(aspectdDirectory.absolute.path, globalPackagesPath);
^^^^^^^^^^^^^^^^^^
../flutter_wechat-master/aspectd_impl/flutter/packages/flutter_tools/lib/src/aspectd.dart:76:61: Error: Getter not found: 'globalPackagesPath'.
globals.fs.path.join(aspectdDirectory.path, globalPackagesPath))
^^^^^^^^^^^^^^^^^^
../flutter_wechat-master/aspectd_impl/flutter/packages/flutter_tools/lib/src/aspectd.dart:160:42: Error: Getter not found: 'globalPackagesPath'.
globals.fs.path.join(aspectdDir, globalPackagesPath), 'kernel');

运行demo编译报错。

@just-for-you
Copy link

发现命令行patch不上的时候,用tortoise git右键可以patch上
image

你这是把patch文件放到了flutter里面吗?成功运行了吗?

@kangwang1988
Copy link
Contributor

On windows, try "git am --reject --whitespace=fix aspects\0001-aspectd.patch" to apply the patch

PS C:\Users\kangw\Codes\flutter> git am --reject --whitespace=fix ..\aspectd\0001-aspectd.patch
Checking patch packages/flutter_tools/lib/src/aspectd.dart...
Checking patch packages/flutter_tools/lib/src/build_system/targets/common.dart... 
Applied patch packages/flutter_tools/lib/src/aspectd.dart cleanly. 
Applied patch packages/flutter_tools/lib/src/build_system/targets/common.dart cleanly. 
Applying: for aspectd.patch

@ameryzhu
Copy link

ameryzhu commented Dec 2, 2020

发现命令行patch不上的时候,用tortoise git右键可以patch上
image

你这是把patch文件放到了flutter里面吗?成功运行了吗?

是的

@chyund
Copy link

chyund commented Jan 4, 2021

git apply --3way /workspace/flutter/.pub-cache/git/aspectd-3d2bce497612ae4b67d314d1bfdc22c22bc401d0/0001-aspectd.patch
error: packages/flutter_tools/lib/src/build_system/targets/common.dart: does not match index

[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H2 darwin-x64, locale
zh-Hans-CN)
• Flutter version 1.22.5 at /Users/chyun/workspace/flutter
• Framework revision 7891006299 (4 weeks ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/chyun/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.0

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin installed
• Dart plugin version 201.9245
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (1 available)
• iPhone 12 Pro Max (mobile) • 08963069-24BF-44ED-97F4-3D24E1CF1166 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)

• No issues found!

git apply出错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
knowledge Knowledge to share
Projects
None yet
Development

No branches or pull requests