Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

JetBrains/kotlin-web-demo

Repository files navigation

Obsolete JetBrains project

This repository contains sources for try.kotl.in

Manual installation 🐳

Before starting the Kotlin-Web-Demo execute two gradle tasks: copyKotlinLibs for downloading kotlin libraries for compiler and war for building war-archive from IDE or terminal:

$ gradlew ::copyKotlinLibs
$ gradlew war

By default try.kotl.in uses port 8080, and if that's OK, just make it available at http://localhost:8080 via this command:

$ docker-compose up

To change the port number, tweak 'docker-compose.yml':

    ports:
      - "your_port:8080"

If you'd like to log in to JetBrains account, Google, Facebook, GitHub, or Twitter, add corresponding keys to this configuration file:

    <Environment name="github_key" value="YOUR-KEY" type="java.lang.String" override="false"/>
    <Environment name="github_secret" value="YOUR-SECRET-KEY" type="java.lang.String" override="false"/>

How to add your own courses 📝

  • Add a course name to manifest.json.
  • Use that name to create a folder next to the Examples folder and put your course content under it.
  • Make a folder for each of the course topics (and don't forget adding them to manifest.json).
  • After that, create:
    1. Test.kt — for test questions
    2. Task.kt — for preview
    3. Solution.kt — for answers to the test questions
    4. task.md - tasks descriptions
    5. manifest.json - to store 'junit' configuration

See Kotlin-Koans for examples.

How to add your dependencies to kotlin compiler 📚

Just put whatever you need as dependencies to build.gradle via gradle task called library:

 library "your dependency"

NOTE: If the library you're adding uses reflection, accesses the file system, or performs any other type of security-sensitive operations, don't forget to configure the executors.policy.template in web-demo-backend. Click here for more information about Java Security Police

How to set Java Security Police in executors.policy.template

If you want to configure a custom dependency, use the marker @WRAPPERS_LIB@:

grant codeBase "file:@WRAPPERS_LIB@/junit-4.12.jar" {
  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
  permission java.lang.RuntimePermission "setIO";
  permission java.io.FilePermission "<<ALL FILES>>", "read";
  permission java.lang.RuntimePermission "accessDeclaredMembers";
};

Feedback and Issue reporting 👷

We're constantly working on making it easier to add your own courses to try.kotl.in and would appreciate ideas, suggestions, and other feedback, so if you have any, please use our issue tracker to share it with us.

And, of course, if you have any bug reports, you can file them as well If you need any help with compiling or running the project locally, join the #kontributors channel in the Kotlin Slack, and we'll be happy to help you out.