fun long2()

in src/main/kotlin/com/intellij/indexing/shared/long.kt [80:122]


fun long2() {
    val gradleBuildPath = Paths.get(".") / "build"
    val tempPath = (gradleBuildPath / "ij-temp").createDirectories()

    val projectHome = Paths.get("/home/user/workspace/java-design-patterns")
    val port = 45124

    val url = IntelliJSharedIndexes(tempPath)
        .project(projectHome)
        .using(
            IntelliJ.fromUrl(
                "https://download.jetbrains.com/idea/ideaIU-2022.3.3.tar.gz",
                "c302bd84b48a56ef1b0f033e8e93a0da5590f80482eae172db6130da035314a6"
            )
        )
        .using(
            listOf(
                // 2023.1 and latest 2023.1.x
                IntelliJ.byProductAndBuild(IntelliJBasedProduct.IDEAUltimate, "231.8109.175"),
                IntelliJ.byProductAndMajorVersion(IntelliJBasedProduct.IDEAUltimate, "231")
            )
        )
        .options(
            IntelliJOptions(
                environmentVariablesToAdd = mapOf(
                    // https://www.jetbrains.com/help/license_server/configure_automatic_server_discovery.html#configure-automatic-license-discovery
                    // "JETBRAINS_LICENSE_SERVER" to "url"
                )
            )
        )
        .buildAndUpload(
            gradleBuildPath.serverDir(),
            "http://127.0.0.1:$port",
            rebuildCdnIf = { LocalDate.now().dayOfYear % 10 == 0 }
        )

    println(
        "Put the following lines into ${projectHome.intellijYaml()}:\n" +
                sharedIndexesConfigurationForIntelliJYaml(url)
    )

    startServerOnLocalIndexes(gradleBuildPath.serverDir(), port = port)
}