1
1
defmodule BuildScript do
2
- @url "https://github.com/V-Sekai/world-editor /releases/download/latest.v-sekai-editor-187 /v-sekai-world.zip"
2
+ @url "https://github.com/V-Sekai/world-godot /releases/download/latest.v-sekai-editor-2 /v-sekai-world.zip"
3
3
@output "v-sekai-world.zip"
4
4
@extract_dir "export"
5
5
@extract_dir_extracted "#{@extract_dir}/temp"
6
6
@os_family :os.type()
7
7
@project_name "xr_grid"
8
- @expected_hash "F7AB549A676C52DD47F9D74C9308EBBE447ABFA1513C7E563B3C15809C0CE3E3 "
8
+ @expected_hash "657529B71E0BFF9500265FEE8C4A932E58A7FAC87CB1600F851ABA7C56FC15E6 "
9
9
10
10
def all do
11
11
pending_files_to_delete = editor_download()
@@ -110,16 +110,16 @@ defmodule BuildScript do
110
110
def export_stage do
111
111
editor_path = case @os_family do
112
112
{:win32, :nt} ->
113
- "#{@extract_dir_extracted}/godot.windows.editor.double.x86_64.llvm.exe"
113
+ Path.expand( "#{@extract_dir_extracted}/godot.windows.editor.double.x86_64.llvm.exe")
114
114
{:unix, :darwin} ->
115
- "#{@extract_dir_extracted}/godot.macos.editor.double.arm64"
115
+ Path.expand( "#{@extract_dir_extracted}/godot.macos.editor.double.arm64")
116
116
{:unix, _} ->
117
- "#{@extract_dir_extracted}/godot.linux.editor.double.x86_64"
117
+ Path.expand( "#{@extract_dir_extracted}/godot.linux.editor.double.x86_64")
118
118
end
119
119
120
120
if File.exists?(editor_path) do
121
121
File.chmod(editor_path, 0o755)
122
- version = System.cmd(editor_path, ["--version"]) |> elem(0) |> String.trim()
122
+ version = System.cmd(editor_path, ["--headless", "-- version"]) |> elem(0) |> String.trim()
123
123
platforms = [
124
124
{"windows", "x86_64"},
125
125
{"linuxbsd", "x86_64"},
@@ -132,6 +132,7 @@ defmodule BuildScript do
132
132
end
133
133
else
134
134
IO.puts("Editor path not found: #{editor_path}")
135
+ exit(:normal)
135
136
end
136
137
end
137
138
@@ -207,30 +208,32 @@ defmodule BuildScript do
207
208
File.cp!(debug_file, "#{templatedir}/#{debug_file_name}", force: true)
208
209
File.cp!(release_file, "#{templatedir}/#{release_file_name}", force: true)
209
210
end
210
-
211
211
def export_platform(from_platform, from_arch, target_platform, target_arch) do
212
212
File.rm_rf!("#{@extract_dir}/export_#{target_platform}_#{target_arch}")
213
213
File.mkdir_p!("#{@extract_dir}/export_#{target_platform}_#{target_arch}")
214
-
215
- editor_file = if from_platform == "windows" and File.exists?("#{@extract_dir_extracted}/godot.#{from_platform}.editor.double.#{from_arch}.llvm.exe") do
216
- "#{@extract_dir_extracted}/godot.#{from_platform}.editor.double.#{from_arch}.llvm.exe"
217
- else
218
- "#{@extract_dir_extracted}/godot.#{from_platform}.editor.double.#{from_arch}"
214
+ editor_file = cond do
215
+ from_platform == "windows" and File.exists?("#{@extract_dir_extracted}/godot.#{from_platform}.editor.double.#{from_arch}.llvm.exe") ->
216
+ "#{@extract_dir_extracted}/godot.#{from_platform}.editor.double.#{from_arch}.llvm.exe"
217
+ from_platform == "macos" and File.exists?("#{@extract_dir_extracted}/godot.macos.editor.double.arm64") ->
218
+ "#{@extract_dir_extracted}/godot.macos.editor.double.arm64"
219
+ true ->
220
+ "#{@extract_dir_extracted}/godot.#{from_platform}.editor.double.#{from_arch}"
219
221
end
220
- env = [{"ANDROID_SDK_ROOT", "#{File.cwd!()}/android_sdk"}, {"JAVA_HOME", "#{File.cwd!()}/jdk"}]
221
- arguments = ["--headless", "--path", ".", "--import"]
222
- System.cmd(editor_file, arguments, env: env)
222
+ File.chmod(editor_file, 0o755)
223
+ pwd = Path.dirname(__ENV__.file)
224
+ arguments = ["--headless", "--path", pwd, "--import", "-e"]
225
+ System.cmd("bash", ["-c", "#{editor_file} #{Enum.join(arguments, " ")}"], stderr_to_stdout: true)
223
226
224
227
output_file = "#{@extract_dir}/export_#{target_platform}_#{target_arch}/#{@project_name}"
225
228
output_file = if target_platform == "windows", do: output_file <> ".exe", else: output_file
226
229
227
- arguments = ["--headless", "--path", "." , "--export-release", target_platform, output_file]
228
- System.cmd(editor_file, arguments, env: env )
230
+ arguments = ["--headless", "--path", pwd , "--export-release", target_platform, output_file, "-e" ]
231
+ {_, 0} = System.cmd("bash", ["-c", "#{editor_file} #{Enum.join( arguments, " ")}"], stderr_to_stdout: true )
229
232
IO.puts(Enum.join(arguments, " "))
230
233
231
234
case target_platform do
232
235
"windows" ->
233
- System.cmd("strip", [output_file])
236
+ System.cmd("strip", [output_file], stderr_to_stdout: true )
234
237
pdb_file = "#{@extract_dir_extracted}/godot.#{target_platform}.template_release.double.#{from_arch}.llvm.pdb"
235
238
if File.exists?(pdb_file) do
236
239
File.cp!(pdb_file, "#{@extract_dir}/export_#{target_platform}_#{target_arch}/#{Path.basename(pdb_file)}")
0 commit comments