|
37 | 37 | import io.sloeber.arduinoFramework.api.BoardDescription; |
38 | 38 | import io.sloeber.arduinoFramework.api.IArduinoLibraryVersion; |
39 | 39 | import io.sloeber.arduinoFramework.api.LibraryManager; |
| 40 | +import io.sloeber.arduinoFramework.internal.ArduinoLibraryVersion; |
40 | 41 | import io.sloeber.autoBuild.api.AutoBuildProject; |
41 | 42 | import io.sloeber.autoBuild.api.IAutoBuildConfigurationDescription; |
42 | 43 | import io.sloeber.autoBuild.buildTools.api.IBuildTools; |
|
48 | 49 | import io.sloeber.autoBuild.schema.api.IProjectType; |
49 | 50 | import io.sloeber.core.Activator; |
50 | 51 | import io.sloeber.core.Messages; |
| 52 | +import io.sloeber.core.internal.ArduinoHardwareLibrary; |
| 53 | +import io.sloeber.core.internal.ArduinoPrivateLibraryVersion; |
51 | 54 | import io.sloeber.core.internal.SloeberConfiguration; |
52 | 55 | import io.sloeber.core.listeners.IndexerController; |
53 | 56 | import io.sloeber.core.natures.SloeberNature; |
@@ -134,7 +137,7 @@ public void run(IProgressMonitor internalMonitor) throws CoreException { |
134 | 137 |
|
135 | 138 | // Get the libraries used |
136 | 139 | Set<String> libNames = new HashSet<>(); |
137 | | - IFolder libFolder = OldCoreFolder.getFolder("libraries"); //$NON-NLS-1$ |
| 140 | + IFolder libFolder = project.getFolder("libraries"); //$NON-NLS-1$ |
138 | 141 | if (libFolder.exists()) { |
139 | 142 | for (IResource curResource : libFolder.members()) { |
140 | 143 | if (curResource instanceof IFolder) { |
@@ -210,18 +213,41 @@ public void run(IProgressMonitor internalMonitor) throws CoreException { |
210 | 213 | SloeberConfiguration sloeberConfiguration = new SloeberConfiguration(boardDescriptor, otherDesc, |
211 | 214 | compileDescriptor); |
212 | 215 |
|
| 216 | + |
| 217 | + |
| 218 | + //Save the sloeber configuration in the autoBuild configuration |
| 219 | + autoConf.setAutoBuildConfigurationExtensionDescription(sloeberConfiguration); |
| 220 | + |
213 | 221 | // Add the libraries |
214 | 222 | TreeMap<String, IArduinoLibraryVersion> availableLibs = LibraryManager |
215 | 223 | .getLibrariesAll(boardDescriptor); |
216 | 224 | // find the libs we can add |
217 | 225 | Set<IArduinoLibraryVersion> toInstallLibs = new HashSet<>(); |
218 | 226 | for (String curLibName : libNames) { |
219 | | - toInstallLibs.add(availableLibs.get(curLibName)); |
| 227 | + IPath boardLibFQN = ArduinoHardwareLibrary.calculateFQN(curLibName); |
| 228 | + IArduinoLibraryVersion foundLib = availableLibs.get(boardLibFQN.toString()); |
| 229 | + if (foundLib != null) { |
| 230 | + toInstallLibs.add(foundLib); |
| 231 | + continue; |
| 232 | + } |
| 233 | + |
| 234 | + IPath managedLibFQN = ArduinoLibraryVersion.calculateFQN(curLibName); |
| 235 | + foundLib = availableLibs.get(managedLibFQN.toString()); |
| 236 | + if (foundLib != null) { |
| 237 | + toInstallLibs.add(foundLib); |
| 238 | + continue; |
| 239 | + } |
| 240 | + |
| 241 | + IPath privateLibFQN = ArduinoPrivateLibraryVersion.calculateFQN(curLibName); |
| 242 | + foundLib = availableLibs.get(privateLibFQN.toString()); |
| 243 | + if (foundLib != null) { |
| 244 | + toInstallLibs.add(foundLib); |
| 245 | + continue; |
| 246 | + } |
| 247 | + |
220 | 248 | } |
| 249 | + toInstallLibs.remove(null); |
221 | 250 | sloeberConfiguration.addLibraries(toInstallLibs); |
222 | | - |
223 | | - //Save the sloeber configuration in the autoBuild configuration |
224 | | - autoConf.setAutoBuildConfigurationExtensionDescription(sloeberConfiguration); |
225 | 251 | } |
226 | 252 |
|
227 | 253 | SubMonitor refreshMonitor = SubMonitor.convert(internalMonitor, 3); |
|
0 commit comments