change name convention for modules
Summary: Following our internal discussion we want to change previously used name convention. Now it looks like: ``` #import <FBReactNativeTestSpec/FBReactNativeTestSpec.h> ``` Name is a param of `rn_codegen` and `rn_library`. Also, I found it the easiest to move replacing `::_IMPORT_::` into buck rule Reviewed By: fkgozali Differential Revision: D16646616 fbshipit-source-id: 2c33c5b4d1c42b0e6f5a42d9a318bd8bda9745f4
This commit is contained in:
Родитель
52c86a96b8
Коммит
0da4612f03
|
@ -48,6 +48,7 @@ fb_native.genrule(
|
|||
|
||||
rn_codegen(
|
||||
name = "codegen_tests",
|
||||
native_module_spec_name = "FBReactNativeTestSpec",
|
||||
schema_target = ":codegen_tests_schema",
|
||||
)
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ load(
|
|||
)
|
||||
|
||||
def rn_codegen(
|
||||
native_module_spec_name,
|
||||
name = "",
|
||||
schema_target = ""):
|
||||
generate_fixtures_rule_name = "generate_fixtures-{}".format(name)
|
||||
|
@ -40,7 +41,7 @@ def rn_codegen(
|
|||
fb_native.genrule(
|
||||
name = generate_fixtures_rule_name,
|
||||
srcs = native.glob(["src/generators/**/*.js"]),
|
||||
cmd = "$(exe fbsource//xplat/js/react-native-github/packages/react-native-codegen:rn_codegen) $(location {}) {} $OUT".format(schema_target, name),
|
||||
cmd = "$(exe fbsource//xplat/js/react-native-github/packages/react-native-codegen:rn_codegen) $(location {}) {} $OUT {}".format(schema_target, name, native_module_spec_name),
|
||||
out = "codegenfiles-{}".format(name),
|
||||
)
|
||||
|
||||
|
@ -125,14 +126,14 @@ def rn_codegen(
|
|||
|
||||
fb_native.genrule(
|
||||
name = generate_module_hobjcpp_name,
|
||||
cmd = "cp $(location :{})/RCTNativeModules.h $OUT".format(generate_fixtures_rule_name),
|
||||
out = "RCTNativeModules.h",
|
||||
cmd = "cp $(location :{})/{}.h $OUT".format(generate_fixtures_rule_name, native_module_spec_name),
|
||||
out = "{}.h".format(native_module_spec_name),
|
||||
)
|
||||
|
||||
fb_native.genrule(
|
||||
name = generate_module_mm_name,
|
||||
cmd = "cp $(location :{})/RCTNativeModules.mm $OUT".format(generate_fixtures_rule_name),
|
||||
out = "RCTNativeModules.mm",
|
||||
cmd = "cp $(location :{})/{}-generated.mm $OUT".format(generate_fixtures_rule_name, native_module_spec_name),
|
||||
out = "{}-generated.mm".format(native_module_spec_name),
|
||||
)
|
||||
|
||||
# libs
|
||||
|
@ -236,10 +237,10 @@ def rn_codegen(
|
|||
":{}".format(generate_module_hobjcpp_name),
|
||||
],
|
||||
ios_exported_headers = {
|
||||
"RCTNativeModules.h": ":{}".format(generate_module_hobjcpp_name),
|
||||
"RCTNativeModules.mm": ":{}".format(generate_module_mm_name),
|
||||
"{}.h".format(native_module_spec_name): ":{}".format(generate_module_hobjcpp_name),
|
||||
"{}-generated.mm".format(native_module_spec_name): ":{}".format(generate_module_mm_name),
|
||||
},
|
||||
header_namespace = "react/modules/{}".format(name),
|
||||
header_namespace = native_module_spec_name,
|
||||
compiler_flags = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <react/components/codegen_tests/ComponentDescriptors.h>
|
||||
#import <react/components/codegen_tests/ComponentViewHelpers.h>
|
||||
#import <react/modules/codegen_tests/RCTNativeModules.h>
|
||||
#import <react/modules/codegen_tests/RCTNativeModules.mm>
|
||||
#import <FBReactNativeTestSpec/FBReactNativeTestSpec.h>
|
||||
#import <FBReactNativeTestSpec/FBReactNativeTestSpec-generated.mm>
|
||||
|
||||
// TODO: Import every prop and event to asset they're generated
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ const fs = require('fs');
|
|||
const mkdirp = require('mkdirp');
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
if (args.length !== 3) {
|
||||
if (args.length !== 4) {
|
||||
throw new Error(
|
||||
`Expected to receive path to schema, library name, and output directory. Received ${args.join(
|
||||
`Expected to receive path to schema, library name, output directory and module spec name. Received ${args.join(
|
||||
', ',
|
||||
)}`,
|
||||
);
|
||||
|
@ -26,6 +26,7 @@ if (args.length !== 3) {
|
|||
const schemaPath = args[0];
|
||||
const libraryName = args[1];
|
||||
const outputDirectory = args[2];
|
||||
const moduleSpecName = args[3];
|
||||
|
||||
const schemaText = fs.readFileSync(schemaPath, 'utf-8');
|
||||
|
||||
|
@ -43,7 +44,7 @@ try {
|
|||
}
|
||||
|
||||
RNCodegen.generate(
|
||||
{libraryName, schema, outputDirectory},
|
||||
{libraryName, schema, outputDirectory, moduleSpecName},
|
||||
{
|
||||
generators: [
|
||||
'descriptors',
|
||||
|
|
|
@ -42,6 +42,7 @@ type Options = $ReadOnly<{|
|
|||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
outputDirectory: string,
|
||||
moduleSpecName: string,
|
||||
|}>;
|
||||
|
||||
type Generators =
|
||||
|
@ -50,8 +51,7 @@ type Generators =
|
|||
| 'props'
|
||||
| 'tests'
|
||||
| 'shadow-nodes'
|
||||
| 'modules'
|
||||
| 'view-configs';
|
||||
| 'modules';
|
||||
|
||||
type Config = $ReadOnly<{|
|
||||
generators: Array<Generators>,
|
||||
|
@ -79,7 +79,6 @@ const GENERATORS = {
|
|||
generateShadowNodeCpp.generate,
|
||||
generateShadowNodeH.generate,
|
||||
],
|
||||
'view-configs': [generateViewConfigJs.generate],
|
||||
};
|
||||
|
||||
function writeMapToFiles(map: Map<string, string>, outputDir: string) {
|
||||
|
@ -118,7 +117,7 @@ function checkFilesForChanges(
|
|||
|
||||
module.exports = {
|
||||
generate(
|
||||
{libraryName, schema, outputDirectory}: Options,
|
||||
{libraryName, schema, outputDirectory, moduleSpecName}: Options,
|
||||
{generators, test}: Config,
|
||||
): boolean {
|
||||
schemaValidator.validate(schema);
|
||||
|
@ -126,7 +125,7 @@ module.exports = {
|
|||
const generatedFiles = [];
|
||||
for (const name of generators) {
|
||||
for (const generator of GENERATORS[name]) {
|
||||
generatedFiles.push(...generator(libraryName, schema));
|
||||
generatedFiles.push(...generator(libraryName, schema, moduleSpecName));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,11 @@ using ::_CLASSNAME_::ComponentDescriptor = ConcreteComponentDescriptor<::_CLASSN
|
|||
`.trim();
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const fileName = 'ComponentDescriptors.h';
|
||||
|
||||
const componentDescriptors = Object.keys(schema.modules)
|
||||
|
|
|
@ -263,7 +263,11 @@ function generateCommandHandler(
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const fileName = 'RCTComponentViewHelpers.h';
|
||||
|
||||
const componentContent = Object.keys(schema.modules)
|
||||
|
|
|
@ -166,7 +166,11 @@ function generateEvent(componentName: string, event): string {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const moduleComponents: ComponentCollection = Object.keys(schema.modules)
|
||||
.map(moduleName => {
|
||||
const components = schema.modules[moduleName].components;
|
||||
|
|
|
@ -221,7 +221,11 @@ function generateEvents(componentName: string, component): string {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const moduleComponents: ComponentCollection = Object.keys(schema.modules)
|
||||
.map(moduleName => {
|
||||
const components = schema.modules[moduleName].components;
|
||||
|
|
|
@ -81,7 +81,11 @@ function getClassExtendString(component): string {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const fileName = 'Props.cpp';
|
||||
const allImports: Set<string> = new Set([
|
||||
'#include <react/core/propsConversions.h>',
|
||||
|
|
|
@ -418,7 +418,11 @@ function getImports(component): Set<string> {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const fileName = 'Props.h';
|
||||
|
||||
const allImports: Set<string> = new Set();
|
||||
|
|
|
@ -208,7 +208,11 @@ function generateMethods(propsString, commandsString): string {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const files = new Map();
|
||||
Object.keys(schema.modules).forEach(moduleName => {
|
||||
const components = schema.modules[moduleName].components;
|
||||
|
|
|
@ -158,7 +158,11 @@ function getClassExtendString(component): string {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const files = new Map();
|
||||
Object.keys(schema.modules).forEach(moduleName => {
|
||||
const components = schema.modules[moduleName].components;
|
||||
|
|
|
@ -39,7 +39,11 @@ extern const char ::_CLASSNAME_::ComponentName[] = "::_CLASSNAME_::";
|
|||
`.trim();
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const fileName = 'ShadowNodes.cpp';
|
||||
|
||||
const componentNames = Object.keys(schema.modules)
|
||||
|
|
|
@ -49,7 +49,11 @@ using ::_CLASSNAME_::ShadowNode = ConcreteViewShadowNode<
|
|||
`.trim();
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const fileName = 'ShadowNodes.h';
|
||||
|
||||
let hasAnyEvents = false;
|
||||
|
|
|
@ -133,7 +133,11 @@ function generateTestsString(name, component) {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const fileName = 'Tests.cpp';
|
||||
const allImports = new Set([
|
||||
'#include <react/core/propsConversions.h>',
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateComponentDescriptorH', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateComponentHObjCpp', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateEventEmitterCpp', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateEventEmitterH', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GeneratePropsCpp', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GeneratePropsH', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GeneratePropsJavaDelegate', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GeneratePropsJavaInterface', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateShadowNodeCpp', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateShadowNodeH', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateTests', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -106,7 +106,11 @@ function traverseProprety(property): string {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const nativeModules = Object.keys(schema.modules)
|
||||
.map(moduleName => {
|
||||
const modules = schema.modules[moduleName].nativeModules;
|
||||
|
|
|
@ -84,7 +84,11 @@ const propertyTemplate =
|
|||
'virtual ::_RETURN_VALUE_:: ::_PROPERTY_NAME_::(jsi::Runtime &rt::_ARGS_::) = 0;';
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const nativeModules = Object.keys(schema.modules)
|
||||
.map(moduleName => {
|
||||
const modules = schema.modules[moduleName].nativeModules;
|
||||
|
|
|
@ -149,7 +149,11 @@ const methodImplementationTemplate =
|
|||
'- (::_RETURN_VALUE_::) ::_PROPERTY_NAME_::::_ARGS_::;';
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const nativeModules = Object.keys(schema.modules)
|
||||
.map(moduleName => {
|
||||
const modules = schema.modules[moduleName].nativeModules;
|
||||
|
@ -243,7 +247,7 @@ module.exports = {
|
|||
})
|
||||
.join('\n');
|
||||
|
||||
const fileName = 'RCTNativeModules.h';
|
||||
const fileName = `${moduleSpecName}.h`;
|
||||
const replacedTemplate = template
|
||||
.replace(/::_MODULES_::/g, modules)
|
||||
.replace(/::_PROTOCOLS_::/g, protocols);
|
||||
|
|
|
@ -56,7 +56,7 @@ const template = `
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <react/modules/::_LIBRARY_NAME_::/RCTNativeModules.h>
|
||||
#include <::_INCLUDE_::>
|
||||
::_GETTERS_::
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
@ -128,7 +128,11 @@ function tranlsateMethodForImplementation(property): string {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
generate(libraryName: string, schema: SchemaType): FilesOutput {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
moduleSpecName: string,
|
||||
): FilesOutput {
|
||||
const nativeModules: {[name: string]: NativeModuleShape} = Object.keys(
|
||||
schema.modules,
|
||||
)
|
||||
|
@ -221,11 +225,12 @@ module.exports = {
|
|||
})
|
||||
.join('\n');
|
||||
|
||||
const fileName = 'RCTNativeModules.mm';
|
||||
const fileName = `${moduleSpecName}-generated.mm`;
|
||||
const replacedTemplate = template
|
||||
.replace(/::_GETTERS_::/g, gettersImplementations)
|
||||
.replace(/::_MODULES_::/g, modules)
|
||||
.replace(/::_LIBRARY_NAME_::/g, libraryName);
|
||||
.replace(/::_LIBRARY_NAME_::/g, libraryName)
|
||||
.replace(/::_INCLUDE_::/g, `${moduleSpecName}/${moduleSpecName}.h`);
|
||||
return new Map([[fileName, replacedTemplate]]);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateModuleCpp', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateModuleCpp', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateModuleHObjCpp', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ describe('GenerateModuleHObjCpp', () => {
|
|||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(generator.generate(fixtureName, fixture)).toMatchSnapshot();
|
||||
expect(
|
||||
generator.generate(fixtureName, fixture, 'SampleSpec'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture COMPLEX_OBJECTS 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.h" => "
|
||||
"SampleSpec.h" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture EMPTY_NATIVE_MODULES 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.h" => "
|
||||
"SampleSpec.h" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture SIMPLE_NATIVE_MODULES 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.h" => "
|
||||
"SampleSpec.h" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
@ -324,7 +324,7 @@ public:
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.h" => "
|
||||
"SampleSpec.h" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
@ -388,7 +388,7 @@ public:
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture TWO_MODULES_SAME_FILE 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.h" => "
|
||||
"SampleSpec.h" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture COMPLEX_OBJECTS 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.mm" => "
|
||||
"SampleSpec-generated.mm" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
@ -10,7 +10,7 @@ Map {
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <react/modules/COMPLEX_OBJECTS/RCTNativeModules.h>
|
||||
#include <SampleSpec/SampleSpec.h>
|
||||
@implementation RCTCxxConvert (NativeSampleTurboModule_SpecDifficultReturnType)
|
||||
+ (RCTManagedPointer *)JS_NativeSampleTurboModule_SpecDifficultReturnType:(id)json
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(id<RCTTurboModule
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture EMPTY_NATIVE_MODULES 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.mm" => "
|
||||
"SampleSpec-generated.mm" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
@ -59,7 +59,7 @@ Map {
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <react/modules/EMPTY_NATIVE_MODULES/RCTNativeModules.h>
|
||||
#include <SampleSpec/SampleSpec.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
@ -80,7 +80,7 @@ NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(id<RCTTurboModule
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture SIMPLE_NATIVE_MODULES 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.mm" => "
|
||||
"SampleSpec-generated.mm" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
@ -88,7 +88,7 @@ Map {
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <react/modules/SIMPLE_NATIVE_MODULES/RCTNativeModules.h>
|
||||
#include <SampleSpec/SampleSpec.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
@ -157,7 +157,7 @@ NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(id<RCTTurboModule
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.mm" => "
|
||||
"SampleSpec-generated.mm" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
@ -165,7 +165,7 @@ Map {
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <react/modules/TWO_MODULES_DIFFERENT_FILES/RCTNativeModules.h>
|
||||
#include <SampleSpec/SampleSpec.h>
|
||||
|
||||
|
||||
namespace facebook {
|
||||
|
@ -199,7 +199,7 @@ NativeSample2TurboModuleSpecJSI::NativeSample2TurboModuleSpecJSI(id<RCTTurboModu
|
|||
|
||||
exports[`GenerateModuleHObjCpp can generate fixture TWO_MODULES_SAME_FILE 1`] = `
|
||||
Map {
|
||||
"RCTNativeModules.mm" => "
|
||||
"SampleSpec-generated.mm" => "
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
@ -207,7 +207,7 @@ Map {
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <react/modules/TWO_MODULES_SAME_FILE/RCTNativeModules.h>
|
||||
#include <SampleSpec/SampleSpec.h>
|
||||
|
||||
|
||||
namespace facebook {
|
||||
|
|
Загрузка…
Ссылка в новой задаче