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

Configuration Cache fix for GenerateTask #1006

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

IgorDomagala
Copy link

Using typescript-plugin (v3.2.1263) with configuration cache enabled results in error:

type `cz.habarta.typescript.generator.gradle.GenerateTask`: cannot serialize object of type 'org.gradle.api.tasks.compile.JavaCompile', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.

and many more, mostly because GenerateTask uses variable "project" directly.

You can reproduce this error by running ./gradlew --configuration-cache --rerun-tasks assemble .

This pull request fixes it by changing way of class loading and getting classpath.
This PR also adds Gradle configuration cache test.

@vojtechhabarta
Copy link
Owner

This project currently supports Gradle version 5.6 but this PR is using Gradle 8. I think it is not reasonable to break compatibility for people who are still using older versions of Gradle. I would consider updating minimal Gradle version to 6.

@IgorDomagala
Copy link
Author

IgorDomagala commented Sep 14, 2023

I changed it to match your requirements ;)

@rouazana
Copy link

Hello, would you consider merging this PR?

@rouazana
Copy link

Hello @IgorDomagala

Thank you very much for your contribution!

After some testing it seems your PR is not compatible with customTypeMappings.

For example with this configuration

        customTypeMappings = listOf("com.hopwork.model.currency.CurrencyCode:CurrencyCode")
        customTypeAliases = listOf("CurrencyCode:string")

I get the following error:

Running TypeScriptGenerator version 3.2-SNAPSHOT-main-1006
Loading class javax.annotation.Nullable
Loading class com.hopwork.model.currency.CurrencyCode

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateTypeScript'.
> Failed to parse configured custom type mapping 'com.hopwork.model.currency.CurrencyCode:CurrencyCode': java.lang.ClassNotFoundException: com.hopwork.model.currency.CurrencyCode

Do you have an idea of what could cause this?

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.

None yet

3 participants