-
-
Notifications
You must be signed in to change notification settings - Fork 286
Integrate intellij scala aspect integration testing into rules_scala #309
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
Integrate intellij scala aspect integration testing into rules_scala #309
Conversation
Can one of the admins verify this patch? |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
3aa1605
to
1068af6
Compare
CLAs look good, thanks! |
test this please |
Sorry -- the git clone failed. PR updated. I'll try setting up my own travis account to iterate on this tomorrow. |
Looks good now! |
test_run.sh
Outdated
cd intellij && git fetch && git pull | ||
fi | ||
git checkout "${intellij_git_tag}" | ||
bazel test --test_output=errors --incompatible_disallow_set_constructor=false --override_repository io_bazel_rules_scala=${rules_scala_dir} //aspect/testing/tests/src/com/google/idea/blaze/aspect/scala/... |
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.
you should quote ${rules_scala_dir}
in case it has whitespace
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.
Good idea, I'll update the PR.
test_run.sh
Outdated
intellij_git_tag=$1 | ||
rules_scala_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
|
||
if [[ "$runner" == "run_test_ci" ]]; then |
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 feels brittle. can you detect CI another way? maybe test -d intellij
?
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.
It doesn't rely on any Travis specific env variables, ci
is passed to the script and then runner
is set based upon that value so I can't see a situation where it would break nor be able to be handled across multiple ci environments.
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.
@kevingessner How about:
if [[ "$1" == "ci" ]]; then
That is one fewer level of indirection, at least.
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.
"brittle" in that, if someone changes the name of the run_test_ci
runner function, this will not error but will start behaving badly -- it'd be better if this was a reference to the function that was safe against changes.
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.
oh yeah, missed that. thanks!
I think @greggdonovan's latest is better.
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.
@greggdonovan can you change the above to if [[ "$1" == "ci" ]]; then
like you suggested?
Why is this brittle? That's how the script works
…On Tue, Oct 17, 2017 at 5:25 PM Kevin Gessner ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In test_run.sh
<#309 (comment)>
:
> @@ -525,6 +525,23 @@ revert_change() {
mv $1/$2.bak $1/$2
}
+test_intellij_aspect() {
+ intellij_git_tag=$1
+ rules_scala_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+ if [[ "$runner" == "run_test_ci" ]]; then
this feels brittle. can you detect CI another way? maybe test -d intellij?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#309 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIFytaxUKcBZWfH6QbtL6HNMLSnU45ks5stLjigaJpZM4P7b8t>
.
|
@greggdonovan I want to merge this, but it is still red on travis. Any ideas on how to get it green? |
2133722
to
50b898b
Compare
@johnynek Thanks! It seems like we have to understand the exact nature of the failures and resolve them to make this green. For example, |
The remaining test failure appears to be due to a transient failure to connect to Maven Central. Otherwise, everything else is green. As long as we're happy with the ijar change and a re-run on CI passes, I think this should be OK to commit. As far as the transient failure goes, I'll open a separate ticket to switch |
Thanks!
I'll take a look at the change tomorrow.
The plans with respect to repository rule and java_import_external is to
add a jvm_import_external which gets a string template of the rule it needs
to serialize and then add a scala_import_external that unsurprisingly uses
scala_import.
If you want to advance it on the Bazel side that will be great.
Shouldn't be a lot of work even
…On Sun, 12 Nov 2017 at 20:58 Gregg Donovan ***@***.***> wrote:
The remaining test failure appears to be due to a transient failure to
connect to Maven Central.
Otherwise, everything else is green. As long as we're happy with the ijar
change and a re-run on CI passes, I think this should be OK to commit.
As far as the transient failure goes, I'll open a separate ticket to
switch native.maven_jar usage to java_import_external or see if it makes
sense to incorporate it into the scala_import PR.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#309 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIF0g-vULNvnFF5ayWB5X0TlPUm7Gcks5s1z_ZgaJpZM4P7b8t>
.
|
test_run.sh
Outdated
intellij_git_tag=$1 | ||
rules_scala_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
|
||
if [[ "$runner" == "run_test_ci" ]]; then |
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.
@greggdonovan can you change the above to if [[ "$1" == "ci" ]]; then
like you suggested?
test_run.sh
Outdated
@@ -604,3 +621,5 @@ $runner test_scala_library_expect_failure_on_missing_direct_java | |||
$runner bazel run test:test_scala_proto_server | |||
$runner test_scala_library_expect_failure_on_missing_direct_deps_warn_mode_java | |||
$runner test_scala_library_expect_better_failure_message_on_missing_transitive_dependency_labels_from_other_jvm_rules | |||
$runner test_intellij_aspect ac2bb7 # TODO(https://github.com/bazelbuild/intellij/issues/146): replace with release tag when fixed. |
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 we remove this? IIRC intellij team said they're not going to have tags any time soon
scala/scala.bzl
Outdated
def _format_full_jars_for_intellij_plugin(full_jars): | ||
return [struct (class_jar = jar, ijar = None) for jar in full_jars] | ||
def _format_full_jars_for_intellij_plugin(full_jars, ijar): | ||
return [struct (class_jar = jar, ijar = ijar) for jar in full_jars] |
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.
@chaoren what does the plugin do with the ijar
field?
I set it to None since I didn't see any drawbacks from setting it to None and on the other hand it becomes a bit more tricky to match the java-code ijar to the java-code full jar and the scala-code ijar to the scala-code full jar. It's not rocket science but a bit more cumbersome than I want and without any value I can see.
@greggdonovan the above implementation might be a problem since it passes the scala-code ijar for the java-code full jar. Depending on @chaoren's response we'll need to:
- Change the intellij tests to expect None (if he agrees we don't need it).
- Change our code to pass the right tuples so that we pass the right ijar to the full jar (if he surfaces reasons to using the ijar).
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.
btw, if @chaoren says this can be ignored we can merge this PR and later remove it once he fixes the test
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 actually just use the class_jar
if the ijar is not available, so you might see some performance hits.
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.
What performance hit? In loading bigger jars to memory?
@greggdonovan this sounds like the current change pleases the test but will break the actual production
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 pretty much. class_jar can always replace ijar, except it's much larger.
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 see.
@greggdonovan do you want to take a crack at passing the matching ijar to the relevant full jar?
@chaoren:
"It's possible to output multiple jars now?"- not quite, we output one
scala jar and one java jar (if both exist).
If you're asking on whether you can remove the single support from your bzl
then I'm not sure if other scala rules still use that struct.
…On Wed, 15 Nov 2017 at 22:07 Chaoren Lin ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In scala/scala.bzl
<#309 (comment)>
:
> @@ -595,8 +595,8 @@ def _collect_jars_from_common_ctx(ctx, extra_deps = [], extra_runtime_deps = [])
return struct(compile_jars = cjars, transitive_runtime_jars = transitive_rjars, jars2labels=jars2labels, transitive_compile_jars = transitive_compile_jars)
-def _format_full_jars_for_intellij_plugin(full_jars):
- return [struct (class_jar = jar, ijar = None) for jar in full_jars]
+def _format_full_jars_for_intellij_plugin(full_jars, ijar):
+ return [struct (class_jar = jar, ijar = ijar) for jar in full_jars]
Yeah pretty much. class_jar can always replace ijar, except it's much
larger.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#309 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIF3IGsezrQwSUwki6CM0-GMQU8fRQks5s20R7gaJpZM4P7b8t>
.
|
@greggdonovan I think this fell off of your radar. Any chance you can carry it through? |
@ittaiz Yes, sorry about that! I'll take a look this week. Thanks for catching the green test not being the whole story. ;-) Can you give me more details on the difference between the Scala JARs and the Java JARs? I'm a bit fuzzy on the distinction. Thanks! |
Sure no problem. |
Hi, |
7c0c0ce
to
f82563b
Compare
Good news, bad news. With the ijar However, on the OSX Travis builders, we're hitting the travis.org timeout of 50 minutes with the added time for this test. The test downloads about ~800mb of IntelliJ IDEs and other artifacts and spends ~3 minutes compiling I can think of a few options to work around this:
|
Option 1 is to synthetically simulate multiple travis configurations?
Sounds good actually.
Can you try it and see how much it complicated the script
…On Wed, 20 Dec 2017 at 17:17 Gregg Donovan ***@***.***> wrote:
Good news, bad news. With the ijar .bzl changes reverted, the build
passes without any runtime changes.
However, on the OSX Travis builders, we're hitting the travis.org timeout
of 50 minutes
<https://docs.travis-ci.com/user/customizing-the-build/#Build-Timeouts>
with the added time for this test. The test downloads about ~800mb of
IntelliJ IDEs and other artifacts and spends ~3 minutes compiling protoc,
so there may not be much to do to speed it up.
I can think of a few options to work around this:
- We can add rows in the build matrix just for this test, keeping us
under 50 minutes.
- We can kick off this test at the beginning of the build in parallel.
- Just run this test periodically via a Travis cron
<https://docs.travis-ci.com/user/cron-jobs/>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#309 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIF9DEFZ7FsMqAtaJEHb4yS-OYKGvPks5tCSUMgaJpZM4P7b8t>
.
|
…by manually cloning intellij. As we want to test multiple versions of the intellij plugin (master and a release tag) we are managing a manual clone of intellij instead of using a git submodule.
…ith Bazel 0.7.0 support.
This was changed here: bazelbuild/intellij@29b78dd.
…the timeout - Split the test_runner into its own file. - Run the IntelliJ aspect in separate rows in the build matrix.
320632b
to
917411d
Compare
env vars do not appear to be analyzed semantially to parse out distinct combinations. See: https://docs.travis-ci.com/user/customizing-the-build/#Build-Matrix
I think this is ready for another look, @ittaiz. The Travis build matrix now has separate rows for the IntelliJ aspect test. |
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.
Looks good, thanks!
Can you please remind me how come the tests now pass?
Well done! |
Related to #308
As we want to test multiple versions of the intellij plugin (master and a release tag) we are managing a manual clone of intellij instead of using a git submodule. I'm not sure how to get submodules to handle a test matrix of intellij versions reasonably.