Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7b97f5b79 |
No files matched your search
@@ -6,17 +6,6 @@
|
||||
[Simple Icons](https://github.com/simple-icons/simple-icons), retrieved through
|
||||
Iconify (`simple-icons:angular`, `simple-icons:astro`, `simple-icons:cplusplus`, `simple-icons:dart`, `simple-icons:deepseek`, `simple-icons:django`, `simple-icons:dotnet`, `simple-icons:elixir`, `simple-icons:express`, `simple-icons:fastapi`, `simple-icons:flask`, `simple-icons:flutter`, `simple-icons:go`, `simple-icons:haskell`, `simple-icons:html5`, `simple-icons:kotlin`, `simple-icons:ktor`, `simple-icons:laravel`, `simple-icons:nestjs`, `simple-icons:nextdotjs`, `simple-icons:nodedotjs`, `simple-icons:nuxt`, `simple-icons:openjdk`, `simple-icons:phoenixframework`, `simple-icons:php`, `simple-icons:python`, `simple-icons:quarkus`, `simple-icons:ruby`, `simple-icons:rubyonrails`, `simple-icons:rust`, `simple-icons:scala`, `simple-icons:springboot`, `simple-icons:svelte`, `simple-icons:swift`, `simple-icons:symfony`, `simple-icons:vite`, `simple-icons:zig`) and filled with the brand colors (the standard icon grey for black logos). Licensed under [CC0 1.0 Universal](https://github.com/simple-icons/simple-icons/blob/develop/LICENSE.md).
|
||||
|
||||
## Agent logos
|
||||
|
||||
The `src/ui/openidea/agents/` logos of agents listed in the
|
||||
[ACP agent registry](https://github.com/agentclientprotocol/registry) (`agoragentic-acp`, `amp-acp`,
|
||||
`antigravity-acp`, `autohand`, `bob`, `cline`, `codebuddy-code`, `cortex-code`, `corust-agent`,
|
||||
`crow-cli`, `deepagents`, `devin`, `dimcode`, `dirac`, `factory-droid`, `fast-agent`, `glm-acp-agent`,
|
||||
`grok-build`, `harn`, `junie`, `kilo`, `kimchi`, `minimax-code`, `minion-code`, `muse-code`, `nova`,
|
||||
`pi-acp`, `poolside`, `sigit`, `stakpak`, `vtcode`) are the registry's icons, with a root `fill`
|
||||
moved onto a group. The registry is licensed under Apache-2.0; the logos remain trademarks of
|
||||
their owners.
|
||||
|
||||
## Microsoft ConPTY
|
||||
|
||||
`crates/ide-core/resources/conpty/` contains the unmodified Microsoft Windows Console
|
||||
|
||||
@@ -2291,25 +2291,14 @@ impl AgentManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// Stops sending events to UI sinks (project closing).
|
||||
pub fn detach_sinks(&self) {
|
||||
self.shared.sinks.write().clear();
|
||||
}
|
||||
|
||||
/// Stops every agent (project closed).
|
||||
pub fn shutdown(&self) {
|
||||
self.detach_sinks();
|
||||
let tasks: Vec<_> = self.tasks.read().values().cloned().collect();
|
||||
for task in tasks {
|
||||
let was_live = task.kill().is_some();
|
||||
if was_live {
|
||||
// Persist late subagent updates and cleared live background state.
|
||||
task.persist();
|
||||
} else {
|
||||
// Flush pending delayed saves without rewriting untouched or archived tasks.
|
||||
task.save();
|
||||
}
|
||||
for task in self.tasks.read().values() {
|
||||
task.kill();
|
||||
// What arrived after the last save (a subagent's late updates).
|
||||
task.persist();
|
||||
}
|
||||
self.shared.sinks.write().clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1632,47 +1632,6 @@ async fn shutdown_writes_the_saves_still_waiting_and_a_delete_drops_them() {
|
||||
assert_eq!(saved_title(&kept_path).as_deref(), Some("renamed"));
|
||||
}
|
||||
|
||||
/// Closing a project with many restored/archived tasks must not rewrite tasks that never changed.
|
||||
#[tokio::test]
|
||||
async fn shutdown_skips_rewriting_untouched_restored_tasks() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let mgr = manager(tmp.path(), Arc::new(FakeAgent::default()));
|
||||
let untouched = idle_task(&mgr, "untouched").await;
|
||||
let archived = idle_task(&mgr, "archived").await;
|
||||
mgr.archive(&archived.id).unwrap();
|
||||
let dirty = idle_task(&mgr, "dirty").await;
|
||||
mgr.shutdown();
|
||||
|
||||
let (untouched_path, archived_path, dirty_path) =
|
||||
(task_file(tmp.path(), &untouched.id), task_file(tmp.path(), &archived.id), task_file(tmp.path(), &dirty.id));
|
||||
let restored = manager(tmp.path(), Arc::new(FakeAgent::default()));
|
||||
let before_untouched = FILE_WRITES.lock().get(&untouched_path).copied().unwrap_or(0);
|
||||
let before_archived = FILE_WRITES.lock().get(&archived_path).copied().unwrap_or(0);
|
||||
let before_dirty = FILE_WRITES.lock().get(&dirty_path).copied().unwrap_or(0);
|
||||
|
||||
let dirty_handle = restored.task(&dirty.id).unwrap();
|
||||
dirty_handle.state.lock().task.title = "updated".into();
|
||||
dirty_handle.persist_soon();
|
||||
|
||||
restored.shutdown();
|
||||
|
||||
assert_eq!(
|
||||
FILE_WRITES.lock().get(&untouched_path).copied().unwrap_or(0),
|
||||
before_untouched,
|
||||
"untouched task should not be rewritten on shutdown"
|
||||
);
|
||||
assert_eq!(
|
||||
FILE_WRITES.lock().get(&archived_path).copied().unwrap_or(0),
|
||||
before_archived,
|
||||
"archived task should not be rewritten on shutdown"
|
||||
);
|
||||
assert!(
|
||||
FILE_WRITES.lock().get(&dirty_path).copied().unwrap_or(0) > before_dirty,
|
||||
"pending persist_soon task must still be flushed on shutdown"
|
||||
);
|
||||
assert_eq!(saved_title(&dirty_path).as_deref(), Some("updated"));
|
||||
}
|
||||
|
||||
/// Archiving saves the task as it is, including changes nobody asked to be saved.
|
||||
#[tokio::test]
|
||||
async fn archiving_saves_the_task_before_it_returns() {
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::io::Read;
|
||||
use std::time::SystemTime;
|
||||
|
||||
/// `(byte length, mtime, blake3 hex)`; the hash is recorded for files inside the project only.
|
||||
pub(crate) type Stamp = (u64, SystemTime, Option<String>);
|
||||
type Stamp = (u64, SystemTime, Option<String>);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct LaunchFingerprint {
|
||||
@@ -182,7 +182,7 @@ fn collect(
|
||||
}
|
||||
|
||||
/// Scans every input, storing project inputs relative to the project.
|
||||
pub(crate) fn scan_all(
|
||||
pub(super) fn scan_all(
|
||||
root: &Path,
|
||||
inputs: Vec<PathBuf>,
|
||||
cancel: &CancellationToken,
|
||||
@@ -282,11 +282,6 @@ pub(super) fn module_fingerprint(
|
||||
}
|
||||
|
||||
impl LaunchFingerprint {
|
||||
/// The fingerprint of `parameters` and the files under `inputs` (see [`scan_all`]).
|
||||
pub(crate) fn new(parameters: String, files: BTreeMap<PathBuf, Option<Stamp>>) -> Self {
|
||||
LaunchFingerprint { version: 2, parameters, files }
|
||||
}
|
||||
|
||||
/// Folders (relative to the project) of the Maven projects whose POM is an input.
|
||||
pub(super) fn project_dirs(&self) -> impl Iterator<Item = &Path> {
|
||||
self.files
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! background with cancellation and parses the compiler output into messages
|
||||
//! for the Build tool window, the Problems view and the editor.
|
||||
|
||||
pub(crate) mod fingerprint;
|
||||
mod fingerprint;
|
||||
mod launch_resources;
|
||||
mod modules;
|
||||
mod parse;
|
||||
@@ -845,28 +845,6 @@ fn reactor_projects<'a>(m: &'a maven::MavenModel, top: &'a maven::MavenProject)
|
||||
projects
|
||||
}
|
||||
|
||||
/// A step running Maven, its output parsed as Maven's.
|
||||
pub(crate) fn maven_build_step(program: &str, args: &[&str], cwd: &Path) -> BuildStep {
|
||||
BuildStep::new(program, args, cwd, Format::Maven)
|
||||
}
|
||||
|
||||
pub(crate) fn gradle_build_step(program: &str, args: &[&str], cwd: &Path) -> BuildStep {
|
||||
BuildStep::new(program, args, cwd, Format::Gradle)
|
||||
}
|
||||
|
||||
/// The linked reactor root building the project at `module` (project-relative).
|
||||
pub(crate) fn maven_reactor_dir<'a>(m: &'a maven::MavenModel, module: &str) -> Option<&'a maven::MavenProject> {
|
||||
maven_reactor(m, module)
|
||||
}
|
||||
|
||||
/// The projects of the reactor `top`.
|
||||
pub(crate) fn reactor_projects_of<'a>(
|
||||
m: &'a maven::MavenModel,
|
||||
top: &'a maven::MavenProject,
|
||||
) -> Vec<&'a maven::MavenProject> {
|
||||
reactor_projects(m, top)
|
||||
}
|
||||
|
||||
fn maven_reactor<'a>(m: &'a maven::MavenModel, module: &str) -> Option<&'a maven::MavenProject> {
|
||||
m.projects.iter().filter(|p| !p.aggregated).find(|top| reactor_projects(m, top).iter().any(|p| p.dir == module))
|
||||
}
|
||||
|
||||
@@ -1,482 +0,0 @@
|
||||
//! What the incremental build needs from a class file (JVMS §4): its name, supertypes, the
|
||||
//! classes its constant pool refers to, and fingerprints of its API and of its compile-time
|
||||
//! constants. Bounds-checked: a malformed file is `None`, never a panic.
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
/// A class file, as the dependency graph and the API diff see it.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct ClassFile {
|
||||
/// Internal name (`com/acme/Order$Line`).
|
||||
pub name: String,
|
||||
pub super_name: Option<String>,
|
||||
pub interfaces: Vec<String>,
|
||||
/// Classes named in the constant pool: references, descriptors, signatures, annotation types.
|
||||
pub refs: BTreeSet<String>,
|
||||
/// What other classes compile against: non-private, non-synthetic members and their
|
||||
/// signatures, supertypes, nested classes, permitted subclasses, record components.
|
||||
pub api: u64,
|
||||
/// The compile-time constants (`static final` fields with a `ConstantValue`), which javac
|
||||
/// copies into the classes that use them: a change can't be traced through references.
|
||||
pub constants: u64,
|
||||
}
|
||||
|
||||
const ACC_PRIVATE: u16 = 0x0002;
|
||||
const ACC_SYNTHETIC: u16 = 0x1000;
|
||||
|
||||
struct Bytes<'a> {
|
||||
data: &'a [u8],
|
||||
pos: usize,
|
||||
}
|
||||
|
||||
impl<'a> Bytes<'a> {
|
||||
fn take(&mut self, n: usize) -> Option<&'a [u8]> {
|
||||
let end = self.pos.checked_add(n)?;
|
||||
let slice = self.data.get(self.pos..end)?;
|
||||
self.pos = end;
|
||||
Some(slice)
|
||||
}
|
||||
fn u1(&mut self) -> Option<u8> {
|
||||
Some(self.take(1)?[0])
|
||||
}
|
||||
fn u2(&mut self) -> Option<u16> {
|
||||
let b = self.take(2)?;
|
||||
Some(u16::from_be_bytes([b[0], b[1]]))
|
||||
}
|
||||
fn u4(&mut self) -> Option<u32> {
|
||||
let b = self.take(4)?;
|
||||
Some(u32::from_be_bytes([b[0], b[1], b[2], b[3]]))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
enum Entry {
|
||||
Empty,
|
||||
Utf8(String),
|
||||
Class(u16),
|
||||
String(u16),
|
||||
/// Integer, float, long, double: the raw bytes.
|
||||
Number(Vec<u8>),
|
||||
NameAndType(u16),
|
||||
MethodType(u16),
|
||||
Other,
|
||||
}
|
||||
|
||||
struct Pool(Vec<Entry>);
|
||||
|
||||
impl Pool {
|
||||
fn utf8(&self, index: u16) -> Option<&str> {
|
||||
match self.0.get(index as usize)? {
|
||||
Entry::Utf8(s) => Some(s),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn class(&self, index: u16) -> Option<&str> {
|
||||
match self.0.get(index as usize)? {
|
||||
Entry::Class(name) => self.utf8(*name),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
/// A `ConstantValue`'s value, as bytes.
|
||||
fn constant(&self, index: u16) -> Option<Vec<u8>> {
|
||||
match self.0.get(index as usize)? {
|
||||
Entry::Number(bytes) => Some(bytes.clone()),
|
||||
Entry::String(utf8) => Some(self.utf8(*utf8)?.as_bytes().to_vec()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// FNV-1a: stable across Rust versions, so recorded fingerprints stay comparable.
|
||||
#[derive(Clone, Copy)]
|
||||
struct Fnv(u64);
|
||||
|
||||
impl Fnv {
|
||||
fn new() -> Self {
|
||||
Fnv(0xcbf2_9ce4_8422_2325)
|
||||
}
|
||||
fn bytes(&mut self, bytes: &[u8]) {
|
||||
for b in bytes {
|
||||
self.0 = (self.0 ^ u64::from(*b)).wrapping_mul(0x100_0000_01b3);
|
||||
}
|
||||
// A separator, so `ab`+`c` and `a`+`bc` differ.
|
||||
self.0 = (self.0 ^ 0xff).wrapping_mul(0x100_0000_01b3);
|
||||
}
|
||||
fn str(&mut self, s: &str) {
|
||||
self.bytes(s.as_bytes());
|
||||
}
|
||||
fn u16(&mut self, v: u16) {
|
||||
self.bytes(&v.to_be_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds the class names a descriptor or signature mentions (`Lcom/acme/Order<Lx/Y;>;`).
|
||||
fn descriptor_refs(text: &str, out: &mut BTreeSet<String>) {
|
||||
let bytes = text.as_bytes();
|
||||
let mut i = 0;
|
||||
while i < bytes.len() {
|
||||
if bytes[i] == b'L'
|
||||
&& (i == 0
|
||||
|| matches!(
|
||||
bytes[i - 1],
|
||||
b'(' | b')'
|
||||
| b'['
|
||||
| b';'
|
||||
| b'<'
|
||||
| b'>'
|
||||
| b'+'
|
||||
| b'-'
|
||||
| b':'
|
||||
| b'*'
|
||||
| b'I'
|
||||
| b'J'
|
||||
| b'Z'
|
||||
| b'B'
|
||||
| b'C'
|
||||
| b'S'
|
||||
| b'F'
|
||||
| b'D'
|
||||
| b'V'
|
||||
| b'^'
|
||||
))
|
||||
{
|
||||
let start = i + 1;
|
||||
let mut end = start;
|
||||
while end < bytes.len() && !matches!(bytes[end], b';' | b'<' | b'.') {
|
||||
end += 1;
|
||||
}
|
||||
if end < bytes.len() && end > start {
|
||||
let name = &text[start..end];
|
||||
if name.bytes().all(|b| b.is_ascii_alphanumeric() || matches!(b, b'/' | b'$' | b'_') || b >= 0x80) {
|
||||
out.insert(name.to_owned());
|
||||
}
|
||||
}
|
||||
i = end;
|
||||
} else {
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn class_ref(name: &str, out: &mut BTreeSet<String>) {
|
||||
if name.starts_with('[') {
|
||||
descriptor_refs(name, out);
|
||||
} else {
|
||||
out.insert(name.to_owned());
|
||||
}
|
||||
}
|
||||
|
||||
struct Member {
|
||||
access: u16,
|
||||
name: String,
|
||||
descriptor: String,
|
||||
/// Fingerprint of the attributes that are part of the API.
|
||||
extra: u64,
|
||||
constant: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
fn attributes(r: &mut Bytes, pool: &Pool, mut on: impl FnMut(&str, &[u8])) -> Option<()> {
|
||||
let count = r.u2()?;
|
||||
for _ in 0..count {
|
||||
let name = pool.utf8(r.u2()?)?.to_owned();
|
||||
let len = r.u4()? as usize;
|
||||
let body = r.take(len)?;
|
||||
on(&name, body);
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
|
||||
fn members(r: &mut Bytes, pool: &Pool, refs: &mut BTreeSet<String>) -> Option<Vec<Member>> {
|
||||
let count = r.u2()?;
|
||||
let mut out = Vec::with_capacity(count as usize);
|
||||
for _ in 0..count {
|
||||
let access = r.u2()?;
|
||||
let name = pool.utf8(r.u2()?)?.to_owned();
|
||||
let descriptor = pool.utf8(r.u2()?)?.to_owned();
|
||||
descriptor_refs(&descriptor, refs);
|
||||
let mut extra = Fnv::new();
|
||||
let mut constant = None;
|
||||
attributes(r, pool, |attr, body| {
|
||||
let mut b = Bytes { data: body, pos: 0 };
|
||||
match attr {
|
||||
"Signature" => {
|
||||
if let Some(sig) = b.u2().and_then(|i| pool.utf8(i)) {
|
||||
descriptor_refs(sig, refs);
|
||||
extra.str("S");
|
||||
extra.str(sig);
|
||||
}
|
||||
}
|
||||
"ConstantValue" => constant = b.u2().and_then(|i| pool.constant(i)),
|
||||
"Exceptions" => {
|
||||
let mut names: Vec<&str> = Vec::new();
|
||||
if let Some(n) = b.u2() {
|
||||
for _ in 0..n {
|
||||
if let Some(c) = b.u2().and_then(|i| pool.class(i)) {
|
||||
names.push(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
names.sort_unstable();
|
||||
extra.str("E");
|
||||
for n in names {
|
||||
extra.str(n);
|
||||
}
|
||||
}
|
||||
// An annotation element's default value is compiled into its uses.
|
||||
"AnnotationDefault" => {
|
||||
extra.str("D");
|
||||
element_value(&mut b, pool, refs, &mut extra);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
})?;
|
||||
out.push(Member { access, name, descriptor, extra: extra.0, constant });
|
||||
}
|
||||
Some(out)
|
||||
}
|
||||
|
||||
/// Parses a class file; `None` when it isn't a well-formed one.
|
||||
pub fn parse(data: &[u8]) -> Option<ClassFile> {
|
||||
let mut r = Bytes { data, pos: 0 };
|
||||
if r.u4()? != 0xCAFE_BABE {
|
||||
return None;
|
||||
}
|
||||
r.u2()?;
|
||||
r.u2()?;
|
||||
let count = r.u2()?;
|
||||
let mut entries = vec![Entry::Empty];
|
||||
let mut i = 1;
|
||||
while i < count {
|
||||
let tag = r.u1()?;
|
||||
let entry = match tag {
|
||||
1 => {
|
||||
let len = r.u2()? as usize;
|
||||
Entry::Utf8(String::from_utf8_lossy(r.take(len)?).into_owned())
|
||||
}
|
||||
3 | 4 => Entry::Number(r.take(4)?.to_vec()),
|
||||
5 | 6 => Entry::Number(r.take(8)?.to_vec()),
|
||||
7 => Entry::Class(r.u2()?),
|
||||
8 => Entry::String(r.u2()?),
|
||||
9..=11 => {
|
||||
r.take(4)?;
|
||||
Entry::Other
|
||||
}
|
||||
12 => {
|
||||
r.u2()?;
|
||||
Entry::NameAndType(r.u2()?)
|
||||
}
|
||||
15 => {
|
||||
r.take(3)?;
|
||||
Entry::Other
|
||||
}
|
||||
16 => Entry::MethodType(r.u2()?),
|
||||
17 | 18 => {
|
||||
r.take(4)?;
|
||||
Entry::Other
|
||||
}
|
||||
19 | 20 => {
|
||||
r.take(2)?;
|
||||
Entry::Other
|
||||
}
|
||||
_ => return None,
|
||||
};
|
||||
let wide = matches!(tag, 5 | 6);
|
||||
entries.push(entry);
|
||||
i += 1;
|
||||
if wide {
|
||||
entries.push(Entry::Empty);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
let pool = Pool(entries);
|
||||
let mut refs = BTreeSet::new();
|
||||
for entry in &pool.0 {
|
||||
match entry {
|
||||
Entry::Class(name) => class_ref(pool.utf8(*name)?, &mut refs),
|
||||
Entry::NameAndType(descriptor) | Entry::MethodType(descriptor) => {
|
||||
descriptor_refs(pool.utf8(*descriptor)?, &mut refs)
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let access = r.u2()?;
|
||||
let name = pool.class(r.u2()?)?.to_owned();
|
||||
let super_index = r.u2()?;
|
||||
let super_name = if super_index == 0 { None } else { Some(pool.class(super_index)?.to_owned()) };
|
||||
let mut interfaces = Vec::new();
|
||||
for _ in 0..r.u2()? {
|
||||
interfaces.push(pool.class(r.u2()?)?.to_owned());
|
||||
}
|
||||
let fields = members(&mut r, &pool, &mut refs)?;
|
||||
let methods = members(&mut r, &pool, &mut refs)?;
|
||||
|
||||
let mut api = Fnv::new();
|
||||
// ACC_SUPER and ACC_SYNTHETIC say nothing about what compiles against the class.
|
||||
api.u16(access & !(0x0020 | ACC_SYNTHETIC));
|
||||
api.str(&name);
|
||||
api.str(super_name.as_deref().unwrap_or(""));
|
||||
let mut sorted = interfaces.clone();
|
||||
sorted.sort();
|
||||
for i in &sorted {
|
||||
api.str(i);
|
||||
}
|
||||
let mut class_attrs: Vec<(String, u64)> = Vec::new();
|
||||
attributes(&mut r, &pool, |attr, body| {
|
||||
let mut b = Bytes { data: body, pos: 0 };
|
||||
let mut h = Fnv::new();
|
||||
match attr {
|
||||
"Signature" => {
|
||||
if let Some(sig) = b.u2().and_then(|i| pool.utf8(i)) {
|
||||
descriptor_refs(sig, &mut refs);
|
||||
h.str(sig);
|
||||
}
|
||||
}
|
||||
"PermittedSubclasses" => {
|
||||
let mut names = Vec::new();
|
||||
for _ in 0..b.u2().unwrap_or(0) {
|
||||
if let Some(c) = b.u2().and_then(|i| pool.class(i)) {
|
||||
names.push(c.to_owned());
|
||||
}
|
||||
}
|
||||
names.sort();
|
||||
names.iter().for_each(|n| h.str(n));
|
||||
}
|
||||
"Record" => {
|
||||
for _ in 0..b.u2().unwrap_or(0) {
|
||||
let (Some(n), Some(d)) = (b.u2().and_then(|i| pool.utf8(i)), b.u2().and_then(|i| pool.utf8(i)))
|
||||
else {
|
||||
break;
|
||||
};
|
||||
h.str(n);
|
||||
h.str(d);
|
||||
let mut component = |attr: &str, body: &[u8]| {
|
||||
if attr == "Signature"
|
||||
&& let Some(sig) = (Bytes { data: body, pos: 0 }).u2().and_then(|i| pool.utf8(i))
|
||||
{
|
||||
h.str(sig);
|
||||
}
|
||||
};
|
||||
if attributes(&mut b, &pool, &mut component).is_none() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Nested classes this class declares, and their access.
|
||||
"InnerClasses" => {
|
||||
let mut nested = Vec::new();
|
||||
for _ in 0..b.u2().unwrap_or(0) {
|
||||
let (Some(inner), Some(outer), Some(_), Some(flags)) = (b.u2(), b.u2(), b.u2(), b.u2()) else {
|
||||
break;
|
||||
};
|
||||
let inner = pool.class(inner).unwrap_or("");
|
||||
if outer != 0 && pool.class(outer) == Some(name.as_str()) && flags & ACC_PRIVATE == 0 {
|
||||
nested.push(format!("{inner}:{flags}"));
|
||||
}
|
||||
}
|
||||
nested.sort();
|
||||
nested.iter().for_each(|n| h.str(n));
|
||||
}
|
||||
"RuntimeVisibleAnnotations" | "RuntimeInvisibleAnnotations" => {
|
||||
// Annotation types are dependencies; their values aren't API.
|
||||
annotation_types(body, &pool, &mut refs);
|
||||
return;
|
||||
}
|
||||
_ => return,
|
||||
}
|
||||
class_attrs.push((attr.to_owned(), h.0));
|
||||
})?;
|
||||
class_attrs.sort();
|
||||
for (attr, h) in &class_attrs {
|
||||
api.str(attr);
|
||||
api.bytes(&h.to_be_bytes());
|
||||
}
|
||||
let mut constants = Fnv::new();
|
||||
let mut api_members: Vec<(u8, &str, &str, u16, u64)> = Vec::new();
|
||||
for (kind, list) in [(0u8, &fields), (1u8, &methods)] {
|
||||
for m in list.iter() {
|
||||
if kind == 0
|
||||
&& let Some(value) = &m.constant
|
||||
{
|
||||
// Private constants are inlined too, but only in their own class.
|
||||
if m.access & ACC_PRIVATE == 0 {
|
||||
constants.str(&m.name);
|
||||
constants.str(&m.descriptor);
|
||||
constants.bytes(value);
|
||||
}
|
||||
}
|
||||
if m.access & (ACC_PRIVATE | ACC_SYNTHETIC) != 0 || m.name == "<clinit>" {
|
||||
continue;
|
||||
}
|
||||
api_members.push((kind, &m.name, &m.descriptor, m.access & !ACC_SYNTHETIC, m.extra));
|
||||
}
|
||||
}
|
||||
api_members.sort();
|
||||
for (kind, name, descriptor, access, extra) in api_members {
|
||||
api.bytes(&[kind]);
|
||||
api.str(name);
|
||||
api.str(descriptor);
|
||||
api.u16(access);
|
||||
api.bytes(&extra.to_be_bytes());
|
||||
}
|
||||
refs.remove(&name);
|
||||
refs.retain(|r| !r.starts_with("java/"));
|
||||
Some(ClassFile { name, super_name, interfaces, refs, api: api.0, constants: constants.0 })
|
||||
}
|
||||
|
||||
/// Adds the types of the annotations in a `Runtime*Annotations` attribute.
|
||||
fn annotation_types(body: &[u8], pool: &Pool, refs: &mut BTreeSet<String>) {
|
||||
let mut b = Bytes { data: body, pos: 0 };
|
||||
let Some(count) = b.u2() else { return };
|
||||
let mut ignored = Fnv::new();
|
||||
for _ in 0..count {
|
||||
if annotation(&mut b, pool, refs, &mut ignored).is_none() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn annotation(b: &mut Bytes, pool: &Pool, refs: &mut BTreeSet<String>, h: &mut Fnv) -> Option<()> {
|
||||
let ty = pool.utf8(b.u2()?)?;
|
||||
descriptor_refs(ty, refs);
|
||||
h.str(ty);
|
||||
for _ in 0..b.u2()? {
|
||||
h.str(pool.utf8(b.u2()?)?);
|
||||
element_value(b, pool, refs, h)?;
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
|
||||
/// An annotation element value: its class names go to `refs`, its value (resolved, not the
|
||||
/// constant pool indices) to `h`.
|
||||
fn element_value(b: &mut Bytes, pool: &Pool, refs: &mut BTreeSet<String>, h: &mut Fnv) -> Option<()> {
|
||||
let tag = b.u1()?;
|
||||
h.bytes(&[tag]);
|
||||
match tag {
|
||||
b'B' | b'C' | b'D' | b'F' | b'I' | b'J' | b'S' | b'Z' => h.bytes(&pool.constant(b.u2()?)?),
|
||||
b's' => h.str(pool.utf8(b.u2()?)?),
|
||||
b'e' => {
|
||||
let ty = pool.utf8(b.u2()?)?;
|
||||
descriptor_refs(ty, refs);
|
||||
h.str(ty);
|
||||
h.str(pool.utf8(b.u2()?)?);
|
||||
}
|
||||
b'c' => {
|
||||
let ty = pool.utf8(b.u2()?)?;
|
||||
descriptor_refs(ty, refs);
|
||||
h.str(ty);
|
||||
}
|
||||
b'@' => annotation(b, pool, refs, h)?,
|
||||
b'[' => {
|
||||
for _ in 0..b.u2()? {
|
||||
element_value(b, pool, refs, h)?;
|
||||
}
|
||||
}
|
||||
_ => return None,
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
|
||||
/// The simple name of a class (`com/acme/Order$Line` → `Line`), which a new class can shadow.
|
||||
pub fn simple_name(name: &str) -> &str {
|
||||
let tail = name.rsplit('/').next().unwrap_or(name);
|
||||
tail.rsplit('$').next().unwrap_or(tail)
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
// OpenIDEA's Java build of a Gradle build (ide_build::jbuild). With -Popenidea.build.output=<dir>,
|
||||
// every Java source set writes its classes and resources to <dir>/[<group>.]<project>/classes|test-classes,
|
||||
// so neither the language server nor a terminal `gradle` writes what the IDE runs. The task
|
||||
// `openideaBuildModel` (-Popenidea.build.model=<file>) runs what generates sources, processes the
|
||||
// resources and writes, as JSON, each source set's roots, classpaths and how JavaCompile compiles it:
|
||||
// the same model the Maven extension writes (java/java-build, BuildModel).
|
||||
import groovy.json.JsonOutput
|
||||
import org.gradle.api.tasks.compile.AbstractCompile
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
|
||||
def property = { String name -> gradle.startParameter.projectProperties[name] }
|
||||
def outRoot = property('openidea.build.output')
|
||||
if (outRoot == null || gradle.parent != null) return
|
||||
|
||||
// The project's name in the build: unique, unlike `name`.
|
||||
def nameOf = { Project p -> p == p.rootProject ? p.name : p.path.substring(1).replace(':', '.') }
|
||||
def outputOf = { Project p, String set ->
|
||||
def folder = p.group ? "${p.group}.${nameOf(p)}" : nameOf(p)
|
||||
new File(outRoot, folder + '/' + (set == 'main' ? 'classes' : 'test-classes'))
|
||||
}
|
||||
def javaSets = { Project p ->
|
||||
def sets = p.extensions.findByName('sourceSets')
|
||||
sets == null ? [] : ['main', 'test'].collect { sets.findByName(it) }.findAll { it != null }
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
def root = gradle.rootProject
|
||||
root.allprojects.each { p ->
|
||||
javaSets(p).each { ss ->
|
||||
def out = outputOf(p, ss.name)
|
||||
ss.java.destinationDirectory.set(out)
|
||||
ss.output.resourcesDir = out
|
||||
p.tasks.named(ss.processResourcesTaskName).configure { destinationDir = out }
|
||||
}
|
||||
}
|
||||
root.tasks.register('openideaBuildModel') {
|
||||
// What compiling needs from the same project (generated sources), and the resources.
|
||||
dependsOn {
|
||||
root.allprojects.collectMany { p ->
|
||||
javaSets(p).collectMany { ss ->
|
||||
def compile = p.tasks.getByName(ss.compileJavaTaskName)
|
||||
def generators = compile.taskDependencies.getDependencies(compile).findAll {
|
||||
it.project == p && !(it instanceof AbstractCompile) && !(it instanceof Jar)
|
||||
}
|
||||
generators + [p.tasks.getByName(ss.processResourcesTaskName)]
|
||||
}
|
||||
}
|
||||
}
|
||||
doLast {
|
||||
// Project artifacts resolve to the projects' outputs.
|
||||
def artifacts = [:]
|
||||
root.allprojects.each { p ->
|
||||
def main = javaSets(p).find { it.name == 'main' }
|
||||
if (main == null) return
|
||||
def jar = p.tasks.findByName('jar')
|
||||
if (jar instanceof Jar) artifacts[jar.archiveFile.get().asFile.canonicalPath] = outputOf(p, 'main')
|
||||
}
|
||||
def files = { collection ->
|
||||
def out = []
|
||||
try {
|
||||
collection?.files?.each { f ->
|
||||
def mapped = artifacts[f.canonicalPath] ?: f
|
||||
if (!out.contains(mapped.canonicalPath)) out << mapped.canonicalPath
|
||||
}
|
||||
} catch (e) {
|
||||
out << "!${e.message}".toString()
|
||||
}
|
||||
out
|
||||
}
|
||||
def included = gradle.includedBuilds.collect { it.name }
|
||||
def projects = root.allprojects.findAll { !javaSets(it).isEmpty() }.collect { p ->
|
||||
def problems = included.isEmpty() ? [] : ["it is a composite build (${included.join(', ')})".toString()]
|
||||
def others = p.tasks.withType(AbstractCompile).findAll {
|
||||
!(it instanceof JavaCompile) && it.name ==~ /(?i)compile.*(Kotlin|Groovy|Scala|Aspectj).*/
|
||||
}.collect { "${it.class.name.replace('_Decorated', '')}@${it.name}".toString() }
|
||||
def setModel = { String name ->
|
||||
def ss = javaSets(p).find { it.name == name }
|
||||
if (ss == null) return [sourceRoots: [], output: outputOf(p, name).path, classpath: [], runtimeClasspath: []]
|
||||
JavaCompile compile = p.tasks.getByName(ss.compileJavaTaskName)
|
||||
def o = compile.options
|
||||
def classpath = files(compile.classpath)
|
||||
def runtime = files(ss.runtimeClasspath)
|
||||
(classpath + runtime).findAll { it.startsWith('!') }.each { problems << "Cannot resolve the dependencies: ${it.substring(1)}".toString() }
|
||||
def processorPath = files(o.annotationProcessorPath)
|
||||
def processorProblems = processorPath.findAll { it.startsWith('!') }
|
||||
def projectProcessors = processorPath.findAll { path -> artifacts.values().any { it.canonicalPath == path } }
|
||||
def home = null
|
||||
try { home = compile.javaCompiler.orNull?.metadata?.installationPath?.asFile?.canonicalPath } catch (ignored) {}
|
||||
[
|
||||
sourceRoots: ss.java.srcDirs.collect { it.canonicalPath },
|
||||
output: outputOf(p, name).canonicalPath,
|
||||
classpath: classpath.findAll { !it.startsWith('!') },
|
||||
runtimeClasspath: runtime.findAll { !it.startsWith('!') },
|
||||
resources: ss.resources.srcDirs.collect { [directory: it.canonicalPath, filtering: false] },
|
||||
compiler: [
|
||||
compilerId: 'javac',
|
||||
source: compile.sourceCompatibility,
|
||||
target: compile.targetCompatibility,
|
||||
release: o.release.orNull?.toString(),
|
||||
encoding: o.encoding,
|
||||
debug: o.debug,
|
||||
debuglevel: o.debugOptions.debugLevel,
|
||||
showWarnings: o.warnings,
|
||||
showDeprecation: o.deprecation,
|
||||
fork: home != null,
|
||||
executable: home == null ? null : new File(home, 'bin/javac').path,
|
||||
generatedSourcesDirectory: o.generatedSourceOutputDirectory.asFile.orNull?.canonicalPath,
|
||||
includes: ss.java.includes as List,
|
||||
excludes: ss.java.excludes as List,
|
||||
compilerArgs: o.allCompilerArgs.collect { it.toString() },
|
||||
processorPath: processorProblems.isEmpty() && projectProcessors.isEmpty() ? processorPath : null,
|
||||
processorPathError: !processorProblems.isEmpty()
|
||||
? processorProblems[0].substring(1)
|
||||
: (projectProcessors.isEmpty() ? null : 'its annotation processors are built in the same build'),
|
||||
],
|
||||
]
|
||||
}
|
||||
def mainModel = setModel('main')
|
||||
def testModel = setModel('test')
|
||||
// Gradle compiles tests against the main classes: they're the main output here.
|
||||
[
|
||||
dir: p.projectDir.canonicalPath,
|
||||
groupId: (p.group ?: '').toString(),
|
||||
artifactId: nameOf(p),
|
||||
version: p.version.toString(),
|
||||
packaging: 'jar',
|
||||
main: mainModel,
|
||||
test: testModel,
|
||||
otherCompilers: others,
|
||||
testGenerators: [],
|
||||
problems: problems,
|
||||
gradlePath: p.path,
|
||||
]
|
||||
}
|
||||
def modelFile = property('openidea.build.model')
|
||||
if (modelFile != null) {
|
||||
def file = new File(modelFile)
|
||||
def temporary = new File(file.parentFile, file.name + '.tmp')
|
||||
temporary.text = JsonOutput.toJson([version: 1, projects: projects])
|
||||
temporary.renameTo(file) || { file.delete(); temporary.renameTo(file) }()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
//! Class-level incremental compilation (#4078 step 3). Each source set records, per class it
|
||||
//! compiled, the source it came from, its supertypes, the classes its constant pool names and
|
||||
//! fingerprints of its API and constants ([`super::classfile`]). A build compiles the changed
|
||||
//! sources, then the sources of classes that refer to a class whose API changed (or to a
|
||||
//! subclass of one), round after round until no API changes. Sets compiled against this one
|
||||
//! read its log of API changes; a changed compile-time constant, which javac copies into the
|
||||
//! classes that use it, recompiles the whole set and every set compiled against it.
|
||||
use super::*;
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
|
||||
pub(super) struct ClassRecord {
|
||||
/// The source javac compiled it from; `None` for classes an annotation processor wrote
|
||||
/// without naming an originating source.
|
||||
pub source: Option<PathBuf>,
|
||||
pub file: PathBuf,
|
||||
pub super_name: Option<String>,
|
||||
#[serde(default)]
|
||||
pub interfaces: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub refs: Vec<String>,
|
||||
pub api: u64,
|
||||
pub constants: u64,
|
||||
}
|
||||
|
||||
impl ClassRecord {
|
||||
pub fn new(class: classfile::ClassFile, file: PathBuf, source: Option<PathBuf>) -> (String, Self) {
|
||||
let record = ClassRecord {
|
||||
source,
|
||||
file,
|
||||
super_name: class.super_name,
|
||||
interfaces: class.interfaces,
|
||||
refs: class.refs.into_iter().collect(),
|
||||
api: class.api,
|
||||
constants: class.constants,
|
||||
};
|
||||
(class.name, record)
|
||||
}
|
||||
|
||||
fn has_constants(&self) -> bool {
|
||||
self.constants != NO_CONSTANTS
|
||||
}
|
||||
}
|
||||
|
||||
/// The constant fingerprint of a class without compile-time constants.
|
||||
pub(super) const NO_CONSTANTS: u64 = 0xcbf2_9ce4_8422_2325;
|
||||
|
||||
/// The classes whose API one compilation of a set changed.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
|
||||
pub(super) struct ApiChange {
|
||||
/// The set's generation before and after the compilation.
|
||||
pub since: u64,
|
||||
pub generation: u64,
|
||||
pub classes: Vec<String>,
|
||||
/// Everything counts as changed: a constant changed, or there was nothing to compare with.
|
||||
pub all: bool,
|
||||
}
|
||||
|
||||
/// How many compilations' API changes a set keeps for the sets compiled against it; one that
|
||||
/// fell further behind compiles from scratch.
|
||||
const CHANGE_LOG: usize = 64;
|
||||
|
||||
/// The inputs of a source set that, when changed, compile it from scratch.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
|
||||
pub(super) struct SetStamp {
|
||||
pub options: Vec<String>,
|
||||
/// Classpath entries outside the reactor's outputs, with their stamps (folders have none).
|
||||
pub libraries: Vec<(PathBuf, Option<FileStamp>)>,
|
||||
/// The reactor outputs on the classpath, in order.
|
||||
pub reactor: Vec<PathBuf>,
|
||||
pub processor_path: Vec<(PathBuf, Option<FileStamp>)>,
|
||||
pub java_home: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||
pub(super) struct SetState {
|
||||
pub stamp: SetStamp,
|
||||
/// The sources as of the last compilation.
|
||||
pub sources: BTreeMap<PathBuf, FileStamp>,
|
||||
/// Changes whenever the set's classes do.
|
||||
pub generation: u64,
|
||||
/// The generation of each reactor output it was compiled against.
|
||||
pub upstream: BTreeMap<PathBuf, u64>,
|
||||
pub classes: BTreeMap<String, ClassRecord>,
|
||||
/// Sources a failed compilation left uncompiled.
|
||||
pub dirty: BTreeSet<PathBuf>,
|
||||
pub changes: Vec<ApiChange>,
|
||||
/// Sources annotation processors wrote, and other files they wrote without an originating
|
||||
/// source (`META-INF/services`…): processors that aggregate. While there are any, a change
|
||||
/// compiles the set from scratch.
|
||||
pub generated: Vec<PathBuf>,
|
||||
pub unowned: Vec<PathBuf>,
|
||||
pub success: bool,
|
||||
}
|
||||
|
||||
impl SetState {
|
||||
/// The classes whose API changed since generation `since`; `None` when unknown (the log
|
||||
/// doesn't reach back that far) or when everything counts as changed.
|
||||
pub fn changes_since(&self, since: u64) -> Option<BTreeSet<String>> {
|
||||
let mut changed = BTreeSet::new();
|
||||
let mut at = since;
|
||||
while at != self.generation {
|
||||
let change = self.changes.iter().find(|c| c.since == at)?;
|
||||
if change.all {
|
||||
return None;
|
||||
}
|
||||
changed.extend(change.classes.iter().cloned());
|
||||
at = change.generation;
|
||||
}
|
||||
Some(changed)
|
||||
}
|
||||
|
||||
pub fn log(&mut self, generation: u64, classes: BTreeSet<String>, all: bool) {
|
||||
self.changes.push(ApiChange {
|
||||
since: self.generation,
|
||||
generation,
|
||||
classes: classes.into_iter().collect(),
|
||||
all,
|
||||
});
|
||||
if self.changes.len() > CHANGE_LOG {
|
||||
self.changes.drain(..self.changes.len() - CHANGE_LOG);
|
||||
}
|
||||
self.generation = generation;
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn load_state(path: &Path) -> Option<SetState> {
|
||||
serde_json::from_slice(&std::fs::read(path).ok()?).ok()
|
||||
}
|
||||
|
||||
/// `seeds` and the classes of `classes` that extend or implement one of them, transitively:
|
||||
/// a class that inherits a changed member changes for the classes that use it.
|
||||
pub(super) fn with_subclasses(classes: &BTreeMap<String, ClassRecord>, seeds: &BTreeSet<String>) -> BTreeSet<String> {
|
||||
let mut out = seeds.clone();
|
||||
loop {
|
||||
let before = out.len();
|
||||
for (name, record) in classes {
|
||||
if !out.contains(name)
|
||||
&& (record.super_name.as_ref().is_some_and(|s| out.contains(s))
|
||||
|| record.interfaces.iter().any(|i| out.contains(i)))
|
||||
{
|
||||
out.insert(name.clone());
|
||||
}
|
||||
}
|
||||
if out.len() == before {
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The sources of the classes that refer to one of `affected`.
|
||||
pub(super) fn dependent_sources(
|
||||
classes: &BTreeMap<String, ClassRecord>,
|
||||
affected: &BTreeSet<String>,
|
||||
) -> BTreeSet<PathBuf> {
|
||||
if affected.is_empty() {
|
||||
return BTreeSet::new();
|
||||
}
|
||||
classes
|
||||
.iter()
|
||||
.filter(|(name, r)| affected.contains(*name) || r.refs.iter().any(|x| affected.contains(x)))
|
||||
.filter_map(|(_, r)| r.source.clone())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The sources of the classes that refer to a class with the same simple name as one of
|
||||
/// `added`: a new class can take a simple name over from an on-demand import.
|
||||
pub(super) fn shadowed_sources(classes: &BTreeMap<String, ClassRecord>, added: &BTreeSet<String>) -> BTreeSet<PathBuf> {
|
||||
let names: BTreeSet<&str> = added.iter().map(|n| classfile::simple_name(n)).collect();
|
||||
if names.is_empty() {
|
||||
return BTreeSet::new();
|
||||
}
|
||||
classes
|
||||
.iter()
|
||||
.filter(|(name, r)| {
|
||||
!added.contains(*name)
|
||||
&& r.refs.iter().any(|x| !added.contains(x) && names.contains(classfile::simple_name(x)))
|
||||
})
|
||||
.filter_map(|(_, r)| r.source.clone())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// What one round's classes changed, compared with the classes the round replaced.
|
||||
#[derive(Debug, Default)]
|
||||
pub(super) struct RoundDiff {
|
||||
pub api: BTreeSet<String>,
|
||||
pub added: BTreeSet<String>,
|
||||
pub constants: bool,
|
||||
}
|
||||
|
||||
pub(super) fn diff(old: &BTreeMap<String, ClassRecord>, new: &BTreeMap<String, ClassRecord>) -> RoundDiff {
|
||||
let mut out = RoundDiff::default();
|
||||
for (name, record) in new {
|
||||
match old.get(name) {
|
||||
Some(before) => {
|
||||
if before.api != record.api {
|
||||
out.api.insert(name.clone());
|
||||
}
|
||||
if before.constants != record.constants {
|
||||
out.constants = true;
|
||||
}
|
||||
}
|
||||
None => {
|
||||
out.api.insert(name.clone());
|
||||
out.added.insert(name.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (name, before) in old {
|
||||
if !new.contains_key(name) {
|
||||
out.api.insert(name.clone());
|
||||
out.constants |= before.has_constants();
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
//! Resident javac processes (`java/java-build`, `ai.openidea.javac.Server`): one JVM per JDK
|
||||
//! and JVM options, kept warm between builds, compiling one request at a time in process.
|
||||
use super::*;
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
use std::process::{Child, ChildStdin, Command, Stdio};
|
||||
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
|
||||
use std::sync::mpsc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
|
||||
/// A message of the server about one request.
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq)]
|
||||
#[serde(tag = "kind", rename_all = "kebab-case", rename_all_fields = "camelCase")]
|
||||
pub enum Reply {
|
||||
Diagnostic {
|
||||
severity: String,
|
||||
path: Option<PathBuf>,
|
||||
/// 1-based.
|
||||
line: Option<u32>,
|
||||
/// 0-based UTF-16.
|
||||
column: Option<u32>,
|
||||
end_line: Option<u32>,
|
||||
end_column: Option<u32>,
|
||||
code: Option<String>,
|
||||
message: String,
|
||||
},
|
||||
/// A class (or resource) file javac wrote, and the source it came from.
|
||||
Output {
|
||||
path: PathBuf,
|
||||
source: Option<PathBuf>,
|
||||
},
|
||||
/// A source file an annotation processor wrote.
|
||||
Generated {
|
||||
path: PathBuf,
|
||||
source: Option<PathBuf>,
|
||||
},
|
||||
OutputText {
|
||||
text: String,
|
||||
},
|
||||
Done {
|
||||
success: bool,
|
||||
cancelled: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct Request<'a> {
|
||||
id: u64,
|
||||
op: &'static str,
|
||||
options: &'a [String],
|
||||
sources: &'a [PathBuf],
|
||||
encoding: Option<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||
pub struct ServerKey {
|
||||
pub java_home: PathBuf,
|
||||
/// Options of the compiler's JVM (`.mvn/jvm.config`: `--add-opens` for processors).
|
||||
pub jvm_args: Vec<String>,
|
||||
}
|
||||
|
||||
type Pending = Arc<Mutex<HashMap<u64, mpsc::Sender<Reply>>>>;
|
||||
|
||||
pub struct JavacServer {
|
||||
child: Mutex<Child>,
|
||||
stdin: Mutex<ChildStdin>,
|
||||
pending: Pending,
|
||||
alive: Arc<AtomicBool>,
|
||||
next: AtomicU64,
|
||||
pub version: String,
|
||||
}
|
||||
|
||||
impl JavacServer {
|
||||
fn start(jar: &Path, key: &ServerKey) -> IdeResult<Self> {
|
||||
let java = key.java_home.join("bin").join(if cfg!(windows) { "java.exe" } else { "java" });
|
||||
let mut cmd = Command::new(&java);
|
||||
cmd.args(&key.jvm_args)
|
||||
.args(["-XX:+UseSerialGC", "-XX:TieredStopAtLevel=1", "-Dfile.encoding=UTF-8", "-cp"])
|
||||
.arg(jar)
|
||||
.arg("ai.openidea.javac.Server")
|
||||
.env("JAVA_HOME", &key.java_home)
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::null());
|
||||
ide_core::process::prepare(&mut cmd);
|
||||
ide_core::process::own_group(&mut cmd);
|
||||
let mut child =
|
||||
cmd.spawn().map_err(|e| IdeError::unavailable(format!("Cannot start javac ({}): {e}", java.display())))?;
|
||||
let stdin = child.stdin.take().expect("piped");
|
||||
let stdout = child.stdout.take().expect("piped");
|
||||
let pending: Pending = Arc::default();
|
||||
let alive = Arc::new(AtomicBool::new(true));
|
||||
let (ready_tx, ready_rx) = mpsc::channel::<Result<String, String>>();
|
||||
{
|
||||
let (pending, alive) = (pending.clone(), alive.clone());
|
||||
std::thread::Builder::new()
|
||||
.name("javac-server".into())
|
||||
.spawn(move || {
|
||||
let mut ready = Some(ready_tx);
|
||||
for line in BufReader::new(stdout).lines() {
|
||||
let Ok(line) = line else { break };
|
||||
let Ok(value) = serde_json::from_str::<serde_json::Value>(&line) else { continue };
|
||||
match value.get("kind").and_then(|k| k.as_str()) {
|
||||
Some("ready") => {
|
||||
let version = value.get("version").and_then(|v| v.as_str()).unwrap_or("").to_owned();
|
||||
if let Some(ready) = ready.take() {
|
||||
let _ = ready.send(Ok(version));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Some("fatal") => {
|
||||
let message = value.get("message").and_then(|v| v.as_str()).unwrap_or("").to_owned();
|
||||
if let Some(ready) = ready.take() {
|
||||
let _ = ready.send(Err(message));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let Some(id) = value.get("id").and_then(|v| v.as_u64()) else { continue };
|
||||
let Ok(reply) = serde_json::from_value::<Reply>(value) else { continue };
|
||||
let done = matches!(reply, Reply::Done { .. });
|
||||
let mut pending = pending.lock().unwrap();
|
||||
if let Some(tx) = pending.get(&id) {
|
||||
let _ = tx.send(reply);
|
||||
}
|
||||
if done {
|
||||
pending.remove(&id);
|
||||
}
|
||||
}
|
||||
alive.store(false, Ordering::SeqCst);
|
||||
// Requests still waiting learn that the server is gone.
|
||||
for (_, tx) in pending.lock().unwrap().drain() {
|
||||
let _ = tx.send(Reply::Diagnostic {
|
||||
severity: "error".into(),
|
||||
path: None,
|
||||
line: None,
|
||||
column: None,
|
||||
end_line: None,
|
||||
end_column: None,
|
||||
code: None,
|
||||
message: "The javac process exited".into(),
|
||||
});
|
||||
let _ = tx.send(Reply::Done { success: false, cancelled: false });
|
||||
}
|
||||
if let Some(ready) = ready.take() {
|
||||
let _ = ready.send(Err("The javac process exited while starting".into()));
|
||||
}
|
||||
})
|
||||
.map_err(|e| IdeError::internal(e.to_string()))?;
|
||||
}
|
||||
let version = match ready_rx.recv_timeout(Duration::from_secs(60)) {
|
||||
Ok(Ok(version)) => version,
|
||||
Ok(Err(message)) => {
|
||||
ide_core::process::kill_tree(&mut child);
|
||||
return Err(IdeError::unavailable(format!("Cannot start javac ({}): {message}", java.display())));
|
||||
}
|
||||
Err(_) => {
|
||||
ide_core::process::kill_tree(&mut child);
|
||||
return Err(IdeError::unavailable(format!("javac ({}) did not start", java.display())));
|
||||
}
|
||||
};
|
||||
Ok(JavacServer {
|
||||
child: Mutex::new(child),
|
||||
stdin: Mutex::new(stdin),
|
||||
pending,
|
||||
alive,
|
||||
next: AtomicU64::new(1),
|
||||
version,
|
||||
})
|
||||
}
|
||||
|
||||
fn alive(&self) -> bool {
|
||||
self.alive.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
fn send(&self, value: &impl Serialize) -> IdeResult<()> {
|
||||
let mut line = serde_json::to_vec(value).map_err(|e| IdeError::internal(e.to_string()))?;
|
||||
line.push(b'\n');
|
||||
let mut stdin = self.stdin.lock().unwrap();
|
||||
stdin.write_all(&line).and_then(|()| stdin.flush()).map_err(|e| IdeError::internal(format!("javac: {e}")))
|
||||
}
|
||||
|
||||
/// Compiles `sources` with javac `options`, passing each reply to `on_reply`, until the
|
||||
/// compilation ends. Cancelling stops javac at its next phase.
|
||||
pub fn compile(
|
||||
&self,
|
||||
options: &[String],
|
||||
sources: &[PathBuf],
|
||||
encoding: Option<&str>,
|
||||
cancel: &CancellationToken,
|
||||
mut on_reply: impl FnMut(&Reply),
|
||||
) -> IdeResult<bool> {
|
||||
let id = self.next.fetch_add(1, Ordering::SeqCst);
|
||||
let (tx, rx) = mpsc::channel();
|
||||
self.pending.lock().unwrap().insert(id, tx);
|
||||
if let Err(e) = self.send(&Request { id, op: "compile", options, sources, encoding }) {
|
||||
self.pending.lock().unwrap().remove(&id);
|
||||
return Err(e);
|
||||
}
|
||||
let mut cancelled = false;
|
||||
loop {
|
||||
match rx.recv_timeout(Duration::from_millis(100)) {
|
||||
Ok(reply) => {
|
||||
if let Reply::Done { success, cancelled: stopped } = reply {
|
||||
if stopped || cancelled {
|
||||
return Err(IdeError::cancelled());
|
||||
}
|
||||
return Ok(success);
|
||||
}
|
||||
on_reply(&reply);
|
||||
}
|
||||
Err(mpsc::RecvTimeoutError::Timeout) => {
|
||||
if cancel.is_cancelled() && !cancelled {
|
||||
cancelled = true;
|
||||
let _ = self.send(&serde_json::json!({ "op": "cancel", "id": id }));
|
||||
}
|
||||
}
|
||||
Err(mpsc::RecvTimeoutError::Disconnected) => {
|
||||
return Err(IdeError::internal("The javac process exited"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for JavacServer {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.send(&serde_json::json!({ "op": "exit" }));
|
||||
let mut child = self.child.lock().unwrap();
|
||||
for _ in 0..20 {
|
||||
if child.try_wait().ok().flatten().is_some() {
|
||||
return;
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
}
|
||||
ide_core::process::kill_tree(&mut child);
|
||||
}
|
||||
}
|
||||
|
||||
/// The resident javac servers of one IDE process.
|
||||
#[derive(Default)]
|
||||
pub struct JavacPool {
|
||||
servers: Mutex<HashMap<ServerKey, Arc<JavacServer>>>,
|
||||
}
|
||||
|
||||
impl JavacPool {
|
||||
/// The running server for `key`, started on first use (or after it died).
|
||||
pub fn server(&self, jar: &Path, key: &ServerKey) -> IdeResult<Arc<JavacServer>> {
|
||||
let mut servers = self.servers.lock().unwrap();
|
||||
if let Some(server) = servers.get(key).filter(|s| s.alive()) {
|
||||
return Ok(server.clone());
|
||||
}
|
||||
let server = Arc::new(JavacServer::start(jar, key)?);
|
||||
servers.insert(key.clone(), server.clone());
|
||||
Ok(server)
|
||||
}
|
||||
|
||||
/// Stops every server (the project closed).
|
||||
pub fn shutdown(&self) {
|
||||
self.servers.lock().unwrap().clear();
|
||||
}
|
||||
}
|
||||
@@ -1,342 +0,0 @@
|
||||
//! The build model of a Maven reactor or Gradle build as the build tool itself configures it,
|
||||
//! recorded by the prepare run (`java/java-build` `BuildModel`, `gradle-build.init.gradle`), and when that run is due.
|
||||
use super::*;
|
||||
use std::fs;
|
||||
|
||||
/// `model.json` of the prepare run (see `BuildModel.java`).
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ReactorModel {
|
||||
pub version: u32,
|
||||
pub projects: Vec<ProjectModel>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProjectModel {
|
||||
/// Absolute project directory.
|
||||
pub dir: PathBuf,
|
||||
pub group_id: String,
|
||||
pub artifact_id: String,
|
||||
pub version: String,
|
||||
pub packaging: String,
|
||||
pub main: SourceSet,
|
||||
pub test: SourceSet,
|
||||
/// Executions in the compile phases that aren't javac (`group:artifact:goal@id`).
|
||||
#[serde(default)]
|
||||
pub other_compilers: Vec<String>,
|
||||
/// Test source generators the prepare run doesn't reach.
|
||||
#[serde(default)]
|
||||
pub test_generators: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub problems: Vec<String>,
|
||||
/// The Gradle project path (`:`, `:app`); `None` for Maven.
|
||||
#[serde(default)]
|
||||
pub gradle_path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SourceSet {
|
||||
pub source_roots: Vec<PathBuf>,
|
||||
pub output: PathBuf,
|
||||
pub classpath: Vec<PathBuf>,
|
||||
pub runtime_classpath: Vec<PathBuf>,
|
||||
#[serde(default)]
|
||||
pub resources: Vec<ResourceRoot>,
|
||||
pub compiler: Option<CompilerConfig>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ResourceRoot {
|
||||
pub directory: PathBuf,
|
||||
#[serde(default)]
|
||||
pub filtering: bool,
|
||||
pub target_path: Option<String>,
|
||||
#[serde(default)]
|
||||
pub includes: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub excludes: Vec<String>,
|
||||
}
|
||||
|
||||
/// maven-compiler-plugin's configuration of one source set, as its mojo was configured.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CompilerConfig {
|
||||
pub compiler_id: Option<String>,
|
||||
pub source: Option<String>,
|
||||
pub target: Option<String>,
|
||||
pub release: Option<String>,
|
||||
pub encoding: Option<String>,
|
||||
pub parameters: Option<bool>,
|
||||
pub debug: Option<bool>,
|
||||
pub debuglevel: Option<String>,
|
||||
pub proc: Option<String>,
|
||||
pub enable_preview: Option<bool>,
|
||||
pub fork: Option<bool>,
|
||||
pub executable: Option<String>,
|
||||
pub skip: Option<bool>,
|
||||
pub show_warnings: Option<bool>,
|
||||
pub show_deprecation: Option<bool>,
|
||||
pub generated_sources_directory: Option<PathBuf>,
|
||||
#[serde(default)]
|
||||
pub includes: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub excludes: Vec<String>,
|
||||
pub annotation_processors: Option<Vec<String>>,
|
||||
#[serde(default)]
|
||||
pub compiler_args: Vec<String>,
|
||||
pub compiler_argument: Option<String>,
|
||||
#[serde(default)]
|
||||
pub compiler_arguments: BTreeMap<String, Option<String>>,
|
||||
pub multi_release_output: Option<bool>,
|
||||
pub processor_path: Option<Vec<PathBuf>>,
|
||||
pub processor_path_error: Option<String>,
|
||||
}
|
||||
|
||||
impl ProjectModel {
|
||||
pub fn key(&self) -> String {
|
||||
format!("{}:{}", self.group_id, self.artifact_id)
|
||||
}
|
||||
|
||||
pub fn set(&self, test: bool) -> &SourceSet {
|
||||
if test { &self.test } else { &self.main }
|
||||
}
|
||||
|
||||
/// Why the IDE can't compile this project with javac itself, if it can't.
|
||||
pub fn unsupported(&self, test: bool) -> Option<String> {
|
||||
// What the build tool couldn't resolve or read: the model would be incomplete.
|
||||
if let Some(problem) = self.problems.first() {
|
||||
return Some(format!("{}: {problem}", self.artifact_id));
|
||||
}
|
||||
if !self.other_compilers.is_empty() {
|
||||
return Some(format!("{} also compiles with {}", self.artifact_id, self.other_compilers.join(", ")));
|
||||
}
|
||||
if test && !self.test_generators.is_empty() {
|
||||
return Some(format!(
|
||||
"{} generates test sources with {}",
|
||||
self.artifact_id,
|
||||
self.test_generators.join(", ")
|
||||
));
|
||||
}
|
||||
for set in [&self.main, &self.test] {
|
||||
let Some(c) = &set.compiler else { continue };
|
||||
if c.compiler_id.as_deref().is_some_and(|id| id != "javac") {
|
||||
return Some(format!("{} compiles with {}", self.artifact_id, c.compiler_id.as_deref().unwrap()));
|
||||
}
|
||||
if c.multi_release_output == Some(true) {
|
||||
return Some(format!("{} is a multi-release jar", self.artifact_id));
|
||||
}
|
||||
if let Some(error) = &c.processor_path_error {
|
||||
return Some(format!("{}: {error}", self.artifact_id));
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Where the IDE's build of the reactor at `top_dir` keeps its model and outputs.
|
||||
pub(super) fn reactor_dir(cache: &Path, top_dir: &str) -> PathBuf {
|
||||
let base = cache.join("java-build");
|
||||
if top_dir.is_empty() { base.join("_root") } else { base.join(top_dir) }
|
||||
}
|
||||
|
||||
/// The outputs of every project, `<out>/<groupId>.<artifactId>/classes`, as the extension
|
||||
/// redirects them (`-Dopenidea.build.output=<out>`).
|
||||
pub(super) fn output_root(cache: &Path, top_dir: &str) -> PathBuf {
|
||||
reactor_dir(cache, top_dir).join("out")
|
||||
}
|
||||
|
||||
/// What the recorded model was prepared from.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub(super) struct PrepareRecord {
|
||||
pub fingerprint: LaunchFingerprint,
|
||||
pub model: ReactorModel,
|
||||
}
|
||||
|
||||
const MODEL_VERSION: u32 = 1;
|
||||
|
||||
/// Files the model depends on: the POM chains, settings, toolchains, the Maven launcher,
|
||||
/// and generator inputs (any `src/<set>/<dir>` that isn't Java sources or resources:
|
||||
/// `proto`, `antlr4`, `avro`…), but not the Java sources and resources themselves.
|
||||
pub(super) fn prepare_fingerprint(
|
||||
root: &Path,
|
||||
reactor: &[&maven::MavenProject],
|
||||
step: &BuildStep,
|
||||
local_repo: Option<PathBuf>,
|
||||
jar_version: &str,
|
||||
cancel: &CancellationToken,
|
||||
) -> IdeResult<Option<LaunchFingerprint>> {
|
||||
let Some(mut inputs) = maven::model_inputs(root, reactor, local_repo) else { return Ok(None) };
|
||||
for project in reactor {
|
||||
let src = subdir(root, &project.dir).join("src");
|
||||
for set in fs::read_dir(&src).into_iter().flatten().flatten() {
|
||||
for dir in fs::read_dir(set.path()).into_iter().flatten().flatten() {
|
||||
let name = dir.file_name();
|
||||
if dir.path().is_dir() && !matches!(name.to_str(), Some("java" | "resources")) {
|
||||
inputs.push(dir.path());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for dir in step.cwd.ancestors() {
|
||||
inputs.extend([dir.join(".mvn"), dir.join("mvnw"), dir.join("mvnw.cmd")]);
|
||||
if dir == root {
|
||||
break;
|
||||
}
|
||||
}
|
||||
inputs.push(process::program_path(&step.program, &step.env, &step.cwd));
|
||||
if let Some(home) = dirs::home_dir() {
|
||||
inputs.extend([home.join(".m2/settings.xml"), home.join(".m2/toolchains.xml")]);
|
||||
}
|
||||
if let Some(home) = step.env.get("JAVA_HOME") {
|
||||
inputs.push(Path::new(home).join("release"));
|
||||
}
|
||||
inputs.sort();
|
||||
inputs.dedup();
|
||||
let parameters = serde_json::to_string(&(MODEL_VERSION, jar_version, &step.program, &step.args, &step.env))
|
||||
.map_err(|e| IdeError::internal(e.to_string()))?;
|
||||
Ok(Some(LaunchFingerprint::new(parameters, fingerprint::scan_all(root, inputs, cancel)?)))
|
||||
}
|
||||
|
||||
pub(super) fn load_record(dir: &Path) -> Option<PrepareRecord> {
|
||||
let record: PrepareRecord = serde_json::from_slice(&fs::read(dir.join("prepare.json")).ok()?).ok()?;
|
||||
(record.model.version == MODEL_VERSION).then_some(record)
|
||||
}
|
||||
|
||||
pub(super) fn save_record(dir: &Path, record: &PrepareRecord) -> IdeResult<()> {
|
||||
write_json(&dir.join("prepare.json"), record)
|
||||
}
|
||||
|
||||
pub(super) fn write_json(path: &Path, value: &impl Serialize) -> IdeResult<()> {
|
||||
let parent = path.parent().ok_or_else(|| IdeError::internal("no parent folder"))?;
|
||||
fs::create_dir_all(parent)?;
|
||||
let mut file = tempfile::NamedTempFile::new_in(parent)?;
|
||||
serde_json::to_writer(file.as_file_mut(), value).map_err(|e| IdeError::internal(e.to_string()))?;
|
||||
file.persist(path).map_err(|e| IdeError::from(e.error))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Whether the generated source roots the model lists still exist: `mvn clean` removes them.
|
||||
pub(super) fn generated_roots_exist(model: &ReactorModel) -> bool {
|
||||
model.projects.iter().all(|p| {
|
||||
[&p.main, &p.test].iter().all(|set| {
|
||||
set.source_roots.iter().all(|root| {
|
||||
root.exists() || !root.components().any(|c| c.as_os_str() == "target") || is_processor_output(set, root)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// The annotation processors' output folder, which javac writes into and never reads as a root.
|
||||
pub(super) fn is_processor_output(set: &SourceSet, root: &Path) -> bool {
|
||||
set.compiler.as_ref().and_then(|c| c.generated_sources_directory.as_deref()).is_some_and(|dir| dir == root)
|
||||
}
|
||||
|
||||
/// A Maven step at the reactor root running `goals` with the IDE's extension loaded.
|
||||
pub(super) fn maven_step(
|
||||
root: &Path,
|
||||
top: &maven::MavenProject,
|
||||
jar: &Path,
|
||||
output_root: &Path,
|
||||
model_file: Option<&Path>,
|
||||
extra: &[String],
|
||||
) -> BuildStep {
|
||||
let mut step = maven_build_step(
|
||||
&top.command,
|
||||
&["-B", "-Dstyle.color=never", maven::LOCAL_REPO_TRACKING_ARG],
|
||||
&subdir(root, &top.dir),
|
||||
);
|
||||
step.args.extend(top.options.iter().cloned());
|
||||
step.args.push(format!("-Dmaven.ext.class.path={}", jar.display()));
|
||||
step.args.push(format!("-Dopenidea.build.output={}", output_root.display()));
|
||||
if let Some(file) = model_file {
|
||||
step.args.push(format!("-Dopenidea.build.model={}", file.display()));
|
||||
}
|
||||
step.args.extend(extra.iter().cloned());
|
||||
step.env = top.env.clone();
|
||||
step
|
||||
}
|
||||
|
||||
/// The init script that gives a Gradle build the IDE's outputs and writes its model.
|
||||
const GRADLE_INIT_SCRIPT: &str = include_str!("gradle-build.init.gradle");
|
||||
|
||||
/// Writes the init script into the build's state folder, and returns its path.
|
||||
pub(super) fn gradle_init_script(dir: &Path) -> IdeResult<PathBuf> {
|
||||
fs::create_dir_all(dir)?;
|
||||
let path = dir.join("openidea-build.init.gradle");
|
||||
if fs::read_to_string(&path).ok().as_deref() != Some(GRADLE_INIT_SCRIPT) {
|
||||
fs::write(&path, GRADLE_INIT_SCRIPT)?;
|
||||
}
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
/// A Gradle step at the build's root running `tasks` with the IDE's init script.
|
||||
pub(super) fn gradle_step(
|
||||
root: &Path,
|
||||
g: &crate::GradleModel,
|
||||
init: &Path,
|
||||
output_root: &Path,
|
||||
model_file: Option<&Path>,
|
||||
tasks: &[String],
|
||||
) -> BuildStep {
|
||||
let mut step = gradle_build_step(
|
||||
&g.command,
|
||||
// The init script configures the evaluated projects, which a configuration cache skips.
|
||||
&["--console=plain", "--no-configuration-cache"],
|
||||
&subdir(root, &g.dir),
|
||||
);
|
||||
step.args.extend(["--init-script".to_owned(), init.to_string_lossy().into_owned()]);
|
||||
step.args.push(format!("-Popenidea.build.output={}", output_root.display()));
|
||||
if let Some(file) = model_file {
|
||||
step.args.push(format!("-Popenidea.build.model={}", file.display()));
|
||||
}
|
||||
step.args.extend(tasks.iter().cloned());
|
||||
step.env = g.env.clone();
|
||||
step
|
||||
}
|
||||
|
||||
/// Files a Gradle build's model depends on: settings and build scripts (with what they apply),
|
||||
/// properties, the wrapper and catalogs, `buildSrc`, and generator inputs.
|
||||
pub(super) fn gradle_prepare_fingerprint(
|
||||
root: &Path,
|
||||
g: &crate::GradleModel,
|
||||
step: &BuildStep,
|
||||
jar_version: &str,
|
||||
cancel: &CancellationToken,
|
||||
) -> IdeResult<LaunchFingerprint> {
|
||||
let mut inputs = crate::gradle::build_files(root, g);
|
||||
let dir = subdir(root, &g.dir);
|
||||
inputs.extend([dir.join("buildSrc"), dir.join("gradle"), dir.join("gradlew"), dir.join("gradlew.bat")]);
|
||||
for project in &g.projects {
|
||||
let src = subdir(root, &project.dir).join("src");
|
||||
for set in fs::read_dir(&src).into_iter().flatten().flatten() {
|
||||
for generator in fs::read_dir(set.path()).into_iter().flatten().flatten() {
|
||||
let name = generator.file_name();
|
||||
if generator.path().is_dir() && !matches!(name.to_str(), Some("java" | "resources")) {
|
||||
inputs.push(generator.path());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
inputs.push(process::program_path(&step.program, &step.env, &step.cwd));
|
||||
if let Some(home) = dirs::home_dir() {
|
||||
inputs.push(home.join(".gradle/gradle.properties"));
|
||||
inputs.push(home.join(".gradle/init.d"));
|
||||
}
|
||||
if let Some(home) = step.env.get("JAVA_HOME") {
|
||||
inputs.push(Path::new(home).join("release"));
|
||||
}
|
||||
inputs.sort();
|
||||
inputs.dedup();
|
||||
let parameters =
|
||||
serde_json::to_string(&(MODEL_VERSION, jar_version, GRADLE_INIT_SCRIPT, &step.program, &step.args, &step.env))
|
||||
.map_err(|e| IdeError::internal(e.to_string()))?;
|
||||
Ok(LaunchFingerprint::new(parameters, fingerprint::scan_all(root, inputs, cancel)?))
|
||||
}
|
||||
|
||||
pub(super) fn read_model(path: &Path) -> IdeResult<ReactorModel> {
|
||||
let bytes = fs::read(path).map_err(|e| IdeError::internal(format!("The build wrote no model ({e})")))?;
|
||||
serde_json::from_slice(&bytes).map_err(|e| IdeError::internal(format!("Unreadable build model: {e}")))
|
||||
}
|
||||
@@ -1,544 +0,0 @@
|
||||
use super::*;
|
||||
use crate::BuildModel;
|
||||
use std::fs;
|
||||
use std::sync::Mutex as StdMutex;
|
||||
|
||||
const JAR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../../java/java-build/openidea-java-build.jar");
|
||||
|
||||
fn write(root: &Path, rel: &str, text: &str) {
|
||||
let path = root.join(rel);
|
||||
fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
fs::write(path, text).unwrap();
|
||||
}
|
||||
|
||||
/// A JDK (`JAVA_HOME`) and Maven on the search path, else `None` (the test is skipped).
|
||||
fn tools() -> Option<(PathBuf, PathBuf)> {
|
||||
let home = std::env::var_os("JAVA_HOME").map(PathBuf::from).filter(|h| h.join("bin").is_dir())?;
|
||||
let mvn = ide_core::process::find_executable("mvn", &ide_core::tool_path::search_path())?;
|
||||
Some((home, mvn))
|
||||
}
|
||||
|
||||
const ROOT_POM: &str = r#"<project><modelVersion>4.0.0</modelVersion><groupId>t</groupId><artifactId>root</artifactId><version>1</version><packaging>pom</packaging>
|
||||
<modules><module>lib</module><module>app</module></modules>
|
||||
<properties><maven.compiler.release>11</maven.compiler.release><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties>
|
||||
<build><pluginManagement><plugins><plugin><artifactId>maven-compiler-plugin</artifactId><version>3.13.0</version>
|
||||
<configuration><parameters>true</parameters></configuration></plugin></plugins></pluginManagement></build></project>"#;
|
||||
const LIB_POM: &str = r#"<project><modelVersion>4.0.0</modelVersion><parent><groupId>t</groupId><artifactId>root</artifactId><version>1</version></parent><artifactId>lib</artifactId></project>"#;
|
||||
const APP_POM: &str = r#"<project><modelVersion>4.0.0</modelVersion><parent><groupId>t</groupId><artifactId>root</artifactId><version>1</version></parent><artifactId>app</artifactId>
|
||||
<dependencies><dependency><groupId>t</groupId><artifactId>lib</artifactId><version>1</version></dependency></dependencies>
|
||||
<build><resources><resource><directory>src/main/resources</directory><filtering>true</filtering></resource></resources></build></project>"#;
|
||||
|
||||
/// A `lib` ← `app` reactor built by the IDE's Java build with a real Maven and JDK.
|
||||
struct Fixture {
|
||||
_tmp: tempfile::TempDir,
|
||||
root: PathBuf,
|
||||
cache: PathBuf,
|
||||
model: BuildModel,
|
||||
/// Where the build keeps its state under the cache (`Reactor::key`).
|
||||
key: &'static str,
|
||||
service: JavaBuildService,
|
||||
events: StdMutex<Vec<BuildEvent>>,
|
||||
}
|
||||
|
||||
impl Fixture {
|
||||
fn new(files: &[(&str, &str)]) -> Option<Self> {
|
||||
let Some((home, mvn)) = tools() else {
|
||||
eprintln!("skipped: needs JAVA_HOME and mvn");
|
||||
return None;
|
||||
};
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let root = dunce::canonicalize(tmp.path()).unwrap();
|
||||
for (rel, text) in
|
||||
[("pom.xml", ROOT_POM), ("lib/pom.xml", LIB_POM), ("app/pom.xml", APP_POM)].iter().chain(files)
|
||||
{
|
||||
write(&root, rel, text);
|
||||
}
|
||||
let cache = root.join(".cache");
|
||||
let mut model = crate::load(&root, &cache, None);
|
||||
for p in &mut model.maven.as_mut().unwrap().projects {
|
||||
p.command = mvn.to_string_lossy().into_owned();
|
||||
p.env.insert("JAVA_HOME".into(), home.to_string_lossy().into_owned());
|
||||
}
|
||||
Some(Fixture {
|
||||
_tmp: tmp,
|
||||
root,
|
||||
cache,
|
||||
model,
|
||||
key: "",
|
||||
service: JavaBuildService::default(),
|
||||
events: StdMutex::default(),
|
||||
})
|
||||
}
|
||||
|
||||
/// The same `lib` ← `app` build with Gradle (`OPENIDEA_TEST_GRADLE`, else `gradle` on the
|
||||
/// search path).
|
||||
fn gradle(files: &[(&str, &str)]) -> Option<Self> {
|
||||
let home = std::env::var_os("JAVA_HOME").map(PathBuf::from).filter(|h| h.join("bin").is_dir());
|
||||
let gradle = std::env::var_os("OPENIDEA_TEST_GRADLE")
|
||||
.map(PathBuf::from)
|
||||
.or_else(|| ide_core::process::find_executable("gradle", &ide_core::tool_path::search_path()));
|
||||
let (Some(home), Some(gradle)) = (home, gradle) else {
|
||||
eprintln!("skipped: needs JAVA_HOME and gradle (OPENIDEA_TEST_GRADLE)");
|
||||
return None;
|
||||
};
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let root = dunce::canonicalize(tmp.path()).unwrap();
|
||||
let build = [
|
||||
("settings.gradle", "rootProject.name = 'root'\ninclude 'lib', 'app'\n"),
|
||||
(
|
||||
"build.gradle",
|
||||
"subprojects {\n apply plugin: 'java'\n group = 't'\n tasks.withType(JavaCompile).configureEach { options.release = 11; options.encoding = 'UTF-8' }\n}\n",
|
||||
),
|
||||
("lib/build.gradle", ""),
|
||||
(
|
||||
"app/build.gradle",
|
||||
"dependencies { implementation project(':lib') }\nprocessResources { filesMatching('*.properties') { expand(version: '1') } }\n",
|
||||
),
|
||||
];
|
||||
for (rel, text) in build.iter().chain(files) {
|
||||
write(&root, rel, text);
|
||||
}
|
||||
let cache = root.join(".cache");
|
||||
let mut model = crate::load(&root, &cache, None);
|
||||
assert_eq!(model.gradle.len(), 1, "{model:?}");
|
||||
let g = &mut model.gradle[0];
|
||||
g.command = gradle.to_string_lossy().into_owned();
|
||||
g.env.insert("JAVA_HOME".into(), home.to_string_lossy().into_owned());
|
||||
Some(Fixture {
|
||||
_tmp: tmp,
|
||||
root,
|
||||
cache,
|
||||
model,
|
||||
key: "_gradle",
|
||||
service: JavaBuildService::default(),
|
||||
events: StdMutex::default(),
|
||||
})
|
||||
}
|
||||
|
||||
fn write(&self, rel: &str, text: &str) {
|
||||
write(&self.root, rel, text);
|
||||
}
|
||||
|
||||
fn out(&self, rel: &str) -> PathBuf {
|
||||
model::output_root(&self.cache, self.key).join(rel)
|
||||
}
|
||||
|
||||
/// Builds the launch of `app` (its tests when `test`).
|
||||
fn launch(&self, test: bool) -> LaunchOutputs {
|
||||
self.build(Target::Launch { module: &self.root.join("app"), test })
|
||||
}
|
||||
|
||||
fn build(&self, target: Target) -> LaunchOutputs {
|
||||
let jdk = |_: Option<u32>| None;
|
||||
let build = JavaBuild {
|
||||
root: &self.root,
|
||||
model: &self.model,
|
||||
cache: &self.cache,
|
||||
jar: Path::new(JAR),
|
||||
jar_version: "test",
|
||||
local_repo: None,
|
||||
service: &self.service,
|
||||
jdk: &jdk,
|
||||
};
|
||||
let on_event = |e: BuildEvent| self.events.lock().unwrap().push(e);
|
||||
match build.build(target, BuildKind::Build, &CancellationToken::new(), &on_event) {
|
||||
Ok(Built::Done(outputs)) => outputs,
|
||||
Ok(Built::Unsupported(reason)) => panic!("unsupported: {reason}"),
|
||||
Err(e) => panic!("{e:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
/// The steps of the launch builds since the last call.
|
||||
fn steps(&self) -> Vec<String> {
|
||||
self.events
|
||||
.lock()
|
||||
.unwrap()
|
||||
.drain(..)
|
||||
.filter_map(|e| match e {
|
||||
BuildEvent::Step { command, .. } => Some(command),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Builds and returns the steps it took, which must succeed.
|
||||
fn steps_of_launch(&self) -> Vec<String> {
|
||||
self.steps();
|
||||
let built = self.launch(false);
|
||||
assert_eq!(built.failure, None, "{:?}", built.messages);
|
||||
self.steps()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn builds_maven_modules_with_javac_and_only_what_changed() {
|
||||
let Some(f) = Fixture::new(&[
|
||||
(
|
||||
"lib/src/main/java/l/L.java",
|
||||
"package l;\npublic class L { public static String name() { return \"lib\"; } }\n",
|
||||
),
|
||||
(
|
||||
"app/src/main/java/a/A.java",
|
||||
"package a;\npublic class A { public static void main(String[] args) { System.out.println(l.L.name()); } }\n",
|
||||
),
|
||||
("app/src/main/resources/app.properties", "version=${project.version}\n"),
|
||||
("app/src/test/java/a/ATest.java", "package a;\npublic class ATest { String s = l.L.name(); }\n"),
|
||||
]) else {
|
||||
return;
|
||||
};
|
||||
|
||||
// First build: Maven prepares the model, javac compiles lib then app into the IDE's outputs.
|
||||
let first = f.launch(false);
|
||||
assert_eq!(first.failure, None, "{:?}", first.messages);
|
||||
assert_eq!(first.class_paths[0], f.out("t.app/classes"));
|
||||
assert!(first.class_paths.contains(&f.out("t.lib/classes")), "{:?}", first.class_paths);
|
||||
assert!(f.out("t.app/classes/a/A.class").is_file());
|
||||
assert!(f.out("t.lib/classes/l/L.class").is_file());
|
||||
assert!(!f.root.join("app/target/classes/a/A.class").exists());
|
||||
assert_eq!(fs::read_to_string(f.out("t.app/classes/app.properties")).unwrap(), "version=1\n");
|
||||
let steps = f.steps();
|
||||
assert!(steps[0].contains("process-resources"), "{steps:?}");
|
||||
assert_eq!(steps[1..], ["javac lib (main, 1 file)", "javac app (main, 1 file)"]);
|
||||
|
||||
// Nothing changed: no Maven, no javac.
|
||||
assert_eq!(f.steps_of_launch(), Vec::<String>::new());
|
||||
|
||||
// A change inside a method compiles that class only, without Maven.
|
||||
f.write(
|
||||
"lib/src/main/java/l/L.java",
|
||||
"package l;\npublic class L { public static String name() { return \"lib 2\"; } }\n",
|
||||
);
|
||||
assert_eq!(f.steps_of_launch(), ["javac lib (main, 1 file)"]);
|
||||
|
||||
// A resource change is processed by Maven (it filters), and compiles nothing.
|
||||
f.write("app/src/main/resources/app.properties", "version=${project.version}\nmore=1\n");
|
||||
let steps = f.steps_of_launch();
|
||||
assert_eq!(steps.len(), 1, "{steps:?}");
|
||||
assert!(steps[0].contains("resources:resources") && steps[0].contains("-pl app"), "{steps:?}");
|
||||
assert_eq!(fs::read_to_string(f.out("t.app/classes/app.properties")).unwrap(), "version=1\nmore=1\n");
|
||||
|
||||
// A deleted source leaves no class behind.
|
||||
f.write("app/src/main/java/a/Gone.java", "package a;\nclass Gone {}\n");
|
||||
assert_eq!(f.steps_of_launch(), ["javac app (main, 1 of 2 files)"]);
|
||||
assert!(f.out("t.app/classes/a/Gone.class").is_file());
|
||||
fs::remove_file(f.root.join("app/src/main/java/a/Gone.java")).unwrap();
|
||||
assert_eq!(f.steps_of_launch(), Vec::<String>::new());
|
||||
assert!(!f.out("t.app/classes/a/Gone.class").exists());
|
||||
|
||||
// Compile errors fail the build with positioned messages.
|
||||
f.write("app/src/main/java/a/A.java", "package a;\npublic class A { int x = \"s\"; }\n");
|
||||
let failed = f.launch(false);
|
||||
let failure = failed.failure.expect("fails");
|
||||
assert!(failure.contains("incompatible types"), "{failure}");
|
||||
let error = failed.messages.iter().find(|m| m.severity == Severity::Error).unwrap();
|
||||
assert_eq!(error.path.as_deref(), Some(f.root.join("app/src/main/java/a/A.java").as_path()));
|
||||
assert_eq!(error.range.unwrap().start, Pos::new(1, 25));
|
||||
// It compiles again next time, even unchanged.
|
||||
f.steps();
|
||||
assert!(f.launch(false).failure.is_some());
|
||||
assert_eq!(f.steps(), ["javac app (main, 1 file)"]);
|
||||
|
||||
// A test launch compiles the module's tests after its main classes.
|
||||
f.write(
|
||||
"app/src/main/java/a/A.java",
|
||||
"package a;\npublic class A { public static void main(String[] args) { System.out.println(l.L.name()); } }\n",
|
||||
);
|
||||
let tests = f.launch(true);
|
||||
assert_eq!(tests.failure, None, "{:?}", tests.messages);
|
||||
assert_eq!(tests.class_paths[..2], [f.out("t.app/test-classes"), f.out("t.app/classes")]);
|
||||
assert!(f.out("t.app/test-classes/a/ATest.class").is_file());
|
||||
|
||||
// Recompile compiles the file even unchanged.
|
||||
f.steps();
|
||||
let file = f.root.join("app/src/main/java/a/A.java");
|
||||
assert_eq!(f.build(Target::File(&file)).failure, None);
|
||||
assert_eq!(f.steps(), ["javac app (main, 1 file)"]);
|
||||
// Build Project builds every module's main and test classes.
|
||||
f.write("lib/src/test/java/l/LTest.java", "package l;\nclass LTest { String s = L.name(); }\n");
|
||||
assert_eq!(f.build(Target::Project).failure, None);
|
||||
assert_eq!(f.steps(), ["javac lib (tests, 1 file)"]);
|
||||
assert!(f.out("t.lib/test-classes/l/LTest.class").is_file());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recompiles_the_classes_an_api_change_reaches() {
|
||||
let Some(f) = Fixture::new(&[
|
||||
("lib/src/main/java/l/Base.java", "package l;\npublic class Base { public int m() { return 1; } }\n"),
|
||||
("lib/src/main/java/l/Sub.java", "package l;\npublic class Sub extends Base {}\n"),
|
||||
("lib/src/main/java/l/User.java", "package l;\nclass User { int u(Sub s) { return s.m(); } }\n"),
|
||||
("lib/src/main/java/l/Const.java", "package l;\npublic class Const { public static final int X = 1; }\n"),
|
||||
("lib/src/main/java/l/ConstUser.java", "package l;\nclass ConstUser { int c() { return Const.X; } }\n"),
|
||||
("lib/src/main/java/l/Other.java", "package l;\npublic class Other { public int o() { return 1; } }\n"),
|
||||
("app/src/main/java/a/A.java", "package a;\nclass A { int a() { return new l.Other().o(); } }\n"),
|
||||
("app/src/main/java/a/B.java", "package a;\nclass B { int b() { return l.Const.X; } }\n"),
|
||||
]) else {
|
||||
return;
|
||||
};
|
||||
assert_eq!(f.steps_of_launch()[1..], ["javac lib (main, 6 files)", "javac app (main, 2 files)"]);
|
||||
|
||||
// A body change: that class only, and nothing downstream.
|
||||
f.write("lib/src/main/java/l/Other.java", "package l;\npublic class Other { public int o() { return 2; } }\n");
|
||||
assert_eq!(f.steps_of_launch(), ["javac lib (main, 1 of 6 files)"]);
|
||||
|
||||
// An API change reaches the classes that use the class or a subclass of it.
|
||||
f.write(
|
||||
"lib/src/main/java/l/Base.java",
|
||||
"package l;\npublic class Base { public int m() { return 1; } public int n() { return 2; } }\n",
|
||||
);
|
||||
assert_eq!(f.steps_of_launch(), ["javac lib (main, 1 of 6 files)", "javac lib (main, 2 of 6 files)"]);
|
||||
|
||||
// Across modules: only the classes that use it.
|
||||
f.write(
|
||||
"lib/src/main/java/l/Other.java",
|
||||
"package l;\npublic class Other { public int o() { return 2; } public void p() {} }\n",
|
||||
);
|
||||
assert_eq!(f.steps_of_launch(), ["javac lib (main, 1 of 6 files)", "javac app (main, 1 of 2 files)"]);
|
||||
|
||||
// A compile-time constant is copied into its uses: everything compiled against it compiles again.
|
||||
f.write("lib/src/main/java/l/Const.java", "package l;\npublic class Const { public static final int X = 2; }\n");
|
||||
assert_eq!(
|
||||
f.steps_of_launch(),
|
||||
["javac lib (main, 1 of 6 files)", "javac lib (main, 5 of 6 files)", "javac app (main, 2 files)"]
|
||||
);
|
||||
|
||||
// A removed method fails the classes that still call it.
|
||||
f.write("lib/src/main/java/l/Base.java", "package l;\npublic class Base { public int n() { return 2; } }\n");
|
||||
let failed = f.launch(false);
|
||||
assert!(failed.failure.expect("fails").contains("User.java"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_api_change_from_a_failed_build_still_reaches_other_modules() {
|
||||
let Some(f) = Fixture::new(&[
|
||||
("lib/src/main/java/l/L.java", "package l;\npublic class L { public static int m() { return 1; } }\n"),
|
||||
("lib/src/main/java/l/U.java", "package l;\nclass U { int u() { return L.m(); } }\n"),
|
||||
("app/src/main/java/a/A.java", "package a;\nclass A { int a() { return l.L.m(); } }\n"),
|
||||
]) else {
|
||||
return;
|
||||
};
|
||||
assert_eq!(f.launch(false).failure, None);
|
||||
|
||||
// L compiles, then U, which still calls the removed method, fails lib before app compiles.
|
||||
f.write("lib/src/main/java/l/L.java", "package l;\npublic class L { public static int n() { return 1; } }\n");
|
||||
assert!(f.launch(false).failure.expect("lib fails").contains("U.java"));
|
||||
|
||||
// Once lib compiles, app learns that L changed, and A fails too instead of keeping a class
|
||||
// that calls a method L no longer has.
|
||||
f.write("lib/src/main/java/l/U.java", "package l;\nclass U { int u() { return L.n(); } }\n");
|
||||
let failed = f.launch(false);
|
||||
assert!(failed.failure.expect("app fails").contains("A.java"), "{:?}", failed.messages);
|
||||
|
||||
// So does a changed constant: C compiles, then the whole set, where U fails.
|
||||
f.write("app/src/main/java/a/A.java", "package a;\nclass A { int a() { return l.L.n() + l.C.X; } }\n");
|
||||
let c = |x: u32, y: &str| format!("package l;\npublic class C {{ public static final int X = {x};{y} }}\n");
|
||||
f.write("lib/src/main/java/l/C.java", &c(1, " public static int y() { return 0; }"));
|
||||
f.write("lib/src/main/java/l/U.java", "package l;\nclass U { int u() { return L.n() + C.y(); } }\n");
|
||||
assert_eq!(f.launch(false).failure, None);
|
||||
f.write("lib/src/main/java/l/C.java", &c(2, ""));
|
||||
assert!(f.launch(false).failure.expect("lib fails").contains("U.java"));
|
||||
f.write("lib/src/main/java/l/U.java", "package l;\nclass U { int u() { return L.n(); } }\n");
|
||||
f.steps();
|
||||
assert_eq!(f.launch(false).failure, None);
|
||||
let steps = f.steps();
|
||||
assert!(steps.contains(&"javac app (main, 1 file)".to_owned()), "{steps:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_what_a_class_file_declares() {
|
||||
let Some((home, _)) = tools() else { return };
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let compile = |text: &str| {
|
||||
write(tmp.path(), "p/C.java", text);
|
||||
let status = std::process::Command::new(home.join("bin/javac"))
|
||||
.args(["-d", "out", "p/C.java"])
|
||||
.current_dir(tmp.path())
|
||||
.status()
|
||||
.unwrap();
|
||||
assert!(status.success());
|
||||
classfile::parse(&fs::read(tmp.path().join("out/p/C.class")).unwrap()).unwrap()
|
||||
};
|
||||
let a = compile(
|
||||
"package p;\nimport java.util.List;\npublic class C extends Thread implements Runnable {\n public static final String K = \"k\";\n @Deprecated public List<javax.swing.JButton> f;\n public x.Y g() { return null; }\n private int hidden() { return 1; }\n}\nclass Z {}\n"
|
||||
.replace("x.Y", "Object")
|
||||
.as_str(),
|
||||
);
|
||||
assert_eq!(a.name, "p/C");
|
||||
assert_eq!(a.super_name.as_deref(), Some("java/lang/Thread"));
|
||||
assert_eq!(a.interfaces, ["java/lang/Runnable"]);
|
||||
assert!(a.refs.contains("javax/swing/JButton"), "{:?}", a.refs);
|
||||
assert!(!a.refs.iter().any(|r| r.starts_with("java/")), "{:?}", a.refs);
|
||||
// Private members and method bodies aren't API; constants have their own fingerprint.
|
||||
let b = compile(
|
||||
"package p;\nimport java.util.List;\npublic class C extends Thread implements Runnable {\n public static final String K = \"k\";\n @Deprecated public List<javax.swing.JButton> f;\n public Object g() { return \"x\"; }\n private long hidden2() { return 1; }\n}\nclass Z {}\n",
|
||||
);
|
||||
assert_eq!((a.api, a.constants), (b.api, b.constants));
|
||||
let c = compile(
|
||||
"package p;\nimport java.util.List;\npublic class C extends Thread implements Runnable {\n public static final String K = \"changed\";\n @Deprecated public List<javax.swing.JButton> f;\n public Object g() { return \"x\"; }\n}\nclass Z {}\n",
|
||||
);
|
||||
assert_eq!(a.api, c.api);
|
||||
assert_ne!(a.constants, c.constants);
|
||||
let d = compile(
|
||||
"package p;\nimport java.util.List;\npublic class C extends Thread implements Runnable {\n public static final String K = \"k\";\n @Deprecated public List<javax.swing.JLabel> f;\n public Object g() { return \"x\"; }\n}\nclass Z {}\n",
|
||||
);
|
||||
assert_ne!(a.api, d.api);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn follows_api_changes_through_the_log() {
|
||||
let mut state = SetState { generation: 1, ..Default::default() };
|
||||
state.log(2, ["a/A".to_owned()].into(), false);
|
||||
state.log(3, ["a/B".to_owned()].into(), false);
|
||||
assert_eq!(state.changes_since(3), Some(BTreeSet::new()));
|
||||
assert_eq!(state.changes_since(2), Some(["a/B".to_owned()].into()));
|
||||
assert_eq!(state.changes_since(1), Some(["a/A".to_owned(), "a/B".to_owned()].into()));
|
||||
// Unknown generations, and a log entry where everything changed, mean everything.
|
||||
assert_eq!(state.changes_since(0), None);
|
||||
state.log(4, BTreeSet::new(), true);
|
||||
assert_eq!(state.changes_since(3), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ant_patterns_match_like_maven() {
|
||||
assert!(ant_match("**/*.java", "a/b/C.java"));
|
||||
assert!(ant_match("**/*.java", "C.java"));
|
||||
assert!(ant_match("com/acme/**", "com/acme/x/Y.java"));
|
||||
assert!(!ant_match("com/acme/**", "com/other/Y.java"));
|
||||
assert!(ant_match("**/generated/", "x/generated/Y.java"));
|
||||
assert!(ant_match("**/*Test?.java", "a/FooTest1.java"));
|
||||
assert!(!ant_match("*.java", "a/B.java"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn javac_options_follow_the_compiler_configuration() {
|
||||
let set = SourceSet {
|
||||
output: PathBuf::from("/o"),
|
||||
compiler: Some(CompilerConfig {
|
||||
release: Some("17".into()),
|
||||
source: Some("1.8".into()),
|
||||
encoding: Some("UTF-8".into()),
|
||||
parameters: Some(true),
|
||||
debuglevel: Some("lines,vars".into()),
|
||||
proc: Some("none".into()),
|
||||
processor_path: Some(vec![PathBuf::from("/p.jar")]),
|
||||
annotation_processors: Some(vec!["a.P".into()]),
|
||||
compiler_args: vec!["-Xlint:unchecked".into()],
|
||||
compiler_arguments: [("Akey=v".to_owned(), None)].into(),
|
||||
show_warnings: Some(false),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let args = javac_options(&set, &[PathBuf::from("/lib.jar")], Path::new("/gen"), Some(21));
|
||||
let joined = args.join(" ");
|
||||
let separator = if cfg!(windows) { ";" } else { ":" };
|
||||
assert!(joined.starts_with(&format!("-d /o -classpath /o{separator}/lib.jar -sourcepath -s /gen")), "{joined}");
|
||||
for expected in [
|
||||
"-processorpath /p.jar",
|
||||
"-processor a.P",
|
||||
"-proc:none",
|
||||
"-g:lines,vars",
|
||||
"-parameters",
|
||||
"-nowarn",
|
||||
"-encoding UTF-8",
|
||||
"--release 17",
|
||||
"-Akey=v",
|
||||
] {
|
||||
assert!(joined.contains(expected), "{expected} in {joined}");
|
||||
}
|
||||
assert!(joined.ends_with("-Xlint:unchecked"), "{joined}");
|
||||
// JDK 8 has no --release: source and target instead.
|
||||
let old = javac_options(&set, &[], Path::new("/gen"), Some(8)).join(" ");
|
||||
assert!(old.contains("-source 1.8") && !old.contains("--release"), "{old}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn builds_gradle_projects_with_javac_and_only_what_changed() {
|
||||
let Some(f) = Fixture::gradle(&[
|
||||
(
|
||||
"lib/src/main/java/l/L.java",
|
||||
"package l;\npublic class L { public static String name() { return \"lib\"; } }\n",
|
||||
),
|
||||
(
|
||||
"app/src/main/java/a/A.java",
|
||||
"package a;\npublic class A { public static void main(String[] args) { System.out.println(l.L.name()); } }\n",
|
||||
),
|
||||
("app/src/main/resources/app.properties", "version=${version}\n"),
|
||||
("app/src/test/java/a/ATest.java", "package a;\npublic class ATest { String s = l.L.name(); }\n"),
|
||||
]) else {
|
||||
return;
|
||||
};
|
||||
let steps = f.steps_of_launch();
|
||||
assert_eq!(steps.len(), 3, "{steps:?}");
|
||||
assert!(steps[0].contains("openideaBuildModel"), "{steps:?}");
|
||||
assert!(steps[1].starts_with("javac lib (main"), "{steps:?}");
|
||||
assert!(steps[2].starts_with("javac app (main"), "{steps:?}");
|
||||
assert!(f.out("t.lib/classes/l/L.class").is_file());
|
||||
assert!(f.out("t.app/classes/a/A.class").is_file());
|
||||
assert_eq!(fs::read_to_string(f.out("t.app/classes/app.properties")).unwrap(), "version=1\n");
|
||||
// Gradle's own outputs stay untouched.
|
||||
assert!(!f.root.join("app/build/classes").exists());
|
||||
|
||||
let built = f.launch(false);
|
||||
assert!(built.class_paths.iter().any(|p| p.ends_with("t.lib/classes")), "{:?}", built.class_paths);
|
||||
assert!(!built.class_paths.iter().any(|p| p.extension().is_some_and(|e| e == "jar")), "{:?}", built.class_paths);
|
||||
assert_eq!(f.steps(), Vec::<String>::new(), "nothing changed");
|
||||
|
||||
f.write(
|
||||
"app/src/main/java/a/A.java",
|
||||
"package a;\npublic class A { public static void main(String[] args) { System.out.println(l.L.name() + 1); } }\n",
|
||||
);
|
||||
let steps = f.steps_of_launch();
|
||||
assert_eq!(steps.len(), 1, "{steps:?}");
|
||||
assert!(steps[0].starts_with("javac app (main"), "{steps:?}");
|
||||
|
||||
f.write("app/src/main/resources/app.properties", "version=${version}\nname=app\n");
|
||||
let steps = f.steps_of_launch();
|
||||
assert_eq!(steps.len(), 1, "{steps:?}");
|
||||
assert!(steps[0].contains(":app:processResources"), "{steps:?}");
|
||||
assert_eq!(fs::read_to_string(f.out("t.app/classes/app.properties")).unwrap(), "version=1\nname=app\n");
|
||||
|
||||
// Tests compile against the main classes.
|
||||
f.steps();
|
||||
let built = f.launch(true);
|
||||
assert_eq!(built.failure, None, "{:?}", built.messages);
|
||||
assert!(f.out("t.app/test-classes/a/ATest.class").is_file());
|
||||
|
||||
// A changed build script prepares again.
|
||||
f.write("lib/build.gradle", "// changed\n");
|
||||
let steps = f.steps_of_launch();
|
||||
assert!(steps[0].contains("openideaBuildModel"), "{steps:?}");
|
||||
|
||||
// An error is a javac diagnostic on the source.
|
||||
f.write("lib/src/main/java/l/L.java", "package l;\npublic class L { public static String name() { return 1; } }\n");
|
||||
let built = f.launch(false);
|
||||
assert!(built.failure.is_some());
|
||||
let error = built.messages.iter().find(|m| m.severity == Severity::Error).expect("an error");
|
||||
assert_eq!(error.path.as_deref(), Some(f.root.join("lib/src/main/java/l/L.java").as_path()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn leaves_gradle_projects_with_other_compilers_to_gradle() {
|
||||
let Some(f) = Fixture::gradle(&[
|
||||
("app/build.gradle", "apply plugin: 'groovy'\ndependencies { implementation project(':lib') }\n"),
|
||||
("app/src/main/java/a/A.java", "package a;\npublic class A {}\n"),
|
||||
]) else {
|
||||
return;
|
||||
};
|
||||
let jdk = |_: Option<u32>| None;
|
||||
let build = JavaBuild {
|
||||
root: &f.root,
|
||||
model: &f.model,
|
||||
cache: &f.cache,
|
||||
jar: Path::new(JAR),
|
||||
jar_version: "test",
|
||||
local_repo: None,
|
||||
service: &f.service,
|
||||
jdk: &jdk,
|
||||
};
|
||||
let target = Target::Launch { module: &f.root.join("app"), test: false };
|
||||
match build.build(target, BuildKind::Build, &CancellationToken::new(), &|_| {}) {
|
||||
Ok(Built::Unsupported(reason)) => assert!(reason.contains("GroovyCompile"), "{reason}"),
|
||||
Ok(Built::Done(outputs)) => panic!("built: {outputs:?}"),
|
||||
Err(e) => panic!("{e:?}"),
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ pub mod application_update;
|
||||
pub mod compile;
|
||||
pub mod gradle;
|
||||
mod gradle_deps;
|
||||
pub mod jbuild;
|
||||
pub mod kotlin_bridge;
|
||||
pub mod maven;
|
||||
pub mod pom_edit;
|
||||
|
||||
@@ -753,26 +753,7 @@ pub(crate) fn launch_inputs(
|
||||
projects: &[&MavenProject],
|
||||
local_repo: Option<PathBuf>,
|
||||
) -> Option<Vec<PathBuf>> {
|
||||
project_inputs(root, projects, local_repo, true)
|
||||
}
|
||||
|
||||
/// The POM chains (with imported BOMs) of `projects` and the files their profiles activate
|
||||
/// on: what Maven's model of them is built from, without their sources.
|
||||
pub(crate) fn model_inputs(
|
||||
root: &Path,
|
||||
projects: &[&MavenProject],
|
||||
local_repo: Option<PathBuf>,
|
||||
) -> Option<Vec<PathBuf>> {
|
||||
project_inputs(root, projects, local_repo, false)
|
||||
}
|
||||
|
||||
fn project_inputs(
|
||||
root: &Path,
|
||||
projects: &[&MavenProject],
|
||||
local_repo: Option<PathBuf>,
|
||||
sources: bool,
|
||||
) -> Option<Vec<PathBuf>> {
|
||||
fn roots(el: &Element, parent: &str, dir: &Path, sources: bool, out: &mut Vec<PathBuf>) -> Option<()> {
|
||||
fn roots(el: &Element, parent: &str, dir: &Path, out: &mut Vec<PathBuf>) -> Option<()> {
|
||||
let input =
|
||||
matches!(el.name.as_str(), "sourceDirectory" | "testSourceDirectory" | "sourceDir" | "testSourceDir")
|
||||
|| (matches!(parent, "sources" | "sourceDirs" | "testSources" | "testSourceDirs")
|
||||
@@ -781,7 +762,6 @@ fn project_inputs(
|
||||
|| (parent == "filters" && el.name == "filter");
|
||||
// Profile activation may depend on the presence of an otherwise unrelated file.
|
||||
let activation = parent == "file" && matches!(el.name.as_str(), "exists" | "missing");
|
||||
let input = input && sources;
|
||||
if input || activation {
|
||||
// A source root under Maven's build directory is generated by the build itself.
|
||||
// Skip it without resolving the property: `<build><directory>` may be custom, and
|
||||
@@ -807,7 +787,7 @@ fn project_inputs(
|
||||
}
|
||||
}
|
||||
for child in &el.children {
|
||||
roots(child, &el.name, dir, sources, out)?;
|
||||
roots(child, &el.name, dir, out)?;
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
@@ -816,9 +796,7 @@ fn project_inputs(
|
||||
for project in projects {
|
||||
let dir = root.join(&project.dir);
|
||||
// Include all conventional language/resource roots, including nonstandard files under src.
|
||||
if sources {
|
||||
out.push(dir.join("src"));
|
||||
}
|
||||
out.push(dir.join("src"));
|
||||
let pom = root.join(&project.pom);
|
||||
resolver.context(&pom, 0);
|
||||
let mut path = pom;
|
||||
@@ -830,7 +808,7 @@ fn project_inputs(
|
||||
}
|
||||
out.push(path.clone());
|
||||
let text = xml::read_text(&path)?;
|
||||
roots(&xml::parse(&text)?, "", &dir, sources, &mut out)?;
|
||||
roots(&xml::parse(&text)?, "", &dir, &mut out)?;
|
||||
let raw = resolver.pom(&path)?;
|
||||
let Some(parent) = raw.parent else { break };
|
||||
path = resolver.parent_path(path.parent()?, &parent)?;
|
||||
|
||||
@@ -118,8 +118,6 @@ pub struct Host {
|
||||
pub(crate) heap_windows: Mutex<HashMap<ide_heap::HeapSnapshotId, String>>,
|
||||
pub(crate) heap_requests: ops::heap::HeapRequests,
|
||||
pub(crate) rebase_editors: Arc<ops::vcs::RebaseEditors>,
|
||||
/// The IDE's Java build: resident javac processes shared by every window's launches.
|
||||
pub(crate) java_build: Arc<ide_build::jbuild::JavaBuildService>,
|
||||
/// SSH connections of Settings › SSH Configurations.
|
||||
pub ssh: Arc<ide_ssh::SshManager>,
|
||||
/// SFTP deployment, remote file editing and runs on run targets.
|
||||
@@ -146,31 +144,11 @@ pub struct Host {
|
||||
requests: requests::Requests,
|
||||
project_requests: RwLock<HashMap<String, Vec<RequestId>>>,
|
||||
/// Shutdowns of projects closed with [`Host::close_project_detached`].
|
||||
closing: parking_lot::Mutex<Vec<DetachedClose>>,
|
||||
closing: parking_lot::Mutex<Vec<std::thread::JoinHandle<()>>>,
|
||||
/// One open at a time per window (see [`Host::opening`]).
|
||||
open_locks: parking_lot::Mutex<HashMap<String, Arc<parking_lot::Mutex<()>>>>,
|
||||
}
|
||||
|
||||
struct DetachedClose {
|
||||
root: Option<std::path::PathBuf>,
|
||||
handle: std::thread::JoinHandle<()>,
|
||||
}
|
||||
|
||||
struct ShutdownWork {
|
||||
notebooks: Vec<Arc<notebook::NotebookService>>,
|
||||
bridges: Vec<Arc<kotlin_bridge::KotlinBridge>>,
|
||||
lsp: Option<Arc<ide_lsp::LspManager>>,
|
||||
debug: Option<(Arc<ide_dap::DebugManager>, String, Option<std::path::PathBuf>)>,
|
||||
agents: Vec<Arc<ide_agent::AgentManager>>,
|
||||
terminals: Option<ide_terminal::DetachedTerminals>,
|
||||
processes: Option<ide_run::DetachedProcessKills>,
|
||||
retired: Option<Arc<Project>>,
|
||||
}
|
||||
|
||||
fn roots_overlap(a: &std::path::Path, b: &std::path::Path) -> bool {
|
||||
a == b || a.starts_with(b) || b.starts_with(a)
|
||||
}
|
||||
|
||||
/// How long exit waits for project shutdown before giving up.
|
||||
const EXIT_SHUTDOWN_WAIT: std::time::Duration = std::time::Duration::from_secs(10);
|
||||
|
||||
@@ -249,7 +227,6 @@ impl Host {
|
||||
heap_windows: Mutex::default(),
|
||||
heap_requests: Default::default(),
|
||||
rebase_editors: Default::default(),
|
||||
java_build: Default::default(),
|
||||
languages,
|
||||
syntax,
|
||||
config_dir,
|
||||
@@ -356,7 +333,7 @@ impl Host {
|
||||
/// [`Self::close_project_detached`] there.
|
||||
pub fn close_project(&self, window: &str) {
|
||||
if let Some(shutdown) = self.begin_close(window) {
|
||||
self.wait_blocking(shutdown.handle);
|
||||
self.wait_blocking(shutdown);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,15 +343,15 @@ impl Host {
|
||||
pub fn close_project_detached(&self, window: &str) {
|
||||
if let Some(shutdown) = self.begin_close(window) {
|
||||
let mut closing = self.closing.lock();
|
||||
closing.retain(|entry| !entry.handle.is_finished());
|
||||
closing.retain(|handle| !handle.is_finished());
|
||||
closing.push(shutdown);
|
||||
}
|
||||
}
|
||||
|
||||
/// Detaches the project from `window` synchronously so the caller (including the UI
|
||||
/// event-loop thread) never blocks on disk I/O or process shutdown, and returns the
|
||||
/// background handle that stops its workers, agents, terminals and processes.
|
||||
fn begin_close(&self, window: &str) -> Option<DetachedClose> {
|
||||
/// Detaches the project from `window` and stops what it started, synchronously,
|
||||
/// so the window can open another project at once. Returns the thread that
|
||||
/// finishes shutting down its workers.
|
||||
fn begin_close(&self, window: &str) -> Option<std::thread::JoinHandle<()>> {
|
||||
self.mcp_reports.forget_window(window);
|
||||
self.mcp_requests.forget_window(window);
|
||||
self.mcp_agent_runs.forget_window(window);
|
||||
@@ -421,115 +398,78 @@ impl Host {
|
||||
phpstan.stop();
|
||||
}
|
||||
project.documents.clear_workspace_edit_history();
|
||||
project.agents.detach_sinks();
|
||||
project.agents.shutdown();
|
||||
project.flutter.stop();
|
||||
project.devtools.stop();
|
||||
project.widget_preview.stop();
|
||||
project.notebooks.stop_admission();
|
||||
// Detach runs and terminals synchronously so a new project opened in the same window
|
||||
// never collides with them, then terminate them and shut down agents on the background thread.
|
||||
let processes = self.processes.detach_project_kills(&project.root);
|
||||
let terminals = self.terminals.detach_key(self.owner_window(window));
|
||||
let root = (!project.light).then(|| project.root.clone());
|
||||
let handle = self.spawn_project_shutdown(ShutdownWork {
|
||||
notebooks: vec![project.notebooks.clone()],
|
||||
bridges: project.kotlin_bridge.iter().cloned().collect(),
|
||||
lsp: Some(project.lsp.clone()),
|
||||
// What the closing window started goes with it — the builds and searches it
|
||||
// asked for, its runs, its shells and its debug sessions — and its language
|
||||
// servers shut down.
|
||||
self.processes.kill_project(&project.root);
|
||||
self.terminals.kill_key(self.owner_window(window));
|
||||
Some(self.spawn_project_shutdown(
|
||||
vec![project.notebooks.clone()],
|
||||
project.kotlin_bridge.iter().cloned().collect(),
|
||||
Some(project.lsp.clone()),
|
||||
// Debug sessions under the root belong to windows: a project served without one starts none.
|
||||
debug: Some((self.debugger.clone(), window.to_owned(), (!background).then(|| project.root.clone()))),
|
||||
agents: vec![project.agents.clone()],
|
||||
terminals: Some(terminals),
|
||||
processes: Some(processes),
|
||||
retired: Some(project),
|
||||
});
|
||||
Some(DetachedClose { root, handle })
|
||||
Some((self.debugger.clone(), window.to_owned(), (!background).then(|| project.root.clone()))),
|
||||
Some(project),
|
||||
))
|
||||
}
|
||||
|
||||
/// Project/window destruction must finish owned kernel and agent cleanup, not enqueue
|
||||
/// Project/window destruction must finish owned kernel cleanup, not enqueue
|
||||
/// work which can be lost as the desktop runtime exits: the returned thread is
|
||||
/// joined by the closer or, for a detached close, before exit.
|
||||
fn spawn_project_shutdown(&self, work: ShutdownWork) -> std::thread::JoinHandle<()> {
|
||||
for bridge in &work.bridges {
|
||||
fn spawn_project_shutdown(
|
||||
&self,
|
||||
notebooks: Vec<Arc<notebook::NotebookService>>,
|
||||
bridges: Vec<Arc<kotlin_bridge::KotlinBridge>>,
|
||||
lsp: Option<Arc<ide_lsp::LspManager>>,
|
||||
debug: Option<(Arc<ide_dap::DebugManager>, String, Option<std::path::PathBuf>)>,
|
||||
retired: Option<Arc<Project>>,
|
||||
) -> std::thread::JoinHandle<()> {
|
||||
for bridge in &bridges {
|
||||
bridge.stop();
|
||||
}
|
||||
for service in &work.notebooks {
|
||||
for service in ¬ebooks {
|
||||
service.stop_admission();
|
||||
}
|
||||
let runtime = self.runtime.clone();
|
||||
std::thread::spawn(move || {
|
||||
if let Some(processes) = work.processes {
|
||||
processes.kill();
|
||||
}
|
||||
if let Some(terminals) = work.terminals {
|
||||
terminals.terminate();
|
||||
}
|
||||
let agents = (!work.agents.is_empty()).then(|| {
|
||||
let agents = work.agents;
|
||||
std::thread::spawn(move || {
|
||||
for manager in agents {
|
||||
manager.shutdown();
|
||||
}
|
||||
})
|
||||
});
|
||||
// Dropping the project stops its file watcher and index worker, which first finish the
|
||||
// batch they are applying (many file events while a build writes its output), so it
|
||||
// isn't done on the closing caller's thread (the UI thread for a window close).
|
||||
let retired = work.retired.map(|project| std::thread::spawn(move || drop(project)));
|
||||
let retired = retired.map(|project| std::thread::spawn(move || drop(project)));
|
||||
runtime.block_on(async move {
|
||||
for bridge in work.bridges {
|
||||
for bridge in bridges {
|
||||
bridge.shutdown().await;
|
||||
}
|
||||
for service in work.notebooks {
|
||||
for service in notebooks {
|
||||
service.shutdown().await;
|
||||
}
|
||||
if let Some(lsp) = work.lsp {
|
||||
if let Some(lsp) = lsp {
|
||||
lsp.shutdown_all().await;
|
||||
}
|
||||
if let Some((debug, key, root)) = work.debug {
|
||||
if let Some((debug, key, root)) = debug {
|
||||
debug.stop_key(&key).await;
|
||||
if let Some(root) = root {
|
||||
debug.stop_under(&root).await;
|
||||
}
|
||||
}
|
||||
});
|
||||
if let Some(agents) = agents {
|
||||
let _ = agents.join();
|
||||
}
|
||||
if let Some(retired) = retired {
|
||||
let _ = retired.join();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Waits for every detached close to finish.
|
||||
#[cfg(test)]
|
||||
/// Waits for detached closes, so a project opened next never races the
|
||||
/// language servers of one still shutting down (e.g. over a shared workspace).
|
||||
pub(crate) fn wait_detached_closes(&self) {
|
||||
let pending: Vec<_> = self.closing.lock().drain(..).collect();
|
||||
for shutdown in pending {
|
||||
self.wait_blocking(shutdown.handle);
|
||||
}
|
||||
}
|
||||
|
||||
/// Waits only for detached closes whose root overlaps `root`, so opening an unrelated project
|
||||
/// never blocks on another project's background shutdown.
|
||||
pub(crate) fn wait_detached_closes_for(&self, root: &std::path::Path) {
|
||||
let matching = {
|
||||
let mut closing = self.closing.lock();
|
||||
closing.retain(|entry| !entry.handle.is_finished());
|
||||
let mut wait = Vec::new();
|
||||
let mut keep = Vec::new();
|
||||
for entry in closing.drain(..) {
|
||||
if entry.root.as_deref().is_some_and(|other| roots_overlap(other, root)) {
|
||||
wait.push(entry.handle);
|
||||
} else {
|
||||
keep.push(entry);
|
||||
}
|
||||
}
|
||||
*closing = keep;
|
||||
wait
|
||||
};
|
||||
for handle in matching {
|
||||
self.wait_blocking(handle);
|
||||
self.wait_blocking(shutdown);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,23 +495,18 @@ impl Host {
|
||||
|
||||
/// Called before the desktop runtime exits, including update/restart exits, on
|
||||
/// the event-loop thread: waits for detached closes and the open projects'
|
||||
/// kernels and agents, but no longer than [`EXIT_SHUTDOWN_WAIT`], so a runtime worker
|
||||
/// kernels, but no longer than [`EXIT_SHUTDOWN_WAIT`], so a runtime worker
|
||||
/// stuck on the event loop cannot keep the process from exiting.
|
||||
pub fn shutdown_notebooks_on_exit(&self) {
|
||||
let projects = self.projects();
|
||||
let mut pending: Vec<_> = self.closing.lock().drain(..).map(|entry| entry.handle).collect();
|
||||
if !projects.is_empty() {
|
||||
pending.push(self.spawn_project_shutdown(ShutdownWork {
|
||||
notebooks: projects.iter().map(|project| project.notebooks.clone()).collect(),
|
||||
bridges: projects.iter().filter_map(|project| project.kotlin_bridge.clone()).collect(),
|
||||
lsp: None,
|
||||
debug: None,
|
||||
agents: projects.iter().map(|project| project.agents.clone()).collect(),
|
||||
terminals: None,
|
||||
processes: None,
|
||||
retired: None,
|
||||
}));
|
||||
}
|
||||
let mut pending: Vec<_> = self.closing.lock().drain(..).collect();
|
||||
pending.push(self.spawn_project_shutdown(
|
||||
projects.iter().map(|project| project.notebooks.clone()).collect(),
|
||||
projects.iter().filter_map(|project| project.kotlin_bridge.clone()).collect(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
));
|
||||
let deadline = std::time::Instant::now() + EXIT_SHUTDOWN_WAIT;
|
||||
while pending.iter().any(|handle| !handle.is_finished()) {
|
||||
if std::time::Instant::now() >= deadline {
|
||||
|
||||
@@ -513,7 +513,6 @@ async fn resolve_jvm_application(
|
||||
call.window(),
|
||||
std::path::PathBuf::from(&module),
|
||||
test == Some(true),
|
||||
false,
|
||||
policy,
|
||||
&cancel,
|
||||
None,
|
||||
|
||||
@@ -9,7 +9,6 @@ use crate::{Host, Project};
|
||||
use ide_command::command;
|
||||
|
||||
use ide_build::compile::{self, BuildEvent, BuildKind, BuildResult};
|
||||
use ide_build::jbuild::Target;
|
||||
use ide_build::maven::completion::{PomCompletion, PomCompletionOption};
|
||||
use ide_build::maven::sources;
|
||||
use ide_build::maven::{PomGoto, PomManagedDeclaration, PomNavigationOptions};
|
||||
@@ -976,38 +975,11 @@ pub async fn build_run(
|
||||
let config_dir = host.config_dir.clone();
|
||||
let token = host.begin_project_request(window, request);
|
||||
let launch_project = project.clone();
|
||||
let (service, data_dir) = (host.java_build.clone(), host.local_data_dir.clone());
|
||||
let result = blocking(move || {
|
||||
let single = cmake.is_none() && ide_workspace::workspace::Workspace::load(&root)?.is_none();
|
||||
// A Maven or Gradle project builds with the IDE's Java build (#4078), unless its
|
||||
// settings ask for the build tool, or it can't.
|
||||
if single {
|
||||
let model = with_profiles(load(&root, &cache, &settings), &cache);
|
||||
let served = match file.as_deref() {
|
||||
Some(module) => super::java::served_by_service(&root, &model, &settings, module),
|
||||
None => super::java::project_served_by_service(&model, &settings),
|
||||
};
|
||||
if served {
|
||||
let service = super::java::ServiceBuild {
|
||||
service: &service,
|
||||
data_dir: &data_dir,
|
||||
root: &root,
|
||||
cache: &cache,
|
||||
settings: &settings,
|
||||
model: &model,
|
||||
};
|
||||
let target = match file.as_deref() {
|
||||
Some(file) => Target::Module(file),
|
||||
None => Target::Project,
|
||||
};
|
||||
if let Some(result) = service_build_result(&service, target, kind, &clear, &sink, &token, &on_event)? {
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fast path (#2476): an unchanged single-project Maven build skips
|
||||
// Maven entirely. Previous diagnostics stay: nothing changed, so they
|
||||
// are still accurate.
|
||||
let single = cmake.is_none() && ide_workspace::workspace::Workspace::load(&root)?.is_none();
|
||||
if single && kind == BuildKind::Build {
|
||||
let model = with_profiles(load(&root, &cache, &settings), &cache);
|
||||
if compile::menu_up_to_date(&cache, &root, &model, file.as_deref(), &token) {
|
||||
@@ -1130,59 +1102,13 @@ pub async fn build_run(
|
||||
let outcome = result?;
|
||||
// Maven generated sources (protobuf, gRPC) stay invisible to jdtls until the
|
||||
// folders the build wrote are attached. An up-to-date build skips Maven and
|
||||
// still needs this: the classes can already be on disk. The IDE's Java build
|
||||
// generates them with Maven too.
|
||||
if matches!(outcome.system, ide_build::compile::BuildSystem::Maven | ide_build::compile::BuildSystem::Javac) {
|
||||
// still needs this: the classes can already be on disk.
|
||||
if outcome.system == ide_build::compile::BuildSystem::Maven {
|
||||
project.lsp.sync_maven_generated_sources(&project.root).await;
|
||||
}
|
||||
Ok(outcome)
|
||||
}
|
||||
|
||||
/// A menu build by the IDE's Java build, as the Build window shows it; `None` when Maven builds.
|
||||
/// Diagnostics of `clear` are cleared once the service builds; its messages are published.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn service_build_result(
|
||||
service: &super::java::ServiceBuild,
|
||||
target: Target,
|
||||
kind: BuildKind,
|
||||
clear: &[std::path::PathBuf],
|
||||
sink: &ide_core::SharedSink,
|
||||
token: &CancellationToken,
|
||||
on_event: &Channel<BuildEvent>,
|
||||
) -> IdeResult<Option<BuildResult>> {
|
||||
let started = std::time::Instant::now();
|
||||
let title = std::sync::Mutex::new(String::new());
|
||||
let forward = |event: BuildEvent| {
|
||||
if let BuildEvent::Started { title: t, .. } = &event {
|
||||
*title.lock().unwrap() = t.clone();
|
||||
}
|
||||
let _ = on_event.send(event);
|
||||
};
|
||||
let built = service.build(target, kind, token, &forward)?;
|
||||
let Some(outputs) = built else { return Ok(None) };
|
||||
for path in clear {
|
||||
sink.emit(IdeEvent::Diagnostics {
|
||||
path: path.clone().into(),
|
||||
source: compile::DIAGNOSTICS_SOURCE.into(),
|
||||
items: Vec::new(),
|
||||
});
|
||||
}
|
||||
for (path, items) in compile::diagnostics(&outputs.messages) {
|
||||
sink.emit(IdeEvent::Diagnostics { path: path.into(), source: compile::DIAGNOSTICS_SOURCE.into(), items });
|
||||
}
|
||||
let count =
|
||||
|severity: ide_core::Severity| outputs.messages.iter().filter(|m| m.severity == severity).count() as u32;
|
||||
Ok(Some(BuildResult {
|
||||
system: compile::BuildSystem::Javac,
|
||||
title: title.into_inner().unwrap(),
|
||||
success: outputs.failure.is_none(),
|
||||
errors: count(ide_core::Severity::Error),
|
||||
warnings: count(ide_core::Severity::Warning),
|
||||
duration_ms: started.elapsed().as_secs_f64() * 1000.0,
|
||||
messages: outputs.messages,
|
||||
}))
|
||||
}
|
||||
|
||||
fn plan_compile_file(
|
||||
root: &Path,
|
||||
cache: &Path,
|
||||
@@ -1241,26 +1167,7 @@ pub async fn build_compile_file(
|
||||
};
|
||||
let sink = project.sink.clone();
|
||||
let token = host.begin_project_request(window, request);
|
||||
let (service, data_dir) = (host.java_build.clone(), host.local_data_dir.clone());
|
||||
let result = blocking(move || {
|
||||
{
|
||||
let model = with_profiles(load(&scope.root, &scope.cache, &scope.settings), &scope.cache);
|
||||
if super::java::served_by_service(&scope.root, &model, &scope.settings, &file) {
|
||||
let service = super::java::ServiceBuild {
|
||||
service: &service,
|
||||
data_dir: &data_dir,
|
||||
root: &scope.root,
|
||||
cache: &scope.cache,
|
||||
settings: &scope.settings,
|
||||
model: &model,
|
||||
};
|
||||
let target = Target::File(&file);
|
||||
let kind = BuildKind::Build;
|
||||
if let Some(result) = service_build_result(&service, target, kind, &clear, &sink, &token, &on_event)? {
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
for path in clear {
|
||||
sink.emit(IdeEvent::Diagnostics {
|
||||
path: path.into(),
|
||||
@@ -1283,7 +1190,7 @@ pub async fn build_compile_file(
|
||||
.await;
|
||||
host.end_request(request);
|
||||
let outcome = result?;
|
||||
if matches!(outcome.system, ide_build::compile::BuildSystem::Maven | ide_build::compile::BuildSystem::Javac) {
|
||||
if outcome.system == ide_build::compile::BuildSystem::Maven {
|
||||
project.lsp.sync_maven_generated_sources(&scope_root).await;
|
||||
}
|
||||
Ok(outcome)
|
||||
|
||||
@@ -9,7 +9,6 @@ use super::build::{load, with_profiles, workspace};
|
||||
use cache::LaunchEvents;
|
||||
use ide_build::BuildModel;
|
||||
use ide_build::compile::{self, BuildEvent};
|
||||
use ide_build::jbuild::{Built, JavaBuild, JavaBuildService, LaunchOutputs, Target};
|
||||
use ide_core::error::ErrorKind;
|
||||
use ide_core::settings::Settings;
|
||||
use ide_core::{CancellationToken, IdeError, IdeResult, RequestId};
|
||||
@@ -23,16 +22,12 @@ use std::path::{Path, PathBuf};
|
||||
/// A module with Kotlin / Groovy / Scala sources is built by its build system, whose class directories come first.
|
||||
/// The build streams its console, messages and progress on `on_event` while it runs; a launch
|
||||
/// whose build another launch's build joins receives that build's events.
|
||||
/// A Maven module is built by the IDE's Java build, except for a `debug` launch the language
|
||||
/// server serves: java-debug's HotSwap reloads the classes the language server compiles.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[command(trust = trusted)]
|
||||
pub async fn java_resolve_launch(
|
||||
host: &Host,
|
||||
window: &str,
|
||||
module: PathBuf,
|
||||
test: bool,
|
||||
debug: bool,
|
||||
policy: BuildPolicy,
|
||||
request: RequestId,
|
||||
on_event: Channel<BuildEvent>,
|
||||
@@ -44,18 +39,16 @@ pub async fn java_resolve_launch(
|
||||
let events: LaunchEvents = std::sync::Arc::new(move |event| {
|
||||
let _ = on_event.send(event);
|
||||
});
|
||||
let result = resolve_launch(host, window, module, test, debug, policy, &cancel, Some(events)).await;
|
||||
let result = resolve_launch(host, window, module, test, policy, &cancel, Some(events)).await;
|
||||
host.end_request(request);
|
||||
result
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) async fn resolve_launch(
|
||||
host: &Host,
|
||||
window: &str,
|
||||
module: PathBuf,
|
||||
test: bool,
|
||||
debug: bool,
|
||||
policy: BuildPolicy,
|
||||
cancel: &CancellationToken,
|
||||
events: Option<LaunchEvents>,
|
||||
@@ -80,12 +73,13 @@ pub(crate) async fn resolve_launch(
|
||||
}
|
||||
let scope = std::sync::Arc::new(scope);
|
||||
let launches = project.java_launches.for_cache(&scope.cache);
|
||||
let waiting = launches.waiting.add(module.clone(), test, policy, events.clone());
|
||||
let prefer_maven = scope.settings.languages.java.maven.delegate_build;
|
||||
// A launch builds incrementally unless the configuration asks for Rebuild or NoBuild.
|
||||
let build = policy != BuildPolicy::NoBuild;
|
||||
let full = policy == BuildPolicy::Rebuild;
|
||||
let build_kind = if full { compile::BuildKind::Rebuild } else { compile::BuildKind::Build };
|
||||
let (model, external, mut delegated, is_maven, non_java, served) = {
|
||||
let (model, external, mut delegated, is_maven) = {
|
||||
let scope = scope.clone();
|
||||
let launches = launches.clone();
|
||||
let module = module.clone();
|
||||
@@ -95,7 +89,6 @@ pub(crate) async fn resolve_launch(
|
||||
let model = load_launch_model(&scope);
|
||||
let non_java = build && compile::launch_has_non_java_sources(root, &model, &module, test);
|
||||
let is_maven = is_maven_module(root, &model, &module);
|
||||
let served = served_by_service(root, &model, &scope.settings, &module);
|
||||
let delegated = build
|
||||
&& delegates_to_external_build(
|
||||
is_maven,
|
||||
@@ -105,65 +98,11 @@ pub(crate) async fn resolve_launch(
|
||||
prefer_maven,
|
||||
);
|
||||
let external = non_java || delegated;
|
||||
(std::sync::Arc::new(model), external, delegated, is_maven, non_java, served)
|
||||
(model, external, delegated, is_maven)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| IdeError::internal(e.to_string()))?
|
||||
};
|
||||
// A Maven or Gradle module is built by the IDE's Java build ([`served_by_service`]), unless
|
||||
// the launch debugs with java-debug, whose HotSwap reloads what jdtls compiles (ecj's
|
||||
// classes differ from javac's: lambda names). jdtls keeps building for its diagnostics
|
||||
// either way.
|
||||
if served && !non_java && !debug {
|
||||
let built = {
|
||||
let (service, data_dir, scope, model, module, cancel, events) = (
|
||||
host.java_build.clone(),
|
||||
host.local_data_dir.clone(),
|
||||
scope.clone(),
|
||||
model.clone(),
|
||||
module.clone(),
|
||||
cancel.clone(),
|
||||
events.clone(),
|
||||
);
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let on_event = |event: BuildEvent| {
|
||||
if let Some(events) = &events {
|
||||
events(event);
|
||||
}
|
||||
};
|
||||
let kind = build.then_some(build_kind);
|
||||
build_with_service(&service, &data_dir, &scope, &model, &module, test, kind, &cancel, &on_event)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| IdeError::internal(e.to_string()))??
|
||||
};
|
||||
if let Some(outputs) = built {
|
||||
progress("Resolving the classpath");
|
||||
let mut info = project.lsp.java_launch(&module, test, false, false, false, cancel).await?;
|
||||
let data_dir = host.local_data_dir.clone();
|
||||
let cancel = cancel.clone();
|
||||
return tokio::task::spawn_blocking(move || {
|
||||
// javac's verdict replaces JDT's, as a Maven build's does.
|
||||
if build {
|
||||
apply_external_build_result(&mut info, outputs.failure, true);
|
||||
}
|
||||
info.class_paths = outputs.class_paths.iter().map(|p| p.to_string_lossy().into_owned()).collect();
|
||||
apply_library_classpath(&mut info, &scope.root, &scope.settings.project_structure.libraries, test);
|
||||
finish_launch(&mut info, &scope.root, &module, &scope.settings, &model, &data_dir);
|
||||
if cancel.is_cancelled() {
|
||||
return Err(IdeError::cancelled());
|
||||
}
|
||||
tracing::info!(
|
||||
total_ms = started.elapsed().as_millis(),
|
||||
"Java launch resolved with the IDE's Java build"
|
||||
);
|
||||
Ok(info)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| IdeError::internal(e.to_string()))?;
|
||||
}
|
||||
}
|
||||
let waiting = launches.waiting.add(module.clone(), test, policy, events.clone());
|
||||
let mut external_build =
|
||||
if delegated { Some(project.lsp.java_external_build(&module, cancel).await?) } else { None };
|
||||
if build && !delegated {
|
||||
@@ -185,6 +124,7 @@ pub(crate) async fn resolve_launch(
|
||||
drop_processor_recreate_errors(&mut info);
|
||||
}
|
||||
}
|
||||
let model = std::sync::Arc::new(model);
|
||||
let members = if delegated {
|
||||
build_members(&project, &scope, &model, &module, test, &waiting, cancel).await?
|
||||
} else {
|
||||
@@ -277,104 +217,6 @@ pub(crate) async fn resolve_launch(
|
||||
.map_err(|e| IdeError::internal(e.to_string()))?
|
||||
}
|
||||
|
||||
/// Builds the launch of a Maven module with the IDE's Java build (#4078): javac in a resident
|
||||
/// process with the configuration Maven gives the compiler, into outputs in the project cache
|
||||
/// that neither the language server nor a terminal `mvn` writes. `None` when the module needs
|
||||
/// Maven's own build (another compiler, a multi-release jar, a Java module…), which then runs.
|
||||
/// Without `kind` (no build before launch), the outputs of its last build, if any.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn build_with_service(
|
||||
service: &JavaBuildService,
|
||||
data_dir: &Path,
|
||||
scope: &workspace::Scope,
|
||||
model: &BuildModel,
|
||||
module: &Path,
|
||||
test: bool,
|
||||
kind: Option<compile::BuildKind>,
|
||||
cancel: &CancellationToken,
|
||||
on_event: &(dyn Fn(BuildEvent) + Sync),
|
||||
) -> IdeResult<Option<LaunchOutputs>> {
|
||||
let service =
|
||||
ServiceBuild { service, data_dir, root: &scope.root, cache: &scope.cache, settings: &scope.settings, model };
|
||||
match kind {
|
||||
Some(kind) => service.build(Target::Launch { module, test }, kind, cancel, on_event),
|
||||
// No build: the outputs of the last one, when there was one.
|
||||
None => Ok(service
|
||||
.with(module, |build| build.recorded_launch(module, test))
|
||||
.flatten()
|
||||
.map(|class_paths| LaunchOutputs { class_paths, ..Default::default() })),
|
||||
}
|
||||
}
|
||||
|
||||
/// A build of the IDE's Java build service in one project (or workspace member).
|
||||
pub(crate) struct ServiceBuild<'a> {
|
||||
pub service: &'a JavaBuildService,
|
||||
pub data_dir: &'a Path,
|
||||
pub root: &'a Path,
|
||||
pub cache: &'a Path,
|
||||
pub settings: &'a Settings,
|
||||
pub model: &'a BuildModel,
|
||||
}
|
||||
|
||||
impl ServiceBuild<'_> {
|
||||
/// Runs `f` with the build, its JDKs resolved for `module`; `None` when the build jar
|
||||
/// can't be installed.
|
||||
fn with<R>(&self, module: &Path, f: impl FnOnce(&JavaBuild) -> R) -> Option<R> {
|
||||
let jar = ide_sdk::java::java_build_jar(self.data_dir)?;
|
||||
let (root, settings) = (self.root, self.settings);
|
||||
let jdk = |release: Option<u32>| {
|
||||
ide_sdk::apply::module_jdk(root, module, settings)
|
||||
.or_else(|| ide_sdk::java::pick_jdk(&ide_sdk::java::installed_jdks(), release).cloned())
|
||||
.map(|jdk| jdk.home)
|
||||
};
|
||||
let version = ide_sdk::java::java_build_version();
|
||||
let build = JavaBuild {
|
||||
root,
|
||||
model: self.model,
|
||||
cache: self.cache,
|
||||
jar: &jar,
|
||||
jar_version: &version,
|
||||
local_repo: ide_sdk::apply::maven_local_repository(root, settings),
|
||||
service: self.service,
|
||||
jdk: &jdk,
|
||||
};
|
||||
Some(f(&build))
|
||||
}
|
||||
|
||||
/// Builds `target`; `None` when the build tool has to (the service doesn't build it, or failed).
|
||||
pub fn build(
|
||||
&self,
|
||||
target: Target,
|
||||
kind: compile::BuildKind,
|
||||
cancel: &CancellationToken,
|
||||
on_event: &(dyn Fn(BuildEvent) + Sync),
|
||||
) -> IdeResult<Option<LaunchOutputs>> {
|
||||
let module = match target {
|
||||
Target::Launch { module, .. } | Target::Module(module) | Target::File(module) => module,
|
||||
Target::Project => self.root,
|
||||
};
|
||||
let Some(built) = self.with(module, |build| build.build(target, kind, cancel, on_event)) else {
|
||||
return Ok(None);
|
||||
};
|
||||
match built {
|
||||
Ok(Built::Done(outputs)) => Ok(Some(outputs)),
|
||||
Ok(Built::Unsupported(reason)) => {
|
||||
tracing::info!(module = %module.display(), reason, "Building with the build tool");
|
||||
Ok(None)
|
||||
}
|
||||
Err(e) if e.kind == ErrorKind::Cancelled => Err(e),
|
||||
Err(e) => {
|
||||
tracing::warn!(module = %module.display(), "The IDE's Java build failed: {}", e.message);
|
||||
on_event(BuildEvent::Output {
|
||||
text: format!("The IDE's Java build failed, so the build tool builds it: {}\n", e.message),
|
||||
stderr: true,
|
||||
});
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn load_launch_model(scope: &workspace::Scope) -> BuildModel {
|
||||
with_profiles(load(&scope.root, &scope.cache, &scope.settings), &scope.cache)
|
||||
}
|
||||
@@ -383,39 +225,6 @@ fn is_maven_module(root: &Path, model: &BuildModel, module: &Path) -> bool {
|
||||
model.maven.as_ref().is_some_and(|m| m.projects.iter().any(|p| root.join(&p.dir) == module))
|
||||
}
|
||||
|
||||
/// Whether the IDE's Java build builds the module holding `path` (#4078): a Maven module unless
|
||||
/// Settings › Maven › Delegate IDE build/run actions to Maven asks for Maven; a Gradle module
|
||||
/// when Settings › Gradle › Build and run using asks for the IDE.
|
||||
pub(crate) fn served_by_service(root: &Path, model: &BuildModel, settings: &Settings, path: &Path) -> bool {
|
||||
let maven = model.maven.iter().flat_map(|m| m.projects.iter().map(|p| (root.join(&p.dir), true)));
|
||||
let gradle = model.gradle.iter().flat_map(|g| g.projects.iter().map(|p| (root.join(&p.dir), false)));
|
||||
// The deepest module holding it; Maven's when both build the folder.
|
||||
let module = maven
|
||||
.chain(gradle)
|
||||
.filter(|(dir, _)| path.starts_with(dir))
|
||||
.max_by_key(|(dir, maven)| (dir.components().count(), *maven));
|
||||
match module {
|
||||
Some((_, true)) => !settings.languages.java.maven.delegate_build,
|
||||
Some((_, false)) => gradle_served(settings),
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the IDE's Java build builds the whole project: it has Maven or Gradle builds, and
|
||||
/// builds them all.
|
||||
pub(crate) fn project_served_by_service(model: &BuildModel, settings: &Settings) -> bool {
|
||||
let maven = model.maven.as_ref().map(|_| !settings.languages.java.maven.delegate_build);
|
||||
let gradle = (!model.gradle.is_empty()).then(|| gradle_served(settings));
|
||||
match (maven, gradle) {
|
||||
(None, None) => false,
|
||||
(maven, gradle) => maven.unwrap_or(true) && gradle.unwrap_or(true),
|
||||
}
|
||||
}
|
||||
|
||||
fn gradle_served(settings: &Settings) -> bool {
|
||||
settings.languages.java.gradle.run_using == ide_core::settings::GradleRunUsing::Ide
|
||||
}
|
||||
|
||||
/// A launch of a module jdtls doesn't serve (another Java language server, or none): the
|
||||
/// build tool compiles it, and the classpath comes from that server, else from Maven.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
@@ -432,9 +241,8 @@ async fn resolve_launch_without_jdtls(
|
||||
let started = std::time::Instant::now();
|
||||
let scope = std::sync::Arc::new(scope);
|
||||
let kind = if policy == BuildPolicy::Rebuild { compile::BuildKind::Rebuild } else { compile::BuildKind::Build };
|
||||
let (model, built, by_service) = {
|
||||
let (model, built) = {
|
||||
let (scope, module, cancel, events) = (scope.clone(), module.clone(), cancel.clone(), events.clone());
|
||||
let (service, data_dir) = (host.java_build.clone(), host.local_data_dir.clone());
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let model = load_launch_model(&scope);
|
||||
let on_event = |event: BuildEvent| {
|
||||
@@ -442,33 +250,12 @@ async fn resolve_launch_without_jdtls(
|
||||
events(event);
|
||||
}
|
||||
};
|
||||
if policy == BuildPolicy::NoBuild {
|
||||
return (model, None, false);
|
||||
}
|
||||
if served_by_service(&scope.root, &model, &scope.settings, &module)
|
||||
&& !compile::launch_has_non_java_sources(&scope.root, &model, &module, test)
|
||||
{
|
||||
match build_with_service(
|
||||
&service,
|
||||
&data_dir,
|
||||
&scope,
|
||||
&model,
|
||||
&module,
|
||||
test,
|
||||
Some(kind),
|
||||
&cancel,
|
||||
&on_event,
|
||||
) {
|
||||
Ok(Some(outputs)) => {
|
||||
let built = compile::LaunchBuild { class_dirs: outputs.class_paths, failure: outputs.failure };
|
||||
return (model, Some(Ok(built)), true);
|
||||
}
|
||||
Ok(None) => {}
|
||||
Err(e) => return (model, Some(Err(e)), false),
|
||||
}
|
||||
}
|
||||
let built = compile::build_for_launch(&scope.root, &model, &module, test, kind, &cancel, &on_event);
|
||||
(model, Some(built), false)
|
||||
let built = if policy == BuildPolicy::NoBuild {
|
||||
None
|
||||
} else {
|
||||
Some(compile::build_for_launch(&scope.root, &model, &module, test, kind, &cancel, &on_event))
|
||||
};
|
||||
(model, built)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| IdeError::internal(e.to_string()))?
|
||||
@@ -507,12 +294,6 @@ async fn resolve_launch_without_jdtls(
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let (root, cache, settings) = (&scope.root, &scope.cache, &scope.settings);
|
||||
match from_server {
|
||||
// The IDE's Java build gave the whole classpath; the server adds its JDK.
|
||||
Some(server) if by_service => {
|
||||
info.project_root = server.classpath.project_root;
|
||||
info.java_home = server.jdk_home.map(Into::into);
|
||||
}
|
||||
None if by_service => {}
|
||||
Some(server) => {
|
||||
info.project_root = server.classpath.project_root;
|
||||
info.module_paths = server.classpath.module_paths;
|
||||
|
||||
@@ -125,8 +125,8 @@ impl Host {
|
||||
// A window takes the root over from the MCP server's background project, whose
|
||||
// shutdown the wait below sits out; none opens until this open is over.
|
||||
let _claim = (!crate::mcp::BackgroundProjects::is_key(window)).then(|| self.mcp_background.claim(self, &root));
|
||||
self.close_project_detached(window);
|
||||
self.wait_detached_closes_for(&root);
|
||||
self.close_project(window);
|
||||
self.wait_detached_closes();
|
||||
let sink: SharedSink = (self.sink_for)(window);
|
||||
// Before anything the project starts: its children get the project's environment.
|
||||
let trusted = Arc::new(AtomicBool::new(self.trust.window_trusted(&root)?));
|
||||
@@ -867,10 +867,8 @@ impl Host {
|
||||
}
|
||||
return Ok(current);
|
||||
}
|
||||
self.close_project_detached(window);
|
||||
if let Some(dir) = watch_dir {
|
||||
self.wait_detached_closes_for(dir);
|
||||
}
|
||||
self.close_project(window);
|
||||
self.wait_detached_closes();
|
||||
let sink: SharedSink = (self.sink_for)(window);
|
||||
let settings = Arc::new(SettingsStore::load(&self.config_dir, None));
|
||||
let effective = settings.effective();
|
||||
|
||||
@@ -1,215 +0,0 @@
|
||||
mod common;
|
||||
|
||||
use ide_build::compile::BuildEvent;
|
||||
use ide_core::RequestId;
|
||||
use ide_host::{Host, ops};
|
||||
use ide_run::BuildPolicy;
|
||||
use ide_workspace::{SettingsStore, settings::SettingsScope};
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
fn write(root: &Path, rel: &str, text: &str) {
|
||||
let path = root.join(rel);
|
||||
fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
fs::write(path, text).unwrap();
|
||||
}
|
||||
|
||||
/// A Maven launch compiles with the IDE's Java build (javac, outputs in the project cache)
|
||||
/// and runs from its outputs. Needs `mvn` and a JDK (`JAVA_HOME`), else it is skipped.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn maven_launch_compiles_with_the_ides_java_build() {
|
||||
let has_jdk = std::env::var_os("JAVA_HOME").is_some_and(|h| Path::new(&h).join("bin").is_dir());
|
||||
if !has_jdk || ide_core::process::find_executable("mvn", &ide_core::tool_path::search_path()).is_none() {
|
||||
eprintln!("skipped: needs JAVA_HOME and mvn");
|
||||
return;
|
||||
}
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let base = dunce::canonicalize(temp.path()).unwrap();
|
||||
let root = base.join("project");
|
||||
write(
|
||||
&root,
|
||||
"pom.xml",
|
||||
r#"<project><modelVersion>4.0.0</modelVersion><groupId>t</groupId><artifactId>root</artifactId><version>1</version><packaging>pom</packaging>
|
||||
<modules><module>lib</module><module>app</module></modules>
|
||||
<properties><maven.compiler.release>11</maven.compiler.release><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties></project>"#,
|
||||
);
|
||||
write(
|
||||
&root,
|
||||
"lib/pom.xml",
|
||||
r#"<project><modelVersion>4.0.0</modelVersion><parent><groupId>t</groupId><artifactId>root</artifactId><version>1</version></parent><artifactId>lib</artifactId></project>"#,
|
||||
);
|
||||
write(
|
||||
&root,
|
||||
"app/pom.xml",
|
||||
r#"<project><modelVersion>4.0.0</modelVersion><parent><groupId>t</groupId><artifactId>root</artifactId><version>1</version></parent><artifactId>app</artifactId>
|
||||
<dependencies><dependency><groupId>t</groupId><artifactId>lib</artifactId><version>1</version></dependency></dependencies></project>"#,
|
||||
);
|
||||
write(
|
||||
&root,
|
||||
"lib/src/main/java/l/L.java",
|
||||
"package l;\npublic class L { public static String name() { return \"lib\"; } }\n",
|
||||
);
|
||||
write(
|
||||
&root,
|
||||
"app/src/main/java/a/A.java",
|
||||
"package a;\npublic class A { public static void main(String[] args) { System.out.println(l.L.name()); } }\n",
|
||||
);
|
||||
// No language server: the build tool compiles the launch.
|
||||
let global = SettingsStore::load(&base.join("config"), None);
|
||||
for server in ["jdtls", "java-analyzer", "kmp-lsp"] {
|
||||
global
|
||||
.set(SettingsScope::Global, &format!("languageServers.{server}.enabled"), serde_json::json!(false))
|
||||
.unwrap();
|
||||
}
|
||||
let host = Host::new(common::host_config(&base));
|
||||
host.trust.decide(&root, true, false).unwrap();
|
||||
host.open_project("main", &root).unwrap();
|
||||
|
||||
let events = Arc::new(Mutex::new(Vec::new()));
|
||||
let sink = events.clone();
|
||||
let channel = ops::Channel::new(move |event: BuildEvent| sink.lock().unwrap().push(event));
|
||||
let info = ops::java::java_resolve_launch(
|
||||
&host,
|
||||
"main",
|
||||
root.join("app"),
|
||||
false,
|
||||
false,
|
||||
BuildPolicy::Make,
|
||||
RequestId::next(),
|
||||
channel,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let steps: Vec<String> = events
|
||||
.lock()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.filter_map(|e| match e {
|
||||
BuildEvent::Step { command, .. } => Some(command.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert!(steps.iter().any(|s| s.starts_with("javac lib")), "{steps:?}");
|
||||
assert!(steps.iter().any(|s| s.starts_with("javac app")), "{steps:?}");
|
||||
assert!(!steps.iter().any(|s| s.contains("-am")), "{steps:?}");
|
||||
let first = Path::new(&info.class_paths[0]);
|
||||
assert!(first.ends_with("out/t.app/classes"), "{:?}", info.class_paths);
|
||||
assert!(first.join("a/A.class").is_file());
|
||||
assert!(info.class_paths.iter().any(|p| Path::new(p).ends_with("out/t.lib/classes")), "{:?}", info.class_paths);
|
||||
assert!(!root.join("app/target/classes").exists());
|
||||
|
||||
// Build › Build Project compiles with it too, and reports javac's errors.
|
||||
write(&root, "lib/src/main/java/l/L.java", "package l;\npublic class L { }\n");
|
||||
let built = ops::build::build_run(
|
||||
&host,
|
||||
"main",
|
||||
ide_build::compile::BuildKind::Build,
|
||||
None,
|
||||
None,
|
||||
RequestId::next(),
|
||||
Vec::new(),
|
||||
ops::Channel::new(|_: BuildEvent| {}),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(built.system, ide_build::compile::BuildSystem::Javac);
|
||||
assert!(!built.success);
|
||||
assert_eq!(built.errors, 1, "{:?}", built.messages);
|
||||
assert!(built.messages[0].path.as_deref().is_some_and(|p| p.ends_with("a/A.java")), "{:?}", built.messages);
|
||||
assert!(!root.join("lib/target/classes").exists());
|
||||
host.shutdown().await;
|
||||
}
|
||||
|
||||
/// With Settings › Gradle › Build and run using: IDE, a Gradle launch and Build Project compile
|
||||
/// with the IDE's Java build too. Needs a JDK (`JAVA_HOME`) and Gradle (`OPENIDEA_TEST_GRADLE`).
|
||||
#[cfg(unix)]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn gradle_launch_compiles_with_the_ides_java_build() {
|
||||
let has_jdk = std::env::var_os("JAVA_HOME").is_some_and(|h| Path::new(&h).join("bin").is_dir());
|
||||
let Some(gradle) = std::env::var_os("OPENIDEA_TEST_GRADLE").filter(|_| has_jdk) else {
|
||||
eprintln!("skipped: needs JAVA_HOME and OPENIDEA_TEST_GRADLE");
|
||||
return;
|
||||
};
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let base = dunce::canonicalize(temp.path()).unwrap();
|
||||
let root = base.join("project");
|
||||
write(&root, "settings.gradle", "rootProject.name = 'root'\ninclude 'lib', 'app'\n");
|
||||
write(&root, "build.gradle", "subprojects {\n apply plugin: 'java'\n group = 't'\n}\n");
|
||||
write(&root, "lib/build.gradle", "");
|
||||
write(&root, "app/build.gradle", "dependencies { implementation project(':lib') }\n");
|
||||
write(&root, "gradlew", &format!("#!/bin/sh\nexec '{}' \"$@\"\n", Path::new(&gradle).display()));
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
fs::set_permissions(root.join("gradlew"), fs::Permissions::from_mode(0o755)).unwrap();
|
||||
write(
|
||||
&root,
|
||||
"lib/src/main/java/l/L.java",
|
||||
"package l;\npublic class L { public static String name() { return \"lib\"; } }\n",
|
||||
);
|
||||
write(
|
||||
&root,
|
||||
"app/src/main/java/a/A.java",
|
||||
"package a;\npublic class A { public static void main(String[] args) { System.out.println(l.L.name()); } }\n",
|
||||
);
|
||||
let global = SettingsStore::load(&base.join("config"), None);
|
||||
for server in ["jdtls", "java-analyzer", "kmp-lsp"] {
|
||||
global
|
||||
.set(SettingsScope::Global, &format!("languageServers.{server}.enabled"), serde_json::json!(false))
|
||||
.unwrap();
|
||||
}
|
||||
global.set(SettingsScope::Global, "languages.java.gradle.runUsing", serde_json::json!("ide")).unwrap();
|
||||
let host = Host::new(common::host_config(&base));
|
||||
host.trust.decide(&root, true, false).unwrap();
|
||||
host.open_project("main", &root).unwrap();
|
||||
|
||||
let events = Arc::new(Mutex::new(Vec::new()));
|
||||
let sink = events.clone();
|
||||
let channel = ops::Channel::new(move |event: BuildEvent| sink.lock().unwrap().push(event));
|
||||
let info = ops::java::java_resolve_launch(
|
||||
&host,
|
||||
"main",
|
||||
root.join("app"),
|
||||
false,
|
||||
false,
|
||||
BuildPolicy::Make,
|
||||
RequestId::next(),
|
||||
channel,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let steps: Vec<String> = events
|
||||
.lock()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.filter_map(|e| match e {
|
||||
BuildEvent::Step { command, .. } => Some(command.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert!(steps.iter().any(|s| s.contains("openideaBuildModel")), "{steps:?}");
|
||||
assert!(steps.iter().any(|s| s.starts_with("javac lib")), "{steps:?}");
|
||||
assert!(steps.iter().any(|s| s.starts_with("javac app")), "{steps:?}");
|
||||
let first = Path::new(&info.class_paths[0]);
|
||||
assert!(first.ends_with("out/t.app/classes"), "{:?}", info.class_paths);
|
||||
assert!(first.join("a/A.class").is_file());
|
||||
assert!(info.class_paths.iter().any(|p| Path::new(p).ends_with("out/t.lib/classes")), "{:?}", info.class_paths);
|
||||
assert!(!root.join("app/build/classes").exists());
|
||||
|
||||
write(&root, "lib/src/main/java/l/L.java", "package l;\npublic class L { }\n");
|
||||
let built = ops::build::build_run(
|
||||
&host,
|
||||
"main",
|
||||
ide_build::compile::BuildKind::Build,
|
||||
None,
|
||||
None,
|
||||
RequestId::next(),
|
||||
Vec::new(),
|
||||
ops::Channel::new(|_: BuildEvent| {}),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(built.system, ide_build::compile::BuildSystem::Javac);
|
||||
assert_eq!(built.errors, 1, "{:?}", built.messages);
|
||||
assert!(built.messages[0].path.as_deref().is_some_and(|p| p.ends_with("a/A.java")), "{:?}", built.messages);
|
||||
host.shutdown().await;
|
||||
}
|
||||
@@ -88,18 +88,10 @@ done
|
||||
let events = std::sync::Arc::new(std::sync::Mutex::new(Vec::new()));
|
||||
let sink = events.clone();
|
||||
let channel = ops::Channel::new(move |event: ide_build::compile::BuildEvent| sink.lock().unwrap().push(event));
|
||||
let info = ops::java::java_resolve_launch(
|
||||
&host,
|
||||
"main",
|
||||
module,
|
||||
test,
|
||||
false,
|
||||
BuildPolicy::Make,
|
||||
RequestId::next(),
|
||||
channel,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let info =
|
||||
ops::java::java_resolve_launch(&host, "main", module, test, BuildPolicy::Make, RequestId::next(), channel)
|
||||
.await
|
||||
.unwrap();
|
||||
// The build streams its command and progress while it runs.
|
||||
use ide_build::compile::BuildEvent;
|
||||
let events = events.lock().unwrap();
|
||||
@@ -118,9 +110,7 @@ done
|
||||
assert!(info.class_paths.iter().any(|p| std::path::Path::new(p) == out));
|
||||
assert!(info.class_paths.iter().any(|p| std::path::Path::new(p) == jar));
|
||||
let calls = fs::read_to_string(root.join("calls")).unwrap();
|
||||
// This Maven records no build model for the IDE's Java build, so Maven builds the module.
|
||||
assert!(calls.lines().next().unwrap().contains("-Dopenidea.build.model="), "{calls}");
|
||||
assert!(calls.lines().nth(1).unwrap().contains("-pl app -am"), "{calls}");
|
||||
assert!(calls.lines().next().unwrap().contains("-pl app -am"), "{calls}");
|
||||
assert!(calls.lines().all(|line| line.contains(&format!("-P member-{index}"))), "{calls}");
|
||||
assert!(calls.contains(":build-classpath"), "{calls}");
|
||||
}
|
||||
|
||||
@@ -1188,107 +1188,3 @@ async fn phoxite_pulls_a_member_up_end_to_end() {
|
||||
assert!(!refused.message.is_empty() && !refused.message.starts_with("phoxite:"), "{refused:?}");
|
||||
mgr.shutdown_all().await;
|
||||
}
|
||||
|
||||
/// jdtls keeps building incrementally even though the IDE's Java build compiles what runs:
|
||||
/// its build is what reports an API change in one Maven module in the files of the modules
|
||||
/// that use it, open or not. With `java.autobuild.enabled: false` (and
|
||||
/// `validateAllOpenBuffersOnChanges`), neither updates.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
#[ignore = "requires jdtls on PATH (or OPENIDEA_TEST_JDTLS) and a compatible JDK"]
|
||||
async fn jdtls_build_reports_cross_module_errors_in_open_and_closed_files() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let root = dunce::canonicalize(dir.path()).unwrap().join("project");
|
||||
let write = |rel: &str, text: &str| {
|
||||
let path = root.join(rel);
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
std::fs::write(&path, text).unwrap();
|
||||
path
|
||||
};
|
||||
let parent = r#"<parent><groupId>t</groupId><artifactId>root</artifactId><version>1</version></parent>"#;
|
||||
write(
|
||||
"pom.xml",
|
||||
r#"<project><modelVersion>4.0.0</modelVersion><groupId>t</groupId><artifactId>root</artifactId><version>1</version><packaging>pom</packaging><modules><module>lib</module><module>app</module></modules><properties><maven.compiler.release>11</maven.compiler.release></properties></project>"#,
|
||||
);
|
||||
write(
|
||||
"lib/pom.xml",
|
||||
&format!("<project><modelVersion>4.0.0</modelVersion>{parent}<artifactId>lib</artifactId></project>"),
|
||||
);
|
||||
write(
|
||||
"app/pom.xml",
|
||||
&format!(
|
||||
"<project><modelVersion>4.0.0</modelVersion>{parent}<artifactId>app</artifactId><dependencies><dependency><groupId>t</groupId><artifactId>lib</artifactId><version>1</version></dependency></dependencies></project>"
|
||||
),
|
||||
);
|
||||
let lib_source = "package l;\npublic class L { public static String name() { return \"lib\"; } }\n";
|
||||
let app_source = "package a;\npublic class A { String s = l.L.name(); }\n";
|
||||
let lib = write("lib/src/main/java/l/L.java", lib_source);
|
||||
let app = write("app/src/main/java/a/A.java", app_source);
|
||||
let closed = write("app/src/main/java/a/B.java", "package a;\nclass B { String s = l.L.name(); }\n");
|
||||
let mut java = LanguageRegistry::load(None).unwrap().get(&LanguageId::new("java")).unwrap();
|
||||
java.language_servers.retain(|s| s.name == "jdtls");
|
||||
let server = &mut java.language_servers[0];
|
||||
if let Ok(bin) = std::env::var("OPENIDEA_TEST_JDTLS") {
|
||||
server.command = bin;
|
||||
}
|
||||
server.args.extend(["-data".into(), dir.path().join("jdtls-data").to_string_lossy().into_owned()]);
|
||||
let (mgr, events) = manager(&root, LanguageRegistry::from_configs(vec![java]));
|
||||
let (lib_doc, app_doc) = (DocId::next(), DocId::next());
|
||||
mgr.did_open(lib_doc, &lib, &LanguageId::new("java"), 1, lib_source);
|
||||
mgr.did_open(app_doc, &app, &LanguageId::new("java"), 1, app_source);
|
||||
let errors = |path: &Path| {
|
||||
events.lock().iter().rev().find_map(|e| match e {
|
||||
IdeEvent::Diagnostics { path: p, items, .. } if p.0 == path => Some(
|
||||
items
|
||||
.iter()
|
||||
.filter(|d| d.severity == ide_core::Severity::Error)
|
||||
.map(|d| d.message.clone())
|
||||
.collect::<Vec<_>>(),
|
||||
),
|
||||
_ => None,
|
||||
})
|
||||
};
|
||||
// The import resolves `lib` from source: the open editor of `app` has no errors.
|
||||
retry("app imported", Duration::from_secs(300), || {
|
||||
let status = last_status(&events, "jdtls");
|
||||
if let Some((ServerStatus::Crashed | ServerStatus::Missing | ServerStatus::Misconfigured, message)) = &status {
|
||||
panic!("jdtls failed: {message:?}");
|
||||
}
|
||||
let clean = errors(&app).is_some_and(|e| e.is_empty());
|
||||
let mgr = mgr.clone();
|
||||
let app = app.clone();
|
||||
async move {
|
||||
let cp =
|
||||
tokio::time::timeout(Duration::from_secs(10), mgr.java_classpath(&app, false, &Default::default()))
|
||||
.await
|
||||
.ok()?
|
||||
.ok()?;
|
||||
(clean && cp.class_paths.iter().any(|p| p.contains("/lib/"))).then_some(())
|
||||
}
|
||||
})
|
||||
.await;
|
||||
// Rename the method in the editor of `lib`, and save.
|
||||
let renamed = lib_source.replace("name()", "title()");
|
||||
let line = lib_source.lines().nth(1).unwrap();
|
||||
mgr.did_change(
|
||||
lib_doc,
|
||||
2,
|
||||
&[AppliedChange {
|
||||
range: Range::new(Pos::new(1, 0), Pos::new(1, line.len() as u32)),
|
||||
text: renamed.lines().nth(1).unwrap().to_owned(),
|
||||
}],
|
||||
&|| renamed.clone(),
|
||||
);
|
||||
std::fs::write(&lib, &renamed).unwrap();
|
||||
mgr.did_save(lib_doc, &renamed);
|
||||
retry("the open editor of app reports the removed method", Duration::from_secs(120), || {
|
||||
let found = errors(&app).is_some_and(|e| e.iter().any(|m| m.contains("name()")));
|
||||
async move { found.then_some(()) }
|
||||
})
|
||||
.await;
|
||||
retry("the closed file of app reports it too", Duration::from_secs(60), || {
|
||||
let found = errors(&closed).is_some_and(|e| e.iter().any(|m| m.contains("name()")));
|
||||
async move { found.then_some(()) }
|
||||
})
|
||||
.await;
|
||||
tokio::time::timeout(Duration::from_secs(10), mgr.shutdown_all()).await.unwrap();
|
||||
}
|
||||
@@ -21,7 +21,7 @@ mod utf8;
|
||||
pub mod wrap;
|
||||
|
||||
pub use detect::cmake::{build_configs as cmake_build_configs, prepare as prepare_cmake};
|
||||
pub use process::{DetachedProcessKills, ProcessManager, StartOptions};
|
||||
pub use process::{ProcessManager, StartOptions};
|
||||
|
||||
use ide_core::{IdeResult, RunId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -888,25 +888,15 @@ impl ProcessManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// Collects every running process tree for `root` and marks it stopping so the actual
|
||||
/// termination can run on a background thread without blocking the UI thread or racing
|
||||
/// processes started later.
|
||||
pub fn detach_project_kills(&self, root: &Path) -> DetachedProcessKills {
|
||||
let mut targets = Vec::new();
|
||||
/// Kills every running process tree at once (shutting down).
|
||||
pub fn kill_project(&self, root: &Path) {
|
||||
for entry in self.runs.lock().values().filter(|e| e.project_root == root) {
|
||||
if !entry.exited.load(Ordering::Acquire)
|
||||
&& let Some(pid) = *entry.pid.lock()
|
||||
{
|
||||
entry.stopping.store(true, Ordering::Release);
|
||||
targets.push((entry.clone(), pid));
|
||||
kill_tree(entry, pid, true);
|
||||
}
|
||||
}
|
||||
DetachedProcessKills(targets)
|
||||
}
|
||||
|
||||
/// Kills every running process tree at once (shutting down).
|
||||
pub fn kill_project(&self, root: &Path) {
|
||||
self.detach_project_kills(root).kill();
|
||||
}
|
||||
|
||||
pub fn kill_all(&self) {
|
||||
@@ -949,19 +939,6 @@ impl ProcessManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// Running process trees snapshotted from [`ProcessManager`] to be killed off the caller's thread.
|
||||
pub struct DetachedProcessKills(Vec<(Arc<Entry>, u32)>);
|
||||
|
||||
impl DetachedProcessKills {
|
||||
pub fn kill(self) {
|
||||
for (entry, pid) in self.0 {
|
||||
if !entry.exited.load(Ordering::Acquire) {
|
||||
kill_tree(&entry, pid, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for ProcessManager {
|
||||
fn drop(&mut self) {
|
||||
self.kill_all();
|
||||
|
||||
@@ -1654,23 +1654,6 @@ pub fn junit_runner_jar(data_dir: &Path) -> Option<PathBuf> {
|
||||
)
|
||||
}
|
||||
|
||||
/// The IDE's Java build (`java/java-build`): the resident javac server and the Maven
|
||||
/// extension that records the build model.
|
||||
const JAVA_BUILD: &[u8] = include_bytes!("../../../java/java-build/openidea-java-build.jar");
|
||||
|
||||
/// Extracts the Java build jar into the application's data directory.
|
||||
pub fn java_build_jar(data_dir: &Path) -> Option<PathBuf> {
|
||||
install_bundle(data_dir, "java-build", "1.0.0", JAVA_BUILD)
|
||||
}
|
||||
|
||||
/// Changes whenever the embedded Java build jar does (FNV-1a of its bytes), so build models
|
||||
/// recorded by an older extension are prepared again.
|
||||
pub fn java_build_version() -> String {
|
||||
let hash =
|
||||
JAVA_BUILD.iter().fold(0xcbf2_9ce4_8422_2325u64, |h, b| (h ^ u64::from(*b)).wrapping_mul(0x100_0000_01b3));
|
||||
format!("{hash:016x}")
|
||||
}
|
||||
|
||||
/// The JUnit Platform launcher a test classpath needs to start the runner.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum JunitLauncher {
|
||||
|
||||
@@ -11,7 +11,7 @@ use ide_core::settings::Settings;
|
||||
use ide_language::LanguageServerConfig;
|
||||
use ide_run::RunConfig;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::Duration;
|
||||
|
||||
fn fake_venv(root: &Path, name: &str) -> std::path::PathBuf {
|
||||
@@ -2103,9 +2103,8 @@ fn the_flutter_sdk_setting_picks_flutter_and_dart_for_server_and_run_configurati
|
||||
// Saved configurations keep the bare name.
|
||||
assert_eq!(crate::apply::without_derived(&configs[0], tmp.path(), &s).command, "flutter");
|
||||
// An explicit tool path still wins.
|
||||
let explicit = tmp.path().join("opt").join("dart");
|
||||
s.tools.insert("dart".into(), ide_core::settings::ToolSettings { path: explicit.to_string_lossy().into_owned() });
|
||||
assert_eq!(crate::apply::tool_command(tmp.path(), &s, "dart"), Some(explicit));
|
||||
s.tools.insert("dart".into(), ide_core::settings::ToolSettings { path: "/opt/dart/bin/dart".into() });
|
||||
assert_eq!(crate::apply::tool_command(tmp.path(), &s, "dart"), Some(PathBuf::from("/opt/dart/bin/dart")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -510,17 +510,13 @@ impl TerminalManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// Detaches every terminal opened by `key` so it can be terminated on a background thread
|
||||
/// without blocking the caller or racing a new project opened in the same window.
|
||||
pub fn detach_key(&self, key: &str) -> DetachedTerminals {
|
||||
let mut sessions = self.sessions.lock();
|
||||
let ids: Vec<TerminalId> = sessions.iter().filter(|(_, s)| s.key == key).map(|(id, _)| *id).collect();
|
||||
DetachedTerminals(ids.into_iter().filter_map(|id| sessions.remove(&id)).collect())
|
||||
}
|
||||
|
||||
/// Closes the terminals `key` opened: the project of that window is closing.
|
||||
pub fn kill_key(&self, key: &str) {
|
||||
self.detach_key(key).terminate();
|
||||
let ids: Vec<TerminalId> =
|
||||
self.sessions.lock().iter().filter(|(_, s)| s.key == key).map(|(id, _)| *id).collect();
|
||||
for id in ids {
|
||||
let _ = self.kill(id);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn kill(&self, id: TerminalId) -> IdeResult<()> {
|
||||
@@ -737,17 +733,6 @@ mod win {
|
||||
}
|
||||
}
|
||||
|
||||
/// Terminal sessions detached from [`TerminalManager`] to be terminated off the caller's thread.
|
||||
pub struct DetachedTerminals(Vec<Arc<Session>>);
|
||||
|
||||
impl DetachedTerminals {
|
||||
pub fn terminate(self) {
|
||||
for session in self.0 {
|
||||
terminate(&session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Hangs up the shell (and its process group), escalating to SIGKILL if it lingers.
|
||||
fn terminate(session: &Session) {
|
||||
let (writer, killer) = match &session.io {
|
||||
|
||||
@@ -44,9 +44,6 @@ async function requestClose(
|
||||
idlePolicy: { overrideSeconds },
|
||||
});
|
||||
window.__ipc.handlers.window_close_context = () => ({ windows, quitting });
|
||||
window.__ipc.handlers.window_begin_prompt = () => true;
|
||||
window.__ipc.handlers.window_end_prompt = () => null;
|
||||
window.__ipc.handlers.window_ready_to_close = () => true;
|
||||
window.__ipc.handlers.close_project = () => null;
|
||||
window.__ipc.handlers.remote_invoke = ({ cmd }) => {
|
||||
if (cmd === "remote_idle_timeout_minutes") {
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Java build
|
||||
|
||||
The IDE's own build of Maven and Gradle modules (`ide_build::jbuild`). The jar holds two parts:
|
||||
|
||||
- `ai.openidea.javac.Server` (`src/`): a resident javac. OpenIDEA starts one per JDK (and
|
||||
`.mvn/jvm.config`) as `java -cp openidea-java-build.jar ai.openidea.javac.Server` and keeps it
|
||||
running between builds. It reads one JSON request per line on stdin and answers on stdout:
|
||||
|
||||
| Request | Meaning |
|
||||
| ------------------------------------------------------------------------ | ----------------------------------------------- |
|
||||
| `{"id":1,"op":"compile","options":[…],"sources":[…],"encoding":"UTF-8"}` | Compile with javac (`ToolProvider`), in process |
|
||||
| `{"op":"cancel","id":1}` | Stop that compilation at javac's next phase |
|
||||
| `{"op":"exit"}` | Finish the queued requests, then exit |
|
||||
|
||||
Replies carry the request's `id`: `diagnostic` (1-based line, 0-based UTF-16 column),
|
||||
`output` (a class file and the source it came from), `generated` (a source an annotation
|
||||
processor wrote), `output-text`, then `done`. `ready` and `fatal` concern the server.
|
||||
|
||||
- `ai.openidea.javac.maven.BuildModel` (`maven/`): a Maven core extension, loaded with
|
||||
`-Dmaven.ext.class.path`. With `-Dopenidea.build.output=<dir>` it redirects every project's
|
||||
output to `<dir>/<groupId>.<artifactId>/classes|test-classes`, and resolves reactor
|
||||
projects to those folders. With `-Dopenidea.build.model=<file>` it writes, after the build,
|
||||
each project's source roots, classpaths, resources and the configuration maven-compiler-plugin's
|
||||
mojos get (including the resolved `annotationProcessorPaths`), as JSON.
|
||||
|
||||
OpenIDEA runs `mvn process-resources resources:testResources` with the extension when the POMs,
|
||||
settings or generator inputs change, then compiles the launch's modules with the server.
|
||||
|
||||
Gradle builds get the same model from an init script instead
|
||||
(`crates/ide-build/src/jbuild/gradle-build.init.gradle`, task `openideaBuildModel`, with
|
||||
`-Popenidea.build.output` and `-Popenidea.build.model`), when Settings › Gradle › Build and run
|
||||
using is set to the IDE.
|
||||
|
||||
The jar is committed and embedded by `ide-sdk` (`java_build_jar`). It is built with `--release 8`
|
||||
against Maven 3.9.11, whose files `build-dependencies.sha256` pins. Rebuild it after changing
|
||||
the source:
|
||||
|
||||
```sh
|
||||
JAVA_HOME=<JDK 11+> python3 build.py <apache-maven-3.9.11 folder>
|
||||
```
|
||||
@@ -1,52 +0,0 @@
|
||||
0addec670fedcd3f113c5c8091d783280d23f75e3acb841b61a9cdb079376a08 maven/aopalliance-1.0.jar
|
||||
876eab6a83daecad5ca67eb9fcabb063c97b5aeb8cf1fca7a989ecde17522051 maven/asm-9.8.jar
|
||||
d3d530d0f28fd0fbbffe2b0b338f70e8cb96f1605579e2e3abd4db29cac24e69 maven/commons-cli-1.9.0.jar
|
||||
ba005f304cef92a3dede24a38ad5ac9b8afccf0d8f75839d6c1338634cf7f6e4 maven/commons-codec-1.18.0.jar
|
||||
6661d5335090a5fc61dd869d2095bc6c1e2156e3aa47a6e4ababdf64c99a7889 maven/error_prone_annotations-2.38.0.jar
|
||||
cbfc3906b19b8f55dd7cfd6dfe0aa4532e834250d7f080bd8d211a3e246b59cb maven/failureaccess-1.0.3.jar
|
||||
94855942d4992f112946d3de1c334e709237b8126d8130bf07807c018a4a2120 maven/gson-2.13.1.jar
|
||||
f3d7f57f67fd622f4d468dfdd692b3a5e3909246c28017ac3263405f0fe617ed maven/guava-33.4.8-jre.jar
|
||||
142ad4475e19524d2fe3ac995b3f7cbc962fc726f2edb9dbdccc61feab9b2bf9 maven/guice-5.1.0-classes.jar
|
||||
c8bc7e1c51a6d4ce72f40d2ebbabf1c4b68bfe76e732104b04381b493478e9d6 maven/httpclient-4.5.14.jar
|
||||
6c9b3dd142a09dc468e23ad39aad6f75a0f2b85125104469f026e52a474e464f maven/httpcore-4.4.16.jar
|
||||
0b7b8b003a90ea491579b62f5118828e45112914c65589b00faa49d6ec785839 maven/jansi-2.4.2.jar
|
||||
e04ba5195bcd555dc95650f7cc614d151e4bcd52d29a10b8aa2197f3ab89ab9b maven/javax.annotation-api-1.3.2.jar
|
||||
91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff maven/javax.inject-1.jar
|
||||
ab57ca8fd223772c17365d121f59e94ecbf0ae59d08c03a3cb5b81071c019195 maven/jcl-over-slf4j-1.7.36.jar
|
||||
1fad6e6be7557781e4d33729d49ae1cdc8fdda6fe477bb0cc68ce351eafdfbab maven/jspecify-1.0.0.jar
|
||||
0bfd1c121f907642344311d81e4dfd93eba6c24dc712cc0aeae273eb22833022 maven/maven-artifact-3.9.11.jar
|
||||
5b1de1560ec19c4c69a655f986455888f3a0bcc3c160cac1f1edb87de3825f77 maven/maven-builder-support-3.9.11.jar
|
||||
b0e2865fc808fd9fb3bee95bf37c0609eeb20c59bf1e6b958b37b365ee11f52e maven/maven-compat-3.9.11.jar
|
||||
93d3c0523dda6c86c6620d9e692e7df39d0e2e4e4cd860061a8c0d274c2ad185 maven/maven-core-3.9.11.jar
|
||||
7e15e05035331d0a7e0fe56d7354b2b30e15c0a8c60863cbf28df25190e197db maven/maven-embedder-3.9.11.jar
|
||||
163aa596f976264384efeb50b4cb8a806086fd64a9b755ad1f69195fed3998ad maven/maven-model-3.9.11.jar
|
||||
c4c72accdcd848332c1a37995610a6a369d49fdaabc43e85f0022a5b77de3ba7 maven/maven-model-builder-3.9.11.jar
|
||||
8e985a56412564cf687040efed8bcd3a63eac2202a824bb01e1d5ece2b87458f maven/maven-plugin-api-3.9.11.jar
|
||||
f8655f5f0060e0032944f2a23688d186e140d2184749bcfa1927f83cd6a8b1a2 maven/maven-repository-metadata-3.9.11.jar
|
||||
c0ce14849298720dcf3b09fe9e263b3c576d2d6cd43c61f8aa9d6117e04e5e47 maven/maven-resolver-api-1.9.24.jar
|
||||
18b7d557c41379db8b157ba95263c676f52c293f5416b67bd1db083e99b30383 maven/maven-resolver-connector-basic-1.9.24.jar
|
||||
3cd88edda00c46242cdbe57aefb47703519d176d9e8a500333de15faf41b0e1d maven/maven-resolver-impl-1.9.24.jar
|
||||
a222b0a5ca4c145e8e0f45207a23bcce18bdbe1f1c980e4e9fb332591ee8c91a maven/maven-resolver-named-locks-1.9.24.jar
|
||||
b5d6e52ae1ecf1cb62ede2234234ba3093149524066488e84415187ce478c582 maven/maven-resolver-provider-3.9.11.jar
|
||||
e3153906e93333c106ee18babb72ba7984ccb15e9116ea08f88c71b8d9387e01 maven/maven-resolver-spi-1.9.24.jar
|
||||
b09268d41e1dfcae15a829d45a512ca29d62b727421d3bd6383ac6252e5e960f maven/maven-resolver-transport-file-1.9.24.jar
|
||||
a0de339a8dd3473d9abaa1cf974507f38783e26af31d36a90c1e59cc8714ded0 maven/maven-resolver-transport-http-1.9.24.jar
|
||||
78ed57fa2123a2d84fad7a0b15ca73b89df47c10294d02d6f8121c4d0e5050cb maven/maven-resolver-transport-wagon-1.9.24.jar
|
||||
aeb7e776a8c47b1c317a2581f299e2525b044cb8abde31164e970bbbefab12b1 maven/maven-resolver-util-1.9.24.jar
|
||||
026718d47d19e360d978857bc63d3dc065884fc2c801563d8a2a77b5ab74ccf8 maven/maven-settings-3.9.11.jar
|
||||
33c96e4ca5a15b7c93180f6b2f8deb15f511dfc15dda0d2b671c968b22108972 maven/maven-settings-builder-3.9.11.jar
|
||||
b613357e1bad4dfc1dead801691c9460f9585fe7c6b466bc25186212d7d18487 maven/maven-shared-utils-3.4.2.jar
|
||||
76d9fa894fa61d1492877ca599cb5ab28ca4573d5f389d6c12a8233b995335f9 maven/maven-slf4j-provider-3.9.11.jar
|
||||
1cbd7a965a5e2a9ea823bab311962a4e5aa5c240705bdbad5a52b40ffdfa1004 maven/org.eclipse.sisu.inject-0.9.0.M4.jar
|
||||
b90579bc652eac7331436e0a25533fce14130b9c6e015f2dd3a3d4bb07e942b7 maven/org.eclipse.sisu.plexus-0.9.0.M4.jar
|
||||
9a7f1b5c5a9effd61eadfd8731452a2f76a8e79111fac391ef75ea801bea203a maven/plexus-cipher-2.0.jar
|
||||
50edb93c73786e62822b4fe1336e22880fdf147191373cf5c911370e16748fcf maven/plexus-component-annotations-2.2.0.jar
|
||||
ab2a8715570438a2e4164d85ad3e8d489eabc38ea5093c2eb8ab7f58403535b5 maven/plexus-interpolation-1.28.jar
|
||||
873139960c4c780176dda580b003a2c4bf82188bdce5bb99234e224ef7acfceb maven/plexus-sec-dispatcher-2.0.jar
|
||||
27ef130e32c236090e408fb5498d94cb9ea26d14070fb1c8985d607b62d098d1 maven/plexus-utils-3.6.0.jar
|
||||
d3ef575e3e4979678dc01bf1dcce51021493b4d11fb7f1be8ad982877c16a1c0 maven/slf4j-api-1.7.36.jar
|
||||
afc9216fa97b78dad227b4a8d4d67b9897bf113a57f80598d62993841113e103 maven/wagon-file-3.5.3.jar
|
||||
d2b6e48c9fcbe579e1858c622d14464011ff265fa6e28e794004a6882154a509 maven/wagon-http-3.5.3.jar
|
||||
8e7da766f55164fde8779aaaa125832506c2848cab4876b5305138873e28037f maven/wagon-http-shared-3.5.3.jar
|
||||
5e72000338945ed3e96f8e4f578d1d0672e1af7e19c0e9014197ae5b31af3ef4 maven/wagon-provider-api-3.5.3.jar
|
||||
1ad3292cd563381e3fd632f3fded1988f9e9b2be7a9f3db63ff4c4cedba13fa5 maven/plexus-classworlds-2.9.0.jar
|
||||
@@ -1,38 +0,0 @@
|
||||
"""Build the committed jar: python3 build.py /path/to/apache-maven-3.9.11 [--record-dependencies].
|
||||
|
||||
One jar, two parts, Java 8 bytecode:
|
||||
- `src`: the resident javac server (`ai.openidea.javac.Server`), JDK classes only.
|
||||
- `maven`: the prepare run's Maven extension (`ai.openidea.javac.maven.BuildModel`), compiled
|
||||
against Maven 3.9.11's API jars, pinned by build-dependencies.sha256.
|
||||
Archive order and timestamps are deterministic. Use a JDK that still compiles `--release 8`."""
|
||||
import hashlib
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import zipfile
|
||||
|
||||
root = pathlib.Path(__file__).resolve().parent
|
||||
maven = pathlib.Path(sys.argv[1]).resolve()
|
||||
jars = sorted((maven / 'lib').glob('*.jar')) + sorted((maven / 'boot').glob('*.jar'))
|
||||
actual = ''.join(f'{hashlib.sha256(p.read_bytes()).hexdigest()} maven/{p.name}\n' for p in jars)
|
||||
if '--record-dependencies' in sys.argv:
|
||||
(root / 'build-dependencies.sha256').write_text(actual)
|
||||
if (root / 'build-dependencies.sha256').read_text() != actual:
|
||||
sys.exit('Build dependencies differ from build-dependencies.sha256')
|
||||
java_home = os.environ.get('JAVA_HOME')
|
||||
javac = str(pathlib.Path(java_home) / 'bin' / 'javac') if java_home else 'javac'
|
||||
with tempfile.TemporaryDirectory() as output:
|
||||
for source, classpath in [('src', []), ('maven', jars)]:
|
||||
subprocess.run([javac, '--release', '8', '-Xlint:-options', '-proc:none', '-encoding', 'UTF-8', '-g',
|
||||
'-classpath', os.pathsep.join(map(str, classpath)), '-d', output,
|
||||
*map(str, sorted((root / source).rglob('*.java')))], check=True)
|
||||
files = {p.relative_to(output).as_posix(): p.read_bytes() for p in pathlib.Path(output).rglob('*.class')}
|
||||
files['META-INF/sisu/javax.inject.Named'] = b'ai.openidea.javac.maven.BuildModel\n'
|
||||
files['META-INF/MANIFEST.MF'] = b'Manifest-Version: 1.0\nMain-Class: ai.openidea.javac.Server\n\n'
|
||||
staged = root / 'openidea-java-build.jar.pending'
|
||||
with zipfile.ZipFile(staged, 'w', zipfile.ZIP_DEFLATED) as jar:
|
||||
for name, data in sorted(files.items()):
|
||||
jar.writestr(zipfile.ZipInfo(name, (2026, 1, 1, 0, 0, 0)), data)
|
||||
staged.replace(root / 'openidea-java-build.jar')
|
||||
@@ -1,501 +0,0 @@
|
||||
package ai.openidea.javac.maven;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.maven.AbstractMavenLifecycleParticipant;
|
||||
import org.apache.maven.MavenExecutionException;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.LifecycleExecutor;
|
||||
import org.apache.maven.lifecycle.MavenExecutionPlan;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Resource;
|
||||
import org.apache.maven.plugin.BuildPluginManager;
|
||||
import org.apache.maven.plugin.MavenPluginManager;
|
||||
import org.apache.maven.plugin.Mojo;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
import org.apache.maven.project.DefaultDependencyResolutionRequest;
|
||||
import org.apache.maven.project.DependencyResolutionResult;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.ProjectDependenciesResolver;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
import org.eclipse.aether.artifact.Artifact;
|
||||
import org.eclipse.aether.artifact.DefaultArtifact;
|
||||
import org.eclipse.aether.collection.CollectRequest;
|
||||
import org.eclipse.aether.graph.DependencyNode;
|
||||
import org.eclipse.aether.graph.Exclusion;
|
||||
import org.eclipse.aether.repository.WorkspaceReader;
|
||||
import org.eclipse.aether.repository.WorkspaceRepository;
|
||||
import org.eclipse.aether.resolution.ArtifactResult;
|
||||
import org.eclipse.aether.resolution.DependencyRequest;
|
||||
import org.eclipse.aether.resolution.DependencyResult;
|
||||
|
||||
/**
|
||||
* Records how each project of the session compiles, for the IDE's own Java build. Loaded only
|
||||
* by the IDE's prepare run ({@code -Dmaven.ext.class.path=<jar> -Dopenidea.build.model=<file>
|
||||
* process-resources resources:testResources}): generated sources exist and resources are
|
||||
* processed, and nothing is compiled. Test source generators run after {@code compile} in
|
||||
* Maven's lifecycle, so they don't run; the source roots build-helper adds are read from its
|
||||
* configuration, and any other generator is listed so the IDE leaves those tests to Maven.
|
||||
*
|
||||
* <p>Per project and source set (main, test): the source roots (including the ones generated
|
||||
* sources added), the output directory, the compile classpath with reactor projects as their
|
||||
* output directories (never their jars), the runtime classpath, the compiler plugin's resolved
|
||||
* configuration (release, encoding, arguments, annotation processor path) and the resources.
|
||||
* Executions bound to the compile phases that are not javac (Kotlin, AspectJ, bytecode
|
||||
* enhancers) are listed, so the IDE leaves such projects to Maven.
|
||||
*/
|
||||
@Named("openidea-build-model")
|
||||
@Singleton
|
||||
public final class BuildModel extends AbstractMavenLifecycleParticipant {
|
||||
private static final String COMPILER = "org.apache.maven.plugins:maven-compiler-plugin";
|
||||
/** Test phases before test-compile, which the prepare run doesn't reach. */
|
||||
private static final Set<String> TEST_GENERATE_PHASES = new HashSet<>(Arrays.asList(
|
||||
"generate-test-sources", "process-test-sources", "generate-test-resources", "process-test-resources"));
|
||||
/** Phases whose executions change what the compile phases produce. */
|
||||
private static final Set<String> COMPILE_PHASES =
|
||||
new HashSet<>(Arrays.asList("compile", "process-classes", "test-compile", "process-test-classes"));
|
||||
/** Executions in those phases that don't change the classes the IDE compiles. */
|
||||
private static final Set<String> HARMLESS = new HashSet<>(Arrays.asList(
|
||||
"org.jacoco:jacoco-maven-plugin", "org.apache.maven.plugins:maven-enforcer-plugin",
|
||||
"org.codehaus.mojo:animal-sniffer-maven-plugin", "org.apache.maven.plugins:maven-checkstyle-plugin",
|
||||
"com.github.spotbugs:spotbugs-maven-plugin", "org.apache.maven.plugins:maven-pmd-plugin",
|
||||
"com.diffplug.spotless:spotless-maven-plugin", "org.apache.maven.plugins:maven-dependency-plugin",
|
||||
"org.apache.maven.plugins:maven-resources-plugin", "org.codehaus.mojo:build-helper-maven-plugin",
|
||||
"pl.project13.maven:git-commit-id-plugin", "io.github.git-commit-id:git-commit-id-maven-plugin"));
|
||||
|
||||
private final LifecycleExecutor lifecycle;
|
||||
private final MavenPluginManager plugins;
|
||||
private final BuildPluginManager buildPlugins;
|
||||
private final ProjectDependenciesResolver dependencies;
|
||||
private final RepositorySystem repositories;
|
||||
|
||||
@Inject
|
||||
public BuildModel(LifecycleExecutor lifecycle, MavenPluginManager plugins, BuildPluginManager buildPlugins,
|
||||
ProjectDependenciesResolver dependencies, RepositorySystem repositories) {
|
||||
this.lifecycle = lifecycle;
|
||||
this.plugins = plugins;
|
||||
this.buildPlugins = buildPlugins;
|
||||
this.dependencies = dependencies;
|
||||
this.repositories = repositories;
|
||||
}
|
||||
|
||||
/**
|
||||
* With {@code -Dopenidea.build.output=<dir>}, every project's classes and resources go to
|
||||
* {@code <dir>/<groupId>.<artifactId>/classes} (and {@code test-classes}): the IDE's outputs,
|
||||
* apart from what a terminal build or the language server writes to {@code target}.
|
||||
*/
|
||||
@Override public void afterProjectsRead(MavenSession session) {
|
||||
String output = session.getUserProperties().getProperty("openidea.build.output");
|
||||
if (output == null) return;
|
||||
for (MavenProject project : session.getProjects()) {
|
||||
File dir = new File(output, project.getGroupId() + "." + project.getArtifactId());
|
||||
project.getBuild().setOutputDirectory(new File(dir, "classes").getAbsolutePath());
|
||||
project.getBuild().setTestOutputDirectory(new File(dir, "test-classes").getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void afterSessionEnd(MavenSession session) throws MavenExecutionException {
|
||||
String destination = session.getUserProperties().getProperty("openidea.build.model");
|
||||
if (destination == null) return;
|
||||
StringBuilder json = new StringBuilder("{\"version\":1,\"projects\":[");
|
||||
boolean first = true;
|
||||
MavenProject current = session.getCurrentProject();
|
||||
try {
|
||||
for (MavenProject project : session.getProjects()) {
|
||||
if (!first) json.append(',');
|
||||
first = false;
|
||||
project(json, session, project);
|
||||
}
|
||||
} finally {
|
||||
session.setCurrentProject(current);
|
||||
}
|
||||
json.append("]}");
|
||||
File target = new File(destination);
|
||||
try {
|
||||
File parent = target.getAbsoluteFile().getParentFile();
|
||||
parent.mkdirs();
|
||||
File temp = File.createTempFile("build-model", ".json", parent);
|
||||
try (Writer out = new OutputStreamWriter(Files.newOutputStream(temp.toPath()), StandardCharsets.UTF_8)) {
|
||||
out.write(json.toString());
|
||||
}
|
||||
Files.move(temp.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
|
||||
} catch (IOException e) {
|
||||
throw new MavenExecutionException("Cannot write the IDE build model: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void project(StringBuilder json, MavenSession session, MavenProject project) {
|
||||
session.setCurrentProject(project);
|
||||
json.append("{\"dir\":").append(q(project.getBasedir().getAbsolutePath()))
|
||||
.append(",\"groupId\":").append(q(project.getGroupId()))
|
||||
.append(",\"artifactId\":").append(q(project.getArtifactId()))
|
||||
.append(",\"version\":").append(q(project.getVersion()))
|
||||
.append(",\"packaging\":").append(q(project.getPackaging()));
|
||||
List<String> problems = new ArrayList<>();
|
||||
Map<String, Mojo> compilers = new HashMap<>();
|
||||
List<MojoExecution> configured = new ArrayList<>();
|
||||
List<String> others = new ArrayList<>();
|
||||
List<String> testGenerators = new ArrayList<>();
|
||||
List<String> testRoots = new ArrayList<>(project.getTestCompileSourceRoots());
|
||||
try {
|
||||
MavenExecutionPlan plan = lifecycle.calculateExecutionPlan(session, true, "test-compile");
|
||||
for (MojoExecution execution : plan.getMojoExecutions()) {
|
||||
String plugin = execution.getGroupId() + ":" + execution.getArtifactId();
|
||||
String phase = execution.getLifecyclePhase();
|
||||
if (COMPILER.equals(plugin) && ("compile".equals(execution.getGoal()) || "testCompile".equals(execution.getGoal()))) {
|
||||
if (compilers.containsKey(execution.getGoal())) {
|
||||
others.add(plugin + ":" + execution.getGoal() + "@" + execution.getExecutionId());
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
buildPlugins.getPluginRealm(session, execution.getMojoDescriptor().getPluginDescriptor());
|
||||
Mojo mojo = plugins.getConfiguredMojo(Mojo.class, session, execution);
|
||||
compilers.put(execution.getGoal(), mojo);
|
||||
configured.add(execution);
|
||||
} catch (Exception e) {
|
||||
problems.add("Cannot read the " + execution.getGoal() + " configuration: " + e);
|
||||
}
|
||||
} else if (phase != null && COMPILE_PHASES.contains(phase) && !HARMLESS.contains(plugin)) {
|
||||
others.add(plugin + ":" + execution.getGoal() + "@" + execution.getExecutionId());
|
||||
} else if (phase != null && TEST_GENERATE_PHASES.contains(phase)) {
|
||||
String goal = plugin + ":" + execution.getGoal();
|
||||
if (goal.equals("org.apache.maven.plugins:maven-resources-plugin:testResources")) continue;
|
||||
if (goal.equals("org.codehaus.mojo:build-helper-maven-plugin:add-test-source")) {
|
||||
try {
|
||||
buildPlugins.getPluginRealm(session, execution.getMojoDescriptor().getPluginDescriptor());
|
||||
Mojo mojo = plugins.getConfiguredMojo(Mojo.class, session, execution);
|
||||
Object sources = get(mojo, "sources");
|
||||
if (sources instanceof File[])
|
||||
for (File f : (File[]) sources) testRoots.add(f.getAbsolutePath());
|
||||
plugins.releaseMojo(mojo, execution);
|
||||
continue;
|
||||
} catch (Exception e) {
|
||||
problems.add("Cannot read build-helper's test sources: " + e);
|
||||
}
|
||||
}
|
||||
testGenerators.add(goal + "@" + execution.getExecutionId());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
problems.add("Cannot plan the build: " + e);
|
||||
}
|
||||
Set<String> reactor = new HashSet<>();
|
||||
for (MavenProject p : session.getProjects()) reactor.add(p.getGroupId() + ":" + p.getArtifactId());
|
||||
RepositorySystemSession repo = reactorSession(session);
|
||||
List<String> compile = new ArrayList<>();
|
||||
List<String> runtime = new ArrayList<>();
|
||||
List<String> test = new ArrayList<>();
|
||||
try {
|
||||
DependencyResolutionResult result =
|
||||
dependencies.resolve(new DefaultDependencyResolutionRequest(project, repo));
|
||||
classpaths(result.getDependencyGraph(), compile, runtime, test);
|
||||
for (Exception e : result.getCollectionErrors()) problems.add(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
problems.add("Cannot resolve the dependencies: " + rootMessage(e));
|
||||
org.apache.maven.project.DependencyResolutionException failure = cause(e);
|
||||
if (failure != null && failure.getResult() != null && failure.getResult().getDependencyGraph() != null)
|
||||
classpaths(failure.getResult().getDependencyGraph(), compile, runtime, test);
|
||||
}
|
||||
json.append(",\"main\":");
|
||||
sourceSet(json, session, project, compilers.get("compile"), null, compile, runtime, problems);
|
||||
json.append(",\"test\":");
|
||||
List<String> testClasspath = new ArrayList<>();
|
||||
testClasspath.add(project.getBuild().getOutputDirectory());
|
||||
testClasspath.addAll(test);
|
||||
sourceSet(json, session, project, compilers.get("testCompile"), testRoots, testClasspath, testClasspath, problems);
|
||||
json.append(",\"otherCompilers\":").append(strings(others));
|
||||
json.append(",\"testGenerators\":").append(strings(testGenerators));
|
||||
json.append(",\"problems\":").append(strings(problems)).append('}');
|
||||
for (int i = 0; i < configured.size(); i++) {
|
||||
Mojo mojo = compilers.get(configured.get(i).getGoal());
|
||||
if (mojo != null) plugins.releaseMojo(mojo, configured.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
/** `testRoots`: the test source roots, `null` for the main source set. */
|
||||
private void sourceSet(StringBuilder json, MavenSession session, MavenProject project, Mojo compiler,
|
||||
List<String> testRoots, List<String> classpath, List<String> runtime, List<String> problems) {
|
||||
boolean test = testRoots != null;
|
||||
List<String> roots = test ? testRoots : project.getCompileSourceRoots();
|
||||
String output = test ? project.getBuild().getTestOutputDirectory() : project.getBuild().getOutputDirectory();
|
||||
json.append("{\"sourceRoots\":").append(strings(roots))
|
||||
.append(",\"output\":").append(q(output))
|
||||
.append(",\"classpath\":").append(strings(classpath))
|
||||
.append(",\"runtimeClasspath\":").append(strings(runtime))
|
||||
.append(",\"resources\":");
|
||||
List<Resource> resources = test ? project.getTestResources() : project.getResources();
|
||||
json.append('[');
|
||||
for (int i = 0; i < resources.size(); i++) {
|
||||
Resource r = resources.get(i);
|
||||
if (i > 0) json.append(',');
|
||||
json.append("{\"directory\":").append(q(new File(project.getBasedir(), r.getDirectory()).isAbsolute()
|
||||
? r.getDirectory() : new File(project.getBasedir(), r.getDirectory()).getAbsolutePath()))
|
||||
.append(",\"filtering\":").append(r.isFiltering())
|
||||
.append(",\"targetPath\":").append(q(r.getTargetPath()))
|
||||
.append(",\"includes\":").append(strings(r.getIncludes()))
|
||||
.append(",\"excludes\":").append(strings(r.getExcludes())).append('}');
|
||||
}
|
||||
json.append(']');
|
||||
json.append(",\"compiler\":");
|
||||
if (compiler == null) {
|
||||
json.append("null}");
|
||||
return;
|
||||
}
|
||||
json.append('{');
|
||||
String goal = test ? "testCompile" : "compile";
|
||||
field(json, "compilerId", get(compiler, "compilerId"));
|
||||
field(json, "source", get(compiler, test ? "testSource" : "source", "source"));
|
||||
field(json, "target", get(compiler, test ? "testTarget" : "target", "target"));
|
||||
field(json, "release", get(compiler, test ? "testRelease" : "release", "release"));
|
||||
field(json, "encoding", get(compiler, "encoding"));
|
||||
field(json, "parameters", get(compiler, "parameters"));
|
||||
field(json, "debug", get(compiler, "debug"));
|
||||
field(json, "debuglevel", get(compiler, "debuglevel"));
|
||||
field(json, "proc", get(compiler, "proc"));
|
||||
field(json, "enablePreview", get(compiler, "enablePreview"));
|
||||
field(json, "fork", get(compiler, "fork"));
|
||||
field(json, "executable", get(compiler, "executable"));
|
||||
field(json, "skip", get(compiler, test ? "skip" : "skipMain"));
|
||||
field(json, "showWarnings", get(compiler, "showWarnings"));
|
||||
field(json, "showDeprecation", get(compiler, "showDeprecation"));
|
||||
field(json, "generatedSourcesDirectory",
|
||||
get(compiler, test ? "generatedTestSourcesDirectory" : "generatedSourcesDirectory"));
|
||||
field(json, "includes", get(compiler, test ? "testIncludes" : "includes"));
|
||||
field(json, "excludes", get(compiler, test ? "testExcludes" : "excludes"));
|
||||
field(json, "annotationProcessors", get(compiler, "annotationProcessors"));
|
||||
field(json, "compilerArgs", get(compiler, "compilerArgs"));
|
||||
field(json, "compilerArgument", get(compiler, "compilerArgument"));
|
||||
field(json, "compilerArguments", get(compiler, "compilerArguments"));
|
||||
field(json, "multiReleaseOutput", get(compiler, "multiReleaseOutput"));
|
||||
Object paths = get(compiler, "annotationProcessorPaths");
|
||||
if (paths instanceof Collection && !((Collection<?>) paths).isEmpty()) {
|
||||
try {
|
||||
Object useDepMgmt = get(compiler, "annotationProcessorPathsUseDepMgmt");
|
||||
field(json, "processorPath", processorPath(session, project, (Collection<?>) paths,
|
||||
Boolean.TRUE.equals(useDepMgmt)));
|
||||
} catch (Exception e) {
|
||||
problems.add("Cannot resolve the annotation processor path of " + goal + ": " + rootMessage(e));
|
||||
field(json, "processorPathError", rootMessage(e));
|
||||
}
|
||||
}
|
||||
if (json.charAt(json.length() - 1) == ',') json.setLength(json.length() - 1);
|
||||
json.append("}}");
|
||||
}
|
||||
|
||||
/** The classpaths of the resolved graph, in Maven's order: compile, runtime, test scopes. */
|
||||
private static void classpaths(DependencyNode root, List<String> compile, List<String> runtime, List<String> test) {
|
||||
List<DependencyNode> nodes = new ArrayList<>();
|
||||
collect(root, nodes, new HashSet<>());
|
||||
for (DependencyNode node : nodes) {
|
||||
if (node.getDependency() == null || node.getArtifact() == null) continue;
|
||||
File file = node.getArtifact().getFile();
|
||||
if (file == null) continue;
|
||||
String scope = node.getDependency().getScope();
|
||||
String path = file.getAbsolutePath();
|
||||
if (!"test".equals(scope) && !"runtime".equals(scope)) compile.add(path);
|
||||
if (!"test".equals(scope) && !"provided".equals(scope) && !"system".equals(scope)) runtime.add(path);
|
||||
test.add(path);
|
||||
}
|
||||
}
|
||||
|
||||
/** Pre-order, as Maven lists `project.getArtifacts()` for classpaths. */
|
||||
private static void collect(DependencyNode node, List<DependencyNode> out, Set<String> seen) {
|
||||
for (DependencyNode child : node.getChildren()) {
|
||||
Artifact a = child.getArtifact();
|
||||
String key = a == null ? String.valueOf(System.identityHashCode(child))
|
||||
: a.getGroupId() + ":" + a.getArtifactId() + ":" + a.getExtension() + ":" + a.getClassifier();
|
||||
if (seen.add(key)) out.add(child);
|
||||
}
|
||||
for (DependencyNode child : node.getChildren()) collect(child, out, seen);
|
||||
}
|
||||
|
||||
/**
|
||||
* A repository session that resolves reactor projects to their output directories, as the
|
||||
* IDE compiles against them: before (and without) any packaging, and even before they exist.
|
||||
*/
|
||||
private static RepositorySystemSession reactorSession(MavenSession session) {
|
||||
final Map<String, MavenProject> byKey = new HashMap<>();
|
||||
for (MavenProject p : session.getProjects())
|
||||
byKey.put(p.getGroupId() + ":" + p.getArtifactId() + ":" + p.getVersion(), p);
|
||||
final WorkspaceReader fallback = session.getRepositorySession().getWorkspaceReader();
|
||||
final WorkspaceRepository repository = new WorkspaceRepository("openidea-reactor");
|
||||
WorkspaceReader reader = new WorkspaceReader() {
|
||||
@Override public WorkspaceRepository getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
@Override public File findArtifact(Artifact artifact) {
|
||||
MavenProject p = byKey.get(artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getBaseVersion());
|
||||
if (p == null) return fallback == null ? null : fallback.findArtifact(artifact);
|
||||
if ("pom".equals(artifact.getExtension())) return p.getFile();
|
||||
boolean tests = "tests".equals(artifact.getClassifier()) || "test-jar".equals(artifact.getProperty("type", ""));
|
||||
File dir = new File(tests ? p.getBuild().getTestOutputDirectory() : p.getBuild().getOutputDirectory());
|
||||
dir.mkdirs();
|
||||
return dir;
|
||||
}
|
||||
|
||||
@Override public List<String> findVersions(Artifact artifact) {
|
||||
MavenProject p = byKey.get(artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getBaseVersion());
|
||||
if (p != null) return java.util.Collections.singletonList(p.getVersion());
|
||||
return fallback == null ? java.util.Collections.<String>emptyList() : fallback.findVersions(artifact);
|
||||
}
|
||||
};
|
||||
DefaultRepositorySystemSession copy = new DefaultRepositorySystemSession(session.getRepositorySession());
|
||||
copy.setWorkspaceReader(reader);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** maven-compiler-plugin's `annotationProcessorPaths`, resolved with their dependencies as the plugin does. */
|
||||
private List<String> processorPath(MavenSession session, MavenProject project, Collection<?> coordinates,
|
||||
boolean useDepMgmt) throws Exception {
|
||||
Map<String, String> managed = new HashMap<>();
|
||||
if (project.getDependencyManagement() != null)
|
||||
for (Dependency d : project.getDependencyManagement().getDependencies())
|
||||
managed.put(d.getGroupId() + ":" + d.getArtifactId(), d.getVersion());
|
||||
CollectRequest request = new CollectRequest();
|
||||
request.setRepositories(project.getRemoteProjectRepositories());
|
||||
for (Object c : coordinates) {
|
||||
String group = (String) get(c, "groupId");
|
||||
String artifact = (String) get(c, "artifactId");
|
||||
String version = (String) get(c, "version");
|
||||
if (version == null) version = managed.get(group + ":" + artifact);
|
||||
if (version == null) throw new IllegalStateException("No version for " + group + ":" + artifact);
|
||||
String classifier = (String) get(c, "classifier");
|
||||
String type = (String) get(c, "type");
|
||||
List<Exclusion> exclusions = new ArrayList<>();
|
||||
Object declared = get(c, "exclusions");
|
||||
if (declared instanceof Collection)
|
||||
for (Object e : (Collection<?>) declared)
|
||||
exclusions.add(new Exclusion((String) get(e, "groupId"), (String) get(e, "artifactId"), "*", "*"));
|
||||
DefaultArtifact a = new DefaultArtifact(group, artifact, classifier == null ? "" : classifier,
|
||||
type == null || "jar".equals(type) ? "jar" : type, version);
|
||||
request.addDependency(new org.eclipse.aether.graph.Dependency(a, "runtime", false, exclusions));
|
||||
}
|
||||
if (useDepMgmt && project.getDependencyManagement() != null) {
|
||||
for (Dependency d : project.getDependencyManagement().getDependencies()) {
|
||||
request.addManagedDependency(new org.eclipse.aether.graph.Dependency(new DefaultArtifact(d.getGroupId(),
|
||||
d.getArtifactId(), d.getClassifier() == null ? "" : d.getClassifier(),
|
||||
d.getType() == null ? "jar" : d.getType(), d.getVersion()), d.getScope()));
|
||||
}
|
||||
}
|
||||
DependencyResult result =
|
||||
repositories.resolveDependencies(reactorSession(session), new DependencyRequest(request, null));
|
||||
Set<String> out = new LinkedHashSet<>();
|
||||
for (ArtifactResult r : result.getArtifactResults())
|
||||
if (r.getArtifact() != null && r.getArtifact().getFile() != null) out.add(r.getArtifact().getFile().getAbsolutePath());
|
||||
return new ArrayList<>(out);
|
||||
}
|
||||
|
||||
private static org.apache.maven.project.DependencyResolutionException cause(Throwable e) {
|
||||
for (Throwable t = e; t != null; t = t.getCause())
|
||||
if (t instanceof org.apache.maven.project.DependencyResolutionException)
|
||||
return (org.apache.maven.project.DependencyResolutionException) t;
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String rootMessage(Throwable e) {
|
||||
Throwable t = e;
|
||||
while (t.getCause() != null && t.getCause() != t) t = t.getCause();
|
||||
return t.getMessage() == null ? t.toString() : t.getMessage();
|
||||
}
|
||||
|
||||
/** The first of `names` that a field of the mojo (or its superclasses) has, read reflectively. */
|
||||
private static Object get(Object target, String... names) {
|
||||
for (String name : names) {
|
||||
for (Class<?> c = target.getClass(); c != null && c != Object.class; c = c.getSuperclass()) {
|
||||
try {
|
||||
Field f = c.getDeclaredField(name);
|
||||
f.setAccessible(true);
|
||||
Object value = f.get(target);
|
||||
if (value != null || names.length == 1) return value;
|
||||
break;
|
||||
} catch (NoSuchFieldException e) {
|
||||
// Try the superclass.
|
||||
} catch (IllegalAccessException | RuntimeException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void field(StringBuilder json, String name, Object value) {
|
||||
if (value == null) return;
|
||||
json.append(q(name)).append(':').append(value(value)).append(',');
|
||||
}
|
||||
|
||||
private static String value(Object value) {
|
||||
if (value == null) return "null";
|
||||
if (value instanceof Boolean || value instanceof Number) return value.toString();
|
||||
if (value instanceof File) return q(((File) value).getAbsolutePath());
|
||||
if (value instanceof Collection) {
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
for (Object o : (Collection<?>) value) {
|
||||
if (b.length() > 1) b.append(',');
|
||||
b.append(value(o));
|
||||
}
|
||||
return b.append(']').toString();
|
||||
}
|
||||
if (value instanceof Object[]) return value(Arrays.asList((Object[]) value));
|
||||
if (value instanceof Map) {
|
||||
StringBuilder b = new StringBuilder("{");
|
||||
for (Map.Entry<?, ?> e : new LinkedHashMap<>((Map<?, ?>) value).entrySet()) {
|
||||
if (b.length() > 1) b.append(',');
|
||||
b.append(q(String.valueOf(e.getKey()))).append(':').append(q(e.getValue() == null ? null : String.valueOf(e.getValue())));
|
||||
}
|
||||
return b.append('}').toString();
|
||||
}
|
||||
return q(value.toString());
|
||||
}
|
||||
|
||||
private static String strings(Collection<String> values) {
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
if (values != null) {
|
||||
for (String s : values) {
|
||||
if (b.length() > 1) b.append(',');
|
||||
b.append(q(s));
|
||||
}
|
||||
}
|
||||
return b.append(']').toString();
|
||||
}
|
||||
|
||||
static String q(String s) {
|
||||
if (s == null) return "null";
|
||||
StringBuilder b = new StringBuilder(s.length() + 2).append('"');
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
switch (c) {
|
||||
case '"': b.append("\\\""); break;
|
||||
case '\\': b.append("\\\\"); break;
|
||||
case '\n': b.append("\\n"); break;
|
||||
case '\r': b.append("\\r"); break;
|
||||
case '\t': b.append("\\t"); break;
|
||||
default:
|
||||
if (c < 0x20) b.append(String.format("\\u%04x", (int) c));
|
||||
else b.append(c);
|
||||
}
|
||||
}
|
||||
return b.append('"').toString();
|
||||
}
|
||||
}
|
||||
@@ -1,459 +0,0 @@
|
||||
package ai.openidea.javac;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.DiagnosticListener;
|
||||
import javax.tools.FileObject;
|
||||
import javax.tools.ForwardingJavaFileManager;
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.JavaFileManager;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.StandardJavaFileManager;
|
||||
import javax.tools.StandardLocation;
|
||||
import javax.tools.ToolProvider;
|
||||
|
||||
/**
|
||||
* A resident javac for the IDE's Java build: one JVM per JDK, compiling requests one at a
|
||||
* time with the JDK's own compiler, in process, annotation processors included.
|
||||
*
|
||||
* <p>Protocol: one JSON object per line. Requests on stdin:
|
||||
* {@code {"id":1,"op":"compile","options":[...],"sources":[...],"encoding":"UTF-8"}},
|
||||
* {@code {"op":"cancel","id":1}}, {@code {"op":"exit"}}. Replies on stdout, all carrying the
|
||||
* request {@code id}: {@code diagnostic} (severity, path, 1-based line, UTF-16 column and end,
|
||||
* code, message), {@code output} (a class or resource file written, with the source it came
|
||||
* from), {@code generated} (a source an annotation processor wrote), {@code output-text}
|
||||
* (javac's own printed text), then one {@code done} (success, cancelled).
|
||||
*/
|
||||
public final class Server {
|
||||
private static final Object OUT_LOCK = new Object();
|
||||
private static PrintWriter out;
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
out = new PrintWriter(new OutputStreamWriter(System.out, StandardCharsets.UTF_8), false);
|
||||
// Anything else printing to stdout would break the protocol.
|
||||
System.setOut(System.err);
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
if (compiler == null) {
|
||||
send("{\"kind\":\"fatal\",\"message\":" + Json.quote("This Java runtime has no compiler (a JRE, not a JDK)") + "}");
|
||||
System.exit(2);
|
||||
}
|
||||
send("{\"kind\":\"ready\",\"version\":" + Json.quote(System.getProperty("java.version")) + "}");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
|
||||
final AtomicReference<Request> running = new AtomicReference<>();
|
||||
final java.util.concurrent.BlockingQueue<Request> queue = new java.util.concurrent.LinkedBlockingQueue<>();
|
||||
Thread worker = new Thread(() -> {
|
||||
while (true) {
|
||||
Request request;
|
||||
try {
|
||||
request = queue.take();
|
||||
} catch (InterruptedException e) {
|
||||
return;
|
||||
}
|
||||
if (request.exit) return;
|
||||
running.set(request);
|
||||
try {
|
||||
compile(compiler, request);
|
||||
} catch (Throwable t) {
|
||||
StringWriter trace = new StringWriter();
|
||||
t.printStackTrace(new PrintWriter(trace));
|
||||
send("{\"id\":" + request.id + ",\"kind\":\"diagnostic\",\"severity\":\"error\",\"message\":"
|
||||
+ Json.quote("javac crashed: " + trace) + "}");
|
||||
send("{\"id\":" + request.id + ",\"kind\":\"done\",\"success\":false,\"cancelled\":false}");
|
||||
} finally {
|
||||
running.set(null);
|
||||
}
|
||||
}
|
||||
}, "javac");
|
||||
worker.start();
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
if (line.trim().isEmpty()) continue;
|
||||
Map<String, Object> message;
|
||||
try {
|
||||
message = Json.parseObject(line);
|
||||
} catch (RuntimeException e) {
|
||||
send("{\"kind\":\"fatal\",\"message\":" + Json.quote("Bad request: " + e.getMessage()) + "}");
|
||||
continue;
|
||||
}
|
||||
String op = (String) message.get("op");
|
||||
if ("cancel".equals(op)) {
|
||||
Request current = running.get();
|
||||
long id = ((Number) message.get("id")).longValue();
|
||||
if (current != null && current.id == id) current.cancelled = true;
|
||||
for (Request queued : queue) if (queued.id == id) queued.cancelled = true;
|
||||
} else if ("exit".equals(op)) {
|
||||
break;
|
||||
} else if ("compile".equals(op)) {
|
||||
queue.add(Request.of(message));
|
||||
}
|
||||
}
|
||||
Request exit = new Request();
|
||||
exit.exit = true;
|
||||
// Requests already sent finish first; the host cancels the ones it no longer wants.
|
||||
queue.add(exit);
|
||||
try {
|
||||
worker.join();
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
static void send(String json) {
|
||||
synchronized (OUT_LOCK) {
|
||||
out.print(json);
|
||||
out.print('\n');
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
|
||||
static final class Request {
|
||||
long id;
|
||||
List<String> options = new ArrayList<>();
|
||||
List<String> sources = new ArrayList<>();
|
||||
String encoding;
|
||||
volatile boolean cancelled;
|
||||
boolean exit;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static Request of(Map<String, Object> message) {
|
||||
Request r = new Request();
|
||||
r.id = ((Number) message.get("id")).longValue();
|
||||
Object options = message.get("options");
|
||||
if (options != null) for (Object o : (List<Object>) options) r.options.add((String) o);
|
||||
Object sources = message.get("sources");
|
||||
if (sources != null) for (Object o : (List<Object>) sources) r.sources.add((String) o);
|
||||
r.encoding = (String) message.get("encoding");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
/** Thrown from the task listener to stop a cancelled compilation. */
|
||||
static final class Cancelled extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
Cancelled() {
|
||||
super("cancelled", null, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
private static void compile(JavaCompiler compiler, final Request request) throws IOException {
|
||||
final long id = request.id;
|
||||
if (request.cancelled) {
|
||||
send("{\"id\":" + id + ",\"kind\":\"done\",\"success\":false,\"cancelled\":true}");
|
||||
return;
|
||||
}
|
||||
Charset charset = request.encoding == null ? StandardCharsets.UTF_8 : Charset.forName(request.encoding);
|
||||
final int[] errors = {0};
|
||||
DiagnosticListener<JavaFileObject> diagnostics = d -> {
|
||||
if (d.getKind() == Diagnostic.Kind.ERROR) errors[0]++;
|
||||
send(diagnostic(id, d));
|
||||
};
|
||||
StandardJavaFileManager standard = compiler.getStandardFileManager(diagnostics, Locale.ROOT, charset);
|
||||
JavaFileManager manager = new Recording(standard, id);
|
||||
List<File> files = new ArrayList<>();
|
||||
for (String source : request.sources) files.add(new File(source));
|
||||
Iterable<? extends JavaFileObject> units = standard.getJavaFileObjectsFromFiles(files);
|
||||
StringWriter printed = new StringWriter();
|
||||
boolean success = false;
|
||||
boolean cancelled = false;
|
||||
try {
|
||||
JavaCompiler.CompilationTask task =
|
||||
compiler.getTask(printed, manager, diagnostics, request.options, null, units);
|
||||
stopWhenCancelled(task, request);
|
||||
success = Boolean.TRUE.equals(task.call()) && errors[0] == 0;
|
||||
} catch (RuntimeException e) {
|
||||
if (isCancelled(e)) {
|
||||
cancelled = true;
|
||||
} else if (e instanceof IllegalArgumentException) {
|
||||
// An option javac doesn't know (a newer --release than this JDK has).
|
||||
send("{\"id\":" + id + ",\"kind\":\"diagnostic\",\"severity\":\"error\",\"message\":"
|
||||
+ Json.quote(e.getMessage()) + "}");
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
manager.close();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
String text = printed.toString();
|
||||
if (!text.isEmpty()) send("{\"id\":" + id + ",\"kind\":\"output-text\",\"text\":" + Json.quote(text) + "}");
|
||||
send("{\"id\":" + id + ",\"kind\":\"done\",\"success\":" + success + ",\"cancelled\":" + cancelled + "}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the compilation at its next phase once {@code request} is cancelled, through
|
||||
* {@code com.sun.source.util.TaskListener} (reflectively: Java 8's {@code --release} API has no
|
||||
* {@code jdk.compiler}).
|
||||
*/
|
||||
private static void stopWhenCancelled(JavaCompiler.CompilationTask task, final Request request) {
|
||||
try {
|
||||
Class<?> listener = Class.forName("com.sun.source.util.TaskListener", false, task.getClass().getClassLoader());
|
||||
Object proxy = java.lang.reflect.Proxy.newProxyInstance(listener.getClassLoader(), new Class<?>[] {listener},
|
||||
(self, method, args) -> {
|
||||
if (method.getDeclaringClass() == Object.class) {
|
||||
switch (method.getName()) {
|
||||
case "hashCode": return System.identityHashCode(self);
|
||||
case "equals": return self == args[0];
|
||||
default: return "cancellation listener";
|
||||
}
|
||||
}
|
||||
if (request.cancelled) throw new Cancelled();
|
||||
return null;
|
||||
});
|
||||
task.getClass().getMethod("addTaskListener", listener).invoke(task, proxy);
|
||||
} catch (ReflectiveOperationException | RuntimeException e) {
|
||||
// Not javac's task: cancellation then waits for the compilation to end.
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isCancelled(Throwable e) {
|
||||
for (Throwable t = e; t != null; t = t.getCause()) if (t instanceof Cancelled) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String diagnostic(long id, Diagnostic<? extends JavaFileObject> d) {
|
||||
StringBuilder json = new StringBuilder("{\"id\":").append(id).append(",\"kind\":\"diagnostic\",\"severity\":");
|
||||
String severity;
|
||||
switch (d.getKind()) {
|
||||
case ERROR: severity = "error"; break;
|
||||
case WARNING:
|
||||
case MANDATORY_WARNING: severity = "warning"; break;
|
||||
default: severity = "info";
|
||||
}
|
||||
json.append(Json.quote(severity));
|
||||
JavaFileObject source = d.getSource();
|
||||
if (source != null) {
|
||||
json.append(",\"path\":").append(Json.quote(path(source.toUri())));
|
||||
long start = d.getStartPosition();
|
||||
long end = d.getEndPosition();
|
||||
int[] startCol = start >= 0 ? lineColumn(source, start) : null;
|
||||
int[] endCol = end >= 0 ? lineColumn(source, end) : null;
|
||||
if (startCol != null) json.append(",\"line\":").append(startCol[0]).append(",\"column\":").append(startCol[1]);
|
||||
else if (d.getLineNumber() > 0) json.append(",\"line\":").append(d.getLineNumber());
|
||||
if (endCol != null) json.append(",\"endLine\":").append(endCol[0]).append(",\"endColumn\":").append(endCol[1]);
|
||||
}
|
||||
if (d.getCode() != null) json.append(",\"code\":").append(Json.quote(d.getCode()));
|
||||
json.append(",\"message\":").append(Json.quote(d.getMessage(Locale.ROOT)));
|
||||
return json.append('}').toString();
|
||||
}
|
||||
|
||||
/** 1-based line and 0-based UTF-16 column of a char offset (Java chars are UTF-16 units). */
|
||||
private static int[] lineColumn(JavaFileObject source, long offset) {
|
||||
CharSequence text;
|
||||
try {
|
||||
text = source.getCharContent(true);
|
||||
} catch (IOException | RuntimeException e) {
|
||||
return null;
|
||||
}
|
||||
if (offset > text.length()) return null;
|
||||
int line = 1;
|
||||
int lineStart = 0;
|
||||
for (int i = 0; i < offset; i++) {
|
||||
char c = text.charAt(i);
|
||||
if (c == '\n' || (c == '\r' && (i + 1 >= text.length() || text.charAt(i + 1) != '\n'))) {
|
||||
line++;
|
||||
lineStart = i + 1;
|
||||
}
|
||||
}
|
||||
return new int[] {line, (int) offset - lineStart};
|
||||
}
|
||||
|
||||
static String path(URI uri) {
|
||||
if ("file".equals(uri.getScheme())) return new File(uri).getPath();
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
/** Reports every file the compiler writes and the source it came from. */
|
||||
static final class Recording extends ForwardingJavaFileManager<JavaFileManager> {
|
||||
private final long id;
|
||||
|
||||
Recording(JavaFileManager manager, long id) {
|
||||
super(manager);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaFileObject getJavaFileForOutput(Location location, String className, JavaFileObject.Kind kind,
|
||||
FileObject sibling) throws IOException {
|
||||
JavaFileObject file = super.getJavaFileForOutput(location, className, kind, sibling);
|
||||
report(location, file, sibling, kind == JavaFileObject.Kind.SOURCE);
|
||||
return file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileObject getFileForOutput(Location location, String packageName, String relativeName,
|
||||
FileObject sibling) throws IOException {
|
||||
FileObject file = super.getFileForOutput(location, packageName, relativeName, sibling);
|
||||
report(location, file, sibling, location == StandardLocation.SOURCE_OUTPUT);
|
||||
return file;
|
||||
}
|
||||
|
||||
private void report(Location location, FileObject file, FileObject sibling, boolean generatedSource) {
|
||||
StringBuilder json = new StringBuilder("{\"id\":").append(id).append(",\"kind\":")
|
||||
.append(Json.quote(generatedSource ? "generated" : "output"))
|
||||
.append(",\"path\":").append(Json.quote(path(file.toUri())));
|
||||
if (sibling != null && sibling.toUri().getScheme() != null)
|
||||
json.append(",\"source\":").append(Json.quote(path(sibling.toUri())));
|
||||
json.append(",\"location\":").append(Json.quote(location.getName()));
|
||||
send(json.append('}').toString());
|
||||
}
|
||||
}
|
||||
|
||||
/** Just enough JSON for the protocol: objects, arrays, strings, numbers, booleans, null. */
|
||||
static final class Json {
|
||||
private final String text;
|
||||
private int at;
|
||||
|
||||
private Json(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static Map<String, Object> parseObject(String text) {
|
||||
Json json = new Json(text);
|
||||
Object value = json.value();
|
||||
json.space();
|
||||
if (!(value instanceof Map) || json.at != text.length()) throw new IllegalArgumentException("not one JSON object");
|
||||
return (Map<String, Object>) value;
|
||||
}
|
||||
|
||||
static String quote(String s) {
|
||||
if (s == null) return "null";
|
||||
StringBuilder b = new StringBuilder(s.length() + 2).append('"');
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
switch (c) {
|
||||
case '"': b.append("\\\""); break;
|
||||
case '\\': b.append("\\\\"); break;
|
||||
case '\n': b.append("\\n"); break;
|
||||
case '\r': b.append("\\r"); break;
|
||||
case '\t': b.append("\\t"); break;
|
||||
default:
|
||||
if (c < 0x20) b.append(String.format("\\u%04x", (int) c));
|
||||
else b.append(c);
|
||||
}
|
||||
}
|
||||
return b.append('"').toString();
|
||||
}
|
||||
|
||||
private void space() {
|
||||
while (at < text.length() && Character.isWhitespace(text.charAt(at))) at++;
|
||||
}
|
||||
|
||||
private char peek() {
|
||||
space();
|
||||
if (at >= text.length()) throw new IllegalArgumentException("unexpected end");
|
||||
return text.charAt(at);
|
||||
}
|
||||
|
||||
private void expect(char c) {
|
||||
if (peek() != c) throw new IllegalArgumentException("expected '" + c + "' at " + at);
|
||||
at++;
|
||||
}
|
||||
|
||||
private Object value() {
|
||||
char c = peek();
|
||||
if (c == '{') {
|
||||
at++;
|
||||
Map<String, Object> map = new java.util.LinkedHashMap<>();
|
||||
if (peek() == '}') {
|
||||
at++;
|
||||
return map;
|
||||
}
|
||||
while (true) {
|
||||
String key = string();
|
||||
expect(':');
|
||||
map.put(key, value());
|
||||
if (peek() == ',') {
|
||||
at++;
|
||||
continue;
|
||||
}
|
||||
expect('}');
|
||||
return map;
|
||||
}
|
||||
}
|
||||
if (c == '[') {
|
||||
at++;
|
||||
List<Object> list = new ArrayList<>();
|
||||
if (peek() == ']') {
|
||||
at++;
|
||||
return list;
|
||||
}
|
||||
while (true) {
|
||||
list.add(value());
|
||||
if (peek() == ',') {
|
||||
at++;
|
||||
continue;
|
||||
}
|
||||
expect(']');
|
||||
return list;
|
||||
}
|
||||
}
|
||||
if (c == '"') return string();
|
||||
if (text.startsWith("true", at)) {
|
||||
at += 4;
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if (text.startsWith("false", at)) {
|
||||
at += 5;
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
if (text.startsWith("null", at)) {
|
||||
at += 4;
|
||||
return null;
|
||||
}
|
||||
int start = at;
|
||||
while (at < text.length() && "+-0123456789.eE".indexOf(text.charAt(at)) >= 0) at++;
|
||||
if (start == at) throw new IllegalArgumentException("unexpected '" + c + "' at " + at);
|
||||
String number = text.substring(start, at);
|
||||
return number.contains(".") || number.contains("e") || number.contains("E")
|
||||
? (Object) Double.parseDouble(number) : (Object) Long.parseLong(number);
|
||||
}
|
||||
|
||||
private String string() {
|
||||
expect('"');
|
||||
StringBuilder b = new StringBuilder();
|
||||
while (true) {
|
||||
if (at >= text.length()) throw new IllegalArgumentException("unterminated string");
|
||||
char c = text.charAt(at++);
|
||||
if (c == '"') return b.toString();
|
||||
if (c != '\\') {
|
||||
b.append(c);
|
||||
continue;
|
||||
}
|
||||
char e = text.charAt(at++);
|
||||
switch (e) {
|
||||
case 'n': b.append('\n'); break;
|
||||
case 'r': b.append('\r'); break;
|
||||
case 't': b.append('\t'); break;
|
||||
case 'b': b.append('\b'); break;
|
||||
case 'f': b.append('\f'); break;
|
||||
case 'u':
|
||||
b.append((char) Integer.parseInt(text.substring(at, at + 4), 16));
|
||||
at += 4;
|
||||
break;
|
||||
default: b.append(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Server() {
|
||||
}
|
||||
}
|
||||
@@ -334,10 +334,6 @@ pub struct CloseContext {
|
||||
pub quitting: bool,
|
||||
/// Number of open project windows (settings windows excluded), including the caller.
|
||||
pub windows: u32,
|
||||
/// Whether this window currently has auxiliary document windows that must settle first.
|
||||
pub has_document_windows: bool,
|
||||
/// Whether this close runs alongside other windows or on a background tab (prompts serialize and raise).
|
||||
pub batch: bool,
|
||||
}
|
||||
|
||||
#[desktop_command(trust = always)]
|
||||
@@ -354,40 +350,10 @@ pub fn window_close_context(app: AppHandle, window: Window, windows: State<'_, W
|
||||
Some(keeper) if pending.len() > 1 && keeper == window.label() => all.len() - pending.len() + 1,
|
||||
_ => all.len(),
|
||||
};
|
||||
let quitting = windows.quitting();
|
||||
let has_document_windows = !windows::document_windows(&app, window.label()).is_empty();
|
||||
let hidden_tab = windows.groups.lock().group(window.label()).is_some_and(|g| g.selected != window.label());
|
||||
let batch = quitting || pending.len() > 1 || windows.in_tab_close_batch(window.label()) || hidden_tab;
|
||||
CloseContext { quitting, windows: count as u32, has_document_windows, batch }
|
||||
CloseContext { quitting: windows.quitting(), windows: count as u32 }
|
||||
}
|
||||
|
||||
/// Acquires the interactive prompt turn for a batch close and brings this window forward.
|
||||
/// Returns `false` if the batch was cancelled while waiting.
|
||||
#[desktop_command(trust = always)]
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn window_begin_prompt(app: AppHandle, window: WebviewWindow) -> bool {
|
||||
crate::window_groups::begin_prompt(&app, &window).await
|
||||
}
|
||||
|
||||
/// Releases the interactive prompt turn held by this window.
|
||||
#[desktop_command(trust = always)]
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn window_end_prompt(app: AppHandle, window: Window) {
|
||||
crate::window_groups::end_prompt(&app, window.label());
|
||||
}
|
||||
|
||||
/// Signals that this window passed its close checks and waits for peers closing in the same
|
||||
/// batch/tab group so they hide together in one frame. Returns `false` if the batch was cancelled.
|
||||
#[desktop_command(trust = always)]
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn window_ready_to_close(app: AppHandle, window: WebviewWindow) -> bool {
|
||||
crate::window_groups::ready_to_close(&app, &window).await
|
||||
}
|
||||
|
||||
/// Quits: closes every window in parallel, each of which runs its own unsaved-changes check.
|
||||
/// Quits: closes every window, each of which runs its own unsaved-changes check.
|
||||
#[desktop_command(trust = always)]
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
@@ -396,17 +362,15 @@ pub fn app_quit(app: AppHandle, windows: State<'_, WindowsState>) {
|
||||
return;
|
||||
}
|
||||
windows.set_quitting(true);
|
||||
windows::start_quit(&app);
|
||||
windows::continue_quit(&app, None);
|
||||
}
|
||||
|
||||
/// A window vetoed the quit (user cancelled its unsaved-changes prompt).
|
||||
#[desktop_command(trust = always)]
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn app_cancel_quit(app: AppHandle, window: Window, windows: State<'_, WindowsState>) {
|
||||
pub fn app_cancel_quit(app: AppHandle, windows: State<'_, WindowsState>) {
|
||||
windows.set_quitting(false);
|
||||
windows.abort_all_closing(Some(window.label()));
|
||||
windows.close_settled(window.label());
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let _ = crate::window_groups::persist(&app).await;
|
||||
});
|
||||
@@ -962,11 +926,9 @@ ide_command::desktop_domain!(
|
||||
menu_model,
|
||||
menu_refresh,
|
||||
menu_set_disabled,
|
||||
window_begin_prompt,
|
||||
window_close_context,
|
||||
window_complete_launch,
|
||||
window_cycle,
|
||||
window_end_prompt,
|
||||
window_flash_taskbar,
|
||||
window_is_fullscreen,
|
||||
window_new,
|
||||
@@ -980,7 +942,6 @@ ide_command::desktop_domain!(
|
||||
window_open_projects,
|
||||
window_open_remote,
|
||||
window_open_settings,
|
||||
window_ready_to_close,
|
||||
window_set_smooth_scrolling,
|
||||
window_set_titlebar_height,
|
||||
window_take_launch,
|
||||
|
||||
@@ -49,6 +49,7 @@ pub async fn window_group_detach(window: WebviewWindow, label: String) -> IdeRes
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn window_group_close(window: WebviewWindow, label: String) -> IdeResult<()> {
|
||||
groups::select(window.app_handle(), window.label(), &label)?;
|
||||
window
|
||||
.app_handle()
|
||||
.get_webview_window(&label)
|
||||
|
||||
@@ -126,26 +126,6 @@ pub fn move_tab_to_new_window(window: &WebviewWindow) -> tauri::Result<()> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Hides `windows` together in a single main-thread turn so a closing window or tab group
|
||||
/// disappears at once instead of flipping through remaining tabs while webviews tear down.
|
||||
/// Native fullscreen windows are left for AppKit's own Space close transition.
|
||||
pub fn hide_windows(windows: Vec<WebviewWindow>) {
|
||||
if windows.is_empty() {
|
||||
return;
|
||||
}
|
||||
let first = windows[0].clone();
|
||||
let _ = on_main(&first, move || {
|
||||
for window in &windows {
|
||||
if window.is_fullscreen().unwrap_or(false) {
|
||||
continue;
|
||||
}
|
||||
if let Some(native) = native(window) {
|
||||
native.orderOut(None);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn has_tab_bar(view: &objc2_app_kit::NSView) -> bool {
|
||||
let class = view.class().name().to_string_lossy();
|
||||
class.contains("TabBar") || view.subviews().iter().any(|v| has_tab_bar(&v))
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::{
|
||||
use ide_core::{IdeError, IdeEvent, IdeResult};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
use std::collections::HashSet;
|
||||
use std::collections::VecDeque;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::atomic::Ordering;
|
||||
use tauri::{AppHandle, Manager, WebviewWindow};
|
||||
@@ -169,59 +169,35 @@ pub fn detach(app: &AppHandle, caller: &str) -> IdeResult<()> {
|
||||
pub fn destroyed(app: &AppHandle, caller: &str) {
|
||||
let Some(state) = app.try_state::<WindowsState>() else { return };
|
||||
let next = state.groups.lock().detach(caller);
|
||||
let batch_done_keep = {
|
||||
let mut batch = state.tab_closes.lock();
|
||||
if let Some(b) = batch.as_mut()
|
||||
&& b.pending.remove(caller)
|
||||
&& b.pending.is_empty()
|
||||
{
|
||||
Some(batch.take().unwrap().keep)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
};
|
||||
let next_closing = next.as_deref().is_some_and(|label| state.is_closing(label));
|
||||
let more_closing = state.has_other_pending_closes(caller);
|
||||
if !state.quitting() {
|
||||
if let Some(keep) = batch_done_keep {
|
||||
if let Some(window) = app.get_webview_window(&keep)
|
||||
&& !window.is_focused().unwrap_or(false)
|
||||
{
|
||||
windows::focus(&window);
|
||||
}
|
||||
} else if !next_closing && let Some(window) = next.as_deref().and_then(|label| app.get_webview_window(label)) {
|
||||
if let Some(window) = next.and_then(|label| app.get_webview_window(&label)) {
|
||||
windows::focus(&window);
|
||||
}
|
||||
if !more_closing {
|
||||
let app = app.clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let _ = persist(&app).await;
|
||||
});
|
||||
let app = app.clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let _ = persist(&app).await;
|
||||
});
|
||||
}
|
||||
changed(app);
|
||||
let advance = state.tab_closes.lock().as_mut().is_some_and(|batch| {
|
||||
let closing = batch.pending.front().is_some_and(|l| l == caller);
|
||||
if closing {
|
||||
batch.pending.pop_front();
|
||||
}
|
||||
}
|
||||
if !next_closing || !more_closing {
|
||||
changed(app);
|
||||
closing
|
||||
});
|
||||
if advance {
|
||||
close_next(app);
|
||||
}
|
||||
}
|
||||
|
||||
/// Tabs closing together in a batch (Close Other / Left / Right Tabs), keeping `keep`.
|
||||
/// Tabs left to close; the first one is closing now.
|
||||
pub struct TabCloses {
|
||||
pub(crate) keep: String,
|
||||
pub(crate) pending: HashSet<String>,
|
||||
keep: String,
|
||||
pending: VecDeque<String>,
|
||||
}
|
||||
|
||||
impl TabCloses {
|
||||
pub(crate) fn contains(&self, label: &str) -> bool {
|
||||
self.pending.contains(label)
|
||||
}
|
||||
|
||||
pub(crate) fn has_other(&self, exclude: &str) -> bool {
|
||||
self.pending.iter().any(|l| l != exclude)
|
||||
}
|
||||
}
|
||||
|
||||
/// Closes `labels` in parallel without flipping tabs; any tab that needs a confirmation prompt
|
||||
/// acquires the prompt turn and raises itself, and `keep` stays selected when the batch finishes.
|
||||
/// Closes `labels` one at a time so each project's unsaved-changes prompt is shown in turn, then selects `keep`.
|
||||
pub fn close_tabs(app: &AppHandle, caller: &str, keep: &str, labels: Vec<String>) -> IdeResult<()> {
|
||||
let state = app.state::<WindowsState>();
|
||||
let members = state
|
||||
@@ -233,235 +209,55 @@ pub fn close_tabs(app: &AppHandle, caller: &str, keep: &str, labels: Vec<String>
|
||||
if !members.iter().any(|m| m == keep) {
|
||||
return Err(IdeError::invalid("The window is not in this group"));
|
||||
}
|
||||
let targets: Vec<String> = members.into_iter().filter(|m| m != keep && labels.contains(m)).collect();
|
||||
if targets.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let pending: HashSet<String> = targets.iter().cloned().collect();
|
||||
let pending = members.into_iter().filter(|m| m != keep && labels.contains(m)).collect();
|
||||
*state.tab_closes.lock() = Some(TabCloses { keep: keep.to_owned(), pending });
|
||||
// Pre-register every target before invoking `close()` so early responders see the full cohort.
|
||||
for label in &targets {
|
||||
state.close_requested(label);
|
||||
}
|
||||
let mut any_sent = false;
|
||||
for label in targets {
|
||||
if let Some(window) = app.get_webview_window(&label)
|
||||
&& window.close().is_ok()
|
||||
{
|
||||
any_sent = true;
|
||||
continue;
|
||||
}
|
||||
if let Some(b) = state.tab_closes.lock().as_mut() {
|
||||
b.pending.remove(&label);
|
||||
}
|
||||
state.close_settled(&label);
|
||||
}
|
||||
if !any_sent {
|
||||
*state.tab_closes.lock() = None;
|
||||
if let Some(window) = app.get_webview_window(keep) {
|
||||
windows::focus(&window);
|
||||
}
|
||||
}
|
||||
close_next(app);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The closing tab stayed open (either its prompt was cancelled or it returned to Welcome).
|
||||
/// The closing tab's project vetoed (its unsaved-changes prompt was cancelled): leave the rest open.
|
||||
pub fn cancel_close(app: &AppHandle, caller: &str) {
|
||||
let state = app.state::<WindowsState>();
|
||||
let cancelled_batch = {
|
||||
let mut batch = state.tab_closes.lock();
|
||||
if batch.as_ref().is_some_and(|b| b.pending.contains(caller)) { batch.take() } else { None }
|
||||
};
|
||||
if let Some(batch) = cancelled_batch {
|
||||
// A vetoed Close Other/Left/Right Tabs leaves the remaining tabs open too.
|
||||
state.abort_batch(batch.pending.into_iter().filter(|l| l != caller));
|
||||
state.close_settled(caller);
|
||||
return;
|
||||
}
|
||||
state.close_settled(caller);
|
||||
// For a red-button group close where this tab stayed open (e.g. returned to Welcome),
|
||||
// select it so closing siblings disappear behind it without flashing.
|
||||
if state.groups.lock().group(caller).is_some()
|
||||
&& let Some(window) = app.get_webview_window(caller)
|
||||
{
|
||||
windows::focus(&window);
|
||||
}
|
||||
if !state.has_other_pending_closes(caller) && !state.quitting() {
|
||||
let app = app.clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let _ = persist(&app).await;
|
||||
});
|
||||
let mut batch = state.tab_closes.lock();
|
||||
if batch.as_ref().is_some_and(|b| b.pending.front().is_some_and(|l| l == caller)) {
|
||||
*batch = None;
|
||||
}
|
||||
}
|
||||
|
||||
/// Waits for the caller's interactive prompt turn in a parallel batch close and brings it forward.
|
||||
/// Returns `false` if the batch was cancelled while waiting (the caller should stay open quietly).
|
||||
pub async fn begin_prompt(app: &AppHandle, window: &WebviewWindow) -> bool {
|
||||
let label = window.label();
|
||||
fn close_next(app: &AppHandle) {
|
||||
let state = app.state::<WindowsState>();
|
||||
loop {
|
||||
let notified = state.close_notify.notified();
|
||||
tokio::pin!(notified);
|
||||
notified.as_mut().enable();
|
||||
|
||||
match state.try_acquire_prompt(label) {
|
||||
Ok(true) => {
|
||||
windows::focus(window);
|
||||
return true;
|
||||
let next = {
|
||||
let mut batch = state.tab_closes.lock();
|
||||
let Some(b) = batch.as_mut() else { return };
|
||||
match b.pending.front() {
|
||||
Some(label) => Ok(label.clone()),
|
||||
None => Err(batch.take().unwrap().keep),
|
||||
}
|
||||
Ok(false) => {
|
||||
notified.await;
|
||||
}
|
||||
Err(()) => {
|
||||
state.take_aborted(label);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn end_prompt(app: &AppHandle, caller: &str) {
|
||||
app.state::<WindowsState>().release_prompt(caller);
|
||||
}
|
||||
|
||||
/// Coordinates the final hide/destroy step across windows closing together.
|
||||
/// Returns `false` if the batch was cancelled while waiting (the caller must stay open).
|
||||
pub async fn ready_to_close(app: &AppHandle, window: &WebviewWindow) -> bool {
|
||||
let label = window.label();
|
||||
let state = app.state::<WindowsState>();
|
||||
if !state.mark_ready(label) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const BARRIER_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(3);
|
||||
const POLL_STEP: std::time::Duration = std::time::Duration::from_millis(250);
|
||||
let mut waited_idle = std::time::Duration::ZERO;
|
||||
let mut last_tick = std::time::Instant::now();
|
||||
|
||||
loop {
|
||||
let notified = state.close_notify.notified();
|
||||
tokio::pin!(notified);
|
||||
notified.as_mut().enable();
|
||||
|
||||
if state.take_aborted(label) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let (cohort, keep_label) = close_cohort(app, &state, label);
|
||||
let any_undecided =
|
||||
cohort.iter().any(|peer| peer != label && app.get_webview_window(peer).is_some() && !state.is_ready(peer));
|
||||
|
||||
if !any_undecided {
|
||||
finish_cohort_visuals(app, &state, label, &cohort, keep_label.as_deref());
|
||||
state.close_notify.notify_waiters();
|
||||
return true;
|
||||
}
|
||||
|
||||
match tokio::time::timeout(POLL_STEP, notified).await {
|
||||
Ok(()) => {
|
||||
waited_idle = std::time::Duration::ZERO;
|
||||
last_tick = std::time::Instant::now();
|
||||
}
|
||||
Err(_) => {
|
||||
// Never time out while another tab is waiting on the user's answer to a dialog.
|
||||
if state.has_prompt_holder() {
|
||||
waited_idle = std::time::Duration::ZERO;
|
||||
} else {
|
||||
waited_idle += last_tick.elapsed();
|
||||
if waited_idle >= BARRIER_TIMEOUT {
|
||||
let single = vec![label.to_owned()];
|
||||
if !state.claim_hide(&single).is_empty() && state.groups.lock().group(label).is_none() {
|
||||
windows::hide_windows(vec![window.clone()]);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
match next {
|
||||
Ok(label) => {
|
||||
if let Some(window) = app.get_webview_window(&label) {
|
||||
windows::focus(&window);
|
||||
if window.close().is_ok() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
last_tick = std::time::Instant::now();
|
||||
if let Some(b) = state.tab_closes.lock().as_mut() {
|
||||
b.pending.pop_front();
|
||||
}
|
||||
}
|
||||
Err(keep) => {
|
||||
if let Some(window) = app.get_webview_window(&keep) {
|
||||
windows::focus(&window);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn close_cohort(app: &AppHandle, state: &WindowsState, label: &str) -> (Vec<String>, Option<String>) {
|
||||
if state.quitting() {
|
||||
let pending = state.pending_closes();
|
||||
let mut cohort: Vec<String> = windows::project_window_labels(app)
|
||||
.into_iter()
|
||||
.filter(|l| l == label || pending.iter().any(|p| p == l))
|
||||
.collect();
|
||||
if !cohort.iter().any(|l| l == label) {
|
||||
cohort.push(label.to_owned());
|
||||
}
|
||||
return (cohort, None);
|
||||
}
|
||||
if let Some((keep, pending)) = state
|
||||
.tab_closes
|
||||
.lock()
|
||||
.as_ref()
|
||||
.filter(|b| b.pending.contains(label))
|
||||
.map(|b| (b.keep.clone(), b.pending.iter().cloned().collect::<Vec<_>>()))
|
||||
{
|
||||
return (pending, Some(keep));
|
||||
}
|
||||
let pending = state.pending_closes();
|
||||
let group_members = state.groups.lock().group(label).map(|g| g.members.clone());
|
||||
if let Some(members) = group_members {
|
||||
let mut cohort: Vec<String> =
|
||||
members.into_iter().filter(|m| m == label || pending.iter().any(|p| p == m)).collect();
|
||||
if !cohort.iter().any(|l| l == label) {
|
||||
cohort.push(label.to_owned());
|
||||
}
|
||||
return (cohort, None);
|
||||
}
|
||||
(vec![label.to_owned()], None)
|
||||
}
|
||||
|
||||
/// Applies the visual transition once every peer in `cohort` is ready to close:
|
||||
/// - Whole closing window or whole closing tab group (or quit): hide all of them in a single frame.
|
||||
/// - Partial tab group close (Close Other Tabs, single tab close, or keeper returning to Welcome):
|
||||
/// ensure a surviving tab is selected so the closing tabs tear down invisibly behind it.
|
||||
fn finish_cohort_visuals(
|
||||
app: &AppHandle,
|
||||
state: &WindowsState,
|
||||
label: &str,
|
||||
cohort: &[String],
|
||||
keep_label: Option<&str>,
|
||||
) {
|
||||
if state.quitting() {
|
||||
let to_hide = state.claim_hide(cohort);
|
||||
let windows: Vec<_> = to_hide.into_iter().filter_map(|l| app.get_webview_window(&l)).collect();
|
||||
windows::hide_windows(windows);
|
||||
return;
|
||||
}
|
||||
let group_snapshot = state.groups.lock().group(label).cloned();
|
||||
if let Some(group) = group_snapshot {
|
||||
let cohort_set: HashSet<&str> = cohort.iter().map(String::as_str).collect();
|
||||
let all_closing = group.members.iter().all(|m| cohort_set.contains(m.as_str()));
|
||||
if all_closing {
|
||||
let to_hide = state.claim_hide(&group.members);
|
||||
let windows: Vec<_> = to_hide.into_iter().filter_map(|l| app.get_webview_window(&l)).collect();
|
||||
windows::hide_windows(windows);
|
||||
} else {
|
||||
let survivor = keep_label
|
||||
.filter(|k| !cohort_set.contains(*k))
|
||||
.map(str::to_owned)
|
||||
.or_else(|| group.members.iter().find(|m| !cohort_set.contains(m.as_str())).cloned());
|
||||
// Only switch tabs if the currently visible tab is one of the closing ones.
|
||||
if cohort_set.contains(group.selected.as_str())
|
||||
&& let Some(survivor) = survivor
|
||||
&& !state.claim_hide(cohort).is_empty()
|
||||
&& let Some(window) = app.get_webview_window(&survivor)
|
||||
{
|
||||
windows::focus(&window);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let to_hide = state.claim_hide(cohort);
|
||||
let windows: Vec<_> = to_hide.into_iter().filter_map(|l| app.get_webview_window(&l)).collect();
|
||||
windows::hide_windows(windows);
|
||||
}
|
||||
}
|
||||
|
||||
/// Window labels in creation order: `main`, then `project-1`, `project-2`, ….
|
||||
fn labels_in_order(app: &AppHandle) -> Vec<String> {
|
||||
let mut labels: Vec<String> = app.webview_windows().into_keys().collect();
|
||||
|
||||
@@ -24,9 +24,8 @@ use ide_core::{IdeError, IdeResult};
|
||||
use parking_lot::Mutex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
|
||||
use tauri::utils::config::{Color, WindowConfig};
|
||||
use tauri::{AppHandle, Emitter, Manager, Theme, WebviewWindow, WebviewWindowBuilder};
|
||||
@@ -321,16 +320,15 @@ pub struct WindowsState {
|
||||
cli: Mutex<cli::Queue>,
|
||||
/// Most recently focused window label (menu events go there).
|
||||
last_focused: Mutex<Option<String>>,
|
||||
/// Set by Quit while windows close in parallel.
|
||||
/// Set by Quit while windows close one by one.
|
||||
quitting: AtomicBool,
|
||||
/// The last closed project opted out of Welcome; macOS keeps its app in the Dock.
|
||||
#[cfg(target_os = "macos")]
|
||||
pub keep_alive: AtomicBool,
|
||||
/// Coordinates parallel window/tab-group closes so clean tabs hide together in one frame
|
||||
/// and interactive prompts still run one at a time.
|
||||
close: Mutex<CloseState>,
|
||||
pub close_notify: Arc<tokio::sync::Notify>,
|
||||
/// Project tabs closing in parallel (Close Other Tabs and friends).
|
||||
/// Windows asked to close whose guards have not finished. AppKit closes a whole tab group at
|
||||
/// once, so its members ask together.
|
||||
close_requests: Mutex<Vec<String>>,
|
||||
/// Project tabs closing one by one (Close Other Tabs and friends).
|
||||
pub tab_closes: Mutex<Option<crate::window_groups::TabCloses>>,
|
||||
/// Relaunch once the quit completes (after installing an update).
|
||||
restart: AtomicBool,
|
||||
@@ -357,180 +355,20 @@ pub(crate) struct AuxGeometry {
|
||||
pub maximized: bool,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct CloseState {
|
||||
/// Windows asked to close whose guards have not finished. AppKit closes a whole tab group at
|
||||
/// once, so its members ask together; Quit and Close Other Tabs also close members in parallel.
|
||||
pending: Vec<String>,
|
||||
/// Members that passed their close guard and are waiting at the batch barrier before destroying.
|
||||
ready: HashSet<String>,
|
||||
/// Members whose batch was cancelled while they waited; they stay open.
|
||||
aborted: HashSet<String>,
|
||||
/// Windows already hidden as part of their closing cohort so hiding only runs once per batch.
|
||||
hidden: HashSet<String>,
|
||||
/// Window currently showing an interactive close dialog (at most one across a batch).
|
||||
prompt_holder: Option<String>,
|
||||
}
|
||||
|
||||
impl WindowsState {
|
||||
pub fn close_requested(&self, label: &str) {
|
||||
let mut close = self.close.lock();
|
||||
close.aborted.remove(label);
|
||||
close.ready.remove(label);
|
||||
close.hidden.remove(label);
|
||||
if !close.pending.iter().any(|l| l == label) {
|
||||
close.pending.push(label.to_owned());
|
||||
let mut requests = self.close_requests.lock();
|
||||
if !requests.iter().any(|l| l == label) {
|
||||
requests.push(label.to_owned());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn close_settled(&self, label: &str) {
|
||||
{
|
||||
let mut close = self.close.lock();
|
||||
close.pending.retain(|l| l != label);
|
||||
close.ready.remove(label);
|
||||
close.aborted.remove(label);
|
||||
close.hidden.remove(label);
|
||||
if close.prompt_holder.as_deref() == Some(label) {
|
||||
close.prompt_holder = None;
|
||||
}
|
||||
}
|
||||
self.close_notify.notify_waiters();
|
||||
self.close_requests.lock().retain(|l| l != label);
|
||||
}
|
||||
|
||||
pub fn pending_closes(&self) -> Vec<String> {
|
||||
self.close.lock().pending.clone()
|
||||
}
|
||||
|
||||
pub fn is_closing(&self, label: &str) -> bool {
|
||||
let in_close = {
|
||||
let close = self.close.lock();
|
||||
close.pending.iter().any(|l| l == label) || close.ready.contains(label)
|
||||
};
|
||||
in_close || self.in_tab_close_batch(label)
|
||||
}
|
||||
|
||||
pub fn has_other_pending_closes(&self, exclude: &str) -> bool {
|
||||
let other_pending = self.close.lock().pending.iter().any(|l| l != exclude);
|
||||
other_pending || self.tab_closes.lock().as_ref().is_some_and(|b| b.has_other(exclude))
|
||||
}
|
||||
|
||||
pub fn in_tab_close_batch(&self, label: &str) -> bool {
|
||||
self.tab_closes.lock().as_ref().is_some_and(|b| b.contains(label))
|
||||
}
|
||||
|
||||
/// Marks `label` ready to destroy. Returns `false` if its batch was already cancelled.
|
||||
pub fn mark_ready(&self, label: &str) -> bool {
|
||||
let ok = {
|
||||
let mut close = self.close.lock();
|
||||
if close.aborted.remove(label) {
|
||||
close.pending.retain(|l| l != label);
|
||||
close.ready.remove(label);
|
||||
close.hidden.remove(label);
|
||||
if close.prompt_holder.as_deref() == Some(label) {
|
||||
close.prompt_holder = None;
|
||||
}
|
||||
false
|
||||
} else {
|
||||
if close.prompt_holder.as_deref() == Some(label) {
|
||||
close.prompt_holder = None;
|
||||
}
|
||||
close.ready.insert(label.to_owned());
|
||||
true
|
||||
}
|
||||
};
|
||||
self.close_notify.notify_waiters();
|
||||
ok
|
||||
}
|
||||
|
||||
pub fn is_ready(&self, label: &str) -> bool {
|
||||
self.close.lock().ready.contains(label)
|
||||
}
|
||||
|
||||
pub fn take_aborted(&self, label: &str) -> bool {
|
||||
let mut close = self.close.lock();
|
||||
if close.aborted.remove(label) {
|
||||
close.pending.retain(|l| l != label);
|
||||
close.ready.remove(label);
|
||||
close.hidden.remove(label);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Marks `labels` as hidden once and returns those newly claimed for hiding.
|
||||
pub fn claim_hide(&self, labels: &[String]) -> Vec<String> {
|
||||
let mut close = self.close.lock();
|
||||
labels.iter().filter(|l| close.hidden.insert((*l).clone())).cloned().collect()
|
||||
}
|
||||
|
||||
/// Marks `labels` as aborted so peers waiting at the close barrier or prompt turn stay open.
|
||||
pub fn abort_batch(&self, labels: impl IntoIterator<Item = String>) {
|
||||
{
|
||||
let mut close = self.close.lock();
|
||||
for label in labels {
|
||||
close.ready.remove(&label);
|
||||
close.hidden.remove(&label);
|
||||
close.pending.retain(|l| l != &label);
|
||||
close.aborted.insert(label);
|
||||
}
|
||||
close.prompt_holder = None;
|
||||
}
|
||||
self.close_notify.notify_waiters();
|
||||
}
|
||||
|
||||
/// Aborts every in-flight close except `initiator` (used when cancelling Quit).
|
||||
pub fn abort_all_closing(&self, initiator: Option<&str>) {
|
||||
{
|
||||
let mut close = self.close.lock();
|
||||
let mut targets: Vec<String> = std::mem::take(&mut close.pending);
|
||||
for label in close.ready.drain() {
|
||||
if !targets.iter().any(|l| l == &label) {
|
||||
targets.push(label);
|
||||
}
|
||||
}
|
||||
close.hidden.clear();
|
||||
close.prompt_holder = None;
|
||||
for label in targets {
|
||||
if initiator != Some(label.as_str()) {
|
||||
close.aborted.insert(label);
|
||||
}
|
||||
}
|
||||
}
|
||||
self.close_notify.notify_waiters();
|
||||
}
|
||||
|
||||
/// Tries to acquire the interactive prompt turn. `Err(())` means this close was aborted.
|
||||
pub fn try_acquire_prompt(&self, label: &str) -> Result<bool, ()> {
|
||||
let mut close = self.close.lock();
|
||||
if close.aborted.contains(label) {
|
||||
return Err(());
|
||||
}
|
||||
if close.prompt_holder.is_none() || close.prompt_holder.as_deref() == Some(label) {
|
||||
close.prompt_holder = Some(label.to_owned());
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn release_prompt(&self, label: &str) {
|
||||
let released = {
|
||||
let mut close = self.close.lock();
|
||||
if close.prompt_holder.as_deref() == Some(label) {
|
||||
close.prompt_holder = None;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
};
|
||||
if released {
|
||||
self.close_notify.notify_waiters();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_prompt_holder(&self) -> bool {
|
||||
self.close.lock().prompt_holder.is_some()
|
||||
self.close_requests.lock().clone()
|
||||
}
|
||||
|
||||
pub fn set_launch(&self, label: &str, launch: Launch) {
|
||||
@@ -909,68 +747,22 @@ pub fn focus(window: &WebviewWindow) {
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
|
||||
pub fn hide_windows(windows: Vec<WebviewWindow>) {
|
||||
#[cfg(target_os = "macos")]
|
||||
crate::macos::hide_windows(windows);
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
for window in windows {
|
||||
let _ = window.hide();
|
||||
}
|
||||
}
|
||||
|
||||
/// Closes every project window in parallel without flipping focus across clean tabs.
|
||||
/// Windows that need user confirmation acquire the prompt turn one at a time via `begin_prompt`.
|
||||
pub fn start_quit(app: &AppHandle) {
|
||||
let state = app.state::<WindowsState>();
|
||||
let labels = project_window_labels(app);
|
||||
if labels.is_empty() {
|
||||
app.exit(0);
|
||||
return;
|
||||
}
|
||||
for label in &labels {
|
||||
state.close_requested(label);
|
||||
}
|
||||
let mut any_sent = false;
|
||||
for label in labels {
|
||||
if let Some(window) = app.get_webview_window(&label)
|
||||
&& window.close().is_ok()
|
||||
{
|
||||
any_sent = true;
|
||||
continue;
|
||||
}
|
||||
state.close_settled(&label);
|
||||
}
|
||||
if !any_sent {
|
||||
if project_window_labels(app).is_empty() {
|
||||
app.exit(0);
|
||||
} else {
|
||||
state.set_quitting(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Exits once every project window has finished closing during Quit.
|
||||
/// Present one project's save prompt at a time, including hidden group members.
|
||||
pub fn continue_quit(app: &AppHandle, closed: Option<&str>) {
|
||||
let state = app.state::<WindowsState>();
|
||||
if !state.quitting() {
|
||||
if !app.state::<WindowsState>().quitting() {
|
||||
return;
|
||||
}
|
||||
let remaining: Vec<String> =
|
||||
project_window_labels(app).into_iter().filter(|label| Some(label.as_str()) != closed).collect();
|
||||
if remaining.is_empty() {
|
||||
app.exit(0);
|
||||
return;
|
||||
}
|
||||
// Close any window that appeared after Quit began and was not yet asked to close.
|
||||
for label in remaining {
|
||||
if !state.is_closing(&label)
|
||||
&& let Some(window) = app.get_webview_window(&label)
|
||||
{
|
||||
state.close_requested(&label);
|
||||
if window.close().is_err() {
|
||||
state.close_settled(&label);
|
||||
}
|
||||
let next = project_window_labels(app)
|
||||
.into_iter()
|
||||
.filter(|label| Some(label.as_str()) != closed)
|
||||
.find_map(|label| app.get_webview_window(&label));
|
||||
if let Some(window) = next {
|
||||
focus(&window);
|
||||
if window.close().is_err() {
|
||||
app.state::<WindowsState>().set_quitting(false);
|
||||
}
|
||||
} else {
|
||||
app.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3314,38 +3106,4 @@ mod tests {
|
||||
assert_eq!(menu_settings_launch("main", true, true, "file.settings", None), None);
|
||||
assert_eq!(menu_settings_launch("main", false, true, "file.openProject", None), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parallel_close_coordination_tracks_ready_prompt_and_abort() {
|
||||
let st = WindowsState::default();
|
||||
st.close_requested("main");
|
||||
st.close_requested("project-1");
|
||||
assert!(st.is_closing("main"));
|
||||
assert!(st.has_other_pending_closes("main"));
|
||||
|
||||
// Prompt turn allows only one holder at a time.
|
||||
assert_eq!(st.try_acquire_prompt("main"), Ok(true));
|
||||
assert_eq!(st.try_acquire_prompt("project-1"), Ok(false));
|
||||
assert!(st.has_prompt_holder());
|
||||
|
||||
// Marking ready releases the prompt turn.
|
||||
assert!(st.mark_ready("main"));
|
||||
assert!(!st.has_prompt_holder());
|
||||
assert_eq!(st.try_acquire_prompt("project-1"), Ok(true));
|
||||
|
||||
// Cancelling the batch aborts waiting ready peers and clears the prompt holder.
|
||||
st.abort_all_closing(Some("project-1"));
|
||||
assert!(!st.has_prompt_holder());
|
||||
assert!(st.take_aborted("main"));
|
||||
assert!(!st.is_closing("main"));
|
||||
assert!(!st.take_aborted("project-1"));
|
||||
|
||||
// A fresh close clears any stale aborted state and claims hide once per cohort.
|
||||
st.close_requested("main");
|
||||
assert_eq!(
|
||||
st.claim_hide(&["main".into(), "project-1".into()]),
|
||||
vec!["main".to_string(), "project-1".to_string()]
|
||||
);
|
||||
assert!(st.claim_hide(&["main".into(), "project-1".into()]).is_empty());
|
||||
}
|
||||
}
|
||||
@@ -830,12 +830,10 @@ web_open always desktop bin
|
||||
web_serves_page trusted desktop bindings async
|
||||
web_unresolved_references always project_host bindings async
|
||||
web_url always project_host bindings async
|
||||
window_begin_prompt always desktop bindings async
|
||||
window_close_context always desktop bindings sync
|
||||
window_complete_launch always desktop bindings sync
|
||||
window_cycle always desktop bindings sync
|
||||
window_drag_files always desktop bindings async
|
||||
window_end_prompt always desktop bindings sync
|
||||
window_flash_taskbar always desktop bindings sync
|
||||
window_group_cancel_close always desktop bindings sync
|
||||
window_group_close always desktop bindings sync
|
||||
@@ -859,7 +857,6 @@ window_open_project always desktop bin
|
||||
window_open_projects always desktop bindings sync
|
||||
window_open_remote always desktop bindings async
|
||||
window_open_settings always desktop bindings async
|
||||
window_ready_to_close always desktop bindings async
|
||||
window_set_smooth_scrolling always desktop bindings sync
|
||||
window_set_titlebar_height always desktop bindings sync
|
||||
window_start_drag always desktop bindings sync
|
||||
|
||||
@@ -218,7 +218,7 @@ export const commands = {
|
||||
* Async: the process walk runs on the blocking pool, not the main thread.
|
||||
*/
|
||||
appMetrics: () => typedError<AppMetrics, IdeError>(__TAURI_INVOKE("app_metrics")),
|
||||
/** Quits: closes every window in parallel, each of which runs its own unsaved-changes check. */
|
||||
/** Quits: closes every window, each of which runs its own unsaved-changes check. */
|
||||
appQuit: () => __TAURI_INVOKE<void>("app_quit"),
|
||||
/**
|
||||
* Release notes of `version` from the update manifest (`latest.json`), read
|
||||
@@ -858,10 +858,8 @@ export const commands = {
|
||||
* A module with Kotlin / Groovy / Scala sources is built by its build system, whose class directories come first.
|
||||
* The build streams its console, messages and progress on `on_event` while it runs; a launch
|
||||
* whose build another launch's build joins receives that build's events.
|
||||
* A Maven module is built by the IDE's Java build, except for a `debug` launch the language
|
||||
* server serves: java-debug's HotSwap reloads the classes the language server compiles.
|
||||
*/
|
||||
javaResolveLaunch: (module: string, test: boolean, debug: boolean, policy: BuildPolicy, request: RequestId, onEvent: Channel<BuildEvent>) => typedError<JavaLaunchInfo, IdeError>(__TAURI_INVOKE("java_resolve_launch", { module, test, debug, policy, request, onEvent })),
|
||||
javaResolveLaunch: (module: string, test: boolean, policy: BuildPolicy, request: RequestId, onEvent: Channel<BuildEvent>) => typedError<JavaLaunchInfo, IdeError>(__TAURI_INVOKE("java_resolve_launch", { module, test, policy, request, onEvent })),
|
||||
/**
|
||||
* Downloads the latest `vendor` JDK of Java `version` into `location` (default:
|
||||
* [`jdk_download_location`]), streaming progress through `on_event`; cancellable
|
||||
@@ -2283,11 +2281,6 @@ export const commands = {
|
||||
* HTML (Settings › File Types can make it so) is served as a page, whatever its extension.
|
||||
*/
|
||||
webUrl: (path: IpcPath) => typedError<string, IdeError>(__TAURI_INVOKE("web_url", { path })),
|
||||
/**
|
||||
* Acquires the interactive prompt turn for a batch close and brings this window forward.
|
||||
* Returns `false` if the batch was cancelled while waiting.
|
||||
*/
|
||||
windowBeginPrompt: () => __TAURI_INVOKE<boolean>("window_begin_prompt"),
|
||||
windowCloseContext: () => __TAURI_INVOKE<CloseContext>("window_close_context"),
|
||||
/** Release the opening window's reservation after navigation or cancellation. */
|
||||
windowCompleteLaunch: () => typedError<null, IdeError>(__TAURI_INVOKE("window_complete_launch")),
|
||||
@@ -2299,8 +2292,6 @@ export const commands = {
|
||||
* with whether a target took the files.
|
||||
*/
|
||||
windowDragFiles: (paths: string[]) => typedError<boolean, IdeError>(__TAURI_INVOKE("window_drag_files", { paths })),
|
||||
/** Releases the interactive prompt turn held by this window. */
|
||||
windowEndPrompt: () => __TAURI_INVOKE<void>("window_end_prompt"),
|
||||
/**
|
||||
* Flash (`true`) or stop flashing (`false`) this window's taskbar button, like IDEA when a
|
||||
* breakpoint is hit while the window is in the background (macOS bounces the dock icon,
|
||||
@@ -2380,11 +2371,6 @@ export const commands = {
|
||||
* `background` (`#rrggbb`) paints a new window until its page has loaded.
|
||||
*/
|
||||
windowOpenSettings: (page: string | null, newProjects: boolean, background: string | null) => typedError<null, IdeError>(__TAURI_INVOKE("window_open_settings", { page, newProjects, background })),
|
||||
/**
|
||||
* Signals that this window passed its close checks and waits for peers closing in the same
|
||||
* batch/tab group so they hide together in one frame. Returns `false` if the batch was cancelled.
|
||||
*/
|
||||
windowReadyToClose: () => __TAURI_INVOKE<boolean>("window_ready_to_close"),
|
||||
/** Appearance › Smooth scrolling for this window's web view (Linux only) */
|
||||
windowSetSmoothScrolling: (enabled: boolean) => typedError<null, IdeError>(__TAURI_INVOKE("window_set_smooth_scrolling", { enabled })),
|
||||
/** Height of the web title bar in native logical pixels (CSS height × IDE zoom). */
|
||||
@@ -4259,10 +4245,6 @@ export type CloseContext = {
|
||||
quitting: boolean,
|
||||
/** Number of open project windows (settings windows excluded), including the caller. */
|
||||
windows: number,
|
||||
/** Whether this window currently has auxiliary document windows that must settle first. */
|
||||
hasDocumentWindows: boolean,
|
||||
/** Whether this close runs alongside other windows or on a background tab (prompts serialize and raise). */
|
||||
batch: boolean,
|
||||
};
|
||||
|
||||
export type CodeAction = {
|
||||
|
||||
@@ -43,7 +43,6 @@ import {
|
||||
entriesKey,
|
||||
findSubagent,
|
||||
groupTasks,
|
||||
providerIcon,
|
||||
subagentTitle,
|
||||
turnNumbers,
|
||||
upsertEntry,
|
||||
@@ -83,22 +82,6 @@ const option = (category: string, values: string[], current: string | null): Age
|
||||
via: "option",
|
||||
});
|
||||
|
||||
describe("providerIcon", () => {
|
||||
it("uses the agent's logo, shared by its legacy and adapter ids", () => {
|
||||
expect(providerIcon("devin")).toBe("agent-devin");
|
||||
expect(providerIcon("amp-acp")).toBe("agent-amp-acp");
|
||||
expect(providerIcon("claude-acp")).toBe("agent-claude");
|
||||
expect(providerIcon("codex-acp")).toBe("agent-codex");
|
||||
expect(providerIcon("kimi-code")).toBe("agent-kimi");
|
||||
expect(providerIcon("opencode-v2")).toBe("agent-opencode");
|
||||
expect(providerIcon("hermes-work")).toBe("agent-hermes");
|
||||
});
|
||||
|
||||
it("falls back to the generic agents icon", () => {
|
||||
expect(providerIcon("my-agent")).toBe("toolwindow-agents");
|
||||
});
|
||||
});
|
||||
|
||||
describe("fenced blocks", () => {
|
||||
it("finds closed blocks, a longer fence holding backticks", () => {
|
||||
const text = fenced("a ``` b\n```", "terminal zsh");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** Pure helpers: task grouping, entry updates, labels. */
|
||||
import type { AgentEntry, AgentStatus, AgentSubagentStatus, AgentTask } from "@/bindings";
|
||||
import { isIconName } from "@/ui/icons";
|
||||
|
||||
export const SESSION_KIND = "agent-session";
|
||||
export const HOME_KIND = "agent-home";
|
||||
@@ -53,6 +52,26 @@ export function subagentStatusLabel(s: AgentSubagentStatus): string {
|
||||
}
|
||||
}
|
||||
|
||||
const PROVIDER_ICONS = new Set([
|
||||
"claude",
|
||||
"codex",
|
||||
"gemini",
|
||||
"copilot",
|
||||
"cursor",
|
||||
"opencode",
|
||||
"qwen",
|
||||
"qoder",
|
||||
"qodercn",
|
||||
"kimi",
|
||||
"goose",
|
||||
"auggie",
|
||||
"kiro",
|
||||
"vibe",
|
||||
"omp",
|
||||
"deepseek-harness",
|
||||
"hermes",
|
||||
]);
|
||||
|
||||
/** Suggests an agent-file id for a display name (`"My Agent!"` → `"my-agent"`). */
|
||||
export function slugifyId(name: string): string {
|
||||
return name
|
||||
@@ -64,18 +83,10 @@ export function slugifyId(name: string): string {
|
||||
/** The agent a Hermes profile runs as: `hermes` for `default`, else `hermes-<slug>` (`hermes -p <name> acp`). */
|
||||
export const hermesAgentId = (profile: string) => (profile === "default" ? "hermes" : `hermes-${slugifyId(profile)}`);
|
||||
|
||||
/** Providers whose logo is another provider's: legacy and ACP-adapter ids of the same agent. */
|
||||
const ICON_ALIASES: Record<string, string> = {
|
||||
"claude-acp": "claude",
|
||||
"codex-acp": "codex",
|
||||
"kimi-code": "kimi",
|
||||
"opencode-v2": "opencode",
|
||||
};
|
||||
|
||||
/** The agent's logo; custom agents get the generic agents icon, Hermes profiles Hermes'. */
|
||||
export function providerIcon(provider: string): string {
|
||||
const id = ICON_ALIASES[provider] ?? (provider.startsWith("hermes-") ? "hermes" : provider);
|
||||
return isIconName(`agent-${id}`) ? `agent-${id}` : "toolwindow-agents";
|
||||
if (PROVIDER_ICONS.has(provider)) return `agent-${provider}`;
|
||||
return provider.startsWith("hermes-") ? "agent-hermes" : "toolwindow-agents";
|
||||
}
|
||||
|
||||
export interface TaskGroup {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { AgentEntry } from "@/bindings";
|
||||
import { foldedTurns, summarizeWork } from "../timeline";
|
||||
import { foldedTurns } from "../timeline";
|
||||
import { conversationRows, foldTurnRows, rowEntries, sameRow } from "./conversationRows";
|
||||
|
||||
const user = (text: string): AgentEntry => ({
|
||||
@@ -47,30 +47,6 @@ describe("conversationRows", () => {
|
||||
expect(rows[4]!.kind === "process" ? rows[4]!.entries.length : 0).toBe(2);
|
||||
});
|
||||
|
||||
it("groups shell commands that only read or search, and keeps the others separate", () => {
|
||||
const run = (id: string, title: string): AgentEntry => ({
|
||||
...(tool(id, "execute") as Extract<AgentEntry, { type: "tool" }>),
|
||||
title,
|
||||
});
|
||||
const entries: AgentEntry[] = [
|
||||
user("a"),
|
||||
{ type: "thought", text: "look around" },
|
||||
run("c1", "cd /repo && git grep -n foo -- src"),
|
||||
run("c2", "sed -n 1,40p src/a.ts"),
|
||||
{ type: "thought", text: "now test" },
|
||||
run("c3", "pnpm test"),
|
||||
run("c4", "git diff --stat"),
|
||||
run("c5", "cat a.ts | head"),
|
||||
agent("done"),
|
||||
];
|
||||
const rows = conversationRows(entries, 0);
|
||||
expect(rows.map((row) => row.kind)).toEqual(["entry", "process", "entry", "process", "entry"]);
|
||||
expect(rows[1]!.kind === "process" ? rows[1]!.entries.map((e) => e.index) : []).toEqual([1, 2, 3, 4]);
|
||||
expect(rows[3]!.kind === "process" ? rows[3]!.entries.map((e) => e.index) : []).toEqual([6, 7]);
|
||||
const work = summarizeWork(rowEntries(rows[1]!));
|
||||
expect([work.search, work.read, work.run]).toEqual([1, 1, 0]);
|
||||
});
|
||||
|
||||
it("flattens grouped runs inside a folded turn to avoid nested folds", () => {
|
||||
const entries: AgentEntry[] = [
|
||||
user("a"),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AgentEntry } from "@/bindings";
|
||||
import { exploringCommand, type FoldedTurn } from "../timeline";
|
||||
import { type FoldedTurn } from "../timeline";
|
||||
|
||||
export type ToolEntryData = Extract<AgentEntry, { type: "tool" }>;
|
||||
|
||||
@@ -23,16 +23,12 @@ export const liveTool = (entry: AgentEntry) =>
|
||||
const EXPLORATION_KINDS = new Set(["read", "search", "fetch", "think"]);
|
||||
|
||||
/**
|
||||
* Reasoning and read-only exploration fold together, running calls included: the run keeps its
|
||||
* place while a call finishes, and its summary line says what is running. Exploration is a
|
||||
* read, search or fetch, or a shell command that only reads or searches (`grep`, `sed -n`,
|
||||
* `git diff`); edits and other commands stay visible as their own rows.
|
||||
* Reasoning and read-only exploration tool calls fold together, running ones included: the run
|
||||
* keeps its place while a call finishes, and its summary line says what is running. Edits,
|
||||
* commands and other side-effecting calls stay visible as their own rows.
|
||||
*/
|
||||
export const isProcessEntry = (entry: AgentEntry) =>
|
||||
entry.type === "thought" ||
|
||||
(entry.type === "tool" &&
|
||||
entry.diffs.length === 0 &&
|
||||
(EXPLORATION_KINDS.has(entry.kind) || exploringCommand(entry) !== null));
|
||||
entry.type === "thought" || (entry.type === "tool" && EXPLORATION_KINDS.has(entry.kind) && entry.diffs.length === 0);
|
||||
|
||||
/**
|
||||
* The conversation's rows from `from`: a run of reasoning and finished tool calls becomes
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { AgentEntry, AgentTask } from "@/bindings";
|
||||
import { useEffect, useState } from "react";
|
||||
import { splitLeadingCd } from "../shellCommand";
|
||||
import { useAgents } from "../store";
|
||||
|
||||
export function providerName(id: string) {
|
||||
@@ -22,13 +21,19 @@ export type UserEntry = Extract<AgentEntry, { type: "user" }>;
|
||||
/** Agent-written titles with the task's own folder dropped from paths. */
|
||||
export const shortTitle = (task: AgentTask, title: string) => title.replaceAll(`${task.cwd}/`, "");
|
||||
|
||||
/** A leading `cd <dir> &&` (or `;`), with the directory quoted or bare. */
|
||||
const LEADING_CD = /^\s*cd\s+("[^"]+"|'[^']+'|\S+)\s*(?:&&|;)\s*/;
|
||||
|
||||
/**
|
||||
* A command's title without the `cd <dir> &&` agents put before every call, and the folder it
|
||||
* moved to when that is not the task's own: the command is what tells calls apart.
|
||||
*/
|
||||
export function commandTitle(task: AgentTask, title: string): { title: string; dir: string | null } {
|
||||
const { command, dir } = splitLeadingCd(title);
|
||||
return { title: shortTitle(task, command), dir: dir === task.cwd || dir === "." ? null : dir };
|
||||
const match = LEADING_CD.exec(title);
|
||||
if (!match || match[0].length === title.length) return { title: shortTitle(task, title), dir: null };
|
||||
const dir = match[1]!.replace(/^(["'])(.*)\1$/, "$2").replace(/\/+$/, "");
|
||||
const rest = shortTitle(task, title.slice(match[0].length));
|
||||
return { title: rest, dir: dir === task.cwd || dir === "." ? null : dir };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { readOnlyCommand, splitLeadingCd } from "./shellCommand";
|
||||
|
||||
describe("splitLeadingCd", () => {
|
||||
it("takes the folder off the front", () => {
|
||||
expect(splitLeadingCd("cd /repo && git status")).toEqual({ command: "git status", dir: "/repo" });
|
||||
expect(splitLeadingCd(`cd "/my repo/" ; ls`)).toEqual({ command: "ls", dir: "/my repo" });
|
||||
expect(splitLeadingCd("cd /tmp")).toEqual({ command: "cd /tmp", dir: null });
|
||||
});
|
||||
});
|
||||
|
||||
describe("readOnlyCommand", () => {
|
||||
it.each([
|
||||
["git grep -n foo -- src", "search"],
|
||||
["cd /repo && rg -n 'a|b' src | head -20", "search"],
|
||||
["grep -rn foo src 2>/dev/null | wc -l", "search"],
|
||||
["find . -name '*.ts' -not -path './node_modules/*'", "search"],
|
||||
["sed -n 1,40p src/a.ts", "read"],
|
||||
["cat a.ts; echo ---; head -5 b.ts", "read"],
|
||||
["git diff --stat origin/main...HEAD", "read"],
|
||||
["git -C ../other log --oneline -3", "read"],
|
||||
["ls -la src && wc -l src/*.ts", "read"],
|
||||
["git branch --show-current", "read"],
|
||||
["git worktree list | head; grep -n x LICENSE | head", "search"],
|
||||
["pgrep -fl openidea | head", "read"],
|
||||
["FOO=1 cat a.ts 2>&1 | sort | uniq -c", "read"],
|
||||
])("%s → %s", (command, kind) => {
|
||||
expect(readOnlyCommand(command)).toBe(kind);
|
||||
});
|
||||
|
||||
it.each([
|
||||
"pnpm test",
|
||||
"cargo build",
|
||||
"git commit -m 'x'",
|
||||
"git branch -D old",
|
||||
"git worktree add ../x",
|
||||
"git stash -q",
|
||||
"git remote add up url",
|
||||
"sed -i '' 's/a/b/' a.ts",
|
||||
"sed -n 1p a.ts > out.txt",
|
||||
"grep foo a.ts >> log",
|
||||
"find . -name '*.tmp' -delete",
|
||||
"find . -exec rm {} ;",
|
||||
"cat a.ts | xargs rm",
|
||||
"echo $(rm -rf x)",
|
||||
"cat <<'EOF' > a.ts",
|
||||
"sort -o a.txt a.txt",
|
||||
"sleep 10 &",
|
||||
"rm -rf build",
|
||||
"",
|
||||
])("%s may change something", (command) => {
|
||||
expect(readOnlyCommand(command)).toBeNull();
|
||||
});
|
||||
|
||||
it("does not split on operators inside quotes", () => {
|
||||
expect(readOnlyCommand(`grep -n "a && rm -rf /" src`)).toBe("search");
|
||||
expect(readOnlyCommand(`echo 'x' ; rm a`)).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -1,159 +0,0 @@
|
||||
/** Reading what an agent's shell command does, from its text alone. */
|
||||
|
||||
/** A leading `cd <dir> &&` (or `;`), with the directory quoted or bare. */
|
||||
const LEADING_CD = /^\s*cd\s+("[^"]+"|'[^']+'|\S+)\s*(?:&&|;)\s*/;
|
||||
|
||||
/** `command` without the `cd <dir> &&` agents put before it, and that folder; `null` when there is none. */
|
||||
export function splitLeadingCd(command: string): { command: string; dir: string | null } {
|
||||
const match = LEADING_CD.exec(command);
|
||||
if (!match || match[0].length === command.length) return { command, dir: null };
|
||||
const dir = match[1]!.replace(/^(["'])(.*)\1$/, "$2").replace(/\/+$/, "");
|
||||
return { command: command.slice(match[0].length), dir };
|
||||
}
|
||||
|
||||
/** Programs that look for something. */
|
||||
const SEARCH = new Set(["grep", "egrep", "fgrep", "rg", "ag", "ack", "find", "fd", "mdfind", "locate"]);
|
||||
|
||||
/** Programs that only print what is there. */
|
||||
const READ = new Set([
|
||||
"cat",
|
||||
"head",
|
||||
"tail",
|
||||
"sed",
|
||||
"awk",
|
||||
"nl",
|
||||
"wc",
|
||||
"ls",
|
||||
"tree",
|
||||
"stat",
|
||||
"file",
|
||||
"pwd",
|
||||
"echo",
|
||||
"printf",
|
||||
"jq",
|
||||
"sort",
|
||||
"uniq",
|
||||
"cut",
|
||||
"tr",
|
||||
"column",
|
||||
"diff",
|
||||
"cmp",
|
||||
"which",
|
||||
"type",
|
||||
"realpath",
|
||||
"readlink",
|
||||
"basename",
|
||||
"dirname",
|
||||
"du",
|
||||
"df",
|
||||
"true",
|
||||
"cd",
|
||||
"ps",
|
||||
"pgrep",
|
||||
"lsof",
|
||||
"date",
|
||||
"uname",
|
||||
"whoami",
|
||||
]);
|
||||
|
||||
/** Git subcommands that only read the repository. */
|
||||
const GIT_READ = new Set([
|
||||
"status",
|
||||
"diff",
|
||||
"log",
|
||||
"show",
|
||||
"blame",
|
||||
"ls-files",
|
||||
"ls-tree",
|
||||
"rev-parse",
|
||||
"merge-base",
|
||||
"describe",
|
||||
"cat-file",
|
||||
"shortlog",
|
||||
"reflog",
|
||||
]);
|
||||
|
||||
/** Splits on `&&`, `||`, `;` and `|` outside quotes; `null` when the text has what this can't read safely. */
|
||||
function segments(command: string): string[] | null {
|
||||
const out: string[] = [];
|
||||
let current = "";
|
||||
let quote: string | null = null;
|
||||
for (let i = 0; i < command.length; i++) {
|
||||
const c = command[i]!;
|
||||
if (quote) {
|
||||
if (c === quote) quote = null;
|
||||
else if (c === "\\" && quote === '"') current += command[i++] ?? "";
|
||||
current += c;
|
||||
continue;
|
||||
}
|
||||
if (c === "'" || c === '"') quote = c;
|
||||
else if (c === "`" || c === "\n" || (c === "$" && command[i + 1] === "(")) return null;
|
||||
else if (c === "<" && command[i + 1] === "<") return null;
|
||||
else if (c === ">") {
|
||||
// Only output thrown away (`>/dev/null`, `2>&1`) leaves the disk as it was.
|
||||
const target = /^>?\s*(\/dev\/null\b|&\d)/.exec(command.slice(i + 1));
|
||||
if (!target) return null;
|
||||
i += target[0].length;
|
||||
continue;
|
||||
} else if (c === ";" || c === "|" || (c === "&" && command[i + 1] === "&")) {
|
||||
out.push(current);
|
||||
current = "";
|
||||
if (command[i + 1] === c) i++;
|
||||
continue;
|
||||
} else if (c === "&") return null;
|
||||
current += c;
|
||||
}
|
||||
if (quote) return null;
|
||||
out.push(current);
|
||||
return out.map((s) => s.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
const words = (segment: string) => segment.match(/"[^"]*"|'[^']*'|\S+/g) ?? [];
|
||||
|
||||
/** What one segment does: `"search"`, `"read"`, or `null` when it may change something. */
|
||||
function segmentKind(segment: string): "search" | "read" | null {
|
||||
const args = words(segment).filter(
|
||||
(w, i, all) => !(/^[A-Za-z_][A-Za-z0-9_]*=/.test(w) && all.slice(0, i).every((p) => /=/.test(p))),
|
||||
);
|
||||
const [program, ...rest] = args;
|
||||
if (!program) return null;
|
||||
const name = program.replace(/^.*\//, "");
|
||||
if (name === "git") {
|
||||
// Global options before the subcommand, some taking a value (`git -C <dir> log`).
|
||||
let at = 0;
|
||||
while (at < rest.length && rest[at]!.startsWith("-"))
|
||||
at += /^(-C|-c|--git-dir|--work-tree|--namespace)$/.test(rest[at]!) ? 2 : 1;
|
||||
const sub = rest[at];
|
||||
if (sub === "grep") return "search";
|
||||
const next = rest[at + 1];
|
||||
if (sub === "worktree" || sub === "stash")
|
||||
return next === "list" || (sub === "stash" && next === "show") ? "read" : null;
|
||||
if (sub === "remote") return next === undefined || next === "-v" || next === "show" ? "read" : null;
|
||||
if (sub === "branch") return rest.some((a) => /^-(d|D|m|M|c|C|-delete|-move|-copy)$/.test(a)) ? null : "read";
|
||||
return sub && GIT_READ.has(sub) ? "read" : null;
|
||||
}
|
||||
if (name === "sed" && rest.some((a) => /^-[a-zA-Z]*i|^--in-place/.test(a))) return null;
|
||||
if (name === "awk" && rest.some((a) => /inplace/.test(a))) return null;
|
||||
if (name === "sort" && rest.some((a) => /^-[a-zA-Z]*o|^--output/.test(a))) return null;
|
||||
if (name === "find" && rest.some((a) => /^-(delete|exec|execdir|ok|okdir|fprint|fprintf|fls)$/.test(a))) return null;
|
||||
if (name === "fd" && rest.some((a) => /^(-x|-X|--exec|--exec-batch)$/.test(a))) return null;
|
||||
if (SEARCH.has(name)) return "search";
|
||||
return READ.has(name) ? "read" : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a shell command only looks at the workspace, and how: `"search"` when it looks for
|
||||
* something (`grep`, `rg`, `find`, `git grep`), `"read"` when it prints files or state (`cat`,
|
||||
* `sed -n`, `ls`, `git diff`); `null` when it may change something or can't be told.
|
||||
*/
|
||||
export function readOnlyCommand(command: string): "search" | "read" | null {
|
||||
const parts = segments(splitLeadingCd(command).command);
|
||||
if (!parts?.length) return null;
|
||||
let kind: "search" | "read" = "read";
|
||||
for (const part of parts) {
|
||||
const k = segmentKind(part);
|
||||
if (!k) return null;
|
||||
if (k === "search") kind = "search";
|
||||
}
|
||||
return kind;
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
* the conversation renders the rows these describe.
|
||||
*/
|
||||
import type { AgentEntry } from "@/bindings";
|
||||
import { readOnlyCommand } from "./shellCommand";
|
||||
|
||||
type ToolEntry = Extract<AgentEntry, { type: "tool" }>;
|
||||
|
||||
@@ -57,14 +56,9 @@ function countTool(s: WorkSummary, e: ToolEntry, edited: Set<string>) {
|
||||
case "search":
|
||||
s.search++;
|
||||
break;
|
||||
case "execute": {
|
||||
// A command that only reads or searches counts as what it did.
|
||||
const kind = exploringCommand(e);
|
||||
if (kind === "search") s.search++;
|
||||
else if (kind === "read") s.read++;
|
||||
else s.run++;
|
||||
case "execute":
|
||||
s.run++;
|
||||
break;
|
||||
}
|
||||
case "fetch":
|
||||
s.fetch++;
|
||||
break;
|
||||
@@ -154,15 +148,6 @@ export interface ToolRun {
|
||||
}
|
||||
|
||||
/** Splits an `execute` tool's text into its command, output and exit code, where it names them. */
|
||||
/**
|
||||
* How a shell command call only looks at the workspace (`"search"`, `"read"`), from the command
|
||||
* it ran; `null` for any other call, or a command that may change something.
|
||||
*/
|
||||
export function exploringCommand(entry: ToolEntry): "search" | "read" | null {
|
||||
if (entry.kind !== "execute" || entry.diffs.length) return null;
|
||||
return readOnlyCommand(toolRun(entry).command ?? entry.title);
|
||||
}
|
||||
|
||||
export function toolRun(entry: ToolEntry): ToolRun {
|
||||
const text = entry.output ?? "";
|
||||
const command = /^\$ (.+)$/m.exec(text)?.[1] ?? null;
|
||||
|
||||
@@ -35,15 +35,7 @@ const flushSession = vi.fn();
|
||||
beforeEach(() => {
|
||||
vi.spyOn(ipc, "isTauri").mockReturnValue(true);
|
||||
vi.spyOn(ipc, "onIdeEvent").mockReturnValue(() => {});
|
||||
vi.spyOn(ipc.commands, "windowCloseContext").mockResolvedValue({
|
||||
quitting: false,
|
||||
windows: 1,
|
||||
hasDocumentWindows: false,
|
||||
batch: false,
|
||||
});
|
||||
vi.spyOn(ipc.commands, "windowBeginPrompt").mockResolvedValue(true);
|
||||
vi.spyOn(ipc.commands, "windowEndPrompt").mockResolvedValue(undefined);
|
||||
vi.spyOn(ipc.commands, "windowReadyToClose").mockResolvedValue(true);
|
||||
vi.spyOn(ipc.commands, "windowCloseContext").mockResolvedValue({ quitting: false, windows: 1 });
|
||||
vi.spyOn(ipc.commands, "windowGroupCancelClose").mockResolvedValue(undefined);
|
||||
vi.spyOn(ipc.commands, "appCancelQuit").mockResolvedValue(undefined);
|
||||
vi.spyOn(ipc.commands, "closeProject").mockResolvedValue(undefined);
|
||||
@@ -97,12 +89,7 @@ describe("native window close", () => {
|
||||
});
|
||||
|
||||
it.each([1, 2])("closes one of %s windows when opted in", async (windows) => {
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({
|
||||
quitting: false,
|
||||
windows,
|
||||
hasDocumentWindows: false,
|
||||
batch: false,
|
||||
});
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({ quitting: false, windows });
|
||||
const prevented = await close({ closeWithoutWelcome: true, closeTabsWithWindow: true });
|
||||
expect(prevented).not.toHaveBeenCalled();
|
||||
expect(ipc.commands.closeProject).not.toHaveBeenCalled();
|
||||
@@ -110,12 +97,7 @@ describe("native window close", () => {
|
||||
});
|
||||
|
||||
it("closes a nonlast window with defaults and keeps its saved tabs", async () => {
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({
|
||||
quitting: false,
|
||||
windows: 2,
|
||||
hasDocumentWindows: false,
|
||||
batch: false,
|
||||
});
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({ quitting: false, windows: 2 });
|
||||
const prevented = await close({});
|
||||
expect(prevented).not.toHaveBeenCalled();
|
||||
expect(ipc.commands.closeProject).not.toHaveBeenCalled();
|
||||
@@ -144,12 +126,7 @@ describe("native window close", () => {
|
||||
});
|
||||
|
||||
it("stays open when an untitled buffer's Save As is cancelled", async () => {
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({
|
||||
quitting: false,
|
||||
windows: 2,
|
||||
hasDocumentWindows: false,
|
||||
batch: false,
|
||||
});
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({ quitting: false, windows: 2 });
|
||||
vi.mocked(services.maybeEditorService).mockReturnValue({
|
||||
forgetSavedTabs: forget,
|
||||
keepSavedTabs: keep,
|
||||
@@ -182,12 +159,7 @@ describe("native window close", () => {
|
||||
os: "linux",
|
||||
commands: [],
|
||||
});
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({
|
||||
quitting: false,
|
||||
windows: 2,
|
||||
hasDocumentWindows: false,
|
||||
batch: false,
|
||||
});
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({ quitting: false, windows: 2 });
|
||||
vi.mocked(deps.ask).mockResolvedValueOnce({ button: "keep", checked: false });
|
||||
const terminate = vi.fn(async () => {});
|
||||
deps.runningProcesses = vi.fn(async () => ["docker compose up"]);
|
||||
@@ -249,12 +221,7 @@ describe("quitting from outside the window", () => {
|
||||
});
|
||||
|
||||
it("leaves a window with nothing to ask where it is while the app quits", async () => {
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({
|
||||
quitting: true,
|
||||
windows: 2,
|
||||
hasDocumentWindows: false,
|
||||
batch: true,
|
||||
});
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({ quitting: true, windows: 2 });
|
||||
deps.runningProcesses = async () => [];
|
||||
const { d, asked } = recordingDeps("cancel");
|
||||
useProject.setState({
|
||||
@@ -267,17 +234,10 @@ describe("quitting from outside the window", () => {
|
||||
await native.close!({ preventDefault: vi.fn() });
|
||||
expect(asked).toEqual([]);
|
||||
expect(native.order).toEqual([]);
|
||||
expect(ipc.commands.windowBeginPrompt).not.toHaveBeenCalled();
|
||||
expect(ipc.commands.windowReadyToClose).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("raises each window before the prompts a quit makes it show", async () => {
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({
|
||||
quitting: true,
|
||||
windows: 2,
|
||||
hasDocumentWindows: false,
|
||||
batch: true,
|
||||
});
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({ quitting: true, windows: 2 });
|
||||
deps.runningProcesses = async () => ["server.js"];
|
||||
const { d } = recordingDeps("cancel");
|
||||
useProject.setState({
|
||||
@@ -289,48 +249,6 @@ describe("quitting from outside the window", () => {
|
||||
await vi.waitFor(() => expect(native.close).toBeDefined());
|
||||
await native.close!({ preventDefault: vi.fn() });
|
||||
expect(native.order.slice(0, 4)).toEqual(["unminimize", "show", "setFocus", "ask"]);
|
||||
expect(ipc.commands.windowBeginPrompt).toHaveBeenCalledOnce();
|
||||
expect(ipc.commands.windowEndPrompt).toHaveBeenCalledOnce();
|
||||
expect(ipc.commands.appCancelQuit).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("restores saved tabs and stays open when a peer cancels the batch at the close barrier", async () => {
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({
|
||||
quitting: true,
|
||||
windows: 2,
|
||||
hasDocumentWindows: false,
|
||||
batch: true,
|
||||
});
|
||||
vi.mocked(ipc.commands.windowReadyToClose).mockResolvedValueOnce(false);
|
||||
const prevented = await close({ closeTabsWithWindow: true });
|
||||
expect(prevented).toHaveBeenCalledOnce();
|
||||
expect(forget).toHaveBeenCalledOnce();
|
||||
expect(keep).toHaveBeenCalledOnce();
|
||||
expect(ipc.commands.appCancelQuit).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("skips prompting when a peer already cancelled the batch while waiting for the prompt turn", async () => {
|
||||
vi.mocked(ipc.commands.windowCloseContext).mockResolvedValue({
|
||||
quitting: true,
|
||||
windows: 2,
|
||||
hasDocumentWindows: false,
|
||||
batch: true,
|
||||
});
|
||||
vi.mocked(ipc.commands.windowBeginPrompt).mockResolvedValueOnce(false);
|
||||
deps.runningProcesses = async () => ["server.js"];
|
||||
const { d, asked } = recordingDeps("terminate");
|
||||
useProject.setState({
|
||||
project: { root: "/project", name: "project" },
|
||||
lightEdit: false,
|
||||
settings: { general: {} },
|
||||
} as never);
|
||||
uninstall = installCloseGuard(d);
|
||||
await vi.waitFor(() => expect(native.close).toBeDefined());
|
||||
const preventDefault = vi.fn();
|
||||
await native.close!({ preventDefault });
|
||||
expect(preventDefault).toHaveBeenCalledOnce();
|
||||
expect(asked).toEqual([]);
|
||||
expect(native.order).toEqual([]);
|
||||
expect(ipc.commands.appCancelQuit).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -248,12 +248,8 @@ async function onCloseRequested(deps: CloseDeps): Promise<boolean> {
|
||||
closing = true;
|
||||
let forgot = false;
|
||||
let quitting = false;
|
||||
let promptHeld = false;
|
||||
let batchAborted = false;
|
||||
const cancel = async () => {
|
||||
if (!batchAborted) {
|
||||
await (quitting ? commands.appCancelQuit() : commands.windowGroupCancelClose());
|
||||
}
|
||||
await (quitting ? commands.appCancelQuit() : commands.windowGroupCancelClose());
|
||||
return false;
|
||||
};
|
||||
const undoForget = () => {
|
||||
@@ -264,27 +260,9 @@ async function onCloseRequested(deps: CloseDeps): Promise<boolean> {
|
||||
try {
|
||||
const ctx = await commands.windowCloseContext();
|
||||
quitting = ctx.quitting;
|
||||
// In a quit or multi-tab close, windows check in parallel; only a window that needs to ask
|
||||
// acquires the prompt turn and comes forward so prompts still run one at a time.
|
||||
if (quitting || ctx.batch) {
|
||||
const baseAsk = deps.ask;
|
||||
deps = {
|
||||
...deps,
|
||||
ask: async (request) => {
|
||||
if (!promptHeld) {
|
||||
const proceed = await commands.windowBeginPrompt();
|
||||
if (!proceed) {
|
||||
batchAborted = true;
|
||||
return { button: "cancel", checked: false };
|
||||
}
|
||||
promptHeld = true;
|
||||
}
|
||||
await raiseWindowForPrompts();
|
||||
return baseAsk(request);
|
||||
},
|
||||
};
|
||||
}
|
||||
if (ctx.hasDocumentWindows !== false && !(await closeDocumentWindows())) return await cancel();
|
||||
// Each window of a quit asks about its own processes and unsaved changes, if it has any.
|
||||
if (quitting) deps = raisingBeforeAsk(deps);
|
||||
if (!(await closeDocumentWindows())) return await cancel();
|
||||
const s = useProject.getState();
|
||||
const welcome = returnsToWelcome(quitting, ctx.windows, !!(s.project || s.lightEdit), s.settings);
|
||||
const remote = useRemote.getState();
|
||||
@@ -338,12 +316,6 @@ async function onCloseRequested(deps: CloseDeps): Promise<boolean> {
|
||||
forgot = false;
|
||||
return await cancel();
|
||||
}
|
||||
if (!(await commands.windowReadyToClose())) {
|
||||
batchAborted = true;
|
||||
undoForget();
|
||||
maybeEditorService()?.cancelClose?.();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (e) {
|
||||
undoForget();
|
||||
@@ -352,10 +324,6 @@ async function onCloseRequested(deps: CloseDeps): Promise<boolean> {
|
||||
deps.onSaveFailed(e);
|
||||
return false;
|
||||
} finally {
|
||||
if (promptHeld) {
|
||||
promptHeld = false;
|
||||
void commands.windowEndPrompt().catch(() => {});
|
||||
}
|
||||
closing = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ describe("Java debugging (java-debug through jdtls)", () => {
|
||||
expect(isJavaDebuggable({ ...app, kind: "maven" })).toBe(false);
|
||||
const l = await javaLaunchConfig(app, "/p");
|
||||
expect(invoked).toEqual([
|
||||
["javaResolveLaunch", ["api", false, true, "automatic", expect.any(Number), expect.anything()]],
|
||||
["javaResolveLaunch", ["api", false, "automatic", expect.any(Number), expect.anything()]],
|
||||
["javaDebugAdapter", ["api"]],
|
||||
["javaDebugServer", ["api"]],
|
||||
]);
|
||||
@@ -240,7 +240,7 @@ it.each(["sibling", "/outside/modules"])("debugs from %s with the main class mod
|
||||
const launch = await javaLaunchConfig({ ...app, module, cwd }, "/p");
|
||||
expect(invoked).toContainEqual([
|
||||
"javaResolveLaunch",
|
||||
["api", false, true, "automatic", expect.any(Number), expect.anything()],
|
||||
["api", false, "automatic", expect.any(Number), expect.anything()],
|
||||
]);
|
||||
expect(invoked).toContainEqual(["javaDebugServer", ["api"]]);
|
||||
expect(launch.cwd).toBe(cwd.startsWith("/") ? cwd : `/p/${cwd}`);
|
||||
|
||||
@@ -70,7 +70,7 @@ async function startAndStop() {
|
||||
).toContain("Building and resolving the classpath of Main…");
|
||||
expect(useDebugRunSessions.getState().sessions[0]?.configId).toBe(config.id);
|
||||
await executeAction("debug.stop");
|
||||
expect(ipc.cancelRequest).toHaveBeenCalledWith(ipc.javaResolveLaunch.mock.calls[0]![4]);
|
||||
expect(ipc.cancelRequest).toHaveBeenCalledWith(ipc.javaResolveLaunch.mock.calls[0]![3]);
|
||||
expect(useDebug.getState().sessions[session.id]?.status).toBe("terminated");
|
||||
expect(useDebugRunSessions.getState().sessions).toEqual([]);
|
||||
return { starting };
|
||||
|
||||
@@ -145,16 +145,16 @@ export async function javaLaunchConfig(
|
||||
const parsed = parseJavaArgs(rc.args);
|
||||
if (!parsed.mainClass) throw new Error(`No main class in '${rc.name}'`);
|
||||
preparation?.signal.throwIfAborted();
|
||||
const { module, info, resolved } = await prepareJavaLaunch(rc, {
|
||||
...(preparation ?? {
|
||||
const { module, info, resolved } = await prepareJavaLaunch(
|
||||
rc,
|
||||
preparation ?? {
|
||||
request: nextRequestId(),
|
||||
signal: new AbortController().signal,
|
||||
saveAll: async () => {
|
||||
await maybeEditorService()?.saveAll();
|
||||
},
|
||||
}),
|
||||
debug: true,
|
||||
});
|
||||
},
|
||||
);
|
||||
const cwd = resolved.cwd ? join(root, resolved.cwd) : root;
|
||||
if (info.errorCount > 0 && !preparation?.report)
|
||||
notifications().notify({
|
||||
|
||||
@@ -147,7 +147,7 @@ const boot = {
|
||||
describe("Spring Boot application updates", () => {
|
||||
it("processes resources and publishes them to the resolved runtime output", async () => {
|
||||
await updateTomcat(boot, "resources");
|
||||
expect(mocks.resolve).toHaveBeenCalledWith("app", false, true, "noBuild", 1, expect.anything());
|
||||
expect(mocks.resolve).toHaveBeenCalledWith("app", false, "noBuild", 1, expect.anything());
|
||||
expect(mocks.runBuild).toHaveBeenCalledWith({ id: "build" });
|
||||
expect(mocks.publish).toHaveBeenCalledWith(boot.config, ["/p/app/bin/main"], "a.Main");
|
||||
expect(mocks.update).not.toHaveBeenCalled();
|
||||
@@ -155,7 +155,7 @@ describe("Spring Boot application updates", () => {
|
||||
});
|
||||
it("compiles and invokes the existing scoped HotSwap action in debug", async () => {
|
||||
await updateTomcat(boot, "classes");
|
||||
expect(mocks.resolve).toHaveBeenCalledWith("app", false, true, "make", 1, expect.anything());
|
||||
expect(mocks.resolve).toHaveBeenCalledWith("app", false, "make", 1, expect.anything());
|
||||
expect(mocks.action).toHaveBeenCalledWith("debug.reloadChangedClasses", { configId: "boot" });
|
||||
});
|
||||
it("explains compiled classes require restart without a debugger", async () => {
|
||||
|
||||
@@ -54,8 +54,6 @@ async function updateSpringBoot(config: RunConfig, mode: UpdateMode, debugging:
|
||||
mode === "classes" ? "make" : "noBuild",
|
||||
request,
|
||||
followLaunchBuild(request, tx`Build before launch: ${config.name}`),
|
||||
// HotSwap reloads what the Java language server compiles.
|
||||
debugging,
|
||||
);
|
||||
if (info.build === "failed" || info.build === "withErrors" || info.build === "cancelled")
|
||||
throw updateBuildError(info);
|
||||
|
||||
@@ -84,14 +84,7 @@ afterEach(() => {
|
||||
it.each(["sibling", "/outside/modules"])("runs from %s using the stored module's classpath", async (cwd) => {
|
||||
const session = await startRun({ ...config, module: "app", cwd });
|
||||
expect(session?.status).toBe("running");
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(
|
||||
"app",
|
||||
false,
|
||||
false,
|
||||
"automatic",
|
||||
expect.any(Number),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith("app", false, "automatic", expect.any(Number), expect.anything());
|
||||
expect(ipc.runStart).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ cwd, args: ["-cp", "/p/app/target/classes", "a.Main"] }),
|
||||
expect.anything(),
|
||||
@@ -115,27 +108,13 @@ const launchInfo = (build: "succeeded" | "failed" | "withErrors") => ({
|
||||
|
||||
it.each(["noBuild", "rebuild"] as const)("passes the %s build policy to the resolver", async (buildPolicy) => {
|
||||
await startRun({ ...config, module: "app", buildPolicy });
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(
|
||||
"app",
|
||||
false,
|
||||
false,
|
||||
buildPolicy,
|
||||
expect.any(Number),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith("app", false, buildPolicy, expect.any(Number), expect.anything());
|
||||
});
|
||||
|
||||
it("always applies the launch policy after a Before launch Build Project", async () => {
|
||||
useProject.setState({ project: { root: "/p" } as never });
|
||||
await startRun({ ...config, module: "app" });
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(
|
||||
"app",
|
||||
false,
|
||||
false,
|
||||
"automatic",
|
||||
expect.any(Number),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith("app", false, "automatic", expect.any(Number), expect.anything());
|
||||
useProject.setState({ project: null });
|
||||
});
|
||||
|
||||
@@ -166,14 +145,7 @@ it.each([undefined, "automatic", "make", "rebuild"] as const)(
|
||||
it("finds the source module for an old saved configuration without a module", async () => {
|
||||
await startRun({ ...config, cwd: "/outside/modules" });
|
||||
expect(ipc.findFiles).toHaveBeenCalledWith("Main.java", 1000);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(
|
||||
"app",
|
||||
false,
|
||||
false,
|
||||
"automatic",
|
||||
expect.any(Number),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith("app", false, "automatic", expect.any(Number), expect.anything());
|
||||
expect(ipc.runStart).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ cwd: "/outside/modules" }),
|
||||
expect.anything(),
|
||||
@@ -194,14 +166,7 @@ it.each([null, "/elsewhere"])("recovers an attached module from its indexed path
|
||||
});
|
||||
const session = await startRun({ ...config, cwd });
|
||||
expect(session?.status).toBe("running");
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(
|
||||
module,
|
||||
false,
|
||||
false,
|
||||
"automatic",
|
||||
expect.any(Number),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(module, false, "automatic", expect.any(Number), expect.anything());
|
||||
expect(ipc.runStart).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ cwd: cwd ?? module, module }),
|
||||
expect.anything(),
|
||||
@@ -219,14 +184,7 @@ it.each([["-cp", "lib/*"], []])("colours Spring Boot runs without classpath reso
|
||||
expect.anything(),
|
||||
expect.any(Number),
|
||||
);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(
|
||||
"app",
|
||||
false,
|
||||
false,
|
||||
"automatic",
|
||||
expect.any(Number),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith("app", false, "automatic", expect.any(Number), expect.anything());
|
||||
expect(boot.args).toBe(args);
|
||||
expect(args).not.toContain("-Dspring.output.ansi.enabled=always");
|
||||
});
|
||||
@@ -235,28 +193,14 @@ it.each(["never", "detect", "always"])("preserves an explicit Spring Boot consol
|
||||
const args = [`-Dspring.output.ansi.enabled=${value}`, "-cp", "lib/*", "a.Main"];
|
||||
await startRun({ ...config, kind: "spring-boot", args });
|
||||
expect(ipc.runStart).toHaveBeenCalledWith(expect.objectContaining({ args }), expect.anything(), expect.any(Number));
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(
|
||||
"app",
|
||||
false,
|
||||
false,
|
||||
"automatic",
|
||||
expect.any(Number),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith("app", false, "automatic", expect.any(Number), expect.anything());
|
||||
});
|
||||
|
||||
it("keeps plain Java runs with an explicit classpath free of Spring Boot options", async () => {
|
||||
const args = ["-cp", "lib/*", "a.Main"];
|
||||
await startRun({ ...config, args });
|
||||
expect(ipc.runStart).toHaveBeenCalledWith(expect.objectContaining({ args }), expect.anything(), expect.any(Number));
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(
|
||||
"app",
|
||||
false,
|
||||
false,
|
||||
"automatic",
|
||||
expect.any(Number),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith("app", false, "automatic", expect.any(Number), expect.anything());
|
||||
});
|
||||
|
||||
it("adds the Spring Boot console option once when resolving the module classpath", async () => {
|
||||
|
||||
@@ -69,7 +69,7 @@ describe("Stop during Java launch resolution", () => {
|
||||
await vi.waitFor(() => expect(ipc.javaResolveLaunch).toHaveBeenCalledOnce());
|
||||
const session = useRun.getState().sessions[0]!;
|
||||
expect(session.status).toBe("starting");
|
||||
const request = ipc.javaResolveLaunch.mock.calls[0]![4];
|
||||
const request = ipc.javaResolveLaunch.mock.calls[0]![3];
|
||||
expect(request).toEqual(expect.any(Number));
|
||||
await stopSession(session.id);
|
||||
expect(ipc.cancelRequest).toHaveBeenCalledExactlyOnceWith(request);
|
||||
|
||||
@@ -292,14 +292,7 @@ describe("updating a running Tomcat deployment", () => {
|
||||
it("compiles the selected WAR module and copies its outputs instead of rebuilding the WAR", async () => {
|
||||
const c = config({ deployment: "artifact", artifact: "maven:web/pom.xml" });
|
||||
expect(await syncTomcatOutputs(c, false)).toBe(true);
|
||||
expect(commands.javaResolveLaunch).toHaveBeenCalledWith(
|
||||
"web",
|
||||
false,
|
||||
false,
|
||||
"make",
|
||||
expect.anything(),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(commands.javaResolveLaunch).toHaveBeenCalledWith("web", false, "make", expect.anything(), expect.anything());
|
||||
expect(commands.runTomcatSync).toHaveBeenCalledWith(c, "web", ["/p/web/target/classes", "/m2/lib.jar"], false);
|
||||
});
|
||||
|
||||
|
||||
@@ -252,11 +252,6 @@ export interface JavaPreparation {
|
||||
saveAll?: () => Promise<void>;
|
||||
/** Follows the build while it runs (status bar, Build tool window); see `followLaunchBuild`. */
|
||||
build?: JavaBuildFollower;
|
||||
/**
|
||||
* A debug launch: a module the Java language server serves is compiled by it, whose classes
|
||||
* java-debug's HotSwap reloads, instead of the IDE's Java build.
|
||||
*/
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
/** Receives the events of a launch's build as it runs, then its outcome. */
|
||||
@@ -272,12 +267,11 @@ export async function resolveJavaLaunch(
|
||||
policy: BuildPolicy,
|
||||
request: RequestId,
|
||||
build?: JavaBuildFollower,
|
||||
debug = false,
|
||||
): Promise<JavaLaunchInfo> {
|
||||
const channel = new Channel<BuildEvent>();
|
||||
channel.onmessage = (e) => build?.onEvent(e);
|
||||
try {
|
||||
const info = await call(commands.javaResolveLaunch(module, test, debug, policy, request, channel));
|
||||
const info = await call(commands.javaResolveLaunch(module, test, policy, request, channel));
|
||||
build?.finish(info.build === "failed" ? "failed" : info.build === "cancelled" ? "cancelled" : "success");
|
||||
return info;
|
||||
} catch (e) {
|
||||
@@ -311,7 +305,6 @@ export async function prepareJavaLaunch(config: RunConfig, preparation: JavaPrep
|
||||
policy,
|
||||
preparation.request,
|
||||
preparation.build,
|
||||
preparation.debug,
|
||||
).catch((error: unknown) => {
|
||||
if (error instanceof IpcError && error.data?.type === "javaBuildProblems") {
|
||||
const problems = error.data.problems.join("; ");
|
||||
|
||||
@@ -272,37 +272,6 @@ const ICONS = {
|
||||
"agent-omp": "openidea/agents/omp",
|
||||
"agent-hermes": "openidea/agents/hermes",
|
||||
"agent-deepseek-harness": "brands/deepseek",
|
||||
"agent-agoragentic-acp": "openidea/agents/agoragentic-acp",
|
||||
"agent-amp-acp": "openidea/agents/amp-acp",
|
||||
"agent-antigravity-acp": "openidea/agents/antigravity-acp",
|
||||
"agent-autohand": "openidea/agents/autohand",
|
||||
"agent-bob": "openidea/agents/bob",
|
||||
"agent-cline": "openidea/agents/cline",
|
||||
"agent-codebuddy-code": "openidea/agents/codebuddy-code",
|
||||
"agent-cortex-code": "openidea/agents/cortex-code",
|
||||
"agent-corust-agent": "openidea/agents/corust-agent",
|
||||
"agent-crow-cli": "openidea/agents/crow-cli",
|
||||
"agent-deepagents": "openidea/agents/deepagents",
|
||||
"agent-devin": "openidea/agents/devin",
|
||||
"agent-dimcode": "openidea/agents/dimcode",
|
||||
"agent-dirac": "openidea/agents/dirac",
|
||||
"agent-factory-droid": "openidea/agents/factory-droid",
|
||||
"agent-fast-agent": "openidea/agents/fast-agent",
|
||||
"agent-glm-acp-agent": "openidea/agents/glm-acp-agent",
|
||||
"agent-grok-build": "openidea/agents/grok-build",
|
||||
"agent-harn": "openidea/agents/harn",
|
||||
"agent-junie": "openidea/agents/junie",
|
||||
"agent-kilo": "openidea/agents/kilo",
|
||||
"agent-kimchi": "openidea/agents/kimchi",
|
||||
"agent-minimax-code": "openidea/agents/minimax-code",
|
||||
"agent-minion-code": "openidea/agents/minion-code",
|
||||
"agent-muse-code": "openidea/agents/muse-code",
|
||||
"agent-nova": "openidea/agents/nova",
|
||||
"agent-pi-acp": "openidea/agents/pi-acp",
|
||||
"agent-poolside": "openidea/agents/poolside",
|
||||
"agent-sigit": "openidea/agents/sigit",
|
||||
"agent-stakpak": "openidea/agents/stakpak",
|
||||
"agent-vtcode": "openidea/agents/vtcode",
|
||||
"toolwindow-maven": "toolwindows/maven",
|
||||
"toolwindow-gradle": "toolwindows/gradle",
|
||||
"toolwindow-build": "toolwindows/build",
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
||||
<circle cx="8" cy="8" r="7" stroke="currentColor" stroke-width="1.5"/>
|
||||
<path d="M5.5 10.5L8 4L10.5 10.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<line x1="6.25" y1="8.75" x2="9.75" y2="8.75" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 416 B |
@@ -1,6 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.9197 13.61L17.3816 26.566L14.242 27.4049L11.2645 16.2643L0.119926 13.2906L0.957817 10.15L13.9197 13.61Z" fill="currentColor"/>
|
||||
<path d="M13.7391 16.0892L4.88169 24.9056L2.58872 22.6019L11.4461 13.7865L13.7391 16.0892Z" fill="currentColor"/>
|
||||
<path d="M18.9386 8.58315L22.4005 21.5392L19.2609 22.3781L16.2833 11.2374L5.13879 8.26381L5.97668 5.12318L18.9386 8.58315Z" fill="currentColor"/>
|
||||
<path d="M23.9803 3.55632L27.4422 16.5124L24.3025 17.3512L21.325 6.21062L10.1805 3.23698L11.0183 0.0963593L23.9803 3.55632Z" fill="currentColor"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 650 B |
@@ -1,3 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.1452 14.6818C14.9937 15.3182 16.2664 14.894 15.0997 13.7273C11.5998 10.3333 12.3421 1 7.99366 1C3.64518 1 4.3876 10.3333 0.887603 13.7273C-0.385123 15 0.993664 15.3182 1.84215 14.6818C5.13002 12.4545 4.9179 8.5303 7.99366 8.5303C11.0694 8.5303 10.8573 12.4545 14.1452 14.6818Z" fill="currentColor"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 416 B |
@@ -1,26 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.66949 9.56637C4.66949 8.92122 4.13288 8.39823 3.47094 8.39823C2.809 8.39823 2.2724 8.92122 2.2724 9.56637C2.2724 10.2115 2.809 10.7345 3.47094 10.7345V11C2.65856 11 2 10.3581 2 9.56637C2 8.7746 2.65856 8.13274 3.47094 8.13274C4.28332 8.13274 4.94189 8.7746 4.94189 9.56637C4.94189 10.3581 4.28332 11 3.47094 11V10.7345C4.13288 10.7345 4.66949 10.2115 4.66949 9.56637Z" fill="currentColor"/>
|
||||
<path d="M3.90678 9.59292C3.90678 9.81286 3.72385 9.99115 3.49818 9.99115C3.27252 9.99115 3.08959 9.81286 3.08959 9.59292C3.08959 9.37298 3.27252 9.19469 3.49818 9.19469C3.72385 9.19469 3.90678 9.37298 3.90678 9.59292Z" fill="currentColor"/>
|
||||
<path d="M3.8523 9.59292C3.8523 9.40231 3.69376 9.24779 3.49818 9.24779C3.30261 9.24779 3.14407 9.40231 3.14407 9.59292C3.14407 9.78353 3.30261 9.93805 3.49818 9.93805V9.99115C3.27252 9.99115 3.08959 9.81286 3.08959 9.59292C3.08959 9.37298 3.27252 9.19469 3.49818 9.19469C3.72385 9.19469 3.90678 9.37298 3.90678 9.59292C3.90678 9.81286 3.72385 9.99115 3.49818 9.99115V9.93805C3.69376 9.93805 3.8523 9.78353 3.8523 9.59292Z" fill="currentColor"/>
|
||||
<path d="M4.66949 6.43363C4.66949 5.78848 4.13288 5.26549 3.47094 5.26549C2.809 5.26549 2.2724 5.78848 2.2724 6.43363C2.2724 7.07878 2.809 7.60177 3.47094 7.60177V7.86726C2.65856 7.86726 2 7.2254 2 6.43363C2 5.64186 2.65856 5 3.47094 5C4.28332 5 4.94189 5.64186 4.94189 6.43363C4.94189 7.2254 4.28332 7.86726 3.47094 7.86726V7.60177C4.13288 7.60177 4.66949 7.07878 4.66949 6.43363Z" fill="currentColor"/>
|
||||
<path d="M3.90678 6.46018C3.90678 6.68011 3.72385 6.85841 3.49818 6.85841C3.27252 6.85841 3.08959 6.68011 3.08959 6.46018C3.08959 6.24024 3.27252 6.06195 3.49818 6.06195C3.72385 6.06195 3.90678 6.24024 3.90678 6.46018Z" fill="currentColor"/>
|
||||
<path d="M3.8523 6.46018C3.8523 6.26957 3.69376 6.11504 3.49818 6.11504C3.30261 6.11504 3.14407 6.26957 3.14407 6.46018C3.14407 6.65079 3.30261 6.80531 3.49818 6.80531V6.85841C3.27252 6.85841 3.08959 6.68011 3.08959 6.46018C3.08959 6.24024 3.27252 6.06195 3.49818 6.06195C3.72385 6.06195 3.90678 6.24024 3.90678 6.46018C3.90678 6.68011 3.72385 6.85841 3.49818 6.85841V6.80531C3.69376 6.80531 3.8523 6.65079 3.8523 6.46018Z" fill="currentColor"/>
|
||||
<path d="M8.04722 9.56637C8.04722 8.92122 7.51061 8.39823 6.84867 8.39823C6.18673 8.39823 5.65012 8.92122 5.65012 9.56637C5.65012 10.2115 6.18673 10.7345 6.84867 10.7345V11C6.03629 11 5.37772 10.3581 5.37772 9.56637C5.37772 8.7746 6.03629 8.13274 6.84867 8.13274C7.66105 8.13274 8.31961 8.7746 8.31961 9.56637C8.31961 10.3581 7.66105 11 6.84867 11V10.7345C7.51061 10.7345 8.04722 10.2115 8.04722 9.56637Z" fill="currentColor"/>
|
||||
<path d="M7.2845 9.59292C7.2845 9.81286 7.10157 9.99115 6.87591 9.99115C6.65025 9.99115 6.46731 9.81286 6.46731 9.59292C6.46731 9.37298 6.65025 9.19469 6.87591 9.19469C7.10157 9.19469 7.2845 9.37298 7.2845 9.59292Z" fill="currentColor"/>
|
||||
<path d="M7.23002 9.59292C7.23002 9.40231 7.07148 9.24779 6.87591 9.24779C6.68033 9.24779 6.52179 9.40231 6.52179 9.59292C6.52179 9.78353 6.68033 9.93805 6.87591 9.93805V9.99115C6.65025 9.99115 6.46731 9.81286 6.46731 9.59292C6.46731 9.37298 6.65025 9.19469 6.87591 9.19469C7.10157 9.19469 7.2845 9.37298 7.2845 9.59292C7.2845 9.81286 7.10157 9.99115 6.87591 9.99115V9.93805C7.07148 9.93805 7.23002 9.78353 7.23002 9.59292Z" fill="currentColor"/>
|
||||
<path d="M8.04722 6.43363C8.04722 5.78848 7.51061 5.26549 6.84867 5.26549C6.18673 5.26549 5.65012 5.78848 5.65012 6.43363C5.65012 7.07878 6.18673 7.60177 6.84867 7.60177V7.86726C6.03629 7.86726 5.37772 7.2254 5.37772 6.43363C5.37772 5.64186 6.03629 5 6.84867 5C7.66105 5 8.31961 5.64186 8.31961 6.43363C8.31961 7.2254 7.66105 7.86726 6.84867 7.86726V7.60177C7.51061 7.60177 8.04722 7.07878 8.04722 6.43363Z" fill="currentColor"/>
|
||||
<path d="M7.2845 6.46018C7.2845 6.68011 7.10157 6.85841 6.87591 6.85841C6.65025 6.85841 6.46731 6.68011 6.46731 6.46018C6.46731 6.24024 6.65025 6.06195 6.87591 6.06195C7.10157 6.06195 7.2845 6.24024 7.2845 6.46018Z" fill="currentColor"/>
|
||||
<path d="M7.23002 6.46018C7.23002 6.26957 7.07148 6.11504 6.87591 6.11504C6.68033 6.11504 6.52179 6.26957 6.52179 6.46018C6.52179 6.65079 6.68033 6.80531 6.87591 6.80531V6.85841C6.65025 6.85841 6.46731 6.68011 6.46731 6.46018C6.46731 6.24024 6.65025 6.06195 6.87591 6.06195C7.10157 6.06195 7.2845 6.24024 7.2845 6.46018C7.2845 6.68011 7.10157 6.85841 6.87591 6.85841V6.80531C7.07148 6.80531 7.23002 6.65079 7.23002 6.46018Z" fill="currentColor"/>
|
||||
<path d="M11.207 9.56637C11.207 8.92122 10.6704 8.39823 10.0085 8.39823C9.34653 8.39823 8.80993 8.92122 8.80993 9.56637C8.80993 10.2115 9.34653 10.7345 10.0085 10.7345V11C9.19609 11 8.53753 10.3581 8.53753 9.56637C8.53753 8.7746 9.19609 8.13274 10.0085 8.13274C10.8209 8.13274 11.4794 8.7746 11.4794 9.56637C11.4794 10.3581 10.8209 11 10.0085 11V10.7345C10.6704 10.7345 11.207 10.2115 11.207 9.56637Z" fill="currentColor"/>
|
||||
<path d="M10.4443 9.59292C10.4443 9.81286 10.2614 9.99115 10.0357 9.99115C9.81005 9.99115 9.62712 9.81286 9.62712 9.59292C9.62712 9.37298 9.81005 9.19469 10.0357 9.19469C10.2614 9.19469 10.4443 9.37298 10.4443 9.59292Z" fill="currentColor"/>
|
||||
<path d="M10.3898 9.59292C10.3898 9.40231 10.2313 9.24779 10.0357 9.24779C9.84014 9.24779 9.6816 9.40231 9.6816 9.59292C9.6816 9.78353 9.84014 9.93805 10.0357 9.93805V9.99115C9.81005 9.99115 9.62712 9.81286 9.62712 9.59292C9.62712 9.37298 9.81005 9.19469 10.0357 9.19469C10.2614 9.19469 10.4443 9.37298 10.4443 9.59292C10.4443 9.81286 10.2614 9.99115 10.0357 9.99115V9.93805C10.2313 9.93805 10.3898 9.78353 10.3898 9.59292Z" fill="currentColor"/>
|
||||
<path d="M11.207 6.43363C11.207 5.78848 10.6704 5.26549 10.0085 5.26549C9.34653 5.26549 8.80993 5.78848 8.80993 6.43363C8.80993 7.07878 9.34653 7.60177 10.0085 7.60177V7.86726C9.19609 7.86726 8.53753 7.2254 8.53753 6.43363C8.53753 5.64186 9.19609 5 10.0085 5C10.8209 5 11.4794 5.64186 11.4794 6.43363C11.4794 7.2254 10.8209 7.86726 10.0085 7.86726V7.60177C10.6704 7.60177 11.207 7.07878 11.207 6.43363Z" fill="currentColor"/>
|
||||
<path d="M10.4443 6.46018C10.4443 6.68011 10.2614 6.85841 10.0357 6.85841C9.81005 6.85841 9.62712 6.68011 9.62712 6.46018C9.62712 6.24024 9.81005 6.06195 10.0357 6.06195C10.2614 6.06195 10.4443 6.24024 10.4443 6.46018Z" fill="currentColor"/>
|
||||
<path d="M10.3898 6.46018C10.3898 6.26957 10.2313 6.11504 10.0357 6.11504C9.84014 6.11504 9.6816 6.26957 9.6816 6.46018C9.6816 6.65079 9.84014 6.80531 10.0357 6.80531V6.85841C9.81005 6.85841 9.62712 6.68011 9.62712 6.46018C9.62712 6.24024 9.81005 6.06195 10.0357 6.06195C10.2614 6.06195 10.4443 6.24024 10.4443 6.46018C10.4443 6.68011 10.2614 6.85841 10.0357 6.85841V6.80531C10.2313 6.80531 10.3898 6.65079 10.3898 6.46018Z" fill="currentColor"/>
|
||||
<path d="M14.5847 9.56637C14.5847 8.92122 14.0481 8.39823 13.3862 8.39823C12.7243 8.39823 12.1877 8.92122 12.1877 9.56637C12.1877 10.2115 12.7243 10.7345 13.3862 10.7345V11C12.5738 11 11.9153 10.3581 11.9153 9.56637C11.9153 8.7746 12.5738 8.13274 13.3862 8.13274C14.1986 8.13274 14.8571 8.7746 14.8571 9.56637C14.8571 10.3581 14.1986 11 13.3862 11V10.7345C14.0481 10.7345 14.5847 10.2115 14.5847 9.56637Z" fill="currentColor"/>
|
||||
<path d="M13.822 9.59292C13.822 9.81286 13.6391 9.99115 13.4134 9.99115C13.1878 9.99115 13.0048 9.81286 13.0048 9.59292C13.0048 9.37298 13.1878 9.19469 13.4134 9.19469C13.6391 9.19469 13.822 9.37298 13.822 9.59292Z" fill="currentColor"/>
|
||||
<path d="M13.7676 9.59292C13.7676 9.40231 13.609 9.24779 13.4134 9.24779C13.2179 9.24779 13.0593 9.40231 13.0593 9.59292C13.0593 9.78353 13.2179 9.93805 13.4134 9.93805V9.99115C13.1878 9.99115 13.0048 9.81286 13.0048 9.59292C13.0048 9.37298 13.1878 9.19469 13.4134 9.19469C13.6391 9.19469 13.822 9.37298 13.822 9.59292C13.822 9.81286 13.6391 9.99115 13.4134 9.99115V9.93805C13.609 9.93805 13.7676 9.78353 13.7676 9.59292Z" fill="currentColor"/>
|
||||
<path d="M14.5847 6.43363C14.5847 5.78848 14.0481 5.26549 13.3862 5.26549C12.7243 5.26549 12.1877 5.78848 12.1877 6.43363C12.1877 7.07878 12.7243 7.60177 13.3862 7.60177V7.86726C12.5738 7.86726 11.9153 7.2254 11.9153 6.43363C11.9153 5.64186 12.5738 5 13.3862 5C14.1986 5 14.8571 5.64186 14.8571 6.43363C14.8571 7.2254 14.1986 7.86726 13.3862 7.86726V7.60177C14.0481 7.60177 14.5847 7.07878 14.5847 6.43363Z" fill="currentColor"/>
|
||||
<path d="M13.822 6.46018C13.822 6.68011 13.6391 6.85841 13.4134 6.85841C13.1878 6.85841 13.0048 6.68011 13.0048 6.46018C13.0048 6.24024 13.1878 6.06195 13.4134 6.06195C13.6391 6.06195 13.822 6.24024 13.822 6.46018Z" fill="currentColor"/>
|
||||
<path d="M13.7676 6.46018C13.7676 6.26957 13.609 6.11504 13.4134 6.11504C13.2179 6.11504 13.0593 6.26957 13.0593 6.46018C13.0593 6.65079 13.2179 6.80531 13.4134 6.80531V6.85841C13.1878 6.85841 13.0048 6.68011 13.0048 6.46018C13.0048 6.24024 13.1878 6.06195 13.4134 6.06195C13.6391 6.06195 13.822 6.24024 13.822 6.46018C13.822 6.68011 13.6391 6.85841 13.4134 6.85841V6.80531C13.609 6.80531 13.7676 6.65079 13.7676 6.46018Z" fill="currentColor"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 8.8 KiB |
@@ -1,7 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.859 7.625C14.7861 6.19257 14.2645 4.81937 13.3679 3.69983C12.4714 2.58029 11.2454 1.77115 9.8635 1.387C9.83646 1.17687 9.73397 0.983728 9.57511 0.843545C9.41625 0.703362 9.21186 0.625692 9 0.625H7C6.5565 0.625 6.1925 0.9585 6.1365 1.387C4.75462 1.77115 3.52861 2.58029 2.63206 3.69983C1.73552 4.81937 1.21387 6.19257 1.141 7.625H0V8.375H16V7.625H14.859ZM6.125 2.1685V6.5H6.875V1.5C6.875 1.46685 6.88817 1.43505 6.91161 1.41161C6.93505 1.38817 6.96685 1.375 7 1.375H9C9.03315 1.375 9.06495 1.38817 9.08839 1.41161C9.11183 1.43505 9.125 1.46685 9.125 1.5V6.5H9.875V2.1685C11.0501 2.54253 12.084 3.26442 12.84 4.23871C13.596 5.213 14.0385 6.39381 14.109 7.625H1.891C1.96146 6.39381 2.40395 5.213 3.15996 4.23871C3.91597 3.26442 4.94989 2.54253 6.125 2.1685Z" fill="currentColor"/>
|
||||
<path d="M1.375 12.5C1.375 12.569 1.431 12.625 1.5 12.625H2.375V13C2.37553 13.4308 2.54693 13.8438 2.85156 14.1484C3.15619 14.4531 3.56919 14.6245 4 14.625H12C12.4308 14.6245 12.8438 14.4531 13.1484 14.1484C13.4531 13.8438 13.6245 13.4308 13.625 13V12.625H14.5C14.5332 12.625 14.5649 12.6118 14.5884 12.5884C14.6118 12.5649 14.625 12.5332 14.625 12.5V9.5H15.375V12.5C15.375 12.9825 14.9825 13.375 14.5 13.375H14.3452C14.2555 13.9324 13.9701 14.4397 13.5405 14.8062C13.1109 15.1726 12.5647 15.3743 12 15.375H4C3.43531 15.3743 2.88912 15.1726 2.45947 14.8062C2.02992 14.4397 1.74453 13.9324 1.65479 13.375H1.5C1.0175 13.375 0.625 12.9825 0.625 12.5V9.5H1.375V12.5Z" fill="currentColor"/>
|
||||
<path d="M9.55518 12.625C9.6045 12.6316 9.65237 12.6477 9.69531 12.6729C9.7382 12.698 9.7758 12.7317 9.80566 12.7715C9.83547 12.8112 9.85697 12.8566 9.86914 12.9048C9.88131 12.953 9.88384 13.0031 9.87646 13.0522C9.86907 13.1015 9.85201 13.1489 9.82617 13.1914C9.80037 13.2338 9.76625 13.2706 9.72607 13.2998C9.22935 13.6748 8.62336 13.877 8.00098 13.875H8C7.37744 13.8771 6.77126 13.6749 6.27441 13.2998C6.19505 13.24 6.14282 13.1511 6.12891 13.0527C6.11503 12.9542 6.14081 12.8539 6.20068 12.7744C6.26051 12.695 6.34934 12.6428 6.44775 12.6289C6.5463 12.615 6.64658 12.6408 6.72607 12.7007C7.46402 13.256 8.53444 13.256 9.27539 12.7007C9.31464 12.6702 9.35973 12.6478 9.40771 12.6348C9.45572 12.6218 9.50589 12.6184 9.55518 12.625Z" fill="currentColor"/>
|
||||
<path d="M5 9.5C5.55228 9.5 6 9.94772 6 10.5C6 11.0523 5.55228 11.5 5 11.5C4.44772 11.5 4 11.0523 4 10.5C4 9.94772 4.44772 9.5 5 9.5Z" fill="currentColor"/>
|
||||
<path d="M11 9.5C11.5523 9.5 12 9.94772 12 10.5C12 11.0523 11.5523 11.5 11 11.5C10.4477 11.5 10 11.0523 10 10.5C10 9.94772 10.4477 9.5 11 9.5Z" fill="currentColor"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.6 KiB |
@@ -1,6 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 92 96"><g fill="currentColor">
|
||||
<path d="M65.45 16.3c10.89 0 19.71 8.86 19.71 19.8v6.6l5.74 11.46a4.48 4.48 0 0 1-.01 3.6L85.16 69.1v6.6c0 10.94-8.83 19.8-19.71 19.8H26.02c-10.89 0-19.71-8.86-19.71-19.8v-6.6L.45 57.8a4.48 4.48 0 0 1-.01-3.67L6.31 42.7v-6.6c0-10.94 8.83-19.8 19.71-19.8h39.43zm-2.52 5.7H29.19c-9.32 0-16.87 7.56-16.87 16.88v5.62l-4.88 9.46a4.48 4.48 0 0 0 .01 3.68l4.87 9.36v5.62c0 9.32 7.55 16.88 16.87 16.88h33.74c9.32 0 16.87-7.55 16.87-16.88V67l4.77-9.39a4.48 4.48 0 0 0 0-3.61L79.8 44.5v-5.62C79.8 29.56 72.25 22 62.93 22z" fill-rule="nonzero"/>
|
||||
<circle cx="45.73" cy="11" r="11"/>
|
||||
<rect stroke="currentColor" stroke-width="8" x="31" y="44.5" width="5" height="22" rx="2.5"/>
|
||||
<rect stroke="currentColor" stroke-width="8" x="55" y="44.5" width="5" height="22" rx="2.5"/>
|
||||
</g></svg>
|
||||
|
Before Width: | Height: | Size: 885 B |
@@ -1,5 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path fill="currentColor" d="M12.13 1.25c.15-.14.16-.14.28-.15.18 0 .36.08.64.34.68.62 1.61 1.89 2.2 2.97l.22.42.32.16c.3.16.81.48 1.02.65.09.08.11.08.21.04.45-.18 1.09.05 1.65.6.51.49 1 1.33 1.18 2.03.03.11.06.36.07.54.04.64-.16 1.14-.55 1.37-.08.04-.08.06-.08.26.02.95-.23 1.89-.74 2.82-.58 1.04-1.6 2.11-2.98 3.12-.74.55-2.5 1.58-3.3 1.95-1.9.86-3.43 1.2-4.76 1.03-.79-.09-1.69-.41-2.22-.77-.14-.1-.16-.1-.27-.07-.57.16-1.31-.18-1.94-.88-.25-.28-.66-.98-.79-1.35-.3-.87-.25-1.65.16-2.12.11-.12.09-.33.09-.33-.04-.33-.05-.82-.04-1.14v-.3l-.43-.79c-.68-1.23-1.12-2.25-1.28-3.04-.09-.43-.09-.62.02-.77.07-.09.28-.18.54-.22.66-.12 2.09-.01 3.69.27l.16.03.36-.32c.61-.54 1.01-.84 1.75-1.31.77-.48 1.64-.89 2.62-1.2l.32-.1.17-.46c.62-1.65 1.25-2.86 1.71-3.27h0Zm-5.19 8.45c-.7.41-1.05.61-1.3.84-1.04.93-1.43 2.39-.99 3.71.11.33.31.68.71 1.39.41.71.61 1.06.83 1.32.92 1.05 2.37 1.45 3.68 1 .32-.11.68-.31 1.38-.72l4.02-2.34c.7-.41 1.05-.61 1.3-.84 1.04-.93 1.43-2.39.99-3.71-.11-.33-.31-.68-.71-1.39s-.61-1.06-.83-1.32c-.92-1.05-2.37-1.45-3.68-1-.32.11-.67.31-1.38.72l-4.02 2.34Z"/>
|
||||
<path fill="currentColor" fill-opacity="0.4" d="M8.02 12.13c.38-.22.87-.09 1.09.29l.86 1.5c.22.38.09.88-.29 1.09-.38.22-.86.09-1.09-.29l-.86-1.5c-.22-.38-.09-.87.29-1.09Z"/>
|
||||
<path fill="currentColor" fill-opacity="0.4" d="M12.31 9.64c.38-.22.87-.09 1.09.29l.86 1.5c.22.38.09.87-.29 1.09s-.87.09-1.09-.29l-.86-1.5c-.22-.38-.09-.88.29-1.09Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 362 362" overflow="hidden">
|
||||
<path fill="currentColor" fill-rule="evenodd" d="M1562.63,107.07h-4.18v5.15h4.18c1.94,0,3.21-.87,3.21-2.53,0-1.75-1.17-2.62-3.21-2.62ZM1553.3,102.31h9.42c5.15,0,8.55,2.82,8.55,7.19,0,2.72-1.36,4.76-3.4,6.02l3.69,5.34v1.07h-5.34l-3.59-5.15h-4.18v5.15h-5.15v-19.62ZM1579.63,112.51c0-10.49-6.99-18.46-17.68-18.46s-17.49,7.58-17.49,18.46,6.99,18.46,17.49,18.46,17.68-7.97,17.68-18.46ZM1584,112.51c0,12.34-8.26,22.63-22.05,22.63s-21.86-10.39-21.86-22.63,8.16-22.63,21.86-22.63,22.05,10.3,22.05,22.63ZM348.21,156.4l-42.55,24.61,42.55,24.54c10.75,6.22,14.42,19.9,8.21,30.67-6.2,10.7-19.92,14.37-30.63,8.18l-76.21-44c-5.08-2.96-8.61-7.59-10.18-12.8-.74-2.4-1.09-4.87-1-7.31.04-1.76.3-3.53.79-5.29,1.52-5.48,5.1-10.38,10.39-13.46l76.21-43.97c10.71-6.19,24.43-2.51,30.63,8.22,6.22,10.72,2.54,24.41-8.21,30.61ZM307.93,275.68l-76.19-43.94c-4.09-2.38-8.63-3.3-12.99-2.93-11.62.83-20.75,10.53-20.75,22.34v87.98c0,12.4,10,22.45,22.42,22.45s22.45-10.05,22.45-22.45v-49.21l42.66,24.63c10.72,6.23,24.43,2.54,30.61-8.17,6.17-10.74,2.53-24.5-8.21-30.7ZM220.01,189.61l-31.67,31.63c-.91.93-2.65,1.69-3.98,1.69h-9.31c-1.28,0-3.06-.76-3.98-1.69l-31.66-31.63c-.91-.89-1.64-2.68-1.64-3.94v-9.33c0-1.29.73-3.09,1.64-3.99l31.66-31.63c.92-.93,2.7-1.66,3.98-1.66h9.31c1.29,0,3.07.73,3.98,1.66l31.67,31.63c.9.9,1.63,2.7,1.63,3.99v9.33c0,1.26-.73,3.05-1.63,3.94ZM194.7,180.83c0-1.28-.77-3.06-1.68-4l-9.17-9.13c-.9-.9-2.68-1.65-3.96-1.65h-.36c-1.28,0-3.05.75-3.94,1.65l-9.17,9.13c-.92.95-1.62,2.73-1.62,4v.36c0,1.26.7,3.03,1.62,3.95l9.17,9.16c.9.9,2.67,1.65,3.94,1.65h.36c1.28,0,3.06-.75,3.96-1.65l9.17-9.16c.9-.92,1.68-2.68,1.68-3.95v-.36ZM51.48,86.28l76.21,43.99c4.09,2.35,8.64,3.29,13.01,2.93,11.6-.86,20.75-10.58,20.75-22.37V22.84c0-12.37-10.06-22.41-22.42-22.41s-22.45,10.05-22.45,22.41v49.23l-42.7-24.66c-10.71-6.2-24.4-2.53-30.61,8.2-6.19,10.76-2.53,24.47,8.2,30.67ZM218.75,133.19c4.36.36,8.9-.57,12.99-2.93l76.19-43.99c10.74-6.2,14.38-19.91,8.21-30.67-6.18-10.72-19.89-14.4-30.61-8.2l-42.66,24.66V22.84c0-12.37-10.03-22.41-22.45-22.41s-22.42,10.05-22.42,22.41v87.98c0,11.8,9.13,21.51,20.75,22.37ZM140.71,228.8c-4.38-.37-8.92.54-13.01,2.93l-76.21,43.94c-10.72,6.2-14.38,19.96-8.2,30.7,6.22,10.71,19.91,14.4,30.61,8.17l42.7-24.63v49.21c0,12.4,10.03,22.45,22.45,22.45s22.42-10.05,22.42-22.45v-87.98c0-11.81-9.16-21.51-20.75-22.34ZM120.04,187.6c.76-2.4,1.08-4.87,1.02-7.31-.09-1.76-.32-3.53-.82-5.29-1.51-5.48-5.08-10.38-10.44-13.46l-76.15-43.97c-10.75-6.19-24.45-2.51-30.63,8.22-6.23,10.72-2.55,24.41,8.2,30.61l42.55,24.61-42.55,24.54c-10.75,6.22-14.41,19.9-8.2,30.67,6.17,10.7,19.88,14.37,30.63,8.18l76.15-44c5.14-2.96,8.63-7.59,10.23-12.8Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.7 KiB |
@@ -1,10 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12">
|
||||
<g transform="matrix(0.00160555,0,0,-0.0014599,-0.26812129,11.08482)" fill="currentColor">
|
||||
<path d="m 297,6493 c -4,-3 -7,-1357 -7,-3008 0,-2390 3,-3005 12,-3012 13,-10 1199,-9 1224,1 11,4 13,61 10,295 -2,159 -7,294 -10,299 -4,7 -112,11 -312,11 -168,0 -309,3 -314,6 -12,7 -13,4775 -2,4792 6,10 85,13 317,15 l 310,3 v 600 l -611,3 c -336,1 -614,-1 -617,-5 z"/>
|
||||
<path d="m 6287,6493 c -4,-3 -7,-136 -7,-294 0,-219 3,-290 13,-296 6,-4 152,-10 322,-13 l 310,-5 3,-2394 c 1,-1545 -1,-2398 -8,-2405 -6,-6 -127,-9 -316,-7 -246,2 -309,0 -315,-11 -5,-7 -9,-145 -9,-305 V 470 l 23,-1 c 158,-4 1192,-2 1200,3 14,9 22,5964 7,6002 l -10,26 h -603 c -332,0 -607,-3 -610,-7 z"/>
|
||||
<g transform="matrix(1.0249,0,0,1.0566,-429.39,51.322)">
|
||||
<path d="m 2476.7,5111.6 c -64.95,-6.2305 -71.077,-28.66 -73.528,-325.23 -3.6765,-261.68 4.9018,-351.4 36.764,-371.34 7.3528,-4.9844 583.32,-12.461 1276.9,-16.199 l 1262.2,-6.2306 73.528,-34.891 c 191.17,-90.966 300.24,-292.84 284.31,-527.1 -15.931,-223.05 -134.8,-392.52 -314.95,-449.85 -61.274,-19.938 -133.58,-21.184 -727.93,-18.692 -607.83,3.7384 -661.75,2.4922 -682.59,-17.446 -22.058,-19.938 -23.284,-43.614 -23.284,-331.47 0,-190.65 4.9019,-320.25 12.255,-335.2 11.029,-21.184 26.96,-23.676 123.77,-23.676 h 110.29 l 66.176,-63.552 c 36.764,-34.891 125,-125.86 198.53,-201.87 72.303,-76.013 322.3,-333.96 555.14,-571.96 l 424.01,-434.89 519.6,3.7383 c 390.93,2.4922 520.83,7.4767 520.83,18.692 0,7.4766 -223.04,249.22 -496.32,534.58 -562.49,589.41 -666.66,701.56 -660.53,707.79 2.451,2.4922 52.695,8.7227 111.52,13.707 322.3,24.922 593.13,194.39 790.43,495.95 129.9,199.38 187.5,391.28 196.08,660.44 8.5783,245.48 -14.706,368.85 -116.42,600.63 -123.77,286.61 -328.43,492.21 -596.8,601.87 -232.84,95.95 -167.89,92.212 -1574.7,93.458 -691.17,1.2462 -1274.5,1.2462 -1295.3,-1.2461 z"/>
|
||||
<path d="m 2430.1,3942.7 c -24.509,-18.692 -24.509,-33.645 -24.509,-1254.8 0,-1163.9 1.2255,-1238.6 22.058,-1271 l 20.833,-33.645 h 337 c 289.21,0 338.23,2.4922 354.16,19.938 18.382,17.446 19.608,145.79 18.382,1267.3 -1.2255,1115.3 -2.4509,1251.1 -19.608,1271 -18.382,18.692 -50.244,21.184 -351.71,21.184 -276.96,-1.2461 -335.78,-3.7383 -356.61,-19.938 z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,9 +0,0 @@
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 366 368"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="m 26,275.93574 c 0.65,-9.32 8.46,-15.43 15,-20.96 15.43,-13.04 35.67,-21.92 53,-32.71 20.67,-12.88 61.58,-40.31 80,-55.03 0,0 21,-18.39 21,-18.39 0,0 28,-23.91 28,-23.91 10,-8.33 14.1,-11.65 25,-18.92 7.42,-4.94 19.07,-12.550001 24.52,-19.330001 7.17,-8.93 4.16,-18.82 -4.53,-25.45 -5.67,-4.32 -23.5,-8.94 -30.99,-10.66 -3.1,-0.72 -11.45,-1.57 -13.38,-3.62 -3.22,-3.43 1.67,-6.99 4.38,-8.45 6.61,-3.54 17.51,-5.73 25,-5.82 0,0 4,0 4,0 16.51,-0.2 18.85,-12.47 40,-11.99 9.26,0.21 21.16,2.48 29,7.54 7.87,5.07 12.2,11.73 17.05,19.45 6.31,10.05 12.35,21.16 14.49,33 1.42,7.88 -0.45,13.62 -0.54,21.000001 -0.28,24.26 6.68,37.92 -2.44,63 -5.9,16.24 -14.87,35.36 -23.98,50 -9.34,15 -20.81,30.64 -35.58,40.64 0,0 -16,9.36 -16,9.36 -3.3,1.9 -6.18,2.94 -6.64,7.04 -0.68,2.83 -0.16,7.11 0,9.96 0,0 1.29,8 1.29,8 1.62,5.16 8.51,12.15 12.35,16 3.36,3.37 6.84,7.82 12,7.89 4.2,0.06 8.14,-2.87 12,-4.44 5.24,-2.13 11.35,-3.55 17,-3.94 6.33,-0.43 17.05,1.85 14,10.49 -2.84,-3.54 -6.09,-6.36 -11,-5.57 -2.47,0.4 -10.06,3.6 -8.09,7.08 1.19,2.08 7.67,3.01 10.09,3.88 6.26,2.25 10.83,5.76 14,11.61 0,0 -17,-6.33 -17,-6.33 -9.74,-2.08 -18.73,0.62 -28,3.33 5.49,3.71 8.06,5.51 12,11 -8.23,-1.96 -13.6,-7.46 -26,-6.96 -9.64,0.39 -11.89,4.13 -27,3.96 -9.42,-0.11 -17.78,-4.36 -27,-3.96 -9.45,0.41 -13.16,5.64 -21,8.96 3.16,-14.88 19.73,-16 32,-16 -7.31,-10.21 -20.46,-18.11 -23.28,-26 -0.7,-1.97 -0.69,-3.94 -0.71,-6 0,0 0,-14 0,-14 0.23,-2.35 1.13,-5.62 0,-7.73 -1.66,-2.77 -8.94,-4.64 -12.01,-5.55 -20.1,-5.96 -24.58,-0.84 -43,2.01 0,0 -14,2.11 -14,2.11 -9.78,1.06 -18.83,0.92 -28,5.02 0,0 -15,7.88 -15,7.88 -16.76,8.6 -42.02,22.27 -59,27.93 -9.14,3.04 -16.2,6.24 -26,6.33 0,0 5,-10 5,-10 -3.92,0.18 -15.76,3.08 -17.92,-0.51 -2.44,-4.07 5.28,-9.01 7.92,-10.91 0,0 36,-24.58 36,-24.58 0,0 -19,3.25 -19,3.25 z m 227,1.75 c -2.98,0.84 -11.45,3.61 -12.96,6.27 -0.95,1.89 -0.18,5.54 0,7.73 0.04,2.47 -0.13,4.56 0.61,7 1.52,5.07 11.84,17.33 16.35,19.88 3.38,1.91 15.93,0.11 20,-0.88 -4.12,-8.71 -16.66,-15.05 -21.99,-24 -3.43,-5.75 -0.8,-10.06 -2.01,-16 z" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.1 KiB |
@@ -1,6 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 128 128">
|
||||
<path fill="currentColor" d="M40.1024 85.0722C47.6207 77.5537 51.8469 67.3453 51.8469 56.7136C51.8469 46.0818 47.617 35.8734 40.1024 28.355L11.7446 0C4.22995 7.5185 0 17.7269 0 28.3586C0 38.9903 4.22995 49.1987 11.7446 56.7172L40.0987 85.0722H40.1024Z"/>
|
||||
<path fill="currentColor" d="M99.4385 87.698C91.9239 80.1832 81.7121 75.9531 71.0844 75.9531C60.4566 75.9531 50.2448 80.1832 42.7266 87.698L71.0844 116.057C78.599 123.571 88.8107 127.802 99.4421 127.802C110.074 127.802 120.282 123.571 127.8 116.057L99.4421 87.698H99.4385Z"/>
|
||||
<path fill="currentColor" d="M11.8146 115.987C19.3329 123.502 29.541 127.732 40.1724 127.732V87.6289H0.0664062C0.0700559 98.2606 4.29635 108.469 11.8146 115.987Z"/>
|
||||
<path fill="currentColor" d="M110.387 45.7684C102.869 38.2535 92.6608 34.0198 82.0258 34.0234C71.3943 34.0234 61.1863 38.2535 53.668 45.772L82.0258 74.1306L110.387 45.7684Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 973 B |
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 263 300">
|
||||
<path fill="currentColor" d="M1.84577e-10 100.797V38.6224C1.88813e-05 35.8899 1.45777 33.365 3.82414 31.9988L57.6539 0.920185C60.0203 -0.446051 62.9358 -0.446051 65.3022 0.920185L119.132 31.9988C121.498 33.3651 122.956 35.8899 122.956 38.6224V70.375C123.192 80.9262 128.769 91.103 138.577 96.7655C148.384 102.428 159.986 102.169 169.242 97.0979L196.74 81.2217C199.107 79.8554 202.022 79.8554 204.388 81.2217L258.218 112.3C260.585 113.667 262.042 116.191 262.042 118.924V181.081C262.042 183.814 260.585 186.339 258.218 187.705L204.388 218.783C202.022 220.15 199.107 220.15 196.74 218.783L169.464 203.036C160.173 197.847 148.465 197.536 138.579 203.244C128.772 208.906 123.195 219.083 122.959 229.634V261.378C122.959 264.111 121.501 266.635 119.135 268.002L65.3048 299.08C62.9384 300.447 60.0229 300.447 57.6566 299.08L3.82673 268.002C1.46036 266.635 0.00260562 264.111 0.00260562 261.378V199.221C0.0026245 196.488 1.46038 193.963 3.82675 192.597L57.6565 161.519C60.0229 160.152 62.9384 160.152 65.3048 161.519L92.8656 177.431C102.11 182.467 113.679 182.711 123.463 177.062C133.349 171.355 138.934 161.06 139.086 150.419C138.85 139.868 133.274 128.601 123.466 122.938C113.658 117.276 102.056 117.534 92.8007 122.606L65.1758 138.645C62.7991 140.025 59.8649 140.024 57.4894 138.642L3.80216 107.407C1.44816 106.038 -1.88809e-05 103.52 1.84577e-10 100.797Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,3 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M3.12109 11.0078H1.99902V5.49316H3.12109V11.0078ZM3.7041 5.49316C4.91979 5.49316 5.31142 5.57449 5.80762 5.7373C6.50208 5.97365 6.85299 6.40958 6.86133 7.04492V9.45605C6.86125 10.207 6.37767 10.6797 5.41016 10.874C4.95546 10.9633 4.69632 11.0078 3.7041 11.0078V10.6064C4.72131 10.6064 4.95994 10.5507 5.34863 10.4404C5.91072 10.2671 6.19576 9.93907 6.2041 9.45605V7.04492C6.20402 6.4883 5.83211 6.13886 5.08789 5.99707C4.74057 5.93405 4.58897 5.89978 3.7041 5.89453V5.49316ZM9.16797 5.49316V11.0078H8.0459V5.49316H9.16797ZM14 6.79297V11.0078H12.8779V8.0791L13.8877 6.79297H14ZM14 5.49316V5.7373L11.3594 8.97852H10.7852L9.74219 6.94531V6.07812H9.86719L11.0723 8.33203L13.4258 5.49316H14Z" fill="currentColor"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 822 B |
@@ -1,6 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><g fill="currentColor">
|
||||
<text x="8" y="10" text-anchor="middle" font-size="10.5" font-family="Georgia, serif" font-style="italic" fill="currentColor">δ</text>
|
||||
<line x1="1" y1="14" x2="15" y2="14" stroke="currentColor" stroke-opacity="0.4" stroke-width="1" stroke-linecap="round"/>
|
||||
<line x1="8" y1="14" x2="8" y2="12" stroke="currentColor" stroke-width="1" stroke-linecap="round"/>
|
||||
<circle cx="8" cy="11.5" r="0.7" fill="currentColor"/>
|
||||
</g></svg>
|
||||
|
Before Width: | Height: | Size: 539 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 900 900" fill="none"><path fill="currentColor" d="M622.037 192.524a10.58 10.58 0 0 1-4.056-2.001 10.573 10.573 0 0 1-3.98-7.89 10.595 10.595 0 0 1 .804-4.452c20.214-49.194 29.134-88.555 14.74-105.033-38.123-43.716-191.004 43.219-239.75 72.663a10.596 10.596 0 0 1-10.841.041 10.576 10.576 0 0 1-4.396-5.07c-20.491-49.089-42.031-83.233-63.865-84.714-57.871-3.96-104.516 165.624-118.17 220.895a10.574 10.574 0 0 1-1.993 4.057 10.572 10.572 0 0 1-7.884 3.977 10.586 10.586 0 0 1-4.447-.802c-49.194-20.215-88.572-29.134-105.033-14.74-43.717 38.123 43.202 191.005 72.644 239.75a10.553 10.553 0 0 1 1.454 4.279 10.573 10.573 0 0 1-6.481 10.958c-49.072 20.491-83.216 42.031-84.715 63.864-3.944 57.871 165.624 104.516 220.913 118.171a10.566 10.566 0 0 1 5.658 3.601 10.57 10.57 0 0 1 2.355 6.281 10.58 10.58 0 0 1-.799 4.442c-20.214 49.194-29.134 88.572-14.739 105.033 38.121 43.717 191.021-43.202 239.767-72.644a10.566 10.566 0 0 1 15.238 5.027c20.489 49.072 42.013 83.216 63.862 84.715 57.871 3.944 104.516-165.624 118.153-220.913a10.603 10.603 0 0 1 9.895-8.021 10.566 10.566 0 0 1 4.449.808c49.193 20.214 88.553 29.116 105.032 14.738 43.718-38.121-43.219-191.022-72.663-239.767a10.602 10.602 0 0 1 1.326-12.655 10.604 10.604 0 0 1 3.703-2.582c49.089-20.49 83.233-42.031 84.714-63.863 3.96-57.871-165.624-104.516-220.895-118.153Zm-66.394-55.478c11.123 19.938-46.196 152.797-88.83 245.724a8.36 8.36 0 0 1-8.239 4.855 8.374 8.374 0 0 1-7.412-6.043c-17.219-60.42-36.899-131.411-57.957-191.675a10.557 10.557 0 0 1 4.924-12.759c52.586-28.721 142.568-66.86 157.514-40.102ZM303.635 153.49c21.953 6.233 75.365 140.709 110.92 236.564a8.364 8.364 0 0 1-2.394 9.249 8.364 8.364 0 0 1-9.504.978c-54.943-30.493-119.013-66.824-176.522-94.546a10.565 10.565 0 0 1-5.528-12.501c16.926-57.44 53.532-148.095 83.028-139.744ZM137.064 343.322c19.921-11.123 152.795 46.197 245.707 88.83a8.369 8.369 0 0 1-1.189 15.652c-60.401 17.219-131.411 36.899-191.675 57.957a10.552 10.552 0 0 1-12.742-4.925c-28.668-52.584-66.876-142.568-40.101-157.514Zm16.443 252.009c6.217-21.953 140.709-75.365 236.564-110.921a8.368 8.368 0 0 1 10.227 11.898c-30.511 54.945-66.842 119.014-94.563 176.507a10.548 10.548 0 0 1-5.229 5.075 10.544 10.544 0 0 1-7.271.468c-57.441-16.822-148.095-53.531-139.728-83.027ZM343.34 761.902c-11.14-19.922 46.197-152.796 88.829-245.707a8.383 8.383 0 0 1 5.713-4.66 8.38 8.38 0 0 1 7.182 1.664 8.371 8.371 0 0 1 2.758 4.184c17.217 60.403 36.898 131.412 57.957 191.675a10.558 10.558 0 0 1-4.942 12.743c-52.568 28.668-142.568 66.875-157.445 40.101h-.052Zm252.009-16.443c-21.971-6.216-75.383-140.709-110.939-236.564a8.37 8.37 0 0 1 11.916-10.228c54.926 30.494 119.014 66.842 176.506 94.563a10.538 10.538 0 0 1 5.527 12.502c-16.909 57.526-53.515 148.094-83.01 139.727Zm166.57-189.834c-19.938 11.141-152.796-46.197-245.724-88.83a8.367 8.367 0 0 1-2.993-12.892 8.378 8.378 0 0 1 4.182-2.759c60.419-17.218 131.41-36.899 191.675-57.958a10.577 10.577 0 0 1 12.758 4.943c28.652 52.568 66.86 142.569 40.102 157.496Zm-16.444-252.009c-6.232 21.971-140.709 75.383-236.562 110.94a8.371 8.371 0 0 1-10.229-11.917c30.495-54.926 66.825-119.012 94.547-176.505a10.555 10.555 0 0 1 12.5-5.528c57.441 16.909 148.096 53.516 139.744 83.01Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 3.2 KiB |
@@ -1,293 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 360" width="16" height="16">
|
||||
<g fill="currentColor">
|
||||
<circle cx="100.50" cy="40.50" r="4.50"/>
|
||||
<circle cx="112.50" cy="40.50" r="4.50"/>
|
||||
<circle cx="124.50" cy="40.50" r="4.50"/>
|
||||
<circle cx="136.50" cy="40.50" r="4.50"/>
|
||||
<circle cx="148.50" cy="40.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="52.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="52.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="52.50" r="4.50"/>
|
||||
<circle cx="136.50" cy="52.50" r="4.50"/>
|
||||
<circle cx="148.50" cy="52.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="52.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="64.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="64.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="64.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="64.50" r="4.50"/>
|
||||
<circle cx="136.50" cy="64.50" r="4.50"/>
|
||||
<circle cx="148.50" cy="64.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="64.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="64.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="76.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="76.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="76.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="76.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="76.50" r="4.50"/>
|
||||
<circle cx="136.50" cy="76.50" r="4.50"/>
|
||||
<circle cx="148.50" cy="76.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="76.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="88.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="88.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="88.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="88.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="88.50" r="4.50"/>
|
||||
<circle cx="148.50" cy="88.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="100.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="100.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="100.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="100.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="100.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="112.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="112.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="112.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="112.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="112.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="124.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="124.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="124.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="124.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="124.50" r="4.50"/>
|
||||
<circle cx="232.50" cy="124.50" r="4.50"/>
|
||||
<circle cx="244.50" cy="124.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="124.50" r="4.50"/>
|
||||
<circle cx="28.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="40.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="112.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="124.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="220.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="232.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="244.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="136.50" r="4.50"/>
|
||||
<circle cx="28.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="40.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="112.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="124.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="148.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="160.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="172.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="184.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="196.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="244.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="208.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="220.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="232.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="220.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="220.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="232.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="244.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="256.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="268.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="280.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="220.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="232.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="244.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="292.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="160.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="220.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="232.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="256.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="316.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="328.50" cy="304.50" r="4.50"/>
|
||||
<circle cx="28.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="40.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="52.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="64.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="76.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="88.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="100.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="112.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="124.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="172.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="184.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="196.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="208.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="220.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="268.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="280.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="292.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="304.50" cy="316.50" r="4.50"/>
|
||||
<circle cx="316.50" cy="316.50" r="4.50"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 13 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill-rule="evenodd"><g fill="currentColor"><title>Z.ai</title><path d="M8.07 1.333L6.618 3.302H.435L1.887 1.333h6.184zM15.503 12.699L14.052 14.667h-6.161l1.449-1.968h6.163zM16 1.333L6.176 14.667H0L9.824 1.333H16z"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 309 B |
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path fill="currentColor" d="M0.58392448,14.9254204 L0.8326,14.66295 C2.004465,13.42985 3.1678,12.2082 2.45814,10.48105 C1.50813,8.1701 2.061355,5.4619 3.820575,3.70057 C5.6495,1.8709 8.3431,1.40957 10.59295,2.336505 C11.0907,2.52161 11.5245,2.785025 11.86295,3.02993 L9.98425,3.89849 C8.235,3.163775 6.23115,3.66355 5.0081,4.88809 C3.354105,6.5426 3.019895,9.4117 4.95835,11.2656 L-0.335,15.99995 C-0.066496,15.62975 0.2538896,15.275934 0.58392448,14.9254204 Z M14.0391,2.288155 L16.33165,2.57749377e-12 L16.20795,0.172288 C14.4658,2.574355 13.6153,3.749045 14.29795,6.6879 C14.76445,8.68415 14.261,10.90255 12.63545,12.53005 C10.5861,14.58325 7.3066,15.0403 4.6059,13.19215 L6.48885,12.3193 C8.2125,12.99705 10.0983,12.69945 11.4536,11.34255 C12.80895,9.9856 13.1133,8.00925 12.4321,6.3647 C12.30265,6.05285 11.9144,5.97455 11.64275,6.1753 L6.102,10.27035 L14.0391,2.288155 Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 976 B |
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path fill="currentColor" d="M11.2 1.4 14.6 4.8a1 1 0 0 1 0 1.4l-1.5 1.5-4.8-4.8 1.5-1.5a1 1 0 0 1 1.4 0ZM7.6 3.6l4.8 4.8-6.9 6.9a1 1 0 0 1-.5.27l-3.4.73a.6.6 0 0 1-.71-.71l.73-3.4a1 1 0 0 1 .27-.5l5.6-5.6Zm-4.5 8.1-.4 1.9 1.9-.4-1.5-1.5Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 335 B |
@@ -1,5 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 40 40" fill="none">
|
||||
<path d="M25 15H35V16.75C35 29 30.5001 35 16.5001 35H15V25H16.5001C22.6251 25 25 22.875 25 16.75V15Z" fill="currentColor"/>
|
||||
<rect x="5" y="15" width="10" height="10" fill="currentColor"/>
|
||||
<rect x="15" y="5" width="10" height="10" fill="currentColor"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 361 B |
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 40 40">
|
||||
<path fill="currentColor" d="M27.9998324,34.6666921h6.6666279v5.3333023h-8.3809037l-3.6190266-3.6190266v-8.3809037h5.3333023v6.6666279ZM39.9997627,26.2857884l-3.6190266-3.6190266h-8.3809037v5.3333023h6.6666279v6.6666279h5.3333023v-8.3809037ZM17.3332326,22.6667578h-5.3333023v5.3333023h5.3333023v-5.3333023ZM0,36.3809638l3.6190266,3.6190266h13.714206v-5.3333023H5.3333023v-11.9999302H0v13.714206ZM33.9600959,11.9999247V3.619021L30.3410693-.0000056h-7.6745392v5.3333023h5.9602634v6.6666279h-5.9602634v5.3333023h17.3332326v-5.3333023h-6.0396668ZM5.3333023,0H0v17.3332326h5.3333023v-5.9999651h6.6666279v5.9999651h5.3333023v-5.9999651l-5.3333023-5.3333023h-6.6666279V0ZM17.3332326,0h-5.3333023v5.9999651h5.3333023V0Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 808 B |
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path fill="currentColor" d="M3 1h2.5v5.5L9 1h3L8.5 6.5 12.5 13H9.5L6 8v5H3V1z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 175 B |
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path fill="currentColor" d="M2 3h3l3 5 3-5h3v10h-2V6.5l-4 6-4-6V13H2V3Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 169 B |
@@ -1,19 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<rect fill="none" stroke="currentColor" stroke-width="1.1" x="4.5" y="2.5" width="7" height="10" rx="3.5"/>
|
||||
<line stroke="currentColor" stroke-width="1" x1="3" y1="5.5" x2="13" y2="5.5"/>
|
||||
<circle fill="none" stroke="currentColor" stroke-width="1" cx="6.5" cy="5.5" r="1.6"/>
|
||||
<circle fill="none" stroke="currentColor" stroke-width="1" cx="9.5" cy="5.5" r="1.6"/>
|
||||
<circle fill="currentColor" cx="6.8" cy="5.6" r="0.55"/>
|
||||
<circle fill="currentColor" cx="9.8" cy="5.6" r="0.55"/>
|
||||
<path fill="none" stroke="currentColor" stroke-width="0.6" stroke-linecap="round" d="M7 8.3 Q8 9 9 8.3"/>
|
||||
<path fill="none" stroke="currentColor" stroke-width="0.9" stroke-linecap="round" d="M4.5 8 L3 9.5"/>
|
||||
<path fill="none" stroke="currentColor" stroke-width="0.9" stroke-linecap="round" d="M11.5 8 L13 9.5"/>
|
||||
<line stroke="currentColor" stroke-width="0.7" x1="5" y1="9.5" x2="11" y2="9.5"/>
|
||||
<line stroke="currentColor" stroke-width="0.9" x1="6.5" y1="12.5" x2="6.5" y2="14"/>
|
||||
<line stroke="currentColor" stroke-width="0.9" x1="9.5" y1="12.5" x2="9.5" y2="14"/>
|
||||
<line stroke="currentColor" stroke-width="0.9" stroke-linecap="round" x1="6.5" y1="14" x2="5.5" y2="14"/>
|
||||
<line stroke="currentColor" stroke-width="0.9" stroke-linecap="round" x1="9.5" y1="14" x2="10.5" y2="14"/>
|
||||
<line stroke="currentColor" stroke-width="0.7" stroke-linecap="round" x1="8" y1="2.5" x2="7.3" y2="0.8"/>
|
||||
<line stroke="currentColor" stroke-width="0.7" stroke-linecap="round" x1="8" y1="2.5" x2="8" y2="0.5"/>
|
||||
<line stroke="currentColor" stroke-width="0.7" stroke-linecap="round" x1="8" y1="2.5" x2="8.7" y2="0.8"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" d="M9.12 5.39C9.87 5.39 10.39 5.85 10.39 6.72C10.39 7.59 10.23 8.77 10.02 10.34C9.88 11.54 9.65 13.08 9.54 13.76C9.77 13.32 10.3 12.31 10.39 12.11C11.5 9.87 12.67 7.87 13.01 7.33C13.45 6.6 13.9 6.32 14.47 6.32C15.21 6.32 15.62 6.91 15.62 7.87C15.62 8.62 15.51 9.95 15.36 11.34C15.29 11.95 15.18 13.21 15.1 14.05C15.82 12.77 17.15 10.41 17.69 9.59C18.15 8.87 18.62 8.41 19.29 8.41C19.88 8.41 20.46 8.78 20.43 9.8C20.36 11.31 20.15 14.53 20.05 16.01C20.85 14.83 21.55 13.7 21.9 13.12C22.23 12.57 22.55 12.11 23.15 12.11C23.66 12.11 24 12.45 24 13.02C24 13.59 23.59 14.29 23.23 14.92C22.87 15.55 22.16 16.59 21.73 17.13C21.32 17.65 21.03 17.97 20.75 18.18C20.41 18.46 20.06 18.61 19.54 18.61C19.08 18.61 18.7 18.46 18.44 18.18C18.16 17.89 18.03 17.46 18.01 16.94C18 16.41 18.06 15.44 18.15 14.58C18.23 13.57 18.33 12.61 18.4 11.96C17.68 13.28 16.17 16 15.49 17.07C14.83 18.12 14.52 18.48 13.82 18.48C13.11 18.48 12.82 17.99 12.8 17.23C12.79 16.41 13.39 11.58 13.61 9.88C13.24 10.64 12.43 12.34 11.93 13.36C11.42 14.41 10.55 16.17 9.94 17.2C9.5 17.94 8.98 18.48 8.24 18.48C7.5 18.48 7.16 17.9 7.16 17.08C7.16 16.26 7.3 15.05 7.57 13.39C7.66 12.79 8.17 9.58 8.4 8.16C8.08 8.66 7.6 9.42 7.27 9.87C6.9 10.37 6.6 10.57 6.18 10.57C5.93 10.57 5.72 10.45 5.57 10.31C5.39 10.14 5.28 9.9 5.28 9.64C5.28 9.27 5.38 8.95 5.87 8.29C6.37 7.58 6.95 6.82 7.45 6.3C8.02 5.71 8.51 5.39 9.12 5.39Z"/><path fill="currentColor" d="M0.98 6.3C1.54 6.3 1.85 6.63 2.31 7.32C2.76 8.01 4.16 10.1 4.62 10.82C5.04 11.49 5.22 11.81 5.22 12.29C5.22 12.76 4.97 13.23 4.51 14.03C4.05 14.74 2.76 16.77 2.31 17.46C1.85 18.15 1.53 18.48 0.97 18.48C0.35 18.48 0 18.01 0 17.54C0 17.08 0.27 16.76 0.59 16.28C1.22 15.35 2.71 13.06 3.18 12.39C2.69 11.66 1.08 9.29 0.61 8.58C0.29 8.1 0 7.72 0 7.24C0 6.76 0.35 6.3 0.98 6.3Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,10 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1"/>
|
||||
<circle cx="8" cy="8" r="4.5" fill="none" stroke="currentColor" stroke-width="0.3" opacity="0.5"/>
|
||||
<line x1="8" y1="8" x2="13.5" y2="13.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
|
||||
<polygon points="14.5,14.5 12.3,13.5 13.5,12.3" fill="currentColor"/>
|
||||
<line x1="8" y1="8" x2="2.5" y2="2.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
|
||||
<polygon points="1.5,1.5 3.7,2.5 2.5,3.7" fill="currentColor"/>
|
||||
<circle cx="8" cy="8" r="1.3" fill="currentColor"/>
|
||||
<circle cx="8" cy="8" r="0.6" fill="none" stroke="currentColor" stroke-width="0.5" opacity="0.7"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 782 B |
@@ -1,4 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1 1H11.7692V7.9999H8.17942V11.4999H4.58982V15H1V1ZM4.58982 4.50005V7.9999H8.17942V4.50005H4.58982Z" fill="currentColor"/>
|
||||
<path d="M11.7692 7.46154H15V15H11.7692V7.46154Z" fill="currentColor"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 307 B |
@@ -1,3 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.63653 5.50522L2.18735 5.28559C2.09852 5.46726 2.12787 5.68456 2.26172 5.83616C2.39558 5.98775 2.60757 6.04379 2.79884 5.97814L2.63653 5.50522ZM5.83578 6.94285L5.3732 7.13265L5.5645 7.59886L6.02919 7.40392L5.83578 6.94285ZM10.7441 9.44034L10.2614 9.57083L10.393 10.0573L10.8784 9.92198L10.7441 9.44034ZM2.5 8.24963C2.4998 7.97349 2.27577 7.74979 1.99963 7.75C1.72349 7.75021 1.4998 7.97423 1.5 8.25037L2.5 8.24963ZM13.4143 10.7751C12.0197 13.6273 8.57701 14.8089 5.72485 13.4143L5.28559 14.3126C8.63389 15.9498 12.6754 14.5627 14.3126 11.2144L13.4143 10.7751ZM3.08571 5.72485C4.48031 2.87269 7.92299 1.69111 10.7751 3.08571L11.2144 2.18735C7.86611 0.550151 3.82455 1.93728 2.18735 5.28559L3.08571 5.72485ZM10.7751 3.08571C13.6273 4.48031 14.8089 7.92299 13.4143 10.7751L14.3126 11.2144C15.9498 7.86611 14.5627 3.82455 11.2144 2.18735L10.7751 3.08571ZM2.79884 5.97814C3.02201 5.90155 3.54835 5.84926 4.09141 6.00587C4.61256 6.15616 5.10736 6.48476 5.3732 7.13265L6.29835 6.75304C5.89213 5.76303 5.11508 5.26032 4.3685 5.04503C3.64385 4.83605 2.9066 4.8839 2.47422 5.0323L2.79884 5.97814ZM6.02919 7.40392C6.25314 7.30998 6.55771 7.25841 6.85281 7.36034C7.13062 7.45631 7.49214 7.72014 7.78743 8.4398L8.71257 8.0602C8.3358 7.14195 7.79046 6.62626 7.17931 6.41515C6.58544 6.21001 6.01893 6.32381 5.64236 6.48177L6.02919 7.40392ZM6.26827 7.19375C6.80493 6.26869 8.18817 4.18684 11.1653 3.10654L10.8242 2.16652C7.53166 3.36127 5.99463 5.67263 5.40329 6.69195L6.26827 7.19375ZM14.3364 10.8325C14.1845 10.39 13.7564 9.79897 13.14 9.37995C12.504 8.94759 11.6302 8.67426 10.6099 8.9587L10.8784 9.92198C11.5634 9.73102 12.1368 9.90713 12.5779 10.207C13.0385 10.5201 13.3174 10.9441 13.3905 11.1571L14.3364 10.8325ZM11.2268 9.30984C11.1236 8.92833 10.8783 8.39265 10.3638 8.02453C9.82769 7.6409 9.08331 7.49864 8.11574 7.76836L8.38426 8.73164C9.1221 8.52595 9.53979 8.66454 9.78189 8.83777C10.0457 9.02651 10.1946 9.32371 10.2614 9.57083L11.2268 9.30984ZM11.216 9.60556C11.6225 8.44463 12.4244 5.47936 11.4712 2.48487L10.5183 2.78819C11.3726 5.47172 10.6545 8.18331 10.2722 9.27512L11.216 9.60556ZM7.80082 8.03037L5.05604 13.6438L5.9544 14.0831L8.69918 8.46963L7.80082 8.03037ZM5.72485 13.4143C3.68742 12.4181 2.50158 10.3763 2.5 8.24963L1.5 8.25037C1.50185 10.7441 2.89229 13.1424 5.28559 14.3126L5.72485 13.4143Z" fill="currentColor"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
@@ -1,98 +0,0 @@
|
||||
<?xml version="1.0" standalone="no" ?>
|
||||
<svg
|
||||
version="1.0"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 1024 1024"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
>
|
||||
|
||||
<g
|
||||
transform="translate(0,1024) scale(0.1,-0.1)"
|
||||
fill="currentColor"
|
||||
stroke="none"
|
||||
>
|
||||
<path
|
||||
d="M6428 6358 c-104 -8 -227 -38 -314 -78 -73 -33 -196 -115 -239 -160
|
||||
-18 -19 -39 -30 -56 -30 -26 0 -27 1 -18 32 5 18 9 52 9 76 0 34 -6 49 -34 80
|
||||
l-34 37 -319 3 c-412 3 -383 18 -447 -236 -20 -78 -36 -154 -36 -168 0 -14 -5
|
||||
-35 -12 -47 -6 -12 -21 -60 -33 -107 l-22 -85 -22 43 c-47 91 -179 184 -310
|
||||
218 -146 37 -375 34 -536 -7 -203 -51 -365 -175 -443 -339 -68 -143 -109 -304
|
||||
-114 -445 l-2 -70 -127 5 c-70 3 -125 2 -123 -1 5 -8 -27 -21 -34 -14 -3 3 0
|
||||
5 7 5 7 0 9 5 6 10 -4 6 -11 8 -16 5 -5 -4 -15 -3 -21 2 -7 4 -17 8 -23 8 -5
|
||||
0 -10 7 -10 15 0 13 -142 15 -1205 18 -663 1 -1212 -1 -1220 -5 -8 -3 -19 -5
|
||||
-25 -4 -5 1 1 -8 15 -21 13 -13 29 -22 34 -20 5 2 3 -4 -4 -14 -13 -15 -15
|
||||
-14 -24 5 -5 13 -15 20 -24 16 -7 -3 -157 -5 -333 -5 l-319 0 0 -2540 0 -2540
|
||||
5120 0 5120 0 0 2540 0 2540 -685 1 c-377 1 -689 2 -694 3 -16 2 -25 16 -10
|
||||
16 11 0 11 2 -1 10 -8 5 -10 10 -4 10 5 0 16 -6 23 -12 11 -10 13 -10 7 0 -5
|
||||
8 1 12 18 12 14 0 27 -1 29 -2 1 -2 13 7 27 20 13 12 30 22 37 22 8 0 11 5 8
|
||||
10 -3 6 -2 10 2 10 5 0 9 8 9 18 1 9 18 82 38 161 20 79 36 158 36 176 0 42
|
||||
-38 97 -75 109 -17 6 -31 11 -32 11 -1 1 5 23 13 50 20 68 20 137 -2 169 -27
|
||||
43 -64 56 -155 56 -73 0 -80 2 -74 18 4 9 9 42 12 72 3 44 0 62 -17 88 -38 61
|
||||
-57 63 -396 60 l-304 -3 0 38 c0 29 -8 46 -34 75 l-34 37 -313 3 c-215 2 -321
|
||||
-1 -340 -8 -50 -21 -68 -52 -100 -177 l-31 -121 -28 16 c-16 9 -35 30 -43 47
|
||||
-23 48 -102 130 -168 174 -132 88 -315 126 -531 109z m296 -148 c43 -11 101
|
||||
-32 129 -47 67 -37 145 -115 170 -172 41 -92 33 -253 -25 -493 l-21 -88 -275
|
||||
0 -274 0 4 23 c3 12 22 91 42 175 25 102 36 170 34 205 -3 51 -4 52 -39 61
|
||||
-57 14 -98 -15 -128 -89 -36 -89 -321 -1238 -328 -1321 -5 -66 -4 -72 18 -88
|
||||
54 -38 118 -7 159 78 28 58 122 403 113 419 -2 4 -27 7 -54 7 -43 0 -50 3 -46
|
||||
18 3 9 20 79 38 154 l33 137 75 7 c79 7 558 1 566 -8 3 -3 -58 -260 -136 -572
|
||||
l-141 -566 -174 0 -174 0 0 29 c0 15 -3 49 -6 74 l-7 46 -61 -55 c-33 -30 -94
|
||||
-72 -135 -92 -74 -37 -76 -37 -201 -37 -126 0 -126 0 -202 38 -203 100 -254
|
||||
266 -179 592 66 287 235 944 271 1050 72 215 132 298 289 403 144 97 262 130
|
||||
462 131 95 1 145 -4 203 -19z m-1046 -37 c-3 -10 -18 -71 -33 -135 l-29 -118
|
||||
-273 0 c-213 0 -271 3 -268 13 2 6 13 50 25 97 11 46 25 101 31 122 l10 38
|
||||
271 0 c253 0 270 -1 266 -17z m2240 0 c-3 -10 -18 -71 -33 -135 l-29 -118
|
||||
-273 0 c-213 0 -271 3 -268 13 2 6 13 50 25 97 11 46 25 101 31 122 l10 38
|
||||
271 0 c253 0 270 -1 266 -17z m722 -139 c0 -3 -13 -59 -30 -124 -16 -65 -30
|
||||
-126 -30 -134 0 -13 13 -16 65 -16 45 0 65 -4 65 -12 0 -13 -31 -146 -51 -220
|
||||
l-10 -38 -72 0 -73 0 -132 -532 c-73 -293 -132 -552 -132 -574 0 -47 11 -54
|
||||
93 -54 26 0 47 -3 47 -7 0 -5 -15 -66 -33 -138 l-33 -130 -165 -3 c-326 -6
|
||||
-421 26 -459 155 -17 55 2 146 155 761 69 277 125 508 125 513 0 5 -25 9 -55
|
||||
9 l-55 0 7 28 c3 15 18 74 33 132 l26 105 59 5 59 5 34 138 34 137 264 0 c145
|
||||
0 264 -3 264 -6z m-4147 -223 c137 -36 218 -93 257 -183 27 -63 24 -128 -12
|
||||
-278 l-24 -95 -232 -3 c-143 -1 -232 1 -232 7 0 5 9 47 20 93 35 145 26 178
|
||||
-49 178 -65 0 -117 -79 -128 -195 -9 -104 10 -126 222 -252 211 -127 273 -191
|
||||
290 -305 14 -94 -44 -332 -112 -458 -105 -195 -319 -301 -607 -300 -253 1
|
||||
-438 89 -476 225 -17 61 -8 193 21 318 l22 97 234 0 233 0 -5 -22 c-3 -13 -14
|
||||
-61 -25 -108 -11 -47 -20 -106 -20 -132 0 -40 4 -50 25 -64 31 -20 85 -12 120
|
||||
19 32 28 64 120 72 203 8 82 7 82 -202 224 -178 120 -243 177 -277 242 -72
|
||||
138 33 532 175 650 70 59 97 75 175 105 101 38 184 51 328 52 99 1 149 -4 207
|
||||
-18z m1087 -20 c0 -7 -408 -1652 -426 -1718 l-6 -23 -269 0 c-173 0 -269 4
|
||||
-269 10 0 6 97 399 216 875 l216 865 269 0 c148 0 269 -4 269 -9z m2240 -1 c0
|
||||
-5 -97 -397 -215 -871 -118 -474 -215 -863 -215 -865 0 -2 -121 -4 -270 -4
|
||||
-174 0 -270 4 -270 10 0 6 97 399 216 875 l216 865 269 0 c166 0 269 -4 269
|
||||
-10z m1040 -742 c0 -5 -5 -6 -11 -2 -8 4 -9 -1 -4 -17 4 -13 4 -21 0 -17 -4 4
|
||||
-9 21 -11 39 -3 27 -2 30 11 19 8 -7 15 -17 15 -22z m-8192 4 c2 -7 -5 -12
|
||||
-15 -11 -12 0 -14 2 -4 6 11 5 11 7 0 15 -12 8 -12 9 0 6 8 -3 17 -10 19 -16z
|
||||
m1840 -1329 c-311 -2 -824 -2 -1140 0 -315 1 -60 2 567 2 627 0 885 -1 573 -2z
|
||||
m619 1 c-3 -3 -12 -4 -19 -1 -8 3 -5 6 6 6 11 1 17 -2 13 -5z"
|
||||
/>
|
||||
<path
|
||||
d="M900 6270 c0 -11 6 -20 14 -20 7 0 16 -9 19 -20 5 -20 12 -20 1803
|
||||
-18 1731 3 1799 4 1802 21 3 12 -4 20 -17 24 -12 3 -21 12 -21 19 0 12 -274
|
||||
14 -1800 14 -1793 0 -1800 0 -1800 -20z"
|
||||
/>
|
||||
<path
|
||||
d="M900 6005 c0 -15 6 -25 14 -25 7 0 16 -9 19 -20 5 -20 12 -20 1334
|
||||
-18 l1328 3 3 23 c3 17 -2 22 -17 22 -14 0 -21 6 -21 20 0 20 -7 20 -1330 20
|
||||
l-1330 0 0 -25z"
|
||||
/>
|
||||
<path
|
||||
d="M737 5713 c-12 -12 -7 -43 7 -43 7 0 16 -9 19 -20 5 -20 12 -20 1323
|
||||
-18 1248 3 1319 4 1322 21 2 9 -4 20 -14 24 -10 3 -26 15 -35 24 -17 17 -83
|
||||
18 -1317 19 -714 0 -1302 -3 -1305 -7z"
|
||||
/>
|
||||
<path
|
||||
d="M1953 5412 c-1265 -2 -1273 -2 -1273 -22 0 -11 6 -20 14 -20 7 0 16
|
||||
-9 19 -20 5 -20 12 -20 1298 -18 1242 3 1294 4 1297 21 3 12 -4 20 -17 24 -12
|
||||
3 -21 11 -21 18 0 7 -10 14 -22 16 -13 2 -596 3 -1295 1z"
|
||||
/>
|
||||
<path d="M9010 5130 c-12 -7 -10 -9 7 -7 12 0 19 5 17 9 -6 10 -6 10 -24 -2z" />
|
||||
<path
|
||||
d="M3180 5109 c0 -5 5 -7 10 -4 6 3 10 8 10 11 0 2 -4 4 -10 4 -5 0 -10
|
||||
-5 -10 -11z"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.3 KiB |
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path fill="currentColor" d="M6.53 4.412h5.883v3.587H9.471v3.588H3.588V7.999H6.53Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 179 B |
@@ -1,4 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0.5 5.5L2.5 8 0.5 10.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<text x="3.2" y="11.5" font-family="'SF Mono', 'Fira Code', 'Consolas', monospace" font-size="10" font-weight="600" letter-spacing="-0.5" fill="currentColor">VT</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 399 B |