@@ -91,7 +91,7 @@ std::string Generator::getHeaderPath() const noexcept
91
91
92
92
std::string Generator::getObjectHeaderPath () const noexcept
93
93
{
94
- if (_options.separateFiles )
94
+ if (! _options.mergeFiles )
95
95
{
96
96
fs::path fullPath { _headerDir };
97
97
@@ -124,7 +124,7 @@ std::vector<std::string> Generator::Build() const noexcept
124
124
builtFiles.push_back (_sourcePath);
125
125
}
126
126
127
- if (_options.separateFiles )
127
+ if (! _options.mergeFiles )
128
128
{
129
129
auto separateFiles = outputSeparateFiles ();
130
130
@@ -306,7 +306,7 @@ static_assert(graphql::internal::MinorVersion == )cpp"
306
306
}
307
307
}
308
308
309
- if (!_loader.getObjectTypes ().empty () && ! _options.separateFiles )
309
+ if (!_loader.getObjectTypes ().empty () && _options.mergeFiles )
310
310
{
311
311
if (_loader.isIntrospection ())
312
312
{
@@ -465,7 +465,7 @@ static_assert(graphql::internal::MinorVersion == )cpp"
465
465
)cpp" ;
466
466
}
467
467
468
- if (!_loader.getObjectTypes ().empty () && _options.separateFiles )
468
+ if (!_loader.getObjectTypes ().empty () && ! _options.mergeFiles )
469
469
{
470
470
for (const auto & objectType : _loader.getObjectTypes ())
471
471
{
@@ -1181,7 +1181,7 @@ service::AwaitableResolver ModifiedResult<)cpp"
1181
1181
}
1182
1182
}
1183
1183
1184
- if (!_loader.getObjectTypes ().empty () && ! _options.separateFiles )
1184
+ if (!_loader.getObjectTypes ().empty () && _options.mergeFiles )
1185
1185
{
1186
1186
NamespaceScope objectNamespace { sourceFile, " object" };
1187
1187
@@ -1624,7 +1624,7 @@ Operations::Operations()cpp";
1624
1624
1625
1625
for (const auto & objectType : _loader.getObjectTypes ())
1626
1626
{
1627
- if (_options.separateFiles )
1627
+ if (! _options.mergeFiles )
1628
1628
{
1629
1629
sourceFile << R"cpp( Add)cpp" << objectType.cppType << R"cpp( Details(type)cpp"
1630
1630
<< objectType.cppType << R"cpp( , schema);
@@ -2057,7 +2057,7 @@ void Generator::outputObjectIntrospection(
2057
2057
2058
2058
firstInterface = false ;
2059
2059
2060
- if (_options.separateFiles )
2060
+ if (! _options.mergeFiles )
2061
2061
{
2062
2062
sourceFile
2063
2063
<< R"cpp( std::static_pointer_cast<const schema::InterfaceType>(schema->LookupType(R"gql()cpp"
@@ -2654,9 +2654,9 @@ int main(int argc, char** argv)
2654
2654
bool showVersion = false ;
2655
2655
bool buildIntrospection = false ;
2656
2656
bool buildCustom = false ;
2657
- bool stubs = false ;
2658
2657
bool verbose = false ;
2659
- bool separateFiles = false ;
2658
+ bool stubs = false ;
2659
+ bool mergeFiles = false ;
2660
2660
bool noIntrospection = false ;
2661
2661
std::string schemaFileName;
2662
2662
std::string filenamePrefix;
@@ -2681,10 +2681,9 @@ int main(int argc, char** argv)
2681
2681
po::value (&headerDir),
2682
2682
" Target path for the <prefix>Schema.h header file" )(" stubs" ,
2683
2683
po::bool_switch (&stubs),
2684
- " Unimplemented fields throw runtime exceptions instead of compiler errors" )(
2685
- " separate-files" ,
2686
- po::bool_switch (&separateFiles),
2687
- " Generate separate files for each of the types" )(" no-introspection" ,
2684
+ " Unimplemented fields throw runtime exceptions instead of compiler errors" )(" merge-files" ,
2685
+ po::bool_switch (&mergeFiles),
2686
+ " Generate a single header and source file for the entire schema" )(" no-introspection" ,
2688
2687
po::bool_switch (&noIntrospection),
2689
2688
" Do not generate support for Introspection" );
2690
2689
positional.add (" schema" , 1 ).add (" prefix" , 1 ).add (" namespace" , 1 );
@@ -2744,9 +2743,15 @@ int main(int argc, char** argv)
2744
2743
{
2745
2744
if (buildIntrospection)
2746
2745
{
2747
- const auto files =
2748
- graphql::generator::schema::Generator (std::nullopt, { std::nullopt, verbose })
2749
- .Build ();
2746
+ const auto files = graphql::generator::schema::Generator (std::nullopt,
2747
+ {
2748
+ std::nullopt,
2749
+ verbose,
2750
+ false , // stubs
2751
+ true , // mergeFiles
2752
+ false , // noIntrospection
2753
+ })
2754
+ .Build ();
2750
2755
2751
2756
for (const auto & file : files)
2752
2757
{
@@ -2764,8 +2769,8 @@ int main(int argc, char** argv)
2764
2769
graphql::generator::schema::GeneratorPaths { std::move (headerDir),
2765
2770
std::move (sourceDir) },
2766
2771
verbose,
2767
- separateFiles,
2768
2772
stubs,
2773
+ mergeFiles,
2769
2774
noIntrospection,
2770
2775
})
2771
2776
.Build ();
0 commit comments