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

[flutter_tools] prefactoring for linux, windows release targets #55708

Closed

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Apr 27, 2020

Description

Initial cleanup to implement Linux, Windows release targets.

Verified that both Linux and Windows still build! Also renames dart.dart to common.dart to reduce insanity (or increase sanity).

I also added code for the Linux, Windows release bundles. These are fairly trivial since its a single arch build.

@fluttergithubbot fluttergithubbot added tool Affects the "flutter" command-line tool. See also t: labels. work in progress; do not review labels Apr 27, 2020
/// expected to be in the root output directory.
///
/// All assets and manifests are included from flutter_assets/**.
abstract class AndroidAssetBundle extends Target {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most apps share the same bundle structure so I refactored this into a common class.

/// All assets and manifests are included from flutter_assets/**.
abstract class ApplicationAssetBundle extends Target {
const ApplicationAssetBundle({
this.shouldCopyAssets = true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document what this means?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@override
Future<void> build(Environment environment) async {
await super.build(environment);
environment.buildDir.childFile('app.so')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this doesn't apply to iOS and macOS; maybe clarify in the comments the intended platforms?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

List<Source> get inputs => <Source>[
...super.inputs,
const Source.artifact(Artifact.vmSnapshotData, mode: BuildMode.debug),
const Source.artifact(Artifact.isolateSnapshotData, mode: BuildMode.debug),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the inputs and outputs in the subclass, but the logic that copies from the input to the output location in the superclass? Shouldn't the superclass be describing the inputs and outputs it's managing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vm_snapshot_data , isolate_snapshot_data, and kernel_blob.bin are not part of profile/release builds. This sort of structure allows me to statically describe all of the dependencies while only having a single build implementation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm not seeing how having one build method is an advantage when it means having the input/output description in a different class—and file—than the code that actually causes it to be an input/output. It seems like this would be incredibly error-prone to maintain because it's not at all obvious that a change here would require changes in a different file, or the other way around.

Why not have a debug subclass that has the debug inputs, outputs, and build logic, and then derive from that here?

@override
List<Source> get inputs => <Source>[
...super.inputs,
const Source.pattern('{BUILD_DIR}/app.so'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to the other comment: why aren't these in ReleaseAssetBundle?

List<Source> get inputs => <Source>[
...super.inputs,
const Source.artifact(Artifact.vmSnapshotData, mode: BuildMode.debug),
const Source.artifact(Artifact.isolateSnapshotData, mode: BuildMode.debug),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm not seeing how having one build method is an advantage when it means having the input/output description in a different class—and file—than the code that actually causes it to be an input/output. It seems like this would be incredibly error-prone to maintain because it's not at all obvious that a change here would require changes in a different file, or the other way around.

Why not have a debug subclass that has the debug inputs, outputs, and build logic, and then derive from that here?

@zanderso
Copy link
Member

Closing as obsolete.

@zanderso zanderso closed this May 28, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants