|
1 | 1 | /******************************************************************************* |
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 |
6 | 5 | * http://www.eclipse.org/legal/epl-v10.html |
7 | 6 | * |
8 | | - * Contributors: |
9 | | - * Vlad Dumitrescu |
| 7 | + * Contributors: Vlad Dumitrescu |
10 | 8 | *******************************************************************************/ |
11 | 9 | package org.erlide.core.builder; |
12 | 10 |
|
|
39 | 37 | import org.erlide.backend.BackendCore; |
40 | 38 | import org.erlide.backend.api.IBackend; |
41 | 39 | import org.erlide.backend.api.IBackendManager; |
| 40 | +import org.erlide.backend.debug.BeamUtil; |
42 | 41 | import org.erlide.core.ErlangPlugin; |
43 | 42 | import org.erlide.core.internal.builder.BuildNotifier; |
44 | 43 | import org.erlide.engine.ErlangEngine; |
|
50 | 49 | import org.erlide.engine.model.root.ErlangProjectProperties; |
51 | 50 | import org.erlide.engine.model.root.IErlProject; |
52 | 51 | import org.erlide.engine.util.ResourceUtil; |
| 52 | +import org.erlide.runtime.api.BeamLoader; |
53 | 53 | import org.erlide.runtime.api.IOtpRpc; |
54 | | -import org.erlide.runtime.rpc.RpcFuture; |
55 | 54 | import org.erlide.runtime.rpc.RpcException; |
| 55 | +import org.erlide.runtime.rpc.RpcFuture; |
56 | 56 | import org.erlide.util.ErlLogger; |
57 | 57 |
|
58 | 58 | import com.ericsson.otp.erlang.OtpErlangAtom; |
| 59 | +import com.ericsson.otp.erlang.OtpErlangBinary; |
59 | 60 | import com.ericsson.otp.erlang.OtpErlangList; |
60 | 61 | import com.ericsson.otp.erlang.OtpErlangObject; |
61 | 62 | import com.ericsson.otp.erlang.OtpErlangString; |
@@ -207,8 +208,7 @@ private void createMarkersForDuplicateModuleNames(final IOtpRpc backend, |
207 | 208 | } |
208 | 209 | } |
209 | 210 |
|
210 | | - private void createMarkersForCodeClashes(final IOtpRpc backend, |
211 | | - final IProject project) { |
| 211 | + private void createMarkersForCodeClashes(final IOtpRpc backend, final IProject project) { |
212 | 212 | try { |
213 | 213 | final OtpErlangList res = BuilderHelper.getCodeClashes(backend); |
214 | 214 | for (final OtpErlangObject elem : res) { |
@@ -575,8 +575,22 @@ public static void loadModule(final @NonNull IProject project, final String modu |
575 | 575 | final IBackendManager backendManager = BackendCore.getBackendManager(); |
576 | 576 | for (final IBackend b : backendManager.getExecutionBackends(project)) { |
577 | 577 | 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 | + |
580 | 594 | backendManager.moduleLoaded(b, project, module); |
581 | 595 | } |
582 | 596 | } catch (final Exception e) { |
|
0 commit comments