[studio,keel] Make keel-pack command a Studio Module subcommand
Build / build (push) Failing after 26s
Build / build (push) Failing after 26s
This commit is contained in:
@@ -27,8 +27,8 @@ git-push-ox:
|
|||||||
git subtree push --prefix=deps/oxlib ox-master master
|
git subtree push --prefix=deps/oxlib ox-master master
|
||||||
|
|
||||||
.PHONY: pkg-gba
|
.PHONY: pkg-gba
|
||||||
pkg-gba: build-pack build-gba-player
|
pkg-gba: build-studio build-gba-player
|
||||||
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/pkg-gba.py sample_project ${BC_VAR_PROJECT_NAME_CAP}
|
${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/pkg-gba.py ${PROJECT_STUDIO} sample_project ${BC_VAR_PROJECT_NAME_CAP}
|
||||||
|
|
||||||
.PHONY: pkg-mac
|
.PHONY: pkg-mac
|
||||||
pkg-mac: install
|
pkg-mac: install
|
||||||
@@ -47,11 +47,6 @@ build-gba-player:
|
|||||||
build-player:
|
build-player:
|
||||||
${BC_CMD_CMAKE_BUILD} ${BC_VAR_BUILD_PATH} ${BC_VAR_PROJECT_NAME_CAP}
|
${BC_CMD_CMAKE_BUILD} ${BC_VAR_BUILD_PATH} ${BC_VAR_PROJECT_NAME_CAP}
|
||||||
|
|
||||||
.PHONY: build-pack
|
|
||||||
build-pack:
|
|
||||||
cmake --build ./build/${BC_VAR_CURRENT_BUILD} --target ${BC_VAR_PROJECT_NAME}-pack
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run: build-player
|
run: build-player
|
||||||
${PROJECT_PLAYER} sample_project
|
${PROJECT_PLAYER} sample_project
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ if(${NOSTALGIA_BUILD_PLAYER})
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT BUILDCORE_TARGET STREQUAL "gba")
|
if(NOT BUILDCORE_TARGET STREQUAL "gba")
|
||||||
add_subdirectory(tools)
|
|
||||||
if(${NOSTALGIA_BUILD_STUDIO_APP})
|
if(${NOSTALGIA_BUILD_STUDIO_APP})
|
||||||
add_subdirectory(studio)
|
add_subdirectory(studio)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
add_executable(nostalgia-pack)
|
|
||||||
|
|
||||||
target_link_libraries(
|
|
||||||
nostalgia-pack
|
|
||||||
KeelPack-AppLib
|
|
||||||
NostalgiaKeelModules
|
|
||||||
NostalgiaProfile
|
|
||||||
OlympicApplib
|
|
||||||
)
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT WIN32)
|
|
||||||
# enable LTO
|
|
||||||
set_property(TARGET nostalgia-pack PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS
|
|
||||||
nostalgia-pack
|
|
||||||
RUNTIME DESTINATION
|
|
||||||
bin
|
|
||||||
)
|
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
namespace olympic {
|
namespace olympic {
|
||||||
ox::StringLiteral appVersion{OLYMPIC_APP_VERSION};
|
ox::StringLiteral appVersion{OLYMPIC_APP_VERSION};
|
||||||
ox::StringLiteral appId{OLYMPIC_APP_ID};
|
ox::StringLiteral appId{OLYMPIC_APP_ID};
|
||||||
|
ox::StringLiteral projectName{OLYMPIC_PROJECT_NAME};
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error run(
|
ox::Error run(
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ox/std/error.hpp>
|
||||||
|
#include <ox/std/span.hpp>
|
||||||
|
#include <ox/std/stringview.hpp>
|
||||||
|
|
||||||
|
namespace keel {
|
||||||
|
|
||||||
|
ox::Error pack(
|
||||||
|
ox::StringViewCR projectDir,
|
||||||
|
ox::StringViewCR projectDataDir,
|
||||||
|
ox::SpanView<ox::CString> argv) noexcept;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -41,20 +41,15 @@ install(
|
|||||||
|
|
||||||
if(TURBINE_BUILD_TYPE STREQUAL "Native")
|
if(TURBINE_BUILD_TYPE STREQUAL "Native")
|
||||||
add_library(
|
add_library(
|
||||||
KeelPack-AppLib
|
KeelPack-PackLib
|
||||||
pack-applib.cpp
|
pack-packlib.cpp
|
||||||
)
|
)
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
KeelPack-AppLib PUBLIC
|
KeelPack-PackLib PUBLIC
|
||||||
../include
|
../include
|
||||||
)
|
)
|
||||||
target_compile_definitions(
|
|
||||||
KeelPack-AppLib PUBLIC
|
|
||||||
OLYMPIC_LOAD_KEEL_MODULES=1
|
|
||||||
OLYMPIC_APP_NAME="Keel Pack"
|
|
||||||
)
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
KeelPack-AppLib
|
KeelPack-PackLib
|
||||||
Keel
|
Keel
|
||||||
OxClArgs
|
OxClArgs
|
||||||
OxClaw
|
OxClaw
|
||||||
@@ -62,7 +57,7 @@ if(TURBINE_BUILD_TYPE STREQUAL "Native")
|
|||||||
)
|
)
|
||||||
install(
|
install(
|
||||||
TARGETS
|
TARGETS
|
||||||
KeelPack-AppLib
|
KeelPack-PackLib
|
||||||
DESTINATION
|
DESTINATION
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
|
|||||||
@@ -92,22 +92,20 @@ static ox::Error pack(
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error run(
|
namespace keel {
|
||||||
[[maybe_unused]] ox::StringView const project,
|
|
||||||
[[maybe_unused]] ox::StringView const appName,
|
ox::Error pack(
|
||||||
ox::StringView const projectDataDir,
|
ox::StringViewCR projectDir,
|
||||||
|
ox::StringViewCR projectDataDir,
|
||||||
ox::SpanView<ox::CString> const argv) noexcept {
|
ox::SpanView<ox::CString> const argv) noexcept {
|
||||||
ox::ClArgs const args(argv);
|
ox::ClArgs const args(argv);
|
||||||
auto const argSrc = args.getString("src", "");
|
|
||||||
auto const argRomBin = args.getString("rom-bin", "");
|
auto const argRomBin = args.getString("rom-bin", "");
|
||||||
auto const argManifest = args.getString("manifest", "");
|
auto const argManifest = args.getString("manifest", "");
|
||||||
if (argSrc == "") {
|
|
||||||
oxErr("\033[31;1;1merror:\033[0m must specify a source directory\n");
|
|
||||||
return ox::Error(1, "must specify a source directory");
|
|
||||||
}
|
|
||||||
if (argRomBin == "") {
|
if (argRomBin == "") {
|
||||||
oxErr("\033[31;1;1merror:\033[0m must specify a path for ROM file\n");
|
oxErr("\033[31;1;1merror:\033[0m must specify a path for ROM file\n");
|
||||||
return ox::Error(1, "must specify a path for preload file");
|
return ox::Error(1, "must specify a path for preload file");
|
||||||
}
|
}
|
||||||
return pack(argSrc, argRomBin, argManifest, projectDataDir);
|
return ::pack(projectDir, argRomBin, argManifest, projectDataDir);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <studioapp/studioapp.hpp>
|
#include <studioapp/studioapp.hpp>
|
||||||
|
|
||||||
#include "subcommands/change-format/change-format.hpp"
|
#include "subcommands/change-format/change-format.hpp"
|
||||||
|
#include "subcommands/pack/pack.hpp"
|
||||||
|
|
||||||
#include "configfile.hpp"
|
#include "configfile.hpp"
|
||||||
#include "font.hpp"
|
#include "font.hpp"
|
||||||
@@ -46,10 +47,8 @@ static struct: Module {
|
|||||||
|
|
||||||
ox::Vector<Command> commands() const final {
|
ox::Vector<Command> commands() const final {
|
||||||
return {
|
return {
|
||||||
{
|
{ "change-format", cmdChangeFormat, },
|
||||||
"change-format",
|
{ "pack", cmdPack, },
|
||||||
cmdChangeFormat,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} constexpr mod;
|
} constexpr mod;
|
||||||
@@ -152,6 +151,7 @@ static ox::Error run(
|
|||||||
ox::StringView const moduleId = args[3];
|
ox::StringView const moduleId = args[3];
|
||||||
ox::StringView const subCmd = args[4];
|
ox::StringView const subCmd = args[4];
|
||||||
for (auto const m : modules()) {
|
for (auto const m : modules()) {
|
||||||
|
oxDebug(m->id());
|
||||||
if (m->id() == moduleId) {
|
if (m->id() == moduleId) {
|
||||||
for (auto const &c : m->commands()) {
|
for (auto const &c : m->commands()) {
|
||||||
if (c.name == subCmd) {
|
if (c.name == subCmd) {
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
target_sources(
|
target_sources(
|
||||||
StudioAppLib PRIVATE
|
StudioAppLib PRIVATE
|
||||||
change-format/change-format.cpp
|
change-format/change-format.cpp
|
||||||
|
pack/pack.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
StudioAppLib PUBLIC
|
StudioAppLib PUBLIC
|
||||||
OxClArgs
|
OxClArgs
|
||||||
|
KeelPack-PackLib
|
||||||
)
|
)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <keel/pack-packlib.hpp>
|
||||||
|
|
||||||
|
#include "pack.hpp"
|
||||||
|
|
||||||
|
namespace olympic {
|
||||||
|
extern ox::StringLiteral projectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace studio {
|
||||||
|
|
||||||
|
ox::Error cmdPack(Project &project, ox::SpanView<ox::CString> args) noexcept {
|
||||||
|
return keel::pack(project.projectPath(), olympic::projectName, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <studio/project.hpp>
|
||||||
|
|
||||||
|
namespace studio {
|
||||||
|
|
||||||
|
ox::Error cmdPack(Project &project, ox::SpanView<ox::CString> args) noexcept;
|
||||||
|
|
||||||
|
}
|
||||||
+8
-14
@@ -8,36 +8,30 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
#
|
#
|
||||||
|
|
||||||
import platform
|
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
os = platform.system().lower()
|
|
||||||
arch = platform.machine()
|
|
||||||
host_env = f'{os}-{arch}'
|
|
||||||
|
|
||||||
def run(args: list[str]):
|
def run(args: list[str]):
|
||||||
if subprocess.run(args).returncode != 0:
|
if subprocess.run(args).returncode != 0:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# get the current build type
|
|
||||||
with open(".current_build", "r") as f:
|
|
||||||
current_build = f.readlines()[0]
|
|
||||||
if current_build[-1] == '\n':
|
|
||||||
current_build = current_build[:-1]
|
|
||||||
|
|
||||||
project_dir = sys.argv[1]
|
studio_path = sys.argv[1]
|
||||||
project_name = sys.argv[2]
|
project_dir = sys.argv[2]
|
||||||
bin = f'./build/{host_env}-{current_build}/bin/'
|
project_name = sys.argv[3]
|
||||||
project_bin = f'build/gba-release/bin/{project_name}.bin'
|
project_bin = f'build/gba-release/bin/{project_name}.bin'
|
||||||
project_gba = f'{project_name}.gba'
|
project_gba = f'{project_name}.gba'
|
||||||
project_manifest = f'{project_name.lower()}-manifest.json'
|
project_manifest = f'{project_name.lower()}-manifest.json'
|
||||||
|
|
||||||
shutil.copyfile(project_bin, project_gba)
|
shutil.copyfile(project_bin, project_gba)
|
||||||
run([
|
run([
|
||||||
f'{bin}/{project_name.lower()}-pack',
|
studio_path,
|
||||||
'-src', project_dir,
|
'cmd',
|
||||||
|
project_dir,
|
||||||
|
'net.drinkingtea.studio',
|
||||||
|
'pack',
|
||||||
'-rom-bin', project_gba,
|
'-rom-bin', project_gba,
|
||||||
'-manifest', project_manifest])
|
'-manifest', project_manifest])
|
||||||
run(['gbafix', project_gba])
|
run(['gbafix', project_gba])
|
||||||
|
|||||||
Reference in New Issue
Block a user