-
Notifications
You must be signed in to change notification settings - Fork 238
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 output directory of all compile* tasks to typescript-gen classpath #205
Conversation
Add samples for groovy, kotlin and scala to sample gradle file. In addition, use the gradle wrapper to allow easily switching the gradle version.
In cz.habarta.typescript.generator.gradle.TypeScriptGeneratorPlugin I replaced "classes" task with "build" task, to avoid problems with circular dependencies. However typically the ts generation should happen before the js-compile stage, eg webpack or whatever. But we don't know the task where the ts files will be used. It may be better just to have the user specify the dependencies themselves in their build file, eg
and
etc. That's what I do. But that would be a breaking change I guess so over to you. Not totally confident in these changes, most of them are just samples to check the plugin works properly. You may want to take only changes to cz.habarta.typescript.generator.gradle.GenerateTask.
I don't think that's an issue. If you want 4 languages in your project you should be able to write interface definitions in any of the languages, and it's only one directory per language we are adding.
I think the easiest thing would be to allow to specify the classes output directory in the config, rather than the tasks. Eg classesDir = "$buildDir/classes/kotlin/main". Easy change but I didn't do it... |
One final thing - the scala class doesn't produce any interface members, but I'm sure that's because I don't know how to write the scala class rather than any other problem. |
Thanks @jechlin for this PR. It seems that this also relates to #161, pinging @r89m, @jtoplak, if you want to comment. I would merge this PR without changes now and for typescript-generator version 2.0 (which I plan soon for #186) I would
What do you think? |
The problem then is the task won't run unless you explicitly specify the task in the gradle command line, eg:
because without that, there will be nothing that depends on generateTypeScript. @r89m seems to be saying the same thing as me, which is just to avoid adding the dependencies and letting the users specify them in the build file via dependsOn etc. But I guess that is a breaking change. Most other plugins don't insert their tasks into the lifecycle. |
@jechlin yes, this would be breaking change (so I would wait with it till 2.0). I understand that |
No, that is what I mean. But if they have to do that isn't that the same breaking change as making them specify |
Yes, the same kind of breaking change, but I think that |
I'm not sure... I was trying to think of any task that would generate class files that wasn't a compile* task, and I couldn't. Therefore it seems to make sense to have the generateTsTask dependent on the compile* tasks, otherwise the user will always have to add that. So I would keep that and remove the classes.dependsOn(generateTs). |
Hi Jamie, |
Hi again, |
Add samples for groovy, kotlin and scala to sample gradle file. In
addition, use the gradle wrapper to allow easily switching the gradle
version.
Note: An easy way for anyone who has the problem this fixes to test, is to use https://jitpack.io/.
Add to the end of your buildScript.repositories:
And replace the plugin dependency with: