Closed cpenny42 closed 6 years ago
I pulled the repo & got started with the MPLAB SDK in Netbeans and was able to get some more clues. I'm unfamiliar with Java development/Netbeans/MPLAB projects, so there are probably some obvious things I am overlooking.
The problem seemed to stem from this line in ImportWorker.java:
Path projectRootPath = Paths.get( folder.getConfigurationDescriptor().getBaseDir() );
As it turns out, the folder
was null.
The folder
parameter was passed in to addFileToFolder
from importChipKitProjectFiles
above here at line 315 of ImportWorker.java.
This is the problematic line:
Folder sourceFolder = newProjectDescriptor.getLogicalFolders().findFolderByName(MakeConfigurationBook.SOURCE_FILES_FOLDER);
findFolderByName
was returning null
when looking for MakeConfigurationBook.SOURCE_FILES_FOLDER
. So sourceFolder
was null when it was passed into addFileToFolder
, causing the specific assertion I saw.
With some further prodding I discovered that newProjectDescriptor.getLogicalFolders()
would return a Folder
object with only 2 subfolders: chipKIT-libraries
and chipKIT-core
. This is a problem because the actual string returned from MakeConfigurationBook.SOURCE_FILES_FOLDER
is simply the string "SourceFiles"
, which is not one of the subfolders returned by newProjectDescriptor.getLogicalFolders()
. I'm assuming findFolderByName
just searches for a sub-folder with that name; if so this error would make sense, since it's searching for the folder "SourceFiles"
when that folder doesn't exist in the MakeConfigurationBook
. Not completely sure though.
I'm not exactly sure what the folders are supposed to represent inside a MakeConfigurationBook
, but I'm assuming it's just the normal mplab project folders we're trying to create during the import.
I was able to get the plugin to complete without crashing, but the generated project was completely empty. I'm guessing there is some issue with finding the correct source folder to copy over.
I will try all this on Windows to see if anything changes. I wouldn't be surprised if the culprit is some Java issue with file paths on Mac (I've seen that before).
Hi Chris
You are generally right - there is an issue with the source folder. It seems that in MPLAB X IDE v5.0.x the source directory is not created by default like it was in the earlier versions. I'll add some logic that adds this directory if it does not exist.
Regards, Grzegorz
@cpenny42, I've pushed version 1.0.7 to the repo. You will find the new .nbm file here: https://github.com/chipKIT32/chipKIT-importer/blob/master/dist/com-microchip-mplab-nbide-embedded-chipkit.nbm You will still get an error message at the end of the import procedure but the project should be created inside MPLAB X IDE and it should compile (at least this is what I got)
Thanks! I'll check it out - this is a huge help, I appreciate it!
Everything worked perfectly with the update!
I am trying to import the basic
Blink.ino
example, but the plugin always crashes. This happens with both MPLAB X IDE V4.15 and MPLAB X IDE v5.0.5, both Importer versions 1.0.5 & 1.0.6, and chipKIT-core v2.0.5. All done on a Mac.There are two different messages depending on whether "Copy all chipKIT Dependencies" is checked.
With "Copy all chipKIT Dependencies" ON:
And with "Copy all chipKIT Dependencies" OFF:
I have yet to see a working example of the Importer for any kind of sketch — can anyone point me in the right direction? Even just having an example of an MPLAB project made from a successfully imported sketch would help.
I tried importing a project with version 1.0.5 posted on this issue, and had a similar crash (though the line numbers are different):