2018-05-11 19:43:49 +00:00
|
|
|
/** @format */
|
|
|
|
|
2017-10-11 21:51:58 +00:00
|
|
|
const fs = require.requireActual('fs');
|
2016-05-20 11:52:08 +00:00
|
|
|
const path = require('path');
|
|
|
|
|
2018-05-11 19:43:49 +00:00
|
|
|
const manifest = fs.readFileSync(
|
|
|
|
path.join(__dirname, './files/AndroidManifest.xml'),
|
|
|
|
);
|
|
|
|
const mainJavaClass = fs.readFileSync(
|
|
|
|
path.join(__dirname, './files/Main.java'),
|
|
|
|
);
|
2016-05-20 11:52:08 +00:00
|
|
|
|
2017-06-29 08:08:47 +00:00
|
|
|
function generateValidFileStructure(classFileName) {
|
|
|
|
return {
|
|
|
|
src: {
|
|
|
|
'AndroidManifest.xml': manifest,
|
|
|
|
main: {
|
|
|
|
com: {
|
|
|
|
some: {
|
|
|
|
example: {
|
|
|
|
'Main.java': mainJavaClass,
|
2018-05-11 19:43:49 +00:00
|
|
|
[classFileName]: fs.readFileSync(
|
|
|
|
path.join(__dirname, `./files/${classFileName}`),
|
|
|
|
),
|
2017-06-29 08:08:47 +00:00
|
|
|
},
|
2016-05-20 11:52:08 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2017-06-29 08:08:47 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.valid = generateValidFileStructure('ReactPackage.java');
|
|
|
|
|
|
|
|
exports.validKotlin = generateValidFileStructure('ReactPackage.kt');
|
2016-05-20 11:52:08 +00:00
|
|
|
|
2017-06-06 21:11:54 +00:00
|
|
|
exports.userConfigManifest = {
|
|
|
|
src: {
|
|
|
|
main: {
|
|
|
|
'AndroidManifest.xml': manifest,
|
|
|
|
com: {
|
|
|
|
some: {
|
|
|
|
example: {
|
|
|
|
'Main.java': mainJavaClass,
|
2018-05-11 19:43:49 +00:00
|
|
|
'ReactPackage.java': fs.readFileSync(
|
|
|
|
path.join(__dirname, './files/ReactPackage.java'),
|
|
|
|
),
|
2017-06-06 21:11:54 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
debug: {
|
2018-05-11 19:43:49 +00:00
|
|
|
'AndroidManifest.xml': fs.readFileSync(
|
|
|
|
path.join(__dirname, './files/AndroidManifest-debug.xml'),
|
|
|
|
),
|
2017-06-06 21:11:54 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2016-05-20 11:52:08 +00:00
|
|
|
exports.corrupted = {
|
|
|
|
src: {
|
|
|
|
'AndroidManifest.xml': manifest,
|
|
|
|
main: {
|
|
|
|
com: {
|
|
|
|
some: {
|
|
|
|
example: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.noPackage = {
|
|
|
|
src: {
|
|
|
|
'AndroidManifest.xml': manifest,
|
|
|
|
main: {
|
|
|
|
com: {
|
|
|
|
some: {
|
|
|
|
example: {
|
|
|
|
'Main.java': mainJavaClass,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|