Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Kkaye/include paths #252

Merged
merged 9 commits into from
Jan 14, 2017
Merged

Conversation

GreatCall-KayeK
Copy link
Contributor

This is an initial implementation of issue #244. Included is:

  • --idl-include-path argument which specified a path to resolve @import and @extern directives.
    • Can be specified multiple times to indicate multiple paths, both relative and absolute. Relative paths are in relation to the directory from which djinni is run. eg:
  --idl-include-path "vendor/idl"
  --idl-include-path "/an/absolute/path/to/externs"
  • Modified import and extern file resolution logic to support multiple paths.
    • Resolution order begins at current directory. If import is not found relative to current file, resolution proceeds to search each --idl-include-path in the order specified, until the import is found.
    • If no imports are found then a FileNotFoundException is thrown and the user is provided an error message.

I look forward to hearing thoughts and feedback.

@smarx
Copy link

smarx commented Jul 14, 2016

Automated message from Dropbox CLA bot

@GreatCall-KayeK, thanks for the pull request! It looks like you haven't yet signed the Dropbox CLA. Please sign it here.

@@ -69,7 +69,9 @@ fi
--objcpp-out "$temp_out/objc" \
--objc-type-prefix TXS \
\
--idl "$in"
--idl "$in" \
--idl-include-path "../../" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these necessary to build the example? If not, I'd rather leave them out.

@artwyman
Copy link
Contributor

Thanks for the PR @GreatCall-KayeK. I've added some suggestions in line notes. You'll also need to sign the CLA before I can merge your code.

@GreatCall-KayeK
Copy link
Contributor Author

@artwyman My apologies for the long delay on this PR, the CLA got stuck in legal.

I've signed that as well as implemented your feedback. Please let me know if you would like me rebase prior to merging this feature.

@artwyman
Copy link
Contributor

artwyman commented Dec 9, 2016

No worries, you're not the one slowing things down. I'm way behind on PRs, but hope to have some time to catch up before the holidays. Rebase is optional, so long as you've resolved all conflicts. There aren't any major changes in master that I recall, which would make this harder to review.

Copy link
Contributor

@artwyman artwyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. I made some suggestions in inline comments, and there area also some conflicts to resolve before I can merge this.

Note that I can confirm the CLA was signed. The company CLA (vs. individual) doesn't trigger the auto-response from the smarx-bot.

def filePath = "[^\"]*".r

def fileParent(): String = {
if (fileStack.top.getParent() != null) fileStack.top.getParent() + "/" else ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to pass paths around using the File type and use the joining functionality provided by the multi-arg File constructor rather than manipulating separators manually. It'll be more robust to Windows path separators, among other things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opted to remove this method. Additionally the path construction is now handled by the File constructor both here and in the importFile method.

exists
})

if (path.isEmpty || file.isEmpty) throw new FileNotFoundException("Unable to find file \"" + fileName + "\" at " + fileStack.top.getCanonicalPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the OR here necessary? Seems like the path variable is actually unnecessary, since the file variable gets the true result of the find()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@import "./date.djinni"
@import "../djinni/date.djinni"
@extern "./date.yaml"
@import "./vendor/third-party/date.djinni"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be tweaked to merge conflicts. Note that some changes were made here to do relative-path testing using a different input file (not date/duration), since the Python code doesn't support external types yet, but wants to be able to test using all.djinni.

@GreatCall-KayeK
Copy link
Contributor Author

@artwyman Thank you for your feedback. I've implemented changes and resolved merge conflicts.

@artwyman artwyman merged commit c5b923f into dropbox:master Jan 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants