-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Including scripts by relative reference - Fixes #303 #330
Including scripts by relative reference - Fixes #303 #330
Conversation
Awesome. Thank you so much for supporting script! I've run the test but they still seems to struggle with the PR: Tests > test_include_annotations FAILED Tests > test_include_detection FAILED |
There is an inherent problem with testing changes covering resolving URLs on branches, at least in the current test setup. Test files rely on KScript Github master branch repository. But the problem is that if you make changes in test files on a branch, then those files are not yet in the master branch of the Github repo, so the tests will just fail. In case of this PR, there is added a new script file, which is included by URL in test/resources/includes/rel_includes/include_by_url.kt. This new file is obviously not in the master branch, because PR is not yet merged, and that's why tests on the branch fail. In such a case, to accomplish the tests on the PR branch you can do the following things:
For testing in my forked branch I have used the following URLs:
|
Hi! I have improved a patch a little bit. Now it is disallowed to include local files from scripts that are invoked by HTTP reference. IMHO that would be a security issue. Additionally, I have modified the URLs in the test resources, so that tests are passing now on this branch. Please modify them back to the master branch before the merge. Please let me know your comments about the patch. |
Hi! Lack of this change blocks from creating real script libraries. That's why I have worked on this PR - I need the changes in my work to create a library of reusable scripts. Please let me know if I can help somehow to close PR and release a new version of the kscript. |
I'm really sorry for the delay. |
Not sure if it's PR or build-system related, but tests still don't seem fine. See build status from above. |
1 similar comment
Not sure if it's PR or build-system related, but tests still don't seem fine. See build status from above. |
That's okay. But I think we will have to discuss why it fails, because it definitely passes on my computer: I suspect that it is something about the branches: currently on aartiPl:Including_scripts_by_relative_reference_-fixes#303 branch test files are pointing to the test resources on the branch. As I noted before they will fail on the master branch. If this is the issue - it is not simply solvable. I have tried to describe the issue in details in my previous comments. Do you understand what is the root cause of the problem? I am happy to meet on the Zoom or Google Meet and shortly explain the issue. My private email is: aarti@interia.pl - please drop me a message and we will set up a short meeting. If that's something else, then I don't know how to reproduce it. In such a case I would be happy to understand why it happens. A short meeting will also help. |
Ok. I was able to start test_suite.sh. I will recheck on my side :-) |
I believe the errors are related to problems with the test script itself. I have refactored a little bit test_suite.sh, so that it does not need $KSCRIPT_HOME environment variable to execute itself. (I have changed it because sdkman is setting this variable to a completely different location and I don't think it is a good idea to mess with this env var if not needed). So there are currently two local variables in the test script: SCRIPT_DIR and PROJECT_DIR, which are calculated automatically, regardless of where the script is located. I have also improved logging in the test_suite.sh a little bit. Below you can find the execution logs from my test run: ` Starting script input modes tests: Starting cli helper tests: Starting environment tests: Starting dependency lookup tests: Starting annotation-driven configuration tests: Starting support api tests: Starting kt support tests: Starting misc tests: Starting junit suite tests: Starting bootstrap headers tests: As you can see there are only four tests, which are failing, totally unrelated to my changes. The first two are connected with the packaging option in kscript (I don't understand very well what they do) and the other two are connected with IntelliJ idea integration, which I don't use also. The failures might be connected with different versions of Gradle or by using relative paths instead of absolute. I can't test it without much fuss, so if you could look at it, it will be appreciated. |
Packaging seems indeed broken currently (see #324). I've run the tests locally against the PR and struggle to complete "kscript https://git.io/fxHBv" both on the terminal and from the IDE. This is because the file-suffix is no longer detected correctly. It must be kt but seems to be kts with PR. Am I missing something here? |
There is indeed something wrong with my implementation. I will try to figure out what's that and provide a fix. Thanks for your input! |
Edit: there is one more case to fix. I will work on that...Ok. I have managed to fix the problem. The remaining problems are with:
Please check if idea generated project is working as expected. It seems to me that there would be needed some deeper refactoring in KScript. I have an idea how to do that. If you are willing to do such changes, I can work on it. But I prefer to do this after applying changes from this PR first. Please do not forget to change links in test files before the merge to the master: |
Seems that the last broken use case is fixed now. There are failures only with packaging and idea. Can you please check those use cases? |
Thank you so much @aartiPl for your patience with my slow response times, and many thanks for your great support. |
This patch Fixes #303
I have tested it on my branch with URLs in the includes directory directed to my branch. After that, I have reverted them back to point to your master branch. Because of that, tests will not work on the branch, but only on the master.
I have started only Tests class in src/test directory. I am not sure how to start other tests. Please let me know if something else should be done to merge this PR.