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

Changes in Kobalt templates #29

Open
dmitry-zhuravlev opened this issue May 12, 2016 · 1 comment
Open

Changes in Kobalt templates #29

dmitry-zhuravlev opened this issue May 12, 2016 · 1 comment
Assignees

Comments

@dmitry-zhuravlev
Copy link
Collaborator

dmitry-zhuravlev commented May 12, 2016

I've checked the templates which comes with Kobalt (java, kotlin, kobalt plugin)
and at the moment there is 2 isues which prevents it from integration:

  1. Template should be configurable. At least "group" and "version".
  2. Kobalt should generate source and test dirs under ${MODULE_NAME}/src and not within ${PROJECT_BASE_DIR}/src. Where ${MODULE_NAME} is the folder in the same hierarchy level like "kobalt" folder (Build.kt module). That means that in Build.kt file should be directory=${MODULE_NAME} definition.

Point 2) relates to some interesting bug which comes from IDEA core. See
error

JUnit and TestNG configuration hides Kobalt run configuration and there is no way to disable JUnit and TestNG. JUnit and TestNG plugins "think" that task relates to its configuration because of layout of modules where ${PROJECT_BASE_DIR} = ${MODULE_NAME} dir. So should be ${PROJECT_BASE_DIR}/${MODULE_NAME} instead.

Anyway I think that the best solution will be to shift template handling from Kobalt itself to IDEA plugin. There is a key benefits to do so:

  1. Almost all templates can be configurable: User can change template of example code from
    public static void main(String[] argv) { System.out.println("\n\nHello Java world from Kobalt\n\n"); }
    to completelly different content. All remplates can be modified by user in "Settings--> File and Code Templates"

  2. There is a possibility to add some headers which are generated in respect of user settings (javadoc, author name etc)

  3. IDEA can reformat the code which based on template in respect of user settings.

  4. With Kobalt templates you cannot combine e.g. "java" template together with "kotlin" template. But within IDEA it is possible to implement.

  5. There is no additional process for generating templates needed (no need to kobaltw --init <template_name>). IDEA can create and generate needed files and folders.
    So it is more solid solution because process can failed or not properly closed and so on.

But Kobalt templates should still exist for users who are not using IDEA and works from console.

@cbeust
Copy link
Owner

cbeust commented May 12, 2016

  1. Not sure I follow, can you elaborate? Do you mean that templates should belong to a group (like tasks) and have a version number?
  2. This can't always be done since templates can be invoked when the project is completely empty (no build files, no source files).

In the case where the template is run on an existing project with Build.kt, it's still possible that it's a single project (just one module). If there are several projects, then yes, each template probably needs to create its files under the correct module, I'll look into that.

things can get a bit more interesting indeed. Let's start by covering the scenario where the template is run on a completely empty project and I'll think about the other scenario.

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

No branches or pull requests

2 participants