JetBrains / intellij-shared-indexes-tool-example

Apache License 2.0
20 stars 1 forks source link

project-id is taken by folder name which is not the correct project-id #6

Open pschwarzer-tt opened 1 year ago

pschwarzer-tt commented 1 year ago

We try to build shared project indices with the ij-shared-indexes-tool-cli tool version 0.9.8 as explained here: https://www.jetbrains.com/help/idea/shared-indexes.html on a build mashine automatically.

The build mashine automatically checkout project from version control system in a folder. That folder name is set by the build system and has a variable number, instead of the real project name.

When than calling tool with ij-shared-indexes-tool-cli tool with ij-shared-indexes-tool-cli.bat indexes --ij "C:\Users\nightlybuild\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\232.9559.62" --project "E:\w\19f8fce6a6742369" --data-directory "E:\IntelliJ\temp" it takes the folder name 19f8fce6a6742369 as project-id.

Is there a possibility to force overwrite the used folder name, to use a constant value (like my_tool_name) instead?

sproshev commented 1 year ago

Hi! Please follow https://youtrack.jetbrains.com/issue/IDEA-322466 or https://youtrack.jetbrains.com/issue/IDEA-327087. At the moment I can suggest the following:

import com.intellij.indexing.shared.builder.IntelliJ import com.intellij.indexing.shared.builder.IntelliJSharedIndexes import java.nio.file.Path

fun main() { IntelliJSharedIndexes(Path.of("E:\IntelliJ\temp")) .project("my_tool_name", Path.of("E:\w\19f8fce6a6742369")) .using(IntelliJ.fromLocallyInstalled(Path.of("C:\Users\nightlybuild\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\232.9559.62"))) .build(Path.of("RESULTS_DIR")) }


* run `gradlew.bat run`
* upload `data` and `project` directories from `RESULTS_DIR` to your server, it is very important to copy them **from** server to build machine **before** running the tool because it updates layout using old and fresh shared indexes. Then updated layout can be uploaded.

Please let me know if running gradle on a build machine is OK or not for you.