mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Reapply "[platform] IJPL-192027 Replace hardcoded Maven repository path with getMavenRepositoryPath() usage"
This reverts commit ffccd301cfe38ff93a77f862e4d7659c58a77645. GitOrigin-RevId: 075fd74924269c7e50d2b89f69cb7f6243233dd6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9f8d69ce0e
commit
94aec07b22
@@ -13,6 +13,7 @@ import org.jdom.Element
|
||||
import org.jetbrains.intellij.build.io.unmapBuffer
|
||||
import org.jetbrains.jps.model.JpsProject
|
||||
import org.jetbrains.jps.model.module.JpsModule
|
||||
import org.jetbrains.jps.model.serialization.JpsMavenSettings.getMavenRepositoryPath
|
||||
import org.jetbrains.jps.model.serialization.JpsModelSerializationDataService
|
||||
import org.jetbrains.jps.model.serialization.JpsSerializationManager
|
||||
import java.io.StringWriter
|
||||
@@ -32,10 +33,10 @@ internal class AddDependencyToImlByUsage {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
val m2Repo = Path.of(System.getProperty("user.home"), ".m2/repository")
|
||||
val m2Repo = getMavenRepositoryPath()
|
||||
//val projectDir = Path.of(PathManager.getHomePath())
|
||||
val projectDir = Path.of("${System.getProperty("user.home")}/projects/idea")
|
||||
val project = JpsSerializationManager.getInstance().loadProject(projectDir.toString(), mapOf("MAVEN_REPOSITORY" to m2Repo.toString()), true)
|
||||
val project = JpsSerializationManager.getInstance().loadProject(projectDir.toString(), mapOf("MAVEN_REPOSITORY" to m2Repo), true)
|
||||
|
||||
val items = listOf(
|
||||
//"intellij.platform.editor",
|
||||
|
||||
@@ -10,10 +10,10 @@ import com.intellij.platform.eel.EelExecApi
|
||||
import com.intellij.platform.eel.EelExecApiHelpers
|
||||
import com.intellij.platform.eel.spawnProcess
|
||||
import com.intellij.util.PathUtil
|
||||
import com.intellij.util.SystemProperties
|
||||
import org.jetbrains.jps.model.java.JpsJavaExtensionService
|
||||
import org.jetbrains.jps.model.library.JpsOrderRootType
|
||||
import org.jetbrains.jps.model.module.JpsModule
|
||||
import org.jetbrains.jps.model.serialization.JpsMavenSettings.getMavenRepositoryPath
|
||||
import org.jetbrains.jps.model.serialization.JpsSerializationManager
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
@@ -39,7 +39,7 @@ internal class JavaMainClassExecutor(clazz: Class<*>, vararg args: String) {
|
||||
|
||||
private companion object {
|
||||
private fun getClassPathForClass(clazz: Class<*>): String {
|
||||
val mavenPath = Path(SystemProperties.getUserHome()).resolve(".m2").resolve("repository").toString()
|
||||
val mavenPath = getMavenRepositoryPath()
|
||||
val helperModuleName = getJpsModuleNameForClass(clazz)
|
||||
logger.value.info("helper module name: $helperModuleName")
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.devkit.modules.toolwindow
|
||||
|
||||
import com.intellij.util.SystemProperties
|
||||
import com.intellij.openapi.util.io.toCanonicalPath
|
||||
import org.jetbrains.jps.model.JpsElementFactory
|
||||
import org.jetbrains.jps.model.JpsModel
|
||||
import org.jetbrains.jps.model.serialization.JpsMavenSettings.getMavenRepositoryPath
|
||||
import org.jetbrains.jps.model.serialization.JpsModelSerializationDataService
|
||||
import org.jetbrains.jps.model.serialization.JpsProjectLoader
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
|
||||
/**
|
||||
@@ -17,10 +17,8 @@ fun loadJpsModel(projectPath: Path): JpsModel {
|
||||
val model = JpsElementFactory.getInstance().createModel() ?: throw Exception("Couldn't create JpsModel")
|
||||
val pathVariablesConfiguration = JpsModelSerializationDataService.getOrCreatePathVariablesConfiguration(model.global)
|
||||
|
||||
val m2HomePath = File(SystemProperties.getUserHome())
|
||||
.resolve(".m2")
|
||||
.resolve("repository")
|
||||
pathVariablesConfiguration.addPathVariable("MAVEN_REPOSITORY", m2HomePath.canonicalPath)
|
||||
val m2HomePath = Path.of(getMavenRepositoryPath()).toCanonicalPath()
|
||||
pathVariablesConfiguration.addPathVariable("MAVEN_REPOSITORY", m2HomePath)
|
||||
|
||||
val pathVariables = JpsModelSerializationDataService.computeAllPathVariables(model.global)
|
||||
JpsProjectLoader.loadProject(model.project, pathVariables, projectPath)
|
||||
|
||||
Reference in New Issue
Block a user