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

Add support for profiling and benchmarking Android Studio sync #259

Merged
merged 15 commits into from
Sep 21, 2020

Conversation

adammurdoch
Copy link
Member

Replaces the previous "sync mock" with a real sync triggered from Android Studio.

Introduces a new "Gradle client" implementation that runs Studio with an agent that intercepts calls to the tooling API in order to inject the correct settings and collect duration information.

This initial implementation has a few limitations:

  1. A human still needs to trigger sync in Studio. The profiler displays instructions on the console.
  2. It only works on macOS for now.

These are things that could be improved in the future.

Copy link
Member

@eskatos eskatos left a comment

Choose a reason for hiding this comment

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

I just did a quick first pass at the changes. I can confirm it fails gracefully on Linux. Will give it a try on a mac later Today.

buildSrc/build.gradle.kts Outdated Show resolved Hide resolved
buildSrc/src/main/kotlin/profiler.java-library.gradle.kts Outdated Show resolved Hide resolved
@eskatos
Copy link
Member

eskatos commented Sep 18, 2020

Tried on a mac against Studio 4.2 Canary 11 installed via the JetBrains Toolbox and I got:

* Starting Android Studio at /Users/paul/Applications/JetBrains Toolbox/Android Studio Canary.app
java.lang.IllegalStateException: Expected object at line 9, found "

    ".
	at org.gradle.profiler.studio.LauncherConfigurationParser$PListParser.broken(LauncherConfigurationParser.java:189)
	at org.gradle.profiler.studio.LauncherConfigurationParser$PListParser.readObject(LauncherConfigurationParser.java:140)
	at org.gradle.profiler.studio.LauncherConfigurationParser$PListParser.dictEntries(LauncherConfigurationParser.java:103)
	at org.gradle.profiler.studio.LauncherConfigurationParser$PListParser.plist(LauncherConfigurationParser.java:92)
	at org.gradle.profiler.studio.LauncherConfigurationParser$PListParser.parse(LauncherConfigurationParser.java:82)
	at org.gradle.profiler.studio.LauncherConfigurationParser.calculate(LauncherConfigurationParser.java:20)
	at org.gradle.profiler.studio.StudioGradleClient.<init>(StudioGradleClient.java:28)
	at org.gradle.profiler.GradleClientSpec$4.create(GradleClientSpec.java:64)
	at org.gradle.profiler.GradleScenarioInvoker.doRun(GradleScenarioInvoker.java:69)
	at org.gradle.profiler.GradleScenarioInvoker.doRun(GradleScenarioInvoker.java:21)
	at org.gradle.profiler.ScenarioInvoker.run(ScenarioInvoker.java:20)
	at org.gradle.profiler.Main.invoke(Main.java:110)
	at org.gradle.profiler.Main.run(Main.java:76)
	at org.gradle.profiler.Main.main(Main.java:18)

Here's theContents/Info.plist file https://gist.github.com/eskatos/c8f305f890ddf422298aecaf86381f6d

@eskatos
Copy link
Member

eskatos commented Sep 18, 2020

Exact same problem with 4.1 RC3 or 4.0.

@adammurdoch
Copy link
Member Author

I've switched to using the dd-plist library. Can you try this again?

@adammurdoch
Copy link
Member Author

I've addressed the review comments. I'm going to merge this, and we can do any fixes in a follow up PR.

@adammurdoch adammurdoch merged commit e8e73f6 into master Sep 21, 2020
@eskatos
Copy link
Member

eskatos commented Sep 22, 2020

@adammurdoch with the changes in #268 I was able to make it work

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

Successfully merging this pull request may close these issues.

None yet

2 participants