Skip to content

Refactor the sample plugin.#26

Open
JackChen365 wants to merge 2 commits into
devfrom
jack/refactor_the_sample_plugin
Open

Refactor the sample plugin.#26
JackChen365 wants to merge 2 commits into
devfrom
jack/refactor_the_sample_plugin

Conversation

@JackChen365
Copy link
Copy Markdown
Owner

@JackChen365 JackChen365 commented Sep 3, 2022

Main changes

  • Add a PreTransformClassesWithAsmTask to read cache from PostTransformClassesWithAsmTask
  • Generate configuration cache and write it to an intermediate file.

Use TransformClassesWithAsm outputs to determine which class is deleted.

    val transformOutputDirs = transformOutputsProvider.get()
    val classFileList =
      transformOutputDirs.flatMap { it.walk().filter { classFile -> classFile.name.endsWith(".class") } }
    val sampleList = SampleClassHandler.getSampleList().toMutableList()
    sampleList.removeIf { item ->
      val classPath = item.className.replace('.', '/')
      classFileList.none { it.absolutePath.endsWith("$classPath.class") }
    }
    val extensionList = SampleClassHandler.getExtensionList().toMutableList()
    extensionList.removeIf { item ->
      val classPath = item.className.replace('.', '/')
      classFileList.none { it.absolutePath.endsWith("$classPath.class") }
    }
  • Move all the configuration-related code into PostTransformClassesWithAsmTask

How to test it

Run `test plugin with incremental` method at least twice to check the output result.

@JackChen365 JackChen365 requested a review from Airsaid September 3, 2022 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant