Step 649: package script generator
This commit is contained in:
@@ -4720,4 +4720,13 @@ target_link_libraries(step648_test PRIVATE
|
||||
tree_sitter_javascript tree_sitter_typescript
|
||||
tree_sitter_java tree_sitter_rust tree_sitter_go)
|
||||
|
||||
add_executable(step649_test tests/step649_test.cpp)
|
||||
target_include_directories(step649_test PRIVATE src)
|
||||
target_link_libraries(step649_test PRIVATE
|
||||
nlohmann_json::nlohmann_json
|
||||
unofficial::tree-sitter::tree-sitter
|
||||
tree_sitter_python tree_sitter_cpp tree_sitter_elisp
|
||||
tree_sitter_javascript tree_sitter_typescript
|
||||
tree_sitter_java tree_sitter_rust tree_sitter_go)
|
||||
|
||||
# Step 12: Dear ImGui shell scaffolding created (main.cpp exists but not built due to dependencies)
|
||||
|
||||
29
editor/src/PackageScriptGenerator.h
Normal file
29
editor/src/PackageScriptGenerator.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
// Step 649: AppImage/.deb package generator
|
||||
|
||||
#include <string>
|
||||
|
||||
struct PackageScripts {
|
||||
bool success = false;
|
||||
std::string appImageScript;
|
||||
std::string debianControl;
|
||||
};
|
||||
|
||||
class PackageScriptGenerator {
|
||||
public:
|
||||
static PackageScripts generate(const std::string& appName,
|
||||
const std::string& version) {
|
||||
PackageScripts out;
|
||||
if (appName.empty() || version.empty()) return out;
|
||||
out.success = true;
|
||||
out.appImageScript = "#!/usr/bin/env bash\n"
|
||||
"set -euo pipefail\n"
|
||||
"appimagetool AppDir " + appName + "-" + version + ".AppImage\n";
|
||||
out.debianControl = "Package: " + appName + "\n"
|
||||
"Version: " + version + "\n"
|
||||
"Architecture: amd64\n"
|
||||
"Maintainer: Whetstone\n"
|
||||
"Description: Whetstone editor package\n";
|
||||
return out;
|
||||
}
|
||||
};
|
||||
24
editor/tests/step649_test.cpp
Normal file
24
editor/tests/step649_test.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
// Step 649: AppImage/.deb package generator (12 tests)
|
||||
|
||||
#include "PackageScriptGenerator.h"
|
||||
#include <iostream>
|
||||
static int p=0,f=0;
|
||||
#define T(n) { std::cout<<" "<<#n<<"... "; }
|
||||
#define P() { std::cout<<"PASS\n"; ++p; }
|
||||
#define F(m) { std::cout<<"FAIL: "<<m<<"\n"; ++f; }
|
||||
#define C(c,m) if(!(c)){F(m);return;}
|
||||
|
||||
void t1(){T(rejects_empty_app_name);auto o=PackageScriptGenerator::generate("","1.0.0");C(!o.success,"should fail");P();}
|
||||
void t2(){T(rejects_empty_version);auto o=PackageScriptGenerator::generate("whetstone","");C(!o.success,"should fail");P();}
|
||||
void t3(){T(generates_successfully);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(o.success,"should pass");P();}
|
||||
void t4(){T(appimage_script_has_shebang);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(o.appImageScript.find("#!/usr/bin/env bash")!=std::string::npos,"shebang");P();}
|
||||
void t5(){T(appimage_script_invokes_tool);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(o.appImageScript.find("appimagetool")!=std::string::npos,"tool missing");P();}
|
||||
void t6(){T(appimage_script_contains_output_name);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(o.appImageScript.find("whetstone-1.0.0.AppImage")!=std::string::npos,"name missing");P();}
|
||||
void t7(){T(debian_control_contains_package);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(o.debianControl.find("Package: whetstone")!=std::string::npos,"pkg missing");P();}
|
||||
void t8(){T(debian_control_contains_version);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(o.debianControl.find("Version: 1.0.0")!=std::string::npos,"version missing");P();}
|
||||
void t9(){T(debian_control_contains_architecture);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(o.debianControl.find("Architecture: amd64")!=std::string::npos,"arch missing");P();}
|
||||
void t10(){T(debian_control_contains_maintainer);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(o.debianControl.find("Maintainer:")!=std::string::npos,"maintainer missing");P();}
|
||||
void t11(){T(debian_control_contains_description);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(o.debianControl.find("Description:")!=std::string::npos,"desc missing");P();}
|
||||
void t12(){T(scripts_non_empty_when_successful);auto o=PackageScriptGenerator::generate("whetstone","1.0.0");C(!o.appImageScript.empty()&&!o.debianControl.empty(),"scripts empty");P();}
|
||||
|
||||
int main(){std::cout<<"Step 649: AppImage/.deb package generator\n";t1();t2();t3();t4();t5();t6();t7();t8();t9();t10();t11();t12();std::cout<<"\nResults: "<<p<<"/"<<(p+f)<<" passed\n";return f?1:0;}
|
||||
24
progress.md
24
progress.md
@@ -13301,3 +13301,27 @@ readiness signal.
|
||||
- `editor/src/Phase39aIntegration.h` (`49` <= `600`)
|
||||
- `editor/tests/step648_test.cpp` within test-file size guidance (`21` lines)
|
||||
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
|
||||
|
||||
### Step 649: AppImage / .deb package generator
|
||||
**Status:** PASS (12/12 tests)
|
||||
|
||||
Adds packaging-script generation for AppImage and Debian control metadata from
|
||||
project release attributes.
|
||||
|
||||
**Files added:**
|
||||
- `editor/src/PackageScriptGenerator.h` - package script generator model
|
||||
- `editor/tests/step649_test.cpp` - 12 tests for script content and validation
|
||||
|
||||
**Files modified:**
|
||||
- `editor/CMakeLists.txt` - `step649_test` target
|
||||
|
||||
**Verification run:**
|
||||
- `cmake -S editor -B editor/build-native` - PASS
|
||||
- `cmake --build editor/build-native --target step649_test step648_test` - PASS
|
||||
- `./editor/build-native/step649_test` - PASS (12/12)
|
||||
- `./editor/build-native/step648_test` - PASS (8/8) regression coverage
|
||||
|
||||
**Architecture gate check:**
|
||||
- `editor/src/PackageScriptGenerator.h` (`29` <= `600`)
|
||||
- `editor/tests/step649_test.cpp` within test-file size guidance (`24` lines)
|
||||
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
|
||||
|
||||
Reference in New Issue
Block a user