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

[Issue #129] Fix duplicated META-INF/*.kotlin_module issue #130

Merged

Conversation

slmlt
Copy link
Contributor

@slmlt slmlt commented Jul 5, 2021

No description provided.

Copy link
Owner

@ZacSweers ZacSweers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's DRY this up a bit by moving the KotlinCompile configuration to the root build file and have it run on subprojects, then make the module name reuse the artifact ID gradle property that each project already has (see their gradle.properties)

@slmlt slmlt force-pushed the issue-129/fix-module-name-mangling-issue branch from 7620a88 to 7283612 Compare July 5, 2021 14:10
@slmlt
Copy link
Contributor Author

slmlt commented Jul 5, 2021

Done :) Used POM_ARTIFACT_ID from gradle.properties

build.gradle.kts Outdated Show resolved Hide resolved
@ZacSweers ZacSweers merged commit 02d4603 into ZacSweers:main Jul 5, 2021
@ZacSweers
Copy link
Owner

ZacSweers commented Jul 5, 2021

Thanks! I plan to cut a release after KSP beta05 is out, hopefully this week

@ZacSweers
Copy link
Owner

@slmlt when I try this locally, I see the following warnings. Are you familiar with them and what possible recourse there is?

> Task :moshi-sealed:codegen:kaptGenerateStubsKotlin
w: Argument -module-name is passed multiple times. Only the last value will be used: moshi-sealed-codegen

> Task :moshi-sealed:codegen-ksp:kspKotlin
w: Argument -module-name is passed multiple times. Only the last value will be used: moshi-sealed-ksp

> Task :moshi-sealed:codegen-ksp:compileKotlin
w: Argument -module-name is passed multiple times. Only the last value will be used: moshi-sealed-ksp

@slmlt
Copy link
Contributor Author

slmlt commented Jul 16, 2021

@ZacSweers I may be wrong about this, but I assume, that KotlinCompile task has its own default arguments (KotlinCompile.createCompilerArgs()), including the "-module-name" (seems to come from K2JVMCompilerArguments.moduleName) which we cannot modify. By specifying additional compiler options (through freeCompilerArgs property) we rely on the fact, that for compiler options with matching names only the last value will be used (the very same statement we got warnings about), so the warnings are somewhat expected. Unfortunately this is the only workaround I was able to find.

@ZacSweers
Copy link
Owner

Do you know if there's a feature request on youtrack? Otherwise we should file one, this prevents use of -Werror

@slmlt
Copy link
Contributor Author

slmlt commented Jul 17, 2021

Well, in a matter of fact there is an issue about this https://youtrack.jetbrains.com/issue/KT-42058 and it is already fixed. Now we actually can do this:
kotlinOptions.moduleName = project.property("POM_ARTIFACT_ID") as String
instead of using freeCompilerArgs. Sorry, I obviously did not put enough effort to research the problem. Here is another PR that should get rid of those warnings #134

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 this pull request may close these issues.

None yet

2 participants