-
Notifications
You must be signed in to change notification settings - Fork 37
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
Migrate Makefile targets to Gradle tasks #105
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Also is @macisamuele happy with this setup?
build.gradle.kts
Outdated
dependsOn(gradle.includedBuild("gradle-plugin").task(":plugin:build")) | ||
dependsOn(gradle.includedBuild("gradle-plugin").task(":plugin:check")) | ||
dependsOn(subprojects.filter { it.name != "samples" }.map { it.tasks.named("assembleDebug") }) | ||
dependsOn(subprojects.filter { it.name != "samples" }.map { it.tasks.named("check") }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work at the moment, as you have to specify also the mustRunAfter
rules. In the current situation you're just saying that preMerge
depends on runHooks
, :plugin:build
, :plugin:check
, assembleDebug
, check
but you're not specifying the order.
This is also the reason why Travis is failing (he's running a one of a sample's check
before the generateSwagger
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also the reason why Travis is failing (he's running a one of a sample's check before the generateSwagger).
That was the point of this block int the root build.gradle.kts:
tasks.all {
if (name == "assembleDebug") {
dependsOn(tasks.named("generateSwagger"))
}
}
Except I forgot that the generated files are needed before the compile
task 🤦♂. So at the moment I think there's a race between compileKotlin
and generateSwagger
, both being dependencies of assembleDebug
. I hopefully fixed that here: b0e45e7#diff-392475fdf2bc320d17762ed97109a121R66
build.gradle.kts
Outdated
if (name == "assembleDebug") { | ||
// assembleDebug needs the generated files | ||
dependsOn(tasks.named("generateSwagger")) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can have this as part of the preMerge
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could but isn't it nice to have gradle regenerate the swagger files on-demand ?
I.e. you could run assembleDebug
, build
, compileMainReleaseeKotlin
, etc... and Gradle would make sure the generated files are up-to-date without having to run generateSwagger
first.
…kts. This makes KotlinCompile visible from the root projet. Use that to make all KotlinCompile tasks depend on GenerateSwagger
build.gradle.kts
Outdated
dependsOn(runHooks) | ||
dependsOn(gradle.includedBuild("gradle-plugin").task(":plugin:build")) | ||
dependsOn(gradle.includedBuild("gradle-plugin").task(":plugin:check")) | ||
dependsOn(subprojects.filter { it.name != "samples" }.map { it.tasks.named("assembleDebug") }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could maybe remove the "assembleDebug" there. The "check" test below already executes testDebugUnitTest
and testReleaseUnitTest
so it will compile the sources for both debug and release mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, let's remove it 👍
@martinbonnin ++ I'm not very familiar with gradle so I'll rely @cortinico for comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's just remove line 52 and we should be good to go!
build.gradle.kts
Outdated
dependsOn(runHooks) | ||
dependsOn(gradle.includedBuild("gradle-plugin").task(":plugin:build")) | ||
dependsOn(gradle.includedBuild("gradle-plugin").task(":plugin:check")) | ||
dependsOn(subprojects.filter { it.name != "samples" }.map { it.tasks.named("assembleDebug") }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, let's remove it 👍
…he `check` task below
Replace the Makefile targets with Gradle tasks: