Skip to content
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

Updated gradle and kotlin.js gradle plugin fixing #5598 #6372

Merged
merged 3 commits into from Jul 17, 2019

Conversation

@Ingwersaft
Copy link
Contributor

commented Jul 14, 2019

What did you implement:

Closes #5598

How did you implement it:

Adapted to latest gradle and kotlin version, also fixed function path.

How can we verify it:

Build the template and test it

Todos:

Note: Run npm run test-ci to run all validation checks on proposed changes

  • Write tests and confirm existing functionality is not broken.
    Validate via npm test
  • Write documentation
  • Ensure there are no lint errors.
    Validate via npm run lint-updated
    Note: Some reported issues can be automatically fixed by running npm run lint:fix
  • Ensure introduced changes match Prettier formatting.
    Validate via npm run prettier-check-updated
    Note: All reported issues can be automatically fixed by running npm run prettify-updated
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@pmuens pmuens self-assigned this Jul 15, 2019
@pmuens pmuens added this to In progress in Serverless via automation Jul 15, 2019
@pmuens pmuens added this to the 1.48.0 milestone Jul 15, 2019
@pmuens pmuens changed the title updated gradle and kotlin.js gradle plugin fixing #5598 Updated gradle and kotlin.js gradle plugin fixing #5598 Jul 15, 2019
Serverless automation moved this from In progress to Needs review Jul 15, 2019
Copy link
Member

left a comment

Thanks for working on this @Ingwersaft 👍

Unfortunately I get an error when running gradle build:

[nix-shell:~/Desktop/serverless/tmp/kotlin]$ gradle build
> Task :kotlinNpmResolve FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kotlinNpmResolve'.
> java.nio.file.FileAlreadyExistsException: /Desktop/serverless/tmp/kotlin/build/js/node_modules/kotlin

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
1 actionable task: 1 executed

Am I missing something? Can you provide the steps to test this PR?

Thanks in advance!

@Ingwersaft

This comment has been minimized.

Copy link
Contributor Author

commented Jul 15, 2019

Sure:

kesselring@LAPTOP-PVRLFH45:/mnt/c/Users/gotth/IdeaProjects$ serverless create --path kotlinnode -u https://github.com/Ingwersaft/serverless/tree/master/lib/plugins/create/templates/aws-kotlin-nodejs-gradle
Serverless: Generating boilerplate...
Serverless: Downloading and installing "aws-kotlin-nodejs-gradle"...
Serverless: Successfully installed "aws-kotlin-nodejs-gradle"
kesselring@LAPTOP-PVRLFH45:/mnt/c/Users/gotth/IdeaProjects$ cd kotlinnode/
kesselring@LAPTOP-PVRLFH45:/mnt/c/Users/gotth/IdeaProjects/kotlinnode$ ./gradlew build

> Task :compileKotlinJs
w: /mnt/c/Users/gotth/IdeaProjects/kotlinnode/src/main/kotlin/com/serverless/Handler.kt: (2, 41): Parameter 'context' is never used

BUILD SUCCESSFUL in 1m 40s
5 actionable tasks: 5 executed
kesselring@LAPTOP-PVRLFH45:/mnt/c/Users/gotth/IdeaProjects/kotlinnode$

I think you used your locally installed gradle instead of the wrapper (gradle vs./gradlew) which might trigger some version incompatibility.

Hope it works now :)

@pmuens

This comment has been minimized.

Copy link
Member

commented Jul 16, 2019

@Ingwersaft Thanks for following-up 👍

Building works fine (thanks for the pointer). However invoking the function remotely causes this error to pop up:

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'aws-kotlin-nodejs-gradle'",
    "trace": [
        "Runtime.ImportModuleError: Error: Cannot find module 'aws-kotlin-nodejs-gradle'",
        "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
        "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
        "    at Object.<anonymous> (/var/runtime/index.js:36:30)",
        "    at Module._compile (internal/modules/cjs/loader.js:701:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)",
        "    at Module.load (internal/modules/cjs/loader.js:600:32)",
        "    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:531:3)",
        "    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)",
        "    at startup (internal/bootstrap/node.js:283:19)"
    ]
}
@Ingwersaft

This comment has been minimized.

Copy link
Contributor Author

commented Jul 16, 2019

Yeah, forgot to name the project (in gradle), so the final output js filename was dependent on your root folder name. Latest commit should fix that.

@pmuens
pmuens approved these changes Jul 17, 2019
Copy link
Member

left a comment

That did the trick. Thanks for updating @Ingwersaft 👍

LGTM :shipit:

Serverless automation moved this from Ready for Review to Reviewer Approved Jul 17, 2019
@pmuens pmuens merged commit 5ce8f98 into serverless:master Jul 17, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
security/snyk - package.json (serverless) No manifest changes detected
Serverless automation moved this from Reviewer Approved to Done Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Serverless
  
Done
2 participants
You can’t perform that action at this time.