Skip to content

Commit

Permalink
Compatible with flutter v3.7.12. #26
Browse files Browse the repository at this point in the history
  • Loading branch information
soloxiao committed May 5, 2023
1 parent eab6de2 commit 4c5fdeb
Show file tree
Hide file tree
Showing 27 changed files with 116 additions and 397 deletions.
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
beike_aspectd:
git:
url: https://github.com/LianjiaTech/Beike_AspectD.git
ref: 3.7.0
ref: 3.7.12
```

## 3. 将aop_config.yaml添加到你的工程.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies:
beike_aspectd:
git:
url: https://github.com/LianjiaTech/Beike_AspectD.git
ref: 3.7.0
ref: 3.7.12
```

## 3. Add aop_config.yaml to your flutter project.
Expand Down
2 changes: 1 addition & 1 deletion example/android/local.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sdk.dir=/Users/solo/Library/Android/sdk
flutter.sdk=/Users/solo/SDK/flutter/stable/3.7.0
flutter.sdk=/Users/solo/SDK/flutter/stable/3.7.12
flutter.buildMode=release
=======
flutter.versionName=1.0.0
Expand Down
Binary file modified inner/flutter_frontend_server/frontend_server.dart.snapshot
Binary file not shown.
27 changes: 13 additions & 14 deletions inner/flutter_tools.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From ce4abfb39a5eb7c456930ff5917a04f701b4f852 Mon Sep 17 00:00:00 2001
From c4ad8560bde629e5687adda3a84d820208238d43 Mon Sep 17 00:00:00 2001
From: xiaopeng015 <[email protected]>
Date: Mon, 30 Jan 2023 14:20:02 +0800
Subject: [PATCH] 3
Date: Fri, 5 May 2023 11:31:14 +0800
Subject: [PATCH] aop

---
.../lib/src/aop/aop_manager.dart | 196 ++++++++++++++++
.../flutter_tools/lib/src/aop/aspectd.dart | 221 ++++++++++++++++++
.../lib/src/aop/hook_factory.dart | 96 ++++++++
.../lib/src/build_system/targets/common.dart | 8 +
.../lib/src/build_system/targets/web.dart | 4 +
.../lib/src/build_system/targets/web.dart | 3 +
.../lib/src/commands/build_bundle.dart | 4 +
packages/flutter_tools/lib/src/compile.dart | 18 ++
7 files changed, 547 insertions(+)
7 files changed, 546 insertions(+)
create mode 100644 packages/flutter_tools/lib/src/aop/aop_manager.dart
create mode 100644 packages/flutter_tools/lib/src/aop/aspectd.dart
create mode 100644 packages/flutter_tools/lib/src/aop/hook_factory.dart
Expand Down Expand Up @@ -548,7 +548,7 @@ index 0000000000..db7aa89af0
+ static String _getSnapShotInputPath(String path) => path;
+}
diff --git a/packages/flutter_tools/lib/src/build_system/targets/common.dart b/packages/flutter_tools/lib/src/build_system/targets/common.dart
index 91a39e6c20..0e802e25cb 100644
index 91a39e6c20..464e8c2db6 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/common.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/common.dart
@@ -20,6 +20,7 @@ import 'dart_plugin_registrant.dart';
Expand All @@ -559,10 +559,11 @@ index 91a39e6c20..0e802e25cb 100644

