| 148 | } |
| 149 | |
| 150 | bool CompileScriptsStep::Perform(CookingData& data) |
| 151 | { |
| 152 | data.StepProgress(TEXT("Compiling game scripts"), 0); |
| 153 | |
| 154 | const ProjectInfo* project = Editor::Project; |
| 155 | String target = project->GameTarget; |
| 156 | StringView workingDir; |
| 157 | const Char *platform, *architecture, *configuration = ::ToString(data.Configuration); |
| 158 | data.GetBuildPlatformName(platform, architecture); |
| 159 | String targetBuildInfo = project->ProjectFolderPath / TEXT("Binaries") / target / platform / architecture / configuration / target + TEXT(".Build.json"); |
| 160 | if (target.IsEmpty()) |
| 161 | { |
| 162 | // Fallback to engine-only if game has no code |
| 163 | LOG(Warning, "Empty GameTarget in project."); |
| 164 | target = TEXT("FlaxGame"); |
| 165 | workingDir = Globals::StartupFolder; |
| 166 | targetBuildInfo = Globals::StartupFolder / TEXT("Source/Platforms") / platform / TEXT("Binaries") / TEXT("Game") / architecture / configuration / target + TEXT(".Build.json"); |
| 167 | } |
| 168 | _extensionsToSkip.Clear(); |
| 169 | _extensionsToSkip.Add(TEXT(".exp")); |
| 170 | _extensionsToSkip.Add(TEXT(".ilk")); |
| 171 | _extensionsToSkip.Add(TEXT(".lib")); |
| 172 | _extensionsToSkip.Add(TEXT(".a")); |
| 173 | _extensionsToSkip.Add(TEXT(".Build.json")); |
| 174 | _extensionsToSkip.Add(TEXT(".DS_Store")); |
| 175 | if (data.Configuration == BuildConfiguration::Release) |
| 176 | { |
| 177 | _extensionsToSkip.Add(TEXT(".xml")); |
| 178 | _extensionsToSkip.Add(TEXT(".pdb")); |
| 179 | } |
| 180 | _deployedBuilds.Clear(); |
| 181 | data.BinaryModules.Clear(); |
| 182 | |
| 183 | if (data.Tools->OnScriptsCompilationStart(data)) |
| 184 | return true; |
| 185 | |
| 186 | BUILD_STEP_CANCEL_CHECK; |
| 187 | |
| 188 | // Compile the scripts |
| 189 | LOG(Info, "Starting scripts compilation for game..."); |
| 190 | const String logFile = data.CacheDirectory / TEXT("CompileLog.txt"); |
| 191 | auto args = String::Format( |
| 192 | TEXT("-log -logfile=\"{4}\" -build -mutex -buildtargets={0} -platform={1} -arch={2} -configuration={3} -aotMode={5} {6}"), |
| 193 | target, platform, architecture, configuration, logFile, ToString(data.Tools->UseAOT()), data.GetDotnetCommandArg()); |
| 194 | #if PLATFORM_WINDOWS |
| 195 | if (data.Platform == BuildPlatform::LinuxX64) |
| 196 | #elif PLATFORM_LINUX |
| 197 | if (data.Platform == BuildPlatform::Windows64 || data.Platform == BuildPlatform::Windows32) |
| 198 | #else |
| 199 | if (false) |
| 200 | #endif |
| 201 | { |
| 202 | // Skip building C++ (no need to install cross-toolchain to build C#-only game) |
| 203 | args += TEXT(" -BuildBindingsOnly"); |
| 204 | |
| 205 | // Assume FlaxGame was prebuilt for target platform |
| 206 | args += TEXT(" -SkipTargets=FlaxGame"); |
| 207 | } |
nothing calls this directly
no test coverage detected