in src/main/kotlin/com/intellij/indexing/shared/long.kt [14:78]
fun long1() {
// example with most options specified,
// builds indexes using specified IDEs and uploads them to the configured S3,
// similar example with fewer options and local server is below.
val gradleBuildPath = Paths.get(".") / "build"
val downloadsPath = (gradleBuildPath / "ij-cache").createDirectories()
val unpacksPath = (gradleBuildPath / "ij-installations").createDirectories()
val tempPath = (gradleBuildPath / "ij-temp").createDirectories()
val projectHome = Paths.get("C:\\Users\\user\\workspace\\java-design-patterns")
val url = IntelliJSharedIndexes(tempPath, downloadsPath, unpacksPath)
.project("jdp", projectHome)
.using(
IntelliJ.fromUrl(
"https://download.jetbrains.com/idea/ideaIU-2022.3.3.exe",
"3e7856afba10f03f4dfab8d46db06f14e2915d87dc591e60aab49cc5890682fe"
)
)
.using(
listOf(
// 2023.1 and latest 2023.1.x
IntelliJ.byProductAndBuild(IntelliJBasedProduct.IDEAUltimate, "231.8109.175"),
IntelliJ.byProductAndMajorVersion(IntelliJBasedProduct.IDEAUltimate, "231")
)
)
.commit(
// if not specified, `git rev-parse HEAD` is called
"commit-hash-value"
)
.compression(IndexEntryCompression.PLAIN)
.options(
IntelliJOptions(
xmx = "4g",
environmentVariablesToAdd = mapOf(
// https://www.jetbrains.com/help/license_server/configure_automatic_server_discovery.html#configure-automatic-license-discovery
// "JETBRAINS_LICENSE_SERVER" to "url"
)
)
)
.timeout(
// interrupt and fail if one of indexes dump takes more than 15 minutes
Duration.ofMinutes(15)
)
.doNotUseDefaultConfigDirectory()
.buildAndUpload(
// default minio settings with `shared-indexes` bucket
S3(
"http://127.0.0.1:9000/shared-indexes",
"shared-indexes",
"http://127.0.0.1:9000",
),
rebuildCdnIf = {
// remove obsolete indexes every tenth day, see `buildAndUpload` method javadoc
LocalDate.now().dayOfYear % 10 == 0
},
projectIndexesExpirationInDays = 15
)
println(
"Put the following lines into ${projectHome.intellijYaml()}:\n" +
sharedIndexesConfigurationForIntelliJYaml(url)
)
}