[Gradle, JS] KT-36784 Provide args for kotlinNpmInstall
#KT-32466 fixed #KT-36784 fixed #KT-36864 fixed
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ interface NpmApi {
|
||||
rootProject: Project,
|
||||
subProjects: Collection<KotlinCompilationNpmResolution>,
|
||||
skipExecution: Boolean,
|
||||
vararg cliArgs: String
|
||||
cliArgs: List<String>
|
||||
)
|
||||
|
||||
fun resolveDependency(
|
||||
|
||||
+2
-2
@@ -39,12 +39,12 @@ class Yarn : NpmApi {
|
||||
rootProject: Project,
|
||||
subProjects: Collection<KotlinCompilationNpmResolution>,
|
||||
skipExecution: Boolean,
|
||||
vararg cliArgs: String
|
||||
cliArgs: List<String>
|
||||
) = getDelegate(rootProject.project)
|
||||
.resolveRootProject(
|
||||
rootProject,
|
||||
subProjects,
|
||||
skipExecution,
|
||||
*cliArgs
|
||||
cliArgs
|
||||
)
|
||||
}
|
||||
+1
-1
@@ -26,7 +26,7 @@ abstract class YarnBasics : NpmApi {
|
||||
project: Project,
|
||||
dir: File,
|
||||
description: String,
|
||||
vararg args: String
|
||||
args: List<String>
|
||||
) {
|
||||
val nodeJs = NodeJsRootPlugin.apply(project)
|
||||
val yarnPlugin = YarnPlugin.apply(project)
|
||||
|
||||
+7
-2
@@ -17,7 +17,12 @@ class YarnSimple : YarnBasics() {
|
||||
val project = resolvedNpmProject.project
|
||||
|
||||
PackageJsonUpToDateCheck(resolvedNpmProject.npmProject).updateIfNeeded {
|
||||
yarnExec(project, resolvedNpmProject.npmProject.dir, NpmApi.resolveOperationDescription("yarn for ${project.path}"))
|
||||
yarnExec(
|
||||
project,
|
||||
resolvedNpmProject.npmProject.dir,
|
||||
NpmApi.resolveOperationDescription("yarn for ${project.path}"),
|
||||
emptyList()
|
||||
)
|
||||
yarnLockReadTransitiveDependencies(resolvedNpmProject.npmProject.dir, resolvedNpmProject.externalNpmDependencies)
|
||||
}
|
||||
}
|
||||
@@ -26,6 +31,6 @@ class YarnSimple : YarnBasics() {
|
||||
rootProject: Project,
|
||||
subProjects: Collection<KotlinCompilationNpmResolution>,
|
||||
skipExecution: Boolean,
|
||||
vararg cliArgs: String
|
||||
cliArgs: List<String>
|
||||
) = Unit
|
||||
}
|
||||
+17
-5
@@ -20,23 +20,34 @@ class YarnWorkspaces : YarnBasics() {
|
||||
rootProject: Project,
|
||||
subProjects: Collection<KotlinCompilationNpmResolution>,
|
||||
skipExecution: Boolean,
|
||||
vararg cliArgs: String
|
||||
cliArgs: List<String>
|
||||
) {
|
||||
check(rootProject == rootProject.rootProject)
|
||||
if (!skipExecution) setup(rootProject)
|
||||
return resolveWorkspaces(rootProject, subProjects, skipExecution)
|
||||
return resolveWorkspaces(
|
||||
rootProject,
|
||||
subProjects,
|
||||
skipExecution,
|
||||
cliArgs
|
||||
)
|
||||
}
|
||||
|
||||
private fun resolveWorkspaces(
|
||||
rootProject: Project,
|
||||
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
||||
skipExecution: Boolean
|
||||
skipExecution: Boolean,
|
||||
cliArgs: List<String>
|
||||
) {
|
||||
val nodeJsWorldDir = NodeJsRootPlugin.apply(rootProject).rootPackageDir
|
||||
|
||||
if (!skipExecution) {
|
||||
saveRootProjectWorkspacesPackageJson(rootProject, npmProjects, nodeJsWorldDir)
|
||||
yarnExec(rootProject, nodeJsWorldDir, NpmApi.resolveOperationDescription("yarn"))
|
||||
yarnExec(
|
||||
rootProject,
|
||||
nodeJsWorldDir,
|
||||
NpmApi.resolveOperationDescription("yarn"),
|
||||
cliArgs
|
||||
)
|
||||
}
|
||||
|
||||
yarnLockReadTransitiveDependencies(nodeJsWorldDir, npmProjects.flatMap { it.externalNpmDependencies })
|
||||
@@ -51,7 +62,8 @@ class YarnWorkspaces : YarnBasics() {
|
||||
rootPackageJson.private = true
|
||||
|
||||
val npmProjectWorkspaces = npmProjects.map { it.npmProject.dir.relativeTo(nodeJsWorldDir).path }
|
||||
val importedProjectWorkspaces = YarnImportedPackagesVersionResolver(rootProject, npmProjects, nodeJsWorldDir).resolveAndUpdatePackages()
|
||||
val importedProjectWorkspaces =
|
||||
YarnImportedPackagesVersionResolver(rootProject, npmProjects, nodeJsWorldDir).resolveAndUpdatePackages()
|
||||
|
||||
rootPackageJson.workspaces = npmProjectWorkspaces + importedProjectWorkspaces
|
||||
rootPackageJson.saveTo(
|
||||
|
||||
Reference in New Issue
Block a user