Skip to content

Conversation

@leethree
Copy link
Contributor

@leethree leethree commented Jan 8, 2020

Summary:

The @ characters from npm scoped packages will cause name conflicts with Kotlin because Kotlin complier will generate .kotlin_module files base on module name by default.

For example, we have both @segment/analytics-react-native and @matt-block/react-native-in-app-browser modules installed. Currently they will be turned into Android modules with name @segment_analytics-react-native and @matt-block_react-native-in-app-browser. And they will both generate META-INF/-no-jdk.kotlin_module file because Kotlin complier failed to parse @ in module name.

Eventually it causes build to fail with error:

More than one file was found with OS independent path 'META-INF/-no-jdk.kotlin_module'

Test Plan:

Tested the code change on our project and it will convert module names into segment_analytics-react-native and matt-block_react-native-in-app-browser. And Kotlin will generate segment_analytics-react-native_debug.kotlin_module and matt-block_react-native-in-app-browser_debug.kotlin_module in META-INF. Thus the error is resolved.

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

LGTM. Wouldn't mind if @Salakar and @dratwas had a look though :)

Copy link
Member

@Salakar Salakar left a comment

Choose a reason for hiding this comment

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

LGTM

@grabbou grabbou merged commit 60c41d7 into react-native-community:master Jan 30, 2020
@grabbou
Copy link
Member

grabbou commented Jan 30, 2020

Sounds good, going to merge it! Thank you for reviewing it!

@leethree leethree deleted the patch-1 branch January 30, 2020 10:40
elvinas-engagecraft added a commit to elvinas-engagecraft/cli that referenced this pull request Mar 3, 2020
This fixes react-native-community#1031 (a regression introduced with react-native-community#910). It also makes sure that the package name contains only allowed chars.
grabbou pushed a commit that referenced this pull request Mar 11, 2020
* fix: scoped packages with `.` produces incorrect package name

This fixes #1031 (a regression introduced with #910). It also makes sure that the package name contains only allowed chars.

* Fix cleansed name creation
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.

4 participants