tirbofish/dropbear · diff
adding support for magna-carta exporting, as well as some general fixes with the build menu.
jarvis, create a new release for magna-carta
Signature present but could not be verified.
Unverified
@@ -0,0 +1,96 @@ +name: Release Magna Carta + +on: + push: + branches: + - main # or your default branch + +jobs: + check-and-release: + runs-on: ubuntu-latest + outputs: + should_release: ${{ steps.check-commit.outputs.should_release }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check commit message + id: check-commit + run: | + COMMIT_MSG=$(git log -1 --pretty=%B) + if [[ "$COMMIT_MSG" == *"jarvis, create a new release for magna-carta"* ]]; then + echo "should_release=true" >> $GITHUB_OUTPUT + else + echo "should_release=false" >> $GITHUB_OUTPUT + fi + + build-and-release: + needs: check-and-release + if: needs.check-and-release.outputs.should_release == 'true' + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + artifact_name: magna-carta-linux + - os: windows-latest + target: x86_64-pc-windows-msvc + artifact_name: magna-carta-windows.exe + - os: macos-latest + target: x86_64-apple-darwin + artifact_name: magna-carta-macos + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Build release + run: cargo build --release --target ${{ matrix.target }} -p magna-carta + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact_name }} + path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }} + + create-release: + needs: [check-and-release, build-and-release] + if: needs.check-and-release.outputs.should_release == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Check if changelog exists + id: changelog-check + run: | + if [ -f "docs/changelog/magna-carta/CHANGELOG.md" ]; then + cp docs/changelog/magna-carta/CHANGELOG.md ./RELEASE_BODY.md + echo "changelog_exists=true" >> $GITHUB_OUTPUT + else + echo "changelog_exists=false" >> $GITHUB_OUTPUT + fi + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: magna-carta-v${{ github.run_number }} + name: Magna Carta Release v${{ github.run_number }} + body_path: ${{ steps.changelog-check.outputs.changelog_exists == 'true' && 'RELEASE_BODY.md' || '' }} + files: | + artifacts/magna-carta-linux/magna-carta-linux + artifacts/magna-carta-windows.exe/magna-carta-windows.exe + artifacts/magna-carta-macos/magna-carta-macos @@ -102,7 +102,7 @@ kotlin { } jvmMain { - kotlin.srcDirs("src/jvmMain/kotlin", "src/jvmMain/java") + kotlin.srcDirs("src/jvmMain/kotlin", "src/jvmMain/java", "build/magna-carta") dependencies { } @@ -0,0 +1,10 @@ +# magna-carta - *Clause 1: A free church* + +The first ever release of the kotlin manifest generator magna-carta. + +This will be not be bundled by the eucalyptus-editor but instead downloaded when a dropbear project is being +built. + +## Usage + +To use this, run the CLI tool with `magna-carta --help`. It should give you an idea of what to do. @@ -2,7 +2,6 @@ pub mod camera; pub mod dropbear; pub mod input; pub mod logging; -mod ptr; pub mod scripting; pub mod spawn; pub mod states; @@ -1,29 +0,0 @@ -#![allow(dead_code)] // needed because some fields arent accessed -use std::marker::PhantomData; - -/// A clonable Send/Sync pointer. Typically unsafe, but fuck it we ball. -/// Anything to not deal with Mutex and RwLock amirite??? -#[derive(Clone)] -pub struct SafePointer<T> { - ptr: *const T, - _marker: PhantomData<T>, -} - -unsafe impl<T> Send for SafePointer<T> where T: Send {} - -unsafe impl<T> Sync for SafePointer<T> where T: Sync {} - -impl<T> SafePointer<T> { - /// Creates a new safe pointer from an unsafe pointer - pub fn new(ptr: *const T) -> Self { - SafePointer { - ptr, - _marker: PhantomData, - } - } - - /// Accesses the [`SafePointer`] as an unsafe pointer - pub unsafe fn get(&self) -> *const T { - self.ptr - } -} @@ -97,11 +97,11 @@ impl ScriptManager { let mut child = Command::new(&gradle_cmd) .current_dir(project_root) - .args(&["--console=plain", "assemble"]) + .args(["--console=plain", "jvmJar"]) .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) .spawn() - .context(format!("Failed to spawn `{} assemble`", gradle_cmd))?; + .context(format!("Failed to spawn `{} jvmJar`", gradle_cmd))?; let stdout = child.stdout.take().expect("Stdout was piped"); let stderr = child.stderr.take().expect("Stderr was piped"); @@ -111,7 +111,6 @@ impl ScriptManager { let mut reader = BufReader::new(stdout).lines(); while let Ok(Some(line)) = reader.next_line().await { // if let Ok(line) = line { - println!("stdout: {}", line); let _ = tx_out.send(BuildStatus::Building(line)); // } } @@ -122,7 +121,6 @@ impl ScriptManager { let mut reader = BufReader::new(stderr).lines(); while let Ok(Some(line)) = reader.next_line().await { // if let Ok(line) = line { - println!("stderr: {}", line); let _ = tx_err.send(BuildStatus::Building(line)); // } } @@ -583,8 +583,8 @@ impl InspectableComponent for ScriptComponent { _cfg: &mut StaticallyKept, ui: &mut Ui, _undo_stack: &mut Vec<UndoableAction>, - signal: &mut Signal, - label: &mut String, + _signal: &mut Signal, + _label: &mut String, ) { ui.vertical(|ui| { CollapsingHeader::new("Scripting") @@ -172,7 +172,6 @@ impl SignalController for Editor { } } - // Handle build failure after the borrow is done if should_stop_building { self.last_build_error = Some(self.build_logs.join("\n")); self.signal = Signal::None; @@ -186,12 +185,10 @@ impl SignalController for Editor { if self.show_build_window { let mut window_open = true; let mut cancel_clicked = false; - egui::Window::new("Building Project") .collapsible(false) - .resizable(true) - .default_width(600.0) - .default_height(400.0) + .resizable(false) + .fixed_size([500.0, 400.0]) .anchor(Align2::CENTER_CENTER, [0.0, 0.0]) .open(&mut window_open) .show(&graphics.get_egui_context(), |ui| { @@ -212,8 +209,9 @@ impl SignalController for Editor { ui.add_space(5.0); egui::ScrollArea::vertical() - .auto_shrink([false, false]) .stick_to_bottom(true) + .max_height(200.0) + .auto_shrink([false, false]) .show(ui, |ui| { for log_line in &self.build_logs { ui.label( @@ -242,7 +240,7 @@ impl SignalController for Editor { } }); }); - + if !window_open || cancel_clicked { if let Some(handle) = self.handle_created { log::info!("Cancelling build task due to window close"); @@ -270,7 +268,7 @@ impl SignalController for Editor { Ok(path) => { log::debug!("Path is valid, JAR location as {}", path.display()); success!("Build completed successfully!"); - self.show_build_window = false; // Close the build window + self.show_build_window = false; let has_player_camera_target = self .world @@ -348,6 +346,8 @@ impl SignalController for Editor { } } } + + self.signal = Signal::None; } else { self.signal = Signal::None; fatal!("Unable to build: No initial camera set"); @@ -367,7 +367,7 @@ impl SignalController for Editor { } } } else { - log::warn!("Handle has not been created, must be a bug"); + // log::warn!("Handle has not been created, must be a bug"); self.signal = Signal::None; self.show_build_window = false; self.editor_state = EditorState::Editing; @@ -381,9 +381,8 @@ impl SignalController for Editor { egui::Window::new("Build Error") .collapsible(true) - .resizable(true) - .default_width(700.0) - .default_height(500.0) + .resizable(false) + .fixed_size([700.0, 500.0]) .anchor(Align2::CENTER_CENTER, [0.0, 0.0]) .open(&mut window_open) .show(&graphics.get_egui_context(), |ui| { @@ -398,6 +397,7 @@ impl SignalController for Editor { // Scrollable error log with code styling egui::ScrollArea::both() .auto_shrink([false, false]) + .max_height(300.0) .show(ui, |ui| { ui.add( egui::TextEdit::multiline(&mut error_log.as_str()) @@ -6,7 +6,14 @@ license = "MIT" repository.workspace = true readme = "README.md" +[[bin]] +name = "magna-carta-cli" +path = "src/bin/main.rs" + [dependencies] anyhow.workspace = true tree-sitter.workspace = true tree-sitter-kotlin.workspace = true +clap = { version = "4.0", features = ["derive"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" @@ -1,4 +1,4 @@ -mod generator; +pub mod generator; use std::path::PathBuf; use tree_sitter::{Parser, Query, QueryCursor};