дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 17:21:13 +02:00
The Tomcat Server form's Before launch section only toggled one Build item. It now uses the same task list as other run configurations (BeforeLaunchTasks), with Tomcat's artifact Build as a removable, reorderable entry that existing configurations keep. Before launch also gains Run Maven Goal and Run Gradle Task steps that run through the build tools' existing execution and abort the launch on failure; BeforeLaunchTask gets an optional projectDir. Fixes #7200
36 рядки
1.3 KiB
TypeScript
36 рядки
1.3 KiB
TypeScript
/**
|
|
* The open project's build model as the Maven / Gradle tool windows last loaded it, for the
|
|
* features that follow the build (run, Project view) without loading it again.
|
|
*/
|
|
import { create } from "zustand";
|
|
import type { BuildModel, BuildTool, RunConfig } from "./ipc";
|
|
|
|
export interface SharedBuildModel {
|
|
/** Project the model belongs to. */
|
|
root: string | null;
|
|
model: BuildModel | null;
|
|
/** Gradle tool window's "Offline" toggle. */
|
|
gradleOffline: boolean;
|
|
}
|
|
|
|
export const useBuildModel = create<SharedBuildModel>(() => ({ root: null, model: null, gradleOffline: false }));
|
|
|
|
export function buildToolProjectDirectory(root: string, dir: string): string {
|
|
const prefix = root.endsWith("/") ? root : `${root}/`;
|
|
return (dir === root || dir.startsWith(prefix) ? dir.slice(prefix.length) : dir) || ".";
|
|
}
|
|
|
|
type BuildToolLaunch = (tool: BuildTool, line: string, directory: string) => RunConfig | null;
|
|
let buildToolLaunch: BuildToolLaunch | undefined;
|
|
|
|
export function registerBuildToolLaunch(provider: BuildToolLaunch): () => void {
|
|
buildToolLaunch = provider;
|
|
return () => {
|
|
if (buildToolLaunch === provider) buildToolLaunch = undefined;
|
|
};
|
|
}
|
|
|
|
export function buildToolLaunchConfig(tool: BuildTool, line: string, directory: string): RunConfig | null {
|
|
return buildToolLaunch?.(tool, line, directory) ?? null;
|
|
}
|