/// Copies the pre-built flutter bundle.
// This is a one-off rule for implementing build bundle in terms of assemble.
@@ -152,6 +153,11 @@ class KernelSnapshot extends Target {
@@ -152,6 +153,12 @@ class KernelSnapshot extends Target {

@override
Future<void> build(Environment environment) async {
+
+ await AspectdHook.enableAspectd();
+ await buildImpl(environment);
+ }
Expand All @@ -571,17 +572,16 @@ index 91a39e6c20..0e802e25cb 100644
final KernelCompiler compiler = KernelCompiler(
fileSystem: environment.fileSystem,
logger: environment.logger,
@@ -245,6 +251,8 @@ class KernelSnapshot extends Target {
@@ -245,6 +252,7 @@ class KernelSnapshot extends Target {
if (output == null || output.errorCount != 0) {
throw Exception();
}
+
+ return output;
}
}

diff --git a/packages/flutter_tools/lib/src/build_system/targets/web.dart b/packages/flutter_tools/lib/src/build_system/targets/web.dart
index 995023d149..95a7902d79 100644
index 995023d149..b4d2a5d778 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/web.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/web.dart
@@ -27,6 +27,7 @@ import '../exceptions.dart';
Expand All @@ -592,12 +592,11 @@ index 995023d149..95a7902d79 100644

/// Whether the application has web plugins.
const String kHasWebPlugins = 'HasWebPlugins';
@@ -225,6 +226,9 @@ class Dart2JSTarget extends Target {
@@ -225,6 +226,8 @@ class Dart2JSTarget extends Target {
throw Exception(_collectOutput(kernelResult));
}

+ await AopManager.hookSnapshotCommand(
+ environment.buildDir.childFile('app.dill').path, buildMode);
+ await AopManager.hookSnapshotCommand(environment.buildDir.childFile('app.dill').path, buildMode);
+
final String? dart2jsOptimization = environment.defines[kDart2jsOptimization];
final bool dumpInfo = environment.defines[kDart2jsDumpInfo] == 'true';
Expand Down Expand Up @@ -689,5 +688,5 @@ index e072e6b7a4..c42311b5ef 100644
// See: https://github.com/flutter/flutter/issues/103994
'--verbosity=error',
--
2.32.1 (Apple Git-133)
2.37.1 (Apple Git-137.1)

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// Test the modular compilation pipeline of ddc.
///
/// This is a shell that runs multiple tests, one per folder under `data/`.
import 'dart:io';

import 'package:modular_test/src/create_package_config.dart';
Expand All @@ -20,25 +17,15 @@ late Options _options;
late String _dartdevcScript;
late String _kernelWorkerScript;

void main(List<String> args) async {
_options = Options.parse(args);
await _resolveScripts();
await runSuite(
sdkRoot.resolve('tests/modular/'),
'tests/modular',
_options,
IOPipeline([
SourceToSummaryDillStep(),
DDCStep(),
RunD8(),
], cacheSharedModules: true));
}

const dillId = DataId('dill');
const jsId = DataId('js');
const txtId = DataId('txt');

class SourceToSummaryDillStep implements IOModularStep {
bool soundNullSafety;

SourceToSummaryDillStep({required this.soundNullSafety});

@override
List<DataId> get resultData => const [dillId];

Expand Down Expand Up @@ -110,6 +97,7 @@ class SourceToSummaryDillStep implements IOModularStep {
'--multi-root-scheme',
rootScheme,
...extraArgs,
if (soundNullSafety) '--sound-null-safety' else '--no-sound-null-safety',
'--output',
'${toUri(module, dillId)}',
if (!module.isSdk) ...[
Expand All @@ -121,7 +109,6 @@ class SourceToSummaryDillStep implements IOModularStep {
.where((m) => !m.isSdk)
.expand((m) => ['--input-summary', '${toUri(m, dillId)}']),
...sources.expand((String uri) => ['--source', uri]),
'--sound-null-safety',
...flags.expand((String flag) => ['--enable-experiment', flag]),
];

Expand All @@ -137,6 +124,11 @@ class SourceToSummaryDillStep implements IOModularStep {
}

class DDCStep implements IOModularStep {
bool soundNullSafety;
bool canaryFeatures;

DDCStep({required this.soundNullSafety, required this.canaryFeatures});

@override
List<DataId> get resultData => const [jsId];

Expand Down Expand Up @@ -196,15 +188,15 @@ class DDCStep implements IOModularStep {
var args = [
'--packages=${sdkRoot.toFilePath()}/.dart_tool/package_config.json',
_dartdevcScript,
'--kernel',
'--modules=es6',
'--no-summarize',
'--no-source-map',
'--multi-root-scheme',
rootScheme,
...sources,
...extraArgs,
'--sound-null-safety',
if (soundNullSafety) '--sound-null-safety' else '--no-sound-null-safety',
if (canaryFeatures) '--canary',
for (String flag in flags) '--enable-experiment=$flag',
...transitiveDependencies
.where((m) => !m.isSdk)
Expand Down Expand Up @@ -328,7 +320,8 @@ String _sourceToImportUri(Module module, String rootScheme, Uri relativeUri) {
}
}

Future<void> _resolveScripts() async {
Future<void> resolveScripts(Options options) async {
_options = options;
Future<String> resolve(
String sdkSourcePath, String relativeSnapshotPath) async {
var result = sdkRoot.resolve(sdkSourcePath).toFilePath();
Expand Down
Loading

0 comments on commit 4c5fdeb

Please sign in to comment.