Compare commits
2 Commits
3b366cbbae
...
f2c4c05b27
| Author | SHA1 | Date | |
|---|---|---|---|
| f2c4c05b27 | |||
| fc3a0d026f |
5
log.go
5
log.go
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
@@ -13,7 +14,7 @@ type Logger struct {
|
||||
logMaxLines int
|
||||
}
|
||||
|
||||
var globalLogger *Logger;
|
||||
var globalLogger *Logger
|
||||
|
||||
func InitLogger(text *widget.Entry, maxLines int) {
|
||||
globalLogger = &Logger{
|
||||
@@ -32,9 +33,11 @@ func Log(line string) {
|
||||
}
|
||||
|
||||
func (l *Logger) log(line string) {
|
||||
fyne.Do(func() {
|
||||
l.logBuffer = append(l.logBuffer, line)
|
||||
if len(l.logBuffer) > l.logMaxLines {
|
||||
l.logBuffer = l.logBuffer[1:]
|
||||
}
|
||||
l.logText.SetText(strings.Join(l.logBuffer, "\n"))
|
||||
})
|
||||
}
|
||||
@@ -1,38 +1,26 @@
|
||||
[
|
||||
{
|
||||
"enginePath": "/home/yann/Apps/UE_5.5/",
|
||||
"projectPath": "/home/yann/Projects/unreal/NpcChatbot/",
|
||||
"projectName": "NpcChatbot",
|
||||
"engineVersion": "5.5"
|
||||
},
|
||||
{
|
||||
"enginePath": "/home/yann/Apps/UE_5.5/",
|
||||
"projectPath": "/home/yann/Projects/unreal/jsbsim/UnrealEngine/",
|
||||
"projectName": "UEReferenceApp",
|
||||
"engineVersion": "5.5"
|
||||
},
|
||||
{
|
||||
"enginePath": "/home/yann/Apps/UE_5.5/",
|
||||
"projectPath": "/run/media/yann/Devel/Unreal/AeroSyncUFS",
|
||||
"enginePath": "D:/Devel/UE_5.7",
|
||||
"projectPath": "E:/unreal/AeroSyncFS/",
|
||||
"projectName": "MiniFS",
|
||||
"engineVersion": "5.5"
|
||||
"engineVersion": "5.7"
|
||||
},
|
||||
{
|
||||
"enginePath": "/home/yann/Apps/UE_5.5/",
|
||||
"projectPath": "/run/media/yann/Devel/Unreal/CyberneticRequiem",
|
||||
"enginePath": "D:/Devel/UE_5.7",
|
||||
"projectPath": "E:/unreal/CyberneticRequiem/",
|
||||
"projectName": "CyberneticRequiem",
|
||||
"engineVersion": "5.5"
|
||||
"engineVersion": "5.7"
|
||||
},
|
||||
{
|
||||
"enginePath": "/home/yann/Apps/UE_5.5/",
|
||||
"projectPath": "/run/media/yann/Devel/Unreal/DVRSimulator",
|
||||
"enginePath": "D:/Devel/UE_5.5",
|
||||
"projectPath": "E:/unreal/DVRSimulator/",
|
||||
"projectName": "DVRSimulator",
|
||||
"engineVersion": "5.5"
|
||||
},
|
||||
{
|
||||
"enginePath": "/home/yann/Apps/UE_5.5/",
|
||||
"projectPath": "/run/media/yann/Devel/Unreal/GunSpinningVR",
|
||||
"projectName": "GSPVR",
|
||||
"enginePath": "D:/Devel/UE_5.5",
|
||||
"projectPath": "E:/novelab/unreal/SNCF_Regiolis",
|
||||
"projectName": "SNCF_Regiolis",
|
||||
"engineVersion": "5.5"
|
||||
}
|
||||
]
|
||||
|
||||
2
ui.go
2
ui.go
@@ -28,7 +28,7 @@ func NewProjectRow(project Project) fyne.CanvasObject {
|
||||
}
|
||||
|
||||
icon := canvas.NewImageFromResource(projectIcon)
|
||||
icon.SetMinSize(fyne.NewSize(48, 48))
|
||||
icon.SetMinSize(fyne.NewSize(64, 64))
|
||||
|
||||
nameLabel := widget.NewLabel(projectName + " / Unreal Engine " + project.Version)
|
||||
nameLabel.Alignment = fyne.TextAlignLeading
|
||||
|
||||
76
utils.go
76
utils.go
@@ -71,33 +71,66 @@ func CleanUnrealProject(project Project) {
|
||||
}
|
||||
|
||||
func GenerateUnrealSolution(project Project) {
|
||||
var buildCmd string
|
||||
var cmd *exec.Cmd
|
||||
|
||||
projectFile := project.ProjectPath + "/" + project.ProjectName + ".uproject"
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
buildCmd = project.EnginePath + "/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh"
|
||||
buildCmd := project.EnginePath + "/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh"
|
||||
cmd = exec.Command(buildCmd, projectFile, "-game")
|
||||
|
||||
case "darwin":
|
||||
buildCmd = project.EnginePath + "/Engine/Build/BatchFiles/Mac/GenerateProjectFiles.sh"
|
||||
buildCmd := project.EnginePath + "/Engine/Build/BatchFiles/Mac/GenerateProjectFiles.sh"
|
||||
cmd = exec.Command(buildCmd, projectFile, "-game")
|
||||
|
||||
case "windows":
|
||||
ubtPath := project.EnginePath + "\\Engine\\Binaries\\DotNET\\UnrealBuildTool\\UnrealBuildTool.dll"
|
||||
cmd = exec.Command(
|
||||
"dotnet", ubtPath,
|
||||
"-projectfiles",
|
||||
"-project="+projectFile,
|
||||
"-game",
|
||||
"-progress",
|
||||
)
|
||||
|
||||
default:
|
||||
fmt.Println("Generate Project is not yet supported on Windows")
|
||||
fmt.Println("Generate Project is not supported on this platform:", runtime.GOOS)
|
||||
return
|
||||
}
|
||||
|
||||
projectCmd := project.ProjectPath + "/" + project.ProjectName + ".uproject"
|
||||
cmd := exec.Command(buildCmd, projectCmd, "-game")
|
||||
|
||||
logToOutput(cmd)
|
||||
}
|
||||
|
||||
func BuildUnrealSolution(project Project) {
|
||||
var cmd *exec.Cmd
|
||||
projectFile := project.ProjectPath + "/" + project.ProjectName + ".uproject"
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
cmd := exec.Command("make", "-C", project.ProjectPath, project.ProjectName)
|
||||
logToOutput(cmd)
|
||||
cmd = exec.Command("make", "-C", project.ProjectPath, project.ProjectName)
|
||||
|
||||
case "windows":
|
||||
buildBatch := project.EnginePath + "\\Engine\\Build\\BatchFiles\\Build.bat"
|
||||
target := project.ProjectName + "Editor"
|
||||
platform := "Win64"
|
||||
config := "Development"
|
||||
|
||||
cmd = exec.Command(
|
||||
buildBatch,
|
||||
target,
|
||||
platform,
|
||||
config,
|
||||
"-Project="+projectFile,
|
||||
"-WaitMutex",
|
||||
)
|
||||
|
||||
default:
|
||||
fmt.Println("Build Project is not yet supported on Windows")
|
||||
fmt.Println("Build Project is not yet supported on this platform:", runtime.GOOS)
|
||||
return
|
||||
}
|
||||
|
||||
logToOutput(cmd)
|
||||
}
|
||||
|
||||
func RunUnrealProject(project Project) {
|
||||
@@ -133,18 +166,27 @@ func logToOutput(cmd *exec.Cmd) {
|
||||
fmt.Println("Error while loading command")
|
||||
}
|
||||
|
||||
readPipe := func(reader io.ReadCloser) {
|
||||
readPipe := func(reader io.ReadCloser, prefix string) {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
if prefix != "" {
|
||||
Log(prefix + line)
|
||||
} else {
|
||||
Log(line)
|
||||
}
|
||||
}
|
||||
|
||||
go readPipe(stdout)
|
||||
go readPipe(stderr)
|
||||
|
||||
if err := cmd.Wait(); err != nil {
|
||||
fmt.Println("Error")
|
||||
}
|
||||
|
||||
go readPipe(stdout, "")
|
||||
go readPipe(stderr, "[ERR] ")
|
||||
|
||||
// attendre la fin dans une goroutine => pas de blocage de l'UI
|
||||
go func() {
|
||||
if err := cmd.Wait(); err != nil {
|
||||
Log("[FAIL] " + err.Error())
|
||||
} else {
|
||||
Log("[DONE] Process finished")
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user