11 #include <unordered_map>
14 #include "GDCore/IDE/CaptureOptions.h"
15 #include "GDCore/String.h"
20 class SerializerElement;
21 class AbstractFileSystem;
22 class ResourcesManager;
23 class SourceFileMetadata;
24 class WholeProjectDiagnosticReport;
41 exportPath(exportPath_),
42 useWindowMessageDebuggerClient(false),
43 useMinimalDebuggerClient(false),
44 nativeMobileApp(false),
45 projectDataOnlyExport(false),
46 fullLoadingScreen(false),
47 isDevelopmentEnvironment(false),
48 nonRuntimeScriptsCacheBurst(0),
49 inAppTutorialMessageInPreview(
""),
50 inAppTutorialMessagePositionInPreview(
""),
52 fallbackAuthorUsername(
""),
56 allowAuthenticationUsingIframeForPreview(false) {};
63 const gd::String &address,
const gd::String &port) {
64 websocketDebuggerServerAddress = address;
65 websocketDebuggerServerPort = port;
74 const gd::String &message,
const gd::String &position) {
75 inAppTutorialMessageInPreview = message;
76 inAppTutorialMessagePositionInPreview = position;
85 const gd::String &username) {
86 fallbackAuthorId = id;
87 fallbackAuthorUsername = username;
96 const gd::String &username,
97 const gd::String &token) {
99 playerUsername = username;
109 useWindowMessageDebuggerClient =
true;
117 useMinimalDebuggerClient =
true;
126 nativeMobileApp = enable;
134 layoutName = layoutName_;
143 const gd::String &externalLayoutName_) {
144 externalLayoutName = externalLayoutName_;
154 includeFileHashes[includeFile] = hash;
163 projectDataOnlyExport = enable;
172 fullLoadingScreen = enable;
181 isDevelopmentEnvironment = enable;
191 nonRuntimeScriptsCacheBurst = value;
202 const gd::String &electronRemoteRequirePath_) {
203 electronRemoteRequirePath = electronRemoteRequirePath_;
212 const gd::String &gdevelopResourceToken_) {
213 gdevelopResourceToken = gdevelopResourceToken_;
225 bool allowAuthenticationUsingIframeForPreview_) {
226 allowAuthenticationUsingIframeForPreview =
227 allowAuthenticationUsingIframeForPreview_;
235 const gd::String &crashReportUploadLevel_) {
236 crashReportUploadLevel = crashReportUploadLevel_;
244 previewContext = previewContext_;
252 const gd::String &gdevelopVersionWithHash_) {
253 gdevelopVersionWithHash = gdevelopVersionWithHash_;
261 const gd::String &projectTemplateSlug_) {
262 projectTemplateSlug = projectTemplateSlug_;
270 sourceGameId = sourceGameId_;
279 const gd::String &signedUrl,
280 const gd::String &publicUrl) {
281 gd::Screenshot screenshot;
282 screenshot.SetDelayTimeInSeconds(delayTimeInSeconds);
283 screenshot.SetSignedUrl(signedUrl);
284 screenshot.SetPublicUrl(publicUrl);
285 captureOptions.AddScreenshot(screenshot);
289 gd::Project &project;
290 gd::String exportPath;
291 gd::String websocketDebuggerServerAddress;
292 gd::String websocketDebuggerServerPort;
293 bool useWindowMessageDebuggerClient;
294 bool useMinimalDebuggerClient;
295 gd::String layoutName;
296 gd::String externalLayoutName;
297 gd::String fallbackAuthorUsername;
298 gd::String fallbackAuthorId;
300 gd::String playerUsername;
301 gd::String playerToken;
302 gd::String inAppTutorialMessageInPreview;
303 gd::String inAppTutorialMessagePositionInPreview;
304 bool nativeMobileApp;
305 std::map<gd::String, int> includeFileHashes;
306 bool projectDataOnlyExport;
307 bool fullLoadingScreen;
308 bool isDevelopmentEnvironment;
309 unsigned int nonRuntimeScriptsCacheBurst;
310 gd::String electronRemoteRequirePath;
311 gd::String gdevelopResourceToken;
312 bool allowAuthenticationUsingIframeForPreview;
313 gd::String crashReportUploadLevel;
314 gd::String previewContext;
315 gd::String gdevelopVersionWithHash;
316 gd::String projectTemplateSlug;
317 gd::String sourceGameId;
318 gd::CaptureOptions captureOptions;
331 exportPath(exportPath_),
333 fallbackAuthorId(
""),
334 fallbackAuthorUsername(
"") {};
341 const gd::String &username) {
342 fallbackAuthorId = id;
343 fallbackAuthorUsername = username;
358 gd::Project &project;
359 gd::String exportPath;
361 gd::String fallbackAuthorUsername;
362 gd::String fallbackAuthorId;
372 gd::String gdjsRoot_,
392 gd::AbstractFileSystem &
fs,
393 gd::Project &project,
395 const gd::SerializerElement &runtimeGameOptions,
396 std::set<gd::String> &projectUsedResources,
397 std::unordered_map<gd::String, std::set<gd::String>>
398 &layersUsedResources);
411 gd::Project &project,
412 gd::String exportDir);
418 bool pixiInThreeRenderers,
419 bool includeWebsocketDebuggerClient,
420 bool includeWindowMessageDebuggerClient,
421 bool includeMinimalDebuggerClient,
422 bool includeCaptureManager,
423 bool includeInAppTutorialMessage,
424 gd::String gdevelopLogoStyle,
425 std::vector<gd::String> &includesFiles);
431 std::vector<gd::String> &includesFiles);
444 gd::String exportDir,
445 bool exportSourceMaps);
457 const gd::Project &project,
458 gd::String outputDir,
459 std::vector<gd::String> &includesFiles,
460 gd::WholeProjectDiagnosticReport &wholeProjectDiagnosticReport,
461 bool exportForPreview);
467 std::vector<gd::String> &includesFiles);
488 gd::String exportDir,
489 const std::vector<gd::String> &includesFiles,
490 const std::vector<gd::SourceFileMetadata> &sourceFiles,
491 unsigned int nonRuntimeScriptsCacheBurst,
492 gd::String additionalSpec =
"");
511 gd::String exportDir,
512 const std::vector<gd::String> &includesFiles,
513 unsigned int nonRuntimeScriptsCacheBurst,
514 gd::String additionalSpec);
533 gd::String exportDir,
534 std::set<gd::String> usedExtensions);
544 gd::String exportDir,
545 std::set<gd::String> usedExtensions);
555 gd::String exportDir);
565 gd::String exportDir);
589 const gd::String &include,
unsigned int nonRuntimeScriptsCacheBurst = 0);
600 static void AddDeprecatedFontFilesToFontResources(
601 gd::AbstractFileSystem &
fs,
602 gd::ResourcesManager &resourcesManager,
603 const gd::String &exportDir,
604 gd::String urlPrefix =
"");
606 gd::AbstractFileSystem
615 static void SerializeUsedResources(
616 gd::SerializerElement &rootElement,
617 std::set<gd::String> &projectUsedResources,
618 std::unordered_map<gd::String, std::set<gd::String>>
619 &layersUsedResources);
Export a project or a layout to a playable HTML5/Javascript based game.
Definition: ExporterHelper.h:369
bool CompleteIndexFile(gd::String &indexFileContent, gd::String exportDir, const std::vector< gd::String > &includesFiles, unsigned int nonRuntimeScriptsCacheBurst, gd::String additionalSpec)
Replace the annotations in a index.html file by the specified content.
Definition: ExporterHelper.cpp:767
gd::String lastError
The last error that occurred.
Definition: ExporterHelper.h:608
bool ExportEffectIncludes(gd::Project &project, std::vector< gd::String > &includesFiles)
Add the project effects include files.
Definition: ExporterHelper.cpp:949
gd::String GetExportedIncludeFilename(const gd::String &include, unsigned int nonRuntimeScriptsCacheBurst=0)
Given an include file, returns the name of the file to reference in the exported game.
Definition: ExporterHelper.cpp:996
bool ExportProjectForPixiPreview(const PreviewExportOptions &options)
Create a preview for the specified options.
Definition: ExporterHelper.cpp:106
bool ExportHtml5Files(const gd::Project &project, gd::String exportDir)
Generate any HTML5 specific file.
Definition: ExporterHelper.cpp:636
bool ExportBuildResourcesElectronFiles(const gd::Project &project, gd::String exportDir)
Generate the Build Resources files for Electron (mainly for the icons) for packaging and save it to t...
Definition: ExporterHelper.cpp:748
bool ExportIncludesAndLibs(const std::vector< gd::String > &includesFiles, gd::String exportDir, bool exportSourceMaps)
Copy all the specified files to the export directory. Relative files are copied from "<GDJS root>/Run...
Definition: ExporterHelper.cpp:1035
void AddLibsInclude(bool pixiRenderers, bool pixiInThreeRenderers, bool includeWebsocketDebuggerClient, bool includeWindowMessageDebuggerClient, bool includeMinimalDebuggerClient, bool includeCaptureManager, bool includeInAppTutorialMessage, gd::String gdevelopLogoStyle, std::vector< gd::String > &includesFiles)
Add libraries files to the list of includes.
Definition: ExporterHelper.cpp:802
gd::String gdjsRoot
The root directory of GDJS, used to copy runtime files.
Definition: ExporterHelper.h:610
bool ExportCordovaFiles(const gd::Project &project, gd::String exportDir, std::set< gd::String > usedExtensions)
Generate the Cordova configuration file and save it to the export directory.
Definition: ExporterHelper.cpp:437
bool ExportFacebookInstantGamesFiles(const gd::Project &project, gd::String exportDir)
Generate the Facebook Instant Games files for packaging and save it to the export directory.
Definition: ExporterHelper.cpp:615
static void ExportResources(gd::AbstractFileSystem &fs, gd::Project &project, gd::String exportDir)
Copy all the resources of the project to to the export directory, updating the resources filenames.
Definition: ExporterHelper.cpp:1074
bool ExportEventsCode(const gd::Project &project, gd::String outputDir, std::vector< gd::String > &includesFiles, gd::WholeProjectDiagnosticReport &wholeProjectDiagnosticReport, bool exportForPreview)
Generate the events JS code, and save them to the export directory.
Definition: ExporterHelper.cpp:961
gd::String codeOutputDir
Definition: ExporterHelper.h:611
bool ExportIndexFile(const gd::Project &project, gd::String source, gd::String exportDir, const std::vector< gd::String > &includesFiles, const std::vector< gd::SourceFileMetadata > &sourceFiles, unsigned int nonRuntimeScriptsCacheBurst, gd::String additionalSpec="")
Generate the standard index file and save it to the export directory.
Definition: ExporterHelper.cpp:390
void RemoveIncludes(bool pixiRenderers, std::vector< gd::String > &includesFiles)
Remove include files that are Pixi renderers.
Definition: ExporterHelper.cpp:935
const gd::String & GetLastError() const
Return the error that occurred during the last export.
Definition: ExporterHelper.h:379
static gd::String ExportProjectData(gd::AbstractFileSystem &fs, gd::Project &project, gd::String filename, const gd::SerializerElement &runtimeGameOptions, std::set< gd::String > &projectUsedResources, std::unordered_map< gd::String, std::set< gd::String >> &layersUsedResources)
Export a project to JSON.
Definition: ExporterHelper.cpp:337
const gd::String GenerateWebManifest(const gd::Project &project)
Generates a WebManifest, a metadata file that allow to make the exported game a working PWA.
Definition: ExporterHelper.cpp:1118
gd::AbstractFileSystem & fs
The abstract file system to be used for exportation.
Definition: ExporterHelper.h:607
bool ExportElectronFiles(const gd::Project &project, gd::String exportDir, std::set< gd::String > usedExtensions)
Generate the Electron files for packaging and save it to the export directory.
Definition: ExporterHelper.cpp:657
void SetCodeOutputDirectory(gd::String codeOutputDir_)
Change the directory where code files are generated.
Definition: ExporterHelper.h:596
The options used to export a project.
Definition: ExporterHelper.h:324
ExportOptions & SetTarget(const gd::String &target_)
Set the (optional) target platform.
Definition: ExporterHelper.h:353
ExportOptions(gd::Project &project_, const gd::String &exportPath_)
Definition: ExporterHelper.h:329
ExportOptions & SetFallbackAuthor(const gd::String &id, const gd::String &username)
Set the fallback author info (if info not present in project properties).
Definition: ExporterHelper.h:340
The options used to export a project for a preview.
Definition: ExporterHelper.h:34
PreviewExportOptions & SetCrashReportUploadLevel(const gd::String &crashReportUploadLevel_)
Set the level of crash reports to be sent to GDevelop APIs.
Definition: ExporterHelper.h:234
PreviewExportOptions & UseWindowMessageDebuggerClient()
Set that the game should connect to the debugger server using the "Window Message " debugger client.
Definition: ExporterHelper.h:108
PreviewExportOptions & SetProjectTemplateSlug(const gd::String &projectTemplateSlug_)
Set the template slug that was used to create the project.
Definition: ExporterHelper.h:260
PreviewExportOptions & SetSourceGameId(const gd::String &sourceGameId_)
Set the source game id that was used to create the project.
Definition: ExporterHelper.h:269
PreviewExportOptions & SetExternalLayoutName(const gd::String &externalLayoutName_)
Set the (optional) external layout to be instantiated in the scene at the beginning of the previewed ...
Definition: ExporterHelper.h:142
PreviewExportOptions & SetElectronRemoteRequirePath(const gd::String &electronRemoteRequirePath_)
Definition: ExporterHelper.h:201
PreviewExportOptions & SetGDevelopResourceToken(const gd::String &gdevelopResourceToken_)
Definition: ExporterHelper.h:211
PreviewExportOptions & SetIncludeFileHash(const gd::String &includeFile, int hash)
Set the hash associated to an include file. Useful for the preview hot-reload, to know if a file chan...
Definition: ExporterHelper.h:152
PreviewExportOptions & SetGDevelopVersionWithHash(const gd::String &gdevelopVersionWithHash_)
Set the GDevelop version so the game is aware of it.
Definition: ExporterHelper.h:251
PreviewExportOptions & SetIsDevelopmentEnvironment(bool enable)
Set if the export should consider to be in a development environment of GDevelop (the game should use...
Definition: ExporterHelper.h:180
PreviewExportOptions & SetPreviewContext(const gd::String &previewContext_)
Set the context of the preview.
Definition: ExporterHelper.h:243
PreviewExportOptions & UseMinimalDebuggerClient()
Set that the game should have a minimal debugger client.
Definition: ExporterHelper.h:116
PreviewExportOptions & SetFullLoadingScreen(bool enable)
Set if the export should show the full loading screen (false by default, skipping the minimum duratio...
Definition: ExporterHelper.h:171
PreviewExportOptions & UseWebsocketDebuggerClientWithServerAddress(const gd::String &address, const gd::String &port)
Set the address of the debugger server that the game should reach out to, using the "WebSockets" debu...
Definition: ExporterHelper.h:62
PreviewExportOptions & SetFallbackAuthor(const gd::String &id, const gd::String &username)
Set the fallback author info (if info not present in project properties).
Definition: ExporterHelper.h:84
PreviewExportOptions & SetLayoutName(const gd::String &layoutName_)
Set the layout to be run first in the previewed game.
Definition: ExporterHelper.h:133
PreviewExportOptions & SetAuthenticatedPlayer(const gd::String &id, const gd::String &username, const gd::String &token)
Set the fallback author info (if info not present in project properties).
Definition: ExporterHelper.h:95
PreviewExportOptions & SetInAppTutorialMessageInPreview(const gd::String &message, const gd::String &position)
Set the message to display to the user in a preview (as part of an in-app tutorial).
Definition: ExporterHelper.h:73
PreviewExportOptions(gd::Project &project_, const gd::String &exportPath_)
Definition: ExporterHelper.h:39
PreviewExportOptions & SetNonRuntimeScriptsCacheBurst(unsigned int value)
If set to a non zero value, the exported script URLs will have an extra search parameter added (with ...
Definition: ExporterHelper.h:190
PreviewExportOptions & SetNativeMobileApp(bool enable)
Set that the preview is launched from a GDevelop native mobile app (iOS or Android).
Definition: ExporterHelper.h:125
PreviewExportOptions & AddScreenshotCapture(int delayTimeInSeconds, const gd::String &signedUrl, const gd::String &publicUrl)
Set the capture options to be used for taking screenshots or videos of the preview.
Definition: ExporterHelper.h:278
PreviewExportOptions & SetProjectDataOnlyExport(bool enable)
Set if the export should only export the project data, not exporting events code.
Definition: ExporterHelper.h:162
PreviewExportOptions & SetAllowAuthenticationUsingIframeForPreview(bool allowAuthenticationUsingIframeForPreview_)
Definition: ExporterHelper.h:224