[Gradle, JS] Ignore scripts by default
^KT-34014 fixed ^KT-49505 fixed
This commit is contained in:
+2
-2
@@ -10,6 +10,7 @@ import org.gradle.api.logging.Logger
|
|||||||
import org.gradle.internal.service.ServiceRegistry
|
import org.gradle.internal.service.ServiceRegistry
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
|
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.npm.resolved.KotlinCompilationNpmResolution
|
import org.jetbrains.kotlin.gradle.targets.js.npm.resolved.KotlinCompilationNpmResolution
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnEnv
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
@@ -36,8 +37,7 @@ interface NpmApi : Serializable {
|
|||||||
services: ServiceRegistry,
|
services: ServiceRegistry,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
nodeJs: NpmEnvironment,
|
nodeJs: NpmEnvironment,
|
||||||
command: String,
|
yarn: YarnEnv,
|
||||||
isStandalone: Boolean,
|
|
||||||
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
||||||
cliArgs: List<String>
|
cliArgs: List<String>
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-2
@@ -291,8 +291,7 @@ internal class KotlinRootNpmResolver internal constructor(
|
|||||||
services,
|
services,
|
||||||
logger,
|
logger,
|
||||||
npmEnvironment,
|
npmEnvironment,
|
||||||
yarnEnvironment.executable,
|
yarnEnvironment,
|
||||||
yarnEnvironment.standalone,
|
|
||||||
allNpmPackages,
|
allNpmPackages,
|
||||||
args
|
args
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-4
@@ -52,8 +52,7 @@ class Yarn : NpmApi {
|
|||||||
services: ServiceRegistry,
|
services: ServiceRegistry,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
nodeJs: NpmEnvironment,
|
nodeJs: NpmEnvironment,
|
||||||
command: String,
|
yarn: YarnEnv,
|
||||||
isStandalone: Boolean,
|
|
||||||
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
||||||
cliArgs: List<String>
|
cliArgs: List<String>
|
||||||
) {
|
) {
|
||||||
@@ -62,8 +61,7 @@ class Yarn : NpmApi {
|
|||||||
services,
|
services,
|
||||||
logger,
|
logger,
|
||||||
nodeJs,
|
nodeJs,
|
||||||
command,
|
yarn,
|
||||||
isStandalone,
|
|
||||||
npmProjects,
|
npmProjects,
|
||||||
cliArgs
|
cliArgs
|
||||||
)
|
)
|
||||||
|
|||||||
+5
-4
@@ -29,15 +29,15 @@ abstract class YarnBasics : NpmApi {
|
|||||||
services: ServiceRegistry,
|
services: ServiceRegistry,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
nodeJs: NpmEnvironment,
|
nodeJs: NpmEnvironment,
|
||||||
command: String,
|
yarn: YarnEnv,
|
||||||
isStandalone: Boolean,
|
|
||||||
dir: File,
|
dir: File,
|
||||||
description: String,
|
description: String,
|
||||||
args: List<String>
|
args: List<String>
|
||||||
) {
|
) {
|
||||||
services.execWithProgress(description) { exec ->
|
services.execWithProgress(description) { exec ->
|
||||||
val arguments = args +
|
val arguments = args +
|
||||||
if (logger.isDebugEnabled) "--verbose" else ""
|
if (logger.isDebugEnabled) "--verbose" else "" +
|
||||||
|
if (yarn.ignoreScripts) "--ignore-scripts" else ""
|
||||||
|
|
||||||
val nodeExecutable = nodeJs.nodeExecutable
|
val nodeExecutable = nodeJs.nodeExecutable
|
||||||
exec.environment(
|
exec.environment(
|
||||||
@@ -45,7 +45,8 @@ abstract class YarnBasics : NpmApi {
|
|||||||
"$nodeExecutable${File.pathSeparator}${System.getenv("PATH")}"
|
"$nodeExecutable${File.pathSeparator}${System.getenv("PATH")}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (isStandalone) {
|
val command = yarn.executable
|
||||||
|
if (yarn.standalone) {
|
||||||
exec.executable = command
|
exec.executable = command
|
||||||
exec.args = arguments
|
exec.args = arguments
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+2
-1
@@ -15,5 +15,6 @@ data class YarnEnv(
|
|||||||
val home: File,
|
val home: File,
|
||||||
val executable: String,
|
val executable: String,
|
||||||
val ivyDependency: String,
|
val ivyDependency: String,
|
||||||
val standalone: Boolean
|
val standalone: Boolean,
|
||||||
|
val ignoreScripts: Boolean,
|
||||||
) : Serializable
|
) : Serializable
|
||||||
|
|||||||
+4
-1
@@ -42,6 +42,8 @@ open class YarnRootExtension(
|
|||||||
var lockFileName by Property("kotlin-yarn.lock")
|
var lockFileName by Property("kotlin-yarn.lock")
|
||||||
var lockFileDirectory: File by Property(project.rootDir)
|
var lockFileDirectory: File by Property(project.rootDir)
|
||||||
|
|
||||||
|
var ignoreScripts by Property(true)
|
||||||
|
|
||||||
val yarnSetupTaskProvider: TaskProvider<YarnSetupTask>
|
val yarnSetupTaskProvider: TaskProvider<YarnSetupTask>
|
||||||
get() = project.tasks
|
get() = project.tasks
|
||||||
.withType(YarnSetupTask::class.java)
|
.withType(YarnSetupTask::class.java)
|
||||||
@@ -103,7 +105,8 @@ open class YarnRootExtension(
|
|||||||
home = home,
|
home = home,
|
||||||
executable = getExecutable("yarn", command, "cmd"),
|
executable = getExecutable("yarn", command, "cmd"),
|
||||||
standalone = !download,
|
standalone = !download,
|
||||||
ivyDependency = "com.yarnpkg:yarn:$version@tar.gz"
|
ivyDependency = "com.yarnpkg:yarn:$version@tar.gz",
|
||||||
|
ignoreScripts = ignoreScripts,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -71,8 +71,7 @@ class YarnWorkspaces : YarnBasics() {
|
|||||||
services: ServiceRegistry,
|
services: ServiceRegistry,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
nodeJs: NpmEnvironment,
|
nodeJs: NpmEnvironment,
|
||||||
command: String,
|
yarn: YarnEnv,
|
||||||
isStandalone: Boolean,
|
|
||||||
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
||||||
cliArgs: List<String>
|
cliArgs: List<String>
|
||||||
) {
|
) {
|
||||||
@@ -82,8 +81,7 @@ class YarnWorkspaces : YarnBasics() {
|
|||||||
services,
|
services,
|
||||||
logger,
|
logger,
|
||||||
nodeJs,
|
nodeJs,
|
||||||
command,
|
yarn,
|
||||||
isStandalone,
|
|
||||||
nodeJsWorldDir,
|
nodeJsWorldDir,
|
||||||
NpmApi.resolveOperationDescription("yarn"),
|
NpmApi.resolveOperationDescription("yarn"),
|
||||||
cliArgs
|
cliArgs
|
||||||
|
|||||||
Reference in New Issue
Block a user