MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / initialize

Method initialize

src/tools/debugadapter/debugger/java/javadebugger.cpp:101–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void JavaDebugger::initialize(const QString &configHomePath,
102 const QString &jreExecute,
103 const QString &launchPackageFile,
104 const QString &launchConfigPath,
105 const QString &workspace)
106{
107 if (d->initialized)
108 return;
109
110 int startPort = 6000;
111
112 auto checkPortFree = [](int port) {
113 QProcess process;
114 QString cmd = QString("fuser %1/tcp").arg(port);
115 process.start(cmd);
116 process.waitForFinished();
117 QString ret = process.readAll();
118 if (ret.isEmpty())
119 return true;
120 return false;
121 };
122
123 while (startPort) {
124 if (checkPortFree(startPort)) {
125 break;
126 }
127 startPort--;
128 }
129
130 QString validPort = QString::number(startPort);
131 QString logFolder = configHomePath + "/dap/javalog/" + QFileInfo(workspace).fileName() +
132 "_" + QDateTime::currentDateTime().toString("yyyyMMddHHmmss");
133 QString heapDumpPath = logFolder + "/heapdump/headdump.java";
134 QString dataPath = logFolder + "/jdt_ws";
135
136 QString param = d->javaparam.getInitBackendParam(validPort,
137 jreExecute,
138 launchPackageFile,
139 heapDumpPath,
140 launchConfigPath,
141 dataPath);
142 qInfo() << validPort;
143 QStringList options;
144 options << "-c" << param;
145 outputMsg("normal", options.join(";"));
146 d->process.start("/bin/bash", options);
147 d->process.waitForStarted();
148
149 d->initialized = true;
150}
151
152void JavaDebugger::slotReceivePojectInfo(const QString &uuid,
153 const QString &kit,

Callers

nothing calls this directly

Calls 8

numberClass · 0.85
readAllMethod · 0.80
fileNameMethod · 0.80
getInitBackendParamMethod · 0.80
QStringClass · 0.50
startMethod · 0.45
isEmptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected