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

Using the amper branch, how do we run specific fun main from specific files? #29

Open
StylianosGakis opened this issue Dec 1, 2023 · 5 comments

Comments

@StylianosGakis
Copy link

The README seems to imply that there should be a green play button next to it. When using Fleet, that does not seem to exist. Is that something that should be there, something that should be written in a custom fleet run.json, or what should one have to do in order to not have to use IntelliJ for this?

@hsz
Copy link
Collaborator

hsz commented Dec 2, 2023

To use Amper, rely on a dedicated fork project linked in README:

Note

There is a fork of this repository available that utilizes the Amper tool for project configuration, recently introduced by JetBrains.

For more, see Advent of Code Kotlin Template — Amper project.

@hsz
Copy link
Collaborator

hsz commented Dec 2, 2023

Note, for Amper, there's a requirement of using the latest Fleet/IntelliJ IDEA:

Warning

Amper is supported since IntelliJ IDEA 2023.3 and Fleet 1.26 releases.

No extra configuration is required.

@VictorIreri
Copy link

VictorIreri commented Dec 3, 2023

Or maybe, like me, you used the Amper template to create your repo before the settings.gradle.kts bug was fixed?

@StylianosGakis
Copy link
Author

It was not the fleet version, nor me forking too late unfortunately.
What I did which ended up working was follow the help I got from Márton here https://slack-chats.kotlinlang.org/t/16101531/i-thought-i-d-give-aoc-a-try-with-amper-fleet-just-to-see-ho#5093cea1-4694-4e97-802d-a978501a1b5d

Basically Márton had to run the task on IntelliJ first, to get a configuration auto-generated, then copied that to a fleet configuration, which setup the right flags etc.
I had to run jvmRun and not just run as a task, and I had to give it "-DmainClass=Day01Kt" as args. The flmapper part seems to not be necessary for it to run, but in any case, that was there too.

Good to note that when I try to do this "Copy configuration" I get nothing on my clipboard, so without this help, unless I wrote the configuration file myself manually I would not have succeeded in making this run. I don't see people who fork this project (the amper one) to also be able to quickly figure out that they have to add a run.json which looks smth like this

{
  "configurations"
: [
        {
            "name": "Day01",
            "type": "gradle",
            "workingDir": "$PROJECT_DIR$",
            "tasks": ["jvmRun"],
            "args": [
                "-DmainClass=Day01Kt",
                "--quiet"
            ]
        },
        
    ]
}

Maybe that should be part of the readme? If not just straight up checked into git completely, like the entire .fleet directory.

@samuelteixeiras
Copy link

https://stackoverflow.com/questions/44615237/how-to-run-kotlin-function-in-intellij-idea

I am running on IntelliJ , just needed to add src as a source folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants