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

'noarg' and 'allopen' plugins fail to compile correctly when used together #365

Closed
dotdat opened this issue Sep 23, 2020 · 0 comments · Fixed by #366
Closed

'noarg' and 'allopen' plugins fail to compile correctly when used together #365

dotdat opened this issue Sep 23, 2020 · 0 comments · Fixed by #366

Comments

@dotdat
Copy link
Contributor

dotdat commented Sep 23, 2020

Simplified use case:
https://github.com/dotdat/rules_kotlin/tree/example_allopen_with_noarg/examples/plugin/src/allopennoarg

It appears that when both noarg and allopen plugins are introduced, neither of them work.
When running the command:
bazel build examples/plugin/src/allopen_with_noarg:user_is_open_test

The following output is produced:

INFO: Analyzed target //examples/plugin/src/allopennoarg:user_is_open_test (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/user/Development/rules_kotlin/examples/plugin/src/allopennoarg/BUILD:48:1: KotlinCompile //examples/plugin/src/allopennoarg:user_is_open_test { kt: 1, java: 0, srcjars: 0 } for k8 failed (Exit 1)
examples/plugin/src/allopennoarg/UserIsOpenTest.kt:5:18: error: this type is final, so it cannot be inherited from
class Subclass : User(UUID.randomUUID(), "[email protected]")
                 ^
Compilation failure: compile phase failed:
/home/user/.cache/bazel/_bazel_user/7eb9b19529baec16e97dbc2b12ec3ade/execroot/io_bazel_rules_kotlin/examples/plugin/src/allopennoarg/UserIsOpenTest.kt:5:18: error: this type is final, so it cannot be inherited from
class Subclass : User(UUID.randomUUID(), "[email protected]")
                 ^
Target //examples/plugin/src/allopennoarg:user_is_open_test failed to build
INFO: Elapsed time: 0.226s, Critical Path: 0.13s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

Running bazel run examples/plugin/src/allopen_with_noarg:user_has_noarg_constructor_test results in:

INFO: Analyzed target //examples/plugin/src/allopennoarg:user_has_noarg_constructor_test (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //examples/plugin/src/allopennoarg:user_has_noarg_constructor_test up-to-date:
  bazel-bin/examples/plugin/src/allopennoarg/user_has_noarg_constructor_test.jar
INFO: Elapsed time: 0.120s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //examples/plugin/src/allopennoarg:user_has_noarg_constructor_test
-----------------------------------------------------------------------------
JUnit4 Test Runner
.E
Time: 0.012
There was 1 failure:
1) userShouldHaveNoargConstructor(plugin.allopennoarg.UserHasNoargConstructorTest)
java.lang.Exception: Expected an empty constructor to exist
        at plugin.allopennoarg.UserHasNoargConstructorTest.userShouldHaveNoargConstructor(UserHasNoargConstructorTest.kt:10)

FAILURES!!!
Tests run: 1,  Failures: 1


BazelTestRunner exiting with a return value of 1
JVM shutdown hooks (if any) will run now.
The JVM will exit once they complete.

-- JVM shutdown starting at 2020-09-23 22:44:24 --


Removing :no_arg_plugin, or :open_for_testing_plugin from the following code succeeds in restoring behavior for the plugin that was not removed.

kt_jvm_library(
    name = "user",
    srcs = ["User.kt"],
    plugins = [
        ":open_for_testing_plugin",
        ":no_arg_plugin"
    ],
    deps = [
        ":open_for_testing",
        ":no_arg_constructor"
    ],
)

Are there any obvious issues here? If not, what can I do to help further?

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

Successfully merging a pull request may close this issue.

1 participant