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

Prevent running unnecesarily #161

Closed
r89m opened this issue Jul 27, 2017 · 8 comments
Closed

Prevent running unnecesarily #161

r89m opened this issue Jul 27, 2017 · 8 comments

Comments

@r89m
Copy link

r89m commented Jul 27, 2017

Hi Vojtěch,

Thanks for you tool - I've been finding it really useful.

One issue I've been having it that it runs a bit too often (on every build) due to the addition of the generateTypeScript tasks as a dependency on the classes tasks here:
https://github.com/vojtechhabarta/typescript-generator/blob/master/typescript-generator-gradle-plugin/src/main/java/cz/habarta/typescript/generator/gradle/TypeScriptGeneratorPlugin.java#L14-L16

Is there a reason for this, or would it be possible to configure it to not always run?
At the moment I'm doing classes.dependsOn.remove(generateTypeScript) which works but feels like a work around. I'd love it if I could configure it to only run when I call generateTypeScript

Thanks,

Richard

@vojtechhabarta
Copy link
Owner

Hi Richard, thanks for using the tool.

In Maven it is possible to configure typescript-generator either to run in each build or only on demand.
But I don't how Gradle works. Maybe somebody can comment or make PR with some improvement?

@r89m
Copy link
Author

r89m commented Jul 27, 2017

I'd possibly suggest removing the lines referenced above, then any users who want the tool to run on every build can add classes.dependsOn(generateTypeScript) to their build.gradle as that's the way task dependencies are configured in Gradle.

@vojtechhabarta
Copy link
Owner

This would be incompatible change. Lets wait for more feedback on this issue.

@jtoplak
Copy link
Contributor

jtoplak commented Nov 12, 2017

I agree that running the tool on every build is overkill. It would be preferable to run generateTypescript on demand. If your concerned about making a breaking change, what about adding another setting property like onBuild = false (default to true) that bypasses the task on build? I would be willing to make the enhancement if everyone thought this was an acceptable solution

@jechlin
Copy link

jechlin commented Dec 29, 2017

Isn't the problem here just that the inputs and outputs are not declared, so gradle can't work out whether to skip it? Typically you would have the task run every time, but gradle will skip it if the inputs and outputs are not changed.

@vojtechhabarta
Copy link
Owner

@jechlin yes, automatically determining whether generateTypeScript task needs to be invoked is complicated or impossible but if I understand it correctly original request was just to allow to invoke generateTypeScript task manually when needed.

@vojtechhabarta
Copy link
Owner

@r89m I just pushed commit which removed setting dependency on generateTypeScript task.
Is it what is needed?

@r89m
Copy link
Author

r89m commented Jan 5, 2018

Perfect. It may be worth adding a note under the Gradle section of the readme outlining how to call the task, ie gradle generateTypeScript just to get people started.

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

No branches or pull requests

4 participants