-
Notifications
You must be signed in to change notification settings - Fork 0
Summer 2017 #22
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
base: ss-config-n2
Are you sure you want to change the base?
Summer 2017 #22
Conversation
Improve README, fix grammatical errors in comments, fixed bug in UmpleGradlePlugin.groovy that was causing an IllegalArugmentException to be thrown when relativize was called, bug fixes relating to the integrationTest task.
|
|
||
|
|
||
| // TODO this should not be neccesary. Find out why compileUmple is returning "UP-TO-DATE" when the output files have been deleted. | ||
| compileUmple { |
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 should get rid of this work around before merging this PR.
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 TODO should be fixed by using IncrementalTaskInputs. You can see how I used them here: https://github.com/assertj/assertj-generator-gradle-plugin/blob/9f0ec19e910a3d7a4add5de461481454688063d8/src/main/groovy/org/assertj/generator/gradle/tasks/AssertJGenerationTask.groovy#L67
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'm not sure if IncrementalTaskInputs are the answer. The problem isn't that gradle is mistaking a modified/removed input file for an unmodified input file, the problem is that gradle isn't checking whether generated/output files (i.e. java files) exist when it does it's "up to date" check for the compileUmple task. We really just need gradle to check to see if the output files have been removed, and if they have, to rerun the generation task.
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.
That's what IncrementalTaskInputs does. If you register all of the produced files with ITI, it will remove/update them when required.
- Made the `compileUmple` task be finalized by the `compileJava` task. This allows the user to run `compileUmple` to generate java files and compile them (so long as the `compileGenerated` flag is set). Before, `compileJava` depended on `compileUmple`, which meant that `compileJava` needed to be executed in order for generation and compilation to occur. This changes also makes the integrationTest task a bit simplier.
|
I made another commit today, small but important bug fix for the way generation followed by compilation works. |
| /** | ||
| * Created by kevin on 15/03/2017. | ||
| */ | ||
| class UmpleGenerateTask extends SourceTask { |
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.
@Nava2 The incremental build stuff appears to be working now. I think this branch can be merged into ss-config-n2, now?
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 don't think that this is properly implemented. I think Gradle needs to know all files that are generated. We either need to keep track of the files created or figure out a way to have Umple tell us what files it will change/create. The intention of the incremental updates is that gradle can choose whether or not to generate new files and also what files to delete.
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 think Gradle needs to know all files that are generated
Doesn't the outputDirs member variable tell it that?
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.
As far as I can tell, other than the "nice to have" refactoring of integrationTest, this is the only real issue that needs to be resolved before merging this branch. What do you think of my earlier comment? I agree the current implementation looks a bit funky, but by setting up the outputDirs member variable like that, doesn't Gradle know where all the generated files will be?
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.
No because it needs to know the files directly. Thats what the incremental input files parameter does.
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.
Looking at the example here: https://docs.gradle.org/3.1/javadoc/org/gradle/api/tasks/incremental/IncrementalTaskInputs.html
What if we have an inputDirs member variable that contains the locations of each of the master files in addition to the outputDirs member variable that we have now? Then we'd basically just copy the if (!inputs.incremental) and inputs.outOfDate... stuff from the example... and hopefully we'd be on our way.
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.
Yes, somewhat. That assumes that we want to always change all files. I don't think we have another choice. The way the umple compiler works requires us to regenerate the entire tree no matter what file changes.
So yeah, that should be the best we can do, but not the ideal case. 🙂
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.
Getting the incremental build stuff working for the integration tests is proving tricky. It works after I rebuild the plugin, but if I don't rebuild it the generation phase gets skipped while the verification step runs anyway (!!?!?!?!), which causes the test to fail. Even better is that the printing to standard out stuff seems to largely be broken for the integration tests, so I'm more or less doing everything blind. It might have something to do with the fact that we're using the test-sets plugin for integrationTest, but I'm really not sure. It looks like I might be able to use GenerationTests.groovy as a template if I can figure how to hook everything together.
On an unrelated note, I'll be starting my final semester on Tuesday. I'm not sure how much time I'll have to contribute to this project over the semester, but I'll do my best to pop in every now and again.
The only thing I can think is to try and convert integrationTest into a "normal" test (using Project Runner). I'm not sure how to go about doing that, though. How are the current tests (CheckGlobals.groovy etc) hooked into the test task?
| void setOutputDirs(UmpleOptions newOpts) { | ||
| this.outputDirs = new ArrayList<File>() | ||
|
|
||
| UmpleOptions opts = newOpts |
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 used the logic in execute as the basis for the logic here. I noticed that in execute we make a copy of the UmpleOptions (in setOutputDirs we do UmpleOptions opts = newOpts). Is this copy necessary? I don't think we're changing the UmpleOption object.
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.
99% sure that's referential copy so it does literally nothing.
|
@Nava2 I've been looking into the Travis failure. The Linux build is working fine, but on Mac there's an assertion error here:
I read on the travis site that: "Groovy builds are not available on the OS X environment." (https://docs.travis-ci.com/user/languages/groovy/). So how about we just remove the Mac stuff from Travis? |
|
@AdamBJ I can't get to this till Tuesday I think. Defence + some personal things. Bump this if you don't hear from me by then, though. |
|
Regarding the OSX build, it's probably installable via homebrew, |
|
Good luck on Monday! |
|
Bump! Hope the thesis defence went well. |
Nava2
left a comment
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.
Looking for some more feedback on this. But I'd also love to get this branch removed and some work into the master branch instead.
| classpath files('libs/umple-latest.jar') | ||
| //TODO update {CURRENT_VERSION} to the version of the plugin you're using | ||
| classpath "umple.gradle.plugin:UmpleGradlePlugin-{CURRENT_VERSION}" | ||
| classpath group: 'com.google.guava', name: 'guava', version: '21.0' |
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.
Should probably make this 22.
| @@ -0,0 +1 @@ | |||
| Put the umple jar in this folder. It should be named umple-latest.jar. No newline at end of file | |||
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 use git-lfs if necessary here, but ideally we need to package umple for ivy/maven and ship it that way.
| @@ -8,9 +8,8 @@ buildscript { | |||
| dependencies { | |||
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.
Do we still need the integrationTest projects as we use the project via the gradle test runner?
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 think we could convert it from the current style to the gradle test runner style we use for everything else (e.g. have the build file included within CompilationAndGeneration.groovy). I'm not 100% sure how it would work, though, since it's one of the more complicated tests (there are subprojects with their own build files, etc). I'd say it would be a "nice to have" feature to have a more consistent testing approach, but that it's probably not worth the effort to switch it over.
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.
And to be clear, I don't think we use the integrationTest project outside of CompilationAndGeneration.groovy.
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.
Yeah, I don't think its necessary -- we should be able to use the groovy test runner + temp folders.
| project.tasks.getByName(sourceSet.compileJavaTaskName).dependsOn umpleGenerate | ||
| // The user has requested that generated Java files are compiled. Make sure | ||
| // the compileJava task runs after the compileUmple task | ||
| umpleGenerate.finalizedBy project.tasks.getByName(sourceSet.compileJavaTaskName) |
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 over using the umple compile mechanics? If so, I much prefer this -- use Gradle to it's advantage.
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.
Yeah, when it comes to compiling Java files we don't (and never have as far as I can tell) use the Umple mechanic. This change makes it so the user can set the compileGenerated flag and invoke the compileUmple task in order to generate and compile. Before the user had to use compileJava if they wanted to compile the generated source. It made the compileGenerated flag redundant.
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 think this should be on by default -- which it is! I can't think of a reason to have it be off by default.
| void setOutputDirs(UmpleOptions newOpts) { | ||
| this.outputDirs = new ArrayList<File>() | ||
|
|
||
| UmpleOptions opts = newOpts |
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.
99% sure that's referential copy so it does literally nothing.
| /** | ||
| * Created by kevin on 15/03/2017. | ||
| */ | ||
| class UmpleGenerateTask extends SourceTask { |
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 don't think that this is properly implemented. I think Gradle needs to know all files that are generated. We either need to keep track of the files created or figure out a way to have Umple tell us what files it will change/create. The intention of the incremental updates is that gradle can choose whether or not to generate new files and also what files to delete.
|
I had this email marked unread because I had to do something.. but I don't know what. Is there something that's needed here other than the comments I've made? I can investigate the mac build. |
|
Comment I didn't make before, change |
I think just that business with the incremental build. I'll have another look at that now. Great to see Travis green again! |
Still not green. :( There's an issue with tests on OS X, not sure why. I'm going to look into that when I finish some other work. |
This PR improves upon the README, fixes grammatical errors in comments, fixes a bug in UmpleGradlePlugin.groovy that was causing an
IllegalArugmentExceptionto be thrown whenrelativizewas called, and includes bug fixes relating to the integrationTest task (we should now once again be able to make the integration tests a normal part of the build process).This branch isn't quite ready to be merged yet, have a look at line 27 of TestProject's
build.gradlefile (src/integrationTest/resources/TestProject/build.gradle). For some reason gradle thinks that the outputs of thecompileUmpletask are up-to-date all the time, even if the output files have been deleted. I was only able to get it working by apply the band aid you see starting at line 27. I was looking here to try and figure out what the problem was, but no luck yet. I think the solution may be annotatingUmpleGenerateTaskdifferently?