Giter VIP home page Giter VIP logo

patilshreyas / compose-report-to-html Goto Github PK

View Code? Open in Web Editor NEW
325.0 4.0 7.0 1.99 MB

A utility (Gradle Plugin + CLI) to convert Jetpack Compose compiler metrics and reports to beautified HTML page.

Home Page: https://patilshreyas.github.io/compose-report-to-html/

License: MIT License

Kotlin 100.00%
android cli command-line command-line-tool compose jetpack jetpack-compose kotlin reporting-tool kotlin-android

compose-report-to-html's Introduction

Hi there👋! I'm Shreyas 🙋‍♂️

LATEST UPDATE: Exploring Android Jetpack Compose and Backend stuff with Kotlin 🥽.

🎍 Welcome to my hub 👨‍💻

  • 👦 Google Developer Expert @Android
  • 💼 Sr. Android Developer @ Paytm.
  • 👨‍💻 #SelfTaught Developer.
  • 👨‍💻 I develop Mobile, Web apps and can also develop Backend server for apps.
  • ✍️ Write blogs on blog.shreyaspatil.dev.
  • Loves 🎵 and 🎹.
  • Proud 🇮🇳.

📊 Github Stats

Shreyas Patil | Stats


🔗 Know more about me

Portfolio Mail Twitter Linkedin Medium Google Play Instagram

compose-report-to-html's People

Contributors

dependabot[bot] avatar eygraber avatar imgbotapp avatar msya avatar patilshreyas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

compose-report-to-html's Issues

Composables reports table is missing some non-skippable composables

It looks like some composables can't be parsed from the composables.tx file.

Example with a lambda that has parameters.

restartable scheme("[androidx.compose.ui.UiComposable]") fun MyComposable(
  unstable periods: List<DataClass>
  stable selectedPeriod: DataClass
  stable onPeriodSelected: Function2<@[ParameterName(name = 'myList')] List<DataClass>, @[ParameterName(name = 'mySingleItem')] DataClass, Unit>
  stable onCloseClicked: Function0<Unit>
)

Example with missing stability information

restartable scheme("[androidx.compose.ui.UiComposable]") fun ComposableTwo(
  stable modifier: Modifier? = @static Companion
  data: SomeDataClass
)

Would be awesome if you could take a look at this.

Thanks,
Andi

ComposeViews not appear in reports

I have a lot of <androidx.compose.ui.platform.ComposeView/> in my code base.
But in the reports of releaseComposeCompilerHtmlReport or other reports, none of them appear in the report. Is there something I missed doing or this type of user can't be detected now?
Also, I have some activities which completely are compose, None of them are recognized!
image

Gradle plugin does not work with Configuration Cache

When trying to run the plugins tasks with configuration cache enabled i get this error:

Configuration cache state could not be cached: field `overrideFieldAccessor` of `java.lang.reflect.Field` bean found in field `overrideField` of `com.google.gson.internal.reflect.UnsafeReflectionAccessor` bean found in field `accessor` of `com.google.gson.internal.ConstructorConstructor` bean found in field `constructorConstructor` of `com.google.gson.Gson` bean found in field `mGson` of `com.android.build.gradle.internal.errors.MessageReceiverImpl` bean found in field `messageReceiverImpl` of `com.android.build.gradle.internal.errors.SyncIssueReporterImpl` bean found in field `issueReporter` of `com.android.build.gradle.internal.errors.DeprecationReporterImpl` bean found in field `deprecationReporter` of `com.android.build.gradle.internal.services.ProjectServices` bean found in field `projectServices` of `com.android.build.gradle.internal.tasks.factory.BootClasspathConfigImpl` bean found in field `value` of `kotlin.InitializedLazyImpl` bean found in field `bootClasspathConfig$delegate` of `com.android.build.gradle.internal.plugins.LibraryPlugin` bean found in field `this$0` of `com.android.build.gradle.internal.plugins.BasePlugin$dslServices$2$1` bean found in field `versionedSdkLoaderServiceProvider` of `com.android.build.gradle.internal.services.DslServicesImpl` bean found in field `dslServices` of `com.android.build.gradle.internal.dsl.CmakeOptions$AgpDecorated` bean found in field `__cmake` of `com.android.build.gradle.internal.dsl.ExternalNativeBuild$AgpDecorated` bean found in field `__externalNativeBuild` of `com.android.build.gradle.internal.dsl.LibraryExtensionImpl$AgpDecorated` bean found in field `dslExtension` of `com.android.build.gradle.internal.VariantManager` bean found in field `this$0` of `com.android.build.gradle.internal.VariantManager$createVariant$variantDslInfoBuilder$1` bean found in field `manifestParsingAllowed` of `com.android.build.gradle.internal.manifest.LazyManifestParser` bean found in field `dataProvider` of `com.android.build.gradle.internal.core.dsl.impl.LibraryVariantDslInfoImpl` bean found in field `dslInfo` of `com.android.build.api.component.impl.ConsumableCreationConfigImpl` bean found in field `value` of `kotlin.InitializedLazyImpl` bean found in field `delegate$delegate` of `com.android.build.api.variant.impl.LibraryVariantImpl` bean found in field `$variant` of `dev.shreyaspatil.composeCompilerMetricsGenerator.plugin.task.ComposeCompilerReportGenerateTaskKt$createComposeCompilerReportGenTaskForVariant$1` bean found in field `this$0` of `dev.shreyaspatil.composeCompilerMetricsGenerator.plugin.task.ComposeCompilerReportGenerateTaskKt$createComposeCompilerReportGenTaskForVariant$1$1` bean found in field `action` of `org.gradle.api.internal.AbstractTask$TaskActionWrapper` bean found in field `actions` of task `:core:ui:releaseComposeCompilerHtmlReport` of type `org.gradle.api.tasks.GradleBuild`: error writing value of type 'jdk.internal.reflect.UnsafeBooleanFieldAccessorImpl'
> Unable to make field protected final java.lang.reflect.Field jdk.internal.reflect.UnsafeFieldAccessorImpl.field accessible: module java.base does not "opens jdk.internal.reflect" to unnamed module @23a452a5

Character encoding issue in the generated HTML

Hello!

I've encountered a character encoding issue in the HTML output generated. This issue is causing misrepresentation of certain characters in the generated HTML file.

Examples:

� Non Skippable ✅ Restartable
â�Œ Non Skippable â�Œ Non Restartable
✅ Skippable ✅ Restartable
� Unstable class MyClass

Examples:
image
image

Could you please shed some light on how I can overcome this problem?

Thank you!

Conflict with Apollo GraphQL

Greetings! Thank you for this amazing library but I can't seem to get it working in project with Apollo GraphQL (AppSync SDK).

Getting the following error executing devDebugComposeCompilerHtmlReport:

Cannot serialize Kotlin type com.apollographql.apollo.compiler.ir.CodeGenerationIR. Reflective serialization of Kotlin classes without using kotlin-reflect has undefined and unexpected behavior. Please use KotlinJsonAdapterFactory from the moshi-kotlin artifact or use code gen from the moshi-kotlin-codegen artifact.

Could you attempt to use KotlinJsonAdapterFactory or allow us to configure if we want to use Moshi or Gson?

Thank you!

Report Generation for Composables fails on dirty content generated by the compiler

Sometimes, compose compiler generates this kind of content in -composables.txt metric, which then this utility's parser fails to parse.

 stable itemContent: Function3<User, Composer, Int, Unit>? = @static composableLambda($composer, 1578247068, true) { user: User, $composer: Composer?, $changed: Int ->
  sourceInformation  (  $composer  ,   "C43@1680L140:UserList.kt#9ot79p"  )  
  val   $dirty   =   $changed  
  if (  $changed   and   0b1110   ===   0  ) {
    $dirty     =     $dirty     or     if (    $composer    .    changed    (    user    )    )     0b0100     else     0b0010
  }
  
  if (  $dirty   and   0b01011011   !==   0b00010010   ||   !  $composer  .  skipping  ) {
    if (    isTraceInProgress    (    )    ) {
      traceEventStart      (      1578247068      ,       $dirty      ,       -1      ,       "com.example.android.UsersList.<anonymous> (UserList.kt:42)"      )
    }
    
    DefaultUser    (    user    ,     onUserSelected    ,     expanded    ,     $composer    ,     0b1110     and     $dirty     or     0b01110000     and     $dirty     shr     0b0110     or     0b001110000000     and     $dirty    )    
    if (    isTraceInProgress    (    )    ) {
      traceEventEnd      (      )
    }

  } else {
    $composer    .    skipToGroupEnd    (    )
  }

Generate unit report sections in separate HTML files

Currently, the report is generated in a single file which is not convenient to refer to in a vast project. So if the report is divided across multiple files based on the metrics sections, it would be very nice.

Gradle plugin doesn't work with Compose Multiplatform 1.5.0-beta02

I tried to apply it to Compose Multiplatform 1.5.0-beta02 and got this:

An exception occurred applying plugin request [id: 'org.jetbrains.compose', version: '1.5.0-beta02']
> Failed to apply plugin 'org.jetbrains.compose'.
   > Shared build service 'org.jetbrains.compose.ComposeMultiplatformBuildService' has unexpected type: org.jetbrains.compose.ComposeMultiplatformBuildService$Inject

[CLI] Feature request: Don't download Java when running the NPM artifact

Even if I run with JAVA_HOME pointed at a java 11 installation, it still tries to download one on the fly.

$ composeReport2Html -app STAR -overallStatsReport samples/star/build/compose_metrics/star_release-module.json -detailedStatsMetrics samples/star/build/compose_metrics/star_release-composables.csv -composableMetrics samples/star/build/compose_metrics/star_release-composables.txt -classMetrics samples/star/build/compose_metrics/star_release-classes.txt -o tmp
Downloading java runtime environment for version 11

Cannot include build 'build-logic' in build 'module_name_here'. This is not supported yet.

I'm trying to run the gradle plugin on some of my modules. Since we are using gradle conventions (which are in the gradle project named build-logic) i applied plugin globally in root build.gradle like this:

alias libs.plugins.composeCompilerReportGenerator apply false

And then i apply the plugin only in selected modules via convention file, like this:

plugins {
    id 'dev.shreyaspatil.compose-compiler-report-generator'
}

When i do that i get the error:

Cannot include build 'build-logic' in build 'module_name_here'. This is not supported yet.

When i apply plugin directly on a module i want to generate reports on i have the same exact issue. For some reason this plugin does not like composite builds

Feature request: remove required m2 repositories

Greetings!

We have a following problem in our company:

  1. We have a Nexus mirror which caches all dependencies downloaded by Android projects;
  2. We have a runner with no internet connection (it can only get data from Nexus);
  3. When building the project, the plugin demands downloading core package from m2;
  4. Build fails because it can't reach m2 maven repository.

Is there any way to remove a requirement of using m2 and other dependencies and get them from the host project instead?

Task `:app:debugComposeCompilerHtmlReport` of type `dev.shreyaspatil.composeCompilerMetricsGenerator.plugin.task.ComposeCompilerReportGenerateTask`: invocation of 'Task.project' at execution time is unsupported.

Unfortunetly I am not able to use the gradle plugin :S Is this tool even maintaned ?

FAILURE: Build failed with an exception.

* What went wrong:
Configuration cache problems found in this build.

1 problem was found storing the configuration cache.
- Task `:app:debugComposeCompilerHtmlReport` of type `dev.shreyaspatil.composeCompilerMetricsGenerator.plugin.task.ComposeCompilerReportGenerateTask`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/8.4/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution

See the complete report at file:///Users/n355021/Documents/GitHub/android-poland/build/reports/configuration-cache/4q3ixo9z57h0bsyonfmkm8m9m/4eynj1pbh1z8w28vx3yye1h37/configuration-cache-report.html
> Invocation of 'Task.project' by task ':app:debugComposeCompilerHtmlReport' at execution time is unsupported.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.


Print file paths as file URIs

The current output of running the Gradle task is:

Checking directory '/home/eli/workspace/portal/samples/kotlin-inject/android-app/build/compose_report/raw'
Checking file '/home/eli/workspace/portal/samples/kotlin-inject/android-app/build/compose_report/raw/android-app_release-module.json'
Checking file '/home/eli/workspace/portal/samples/kotlin-inject/android-app/build/compose_report/raw/android-app_release-composables.csv'
Checking file '/home/eli/workspace/portal/samples/kotlin-inject/android-app/build/compose_report/raw/android-app_release-composables.txt'
Checking file '/home/eli/workspace/portal/samples/kotlin-inject/android-app/build/compose_report/raw/android-app_release-classes.txt'
Compose Compiler report is generated: /home/eli/workspace/portal/samples/kotlin-inject/android-app/build/compose_report/index.html

If a file:// URI is used I believe the IDE will linkify them so it could be opened in the browser.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.