Skip to content

Commit 49a367c

Browse files
committed
#207 - Code reloading on remote nodes
Now always reloading by sending binary, works for remote nodes.
1 parent 1b252c1 commit 49a367c

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

org.erlide.core/src/org/erlide/core/builder/BuilderHelper.java

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2007 IBM Corporation and others.
3-
* All rights reserved. This program and the accompanying materials
4-
* are made available under the terms of the Eclipse Public License v1.0
5-
* which accompanies this distribution, and is available at
2+
* Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved. This program
3+
* and the accompanying materials are made available under the terms of the Eclipse Public
4+
* License v1.0 which accompanies this distribution, and is available at
65
* http://www.eclipse.org/legal/epl-v10.html
76
*
8-
* Contributors:
9-
* Vlad Dumitrescu
7+
* Contributors: Vlad Dumitrescu
108
*******************************************************************************/
119
package org.erlide.core.builder;
1210

@@ -39,6 +37,7 @@
3937
import org.erlide.backend.BackendCore;
4038
import org.erlide.backend.api.IBackend;
4139
import org.erlide.backend.api.IBackendManager;
40+
import org.erlide.backend.debug.BeamUtil;
4241
import org.erlide.core.ErlangPlugin;
4342
import org.erlide.core.internal.builder.BuildNotifier;
4443
import org.erlide.engine.ErlangEngine;
@@ -50,12 +49,14 @@
5049
import org.erlide.engine.model.root.ErlangProjectProperties;
5150
import org.erlide.engine.model.root.IErlProject;
5251
import org.erlide.engine.util.ResourceUtil;
52+
import org.erlide.runtime.api.BeamLoader;
5353
import org.erlide.runtime.api.IOtpRpc;
54-
import org.erlide.runtime.rpc.RpcFuture;
5554
import org.erlide.runtime.rpc.RpcException;
55+
import org.erlide.runtime.rpc.RpcFuture;
5656
import org.erlide.util.ErlLogger;
5757

5858
import com.ericsson.otp.erlang.OtpErlangAtom;
59+
import com.ericsson.otp.erlang.OtpErlangBinary;
5960
import com.ericsson.otp.erlang.OtpErlangList;
6061
import com.ericsson.otp.erlang.OtpErlangObject;
6162
import com.ericsson.otp.erlang.OtpErlangString;
@@ -207,8 +208,7 @@ private void createMarkersForDuplicateModuleNames(final IOtpRpc backend,
207208
}
208209
}
209210

210-
private void createMarkersForCodeClashes(final IOtpRpc backend,
211-
final IProject project) {
211+
private void createMarkersForCodeClashes(final IOtpRpc backend, final IProject project) {
212212
try {
213213
final OtpErlangList res = BuilderHelper.getCodeClashes(backend);
214214
for (final OtpErlangObject elem : res) {
@@ -575,8 +575,22 @@ public static void loadModule(final @NonNull IProject project, final String modu
575575
final IBackendManager backendManager = BackendCore.getBackendManager();
576576
for (final IBackend b : backendManager.getExecutionBackends(project)) {
577577
ErlLogger.debug(":: loading %s in %s", module, b.getName());
578-
b.getOtpRpc().call("erlide_util", "load", "ao", module,
579-
b.getData().shouldLoadOnAllNodes());
578+
579+
final IErlProject erlProject = ErlangEngine.getInstance().getModel()
580+
.findProject(project);
581+
final IPath path = project.getLocation()
582+
.append(erlProject.getProperties().getOutputDir())
583+
.append(module + ".beam");
584+
585+
boolean ok = false;
586+
final OtpErlangBinary bin = BeamUtil.getBeamBinary(module, path);
587+
if (bin != null) {
588+
ok = BeamLoader.loadBeam(b.getOtpRpc(), module, bin);
589+
}
590+
if (!ok) {
591+
ErlLogger.error("Could not load %s", module);
592+
}
593+
580594
backendManager.moduleLoaded(b, project, module);
581595
}
582596
} catch (final Exception e) {

0 commit comments

Comments
 (0)