Thanks to visit codestin.com
Credit goes to github.com

Skip to content

let the plugin's output generated in flutter/.android/plugins_build_output/${androidPlugin.name} #94645

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

Merged

Conversation

chunfengyao
Copy link
Contributor

@chunfengyao chunfengyao commented Dec 4, 2021

let the plugin's output generated in flutter/.android/plugins_build_output/${androidPlugin.name}. will close #92252

change the output directory of native plugin's from $HOME/.pub-cache/${plugin_path} to ${flutter_module_path}/.android/plugins_build_output/${androidPlugin.name}. Because the directory userd before was a shared directory,it will cause issue #92252 when run multiple task simultaneously.

List which issues are fixed by this PR. You must list at least one issue.
#92252

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Dec 4, 2021
@google-cla google-cla bot added the cla: yes label Dec 4, 2021
@chunfengyao
Copy link
Contributor Author

chunfengyao commented Dec 6, 2021

@christopherfujino
Can you find someone developer help to review this pull request for this issue?
Thanks.

@christopherfujino
Copy link
Contributor

cc @stuartmorgan does this look like the right change?

@stuartmorgan-g
Copy link
Contributor

I'm not familiar with the internal build setup of Android plugins; @blasten would be a better reviewer.

Copy link

@blasten blasten left a comment

Choose a reason for hiding this comment

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

This needs to be fixed in the template file. The fix is:

https://github.com/flutter/flutter/blob/master/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl#L33

should have a section similar to:

subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}

@chunfengyao
Copy link
Contributor Author

This needs to be fixed in the template file. The fix is:

https://github.com/flutter/flutter/blob/master/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl#L33

should have a section similar to:

subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}

I have changed the plugin's output directory to ${rootProject.buildDir}/${pluginName} by changes for PR-94645., you can review this pr again.
Thanks @blasten

@blasten
Copy link

blasten commented Dec 7, 2021

can we add the subproject logic below this line https://github.com/flutter/flutter/blob/master/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl#L33?

The reason is that the file you are changing is also used for other case where this change may or may not make sense.

@chunfengyao
Copy link
Contributor Author

can we add the subproject logic below this line https://github.com/flutter/flutter/blob/master/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/build.gradle.tmpl#L33?

The reason is that the file you are changing is also used for other case where this change may or may not make sense.

In some case, the host gradle project may dependent the plugin's native module directly. and the templete may not work for this case.

such as:
We add flutter_aliplayer to flutter project's pubspec.yaml. and sync the host project's gradle file. and then we will see a native module named :flutter_aliplayer appear in module list, and then we can let host project dependent this module(sometime, this can aviod some .so library conflict).

@chunfengyao
Copy link
Contributor Author

@blasten
Is the ${flutterModule}/build/host/${pluginName} was a better directory I could use for this?

@chunfengyao chunfengyao requested a review from blasten December 9, 2021 07:28
@chunfengyao
Copy link
Contributor Author

Hi~ @blasten
The forked repo has add access for you. please have a look at this pull request.
Thanks very much.

@chunfengyao chunfengyao requested a review from blasten January 11, 2022 02:16
@skia-gold
Copy link

Gold has detected about 6 new digest(s) on patchset 4.
View them at https://flutter-gold.skia.org/cl/github/94645

@christopherfujino
Copy link
Contributor

@blasten can you take a look at this PR?

@christopherfujino
Copy link
Contributor

@blasten friendly ping
@chunfengyao to get the customer_testing-linux CI check to pass, you will have to rebase (not merge) upstream master.

@chunfengyao chunfengyao force-pushed the chunfengyao-patch-for-issue-92252 branch from 9e2a8a6 to eb7747f Compare February 20, 2022 12:53
@chunfengyao
Copy link
Contributor Author

@blasten friendly ping @chunfengyao to get the customer_testing-linux CI check to pass, you will have to rebase (not merge) upstream master.

thanks for tips, I rebased the branch with latest master.

@chunfengyao chunfengyao force-pushed the chunfengyao-patch-for-issue-92252 branch from fdcc969 to 7c77d36 Compare February 23, 2022 02:15
Copy link

@blasten blasten left a comment

Choose a reason for hiding this comment

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

needs test

@blasten
Copy link

blasten commented Mar 14, 2022

@google-cla google-cla bot added cla: no and removed cla: yes labels Mar 16, 2022
@chunfengyao
Copy link
Contributor Author

For the test, https://github.com/flutter/flutter/blob/master/packages/flutter_tools/test/integration.shard/android_plugin_compilesdkversion_mismatch_test.dart is an example of how Gradle intergrations are currently tested.

@blasten I have ran the test , and got no error.

/Volumes/Storage/AS_WS/flutter_issue_handle/bin/cache/dart-sdk/bin/dart run test -r json /Volumes/Storage/AS_WS/flutter_issue_handle/packages/flutter_tools/test/integration.shard/android_plugin_compilesdkversion_mismatch_test.dart
Testing started at 11:57 ...

Process finished with exit code 0

@chunfengyao chunfengyao force-pushed the chunfengyao-patch-for-issue-92252 branch from e6b1b6f to e4edc3a Compare March 16, 2022 04:06
@chunfengyao chunfengyao force-pushed the chunfengyao-patch-for-issue-92252 branch from ca50ebc to 40954ef Compare September 5, 2022 06:09
@chunfengyao chunfengyao requested review from stuartmorgan-g and removed request for GaryQian September 5, 2022 06:59
@chunfengyao
Copy link
Contributor Author

chunfengyao commented Sep 5, 2022

@GaryQian should review this as well.

I clicked the re-request review button, and github removed @GaryQian . @stuartmorgan maybe you can request review again. Thanks.

@GaryQian GaryQian self-requested a review September 5, 2022 13:14
@GaryQian
Copy link
Contributor

GaryQian commented Sep 13, 2022

@stuartmorgan So in Gradle, the : indicates that something is a subproject of something else. :blah represents a root project, while hello:blah represents a project hello with a subproject blah. Since the code here is specifically a subproject of the root project, the .name property should not return a "path" style value with colons. Instead, subprojects of subprojects are to be found in the .subprojects property. Thus, we should not expect to find colons in subproject.name and the colon parsing/replacement is not necessary.

@stuartmorgan-g
Copy link
Contributor

Thanks for that explanation!

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 14, 2022
@auto-submit auto-submit bot merged commit 148a0b2 into flutter:master Sep 14, 2022
@chunfengyao
Copy link
Contributor Author

@stuartmorgan So in Gradle, the : indicates that something is a subproject of something else. :blah represents a root project, while hello:blah represents a project hello with a subproject blah. Since the code here is specifically a subproject of the root project, the .name property should not return a "path" style value with colons. Instead, subprojects of subprojects are to be found in the .subprojects property. Thus, we should not expect to find colons in subproject.name and the colon parsing/replacement is not necessary.

It has been discussed at the beginning of this PR.
But from the docs provided by Gradle, It seems that colons was used in gradle task's name to split project's name and action. (I'm not familiar with the detail of gradle task.)
And I don't remember whether the colon was before subproject's name acturally , or the first version of this PR uses the task's name as the plugin name?
But CI check passed when I removed the colons replacement.

Thanks for everyone who helped this PR!

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Sep 15, 2022
@chunfengyao chunfengyao deleted the chunfengyao-patch-for-issue-92252 branch September 26, 2022 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android]: running multiple tasks simultaneously throws file not found exception.
8 participants