mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 04:24:15 +00:00
d666f30665
Summary: Currently React Native cli does not support linking native Android modules written in Kotlin. This PR aims to add support to it and closes #14561 - New unit tests added to verify the added functionality, they can be found inside: `local-cli/core/__tests__/android/findPackageClassName.spec.js` - Existing unit tests passed. Closes https://github.com/facebook/react-native/pull/14660 Differential Revision: D5316981 Pulled By: shergin fbshipit-source-id: 98354ba1e1ce1080a9a4b9958ef39893472038a1
75 lines
1.6 KiB
JavaScript
75 lines
1.6 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const manifest = fs.readFileSync(path.join(__dirname, './files/AndroidManifest.xml'));
|
|
const mainJavaClass = fs.readFileSync(path.join(__dirname, './files/Main.java'));
|
|
|
|
function generateValidFileStructure(classFileName) {
|
|
return {
|
|
src: {
|
|
'AndroidManifest.xml': manifest,
|
|
main: {
|
|
com: {
|
|
some: {
|
|
example: {
|
|
'Main.java': mainJavaClass,
|
|
[classFileName]: fs.readFileSync(path.join(__dirname, `./files/${classFileName}`)),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
exports.valid = generateValidFileStructure('ReactPackage.java');
|
|
|
|
exports.validKotlin = generateValidFileStructure('ReactPackage.kt');
|
|
|
|
exports.userConfigManifest = {
|
|
src: {
|
|
main: {
|
|
'AndroidManifest.xml': manifest,
|
|
com: {
|
|
some: {
|
|
example: {
|
|
'Main.java': mainJavaClass,
|
|
'ReactPackage.java': fs.readFileSync(path.join(__dirname, './files/ReactPackage.java')),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
debug: {
|
|
'AndroidManifest.xml': fs.readFileSync(path.join(__dirname, './files/AndroidManifest-debug.xml')),
|
|
},
|
|
},
|
|
};
|
|
|
|
exports.corrupted = {
|
|
src: {
|
|
'AndroidManifest.xml': manifest,
|
|
main: {
|
|
com: {
|
|
some: {
|
|
example: {},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
exports.noPackage = {
|
|
src: {
|
|
'AndroidManifest.xml': manifest,
|
|
main: {
|
|
com: {
|
|
some: {
|
|
example: {
|
|
'Main.java': mainJavaClass,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|