[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.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
|
||||
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.Serializable
|
||||
|
||||
@@ -36,8 +37,7 @@ interface NpmApi : Serializable {
|
||||
services: ServiceRegistry,
|
||||
logger: Logger,
|
||||
nodeJs: NpmEnvironment,
|
||||
command: String,
|
||||
isStandalone: Boolean,
|
||||
yarn: YarnEnv,
|
||||
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
||||
cliArgs: List<String>
|
||||
)
|
||||
|
||||
+1
-2
@@ -291,8 +291,7 @@ internal class KotlinRootNpmResolver internal constructor(
|
||||
services,
|
||||
logger,
|
||||
npmEnvironment,
|
||||
yarnEnvironment.executable,
|
||||
yarnEnvironment.standalone,
|
||||
yarnEnvironment,
|
||||
allNpmPackages,
|
||||
args
|
||||
)
|
||||
|
||||
+2
-4
@@ -52,8 +52,7 @@ class Yarn : NpmApi {
|
||||
services: ServiceRegistry,
|
||||
logger: Logger,
|
||||
nodeJs: NpmEnvironment,
|
||||
command: String,
|
||||
isStandalone: Boolean,
|
||||
yarn: YarnEnv,
|
||||
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
||||
cliArgs: List<String>
|
||||
) {
|
||||
@@ -62,8 +61,7 @@ class Yarn : NpmApi {
|
||||
services,
|
||||
logger,
|
||||
nodeJs,
|
||||
command,
|
||||
isStandalone,
|
||||
yarn,
|
||||
npmProjects,
|
||||
cliArgs
|
||||
)
|
||||
|
||||
+5
-4
@@ -29,15 +29,15 @@ abstract class YarnBasics : NpmApi {
|
||||
services: ServiceRegistry,
|
||||
logger: Logger,
|
||||
nodeJs: NpmEnvironment,
|
||||
command: String,
|
||||
isStandalone: Boolean,
|
||||
yarn: YarnEnv,
|
||||
dir: File,
|
||||
description: String,
|
||||
args: List<String>
|
||||
) {
|
||||
services.execWithProgress(description) { exec ->
|
||||
val arguments = args +
|
||||
if (logger.isDebugEnabled) "--verbose" else ""
|
||||
if (logger.isDebugEnabled) "--verbose" else "" +
|
||||
if (yarn.ignoreScripts) "--ignore-scripts" else ""
|
||||
|
||||
val nodeExecutable = nodeJs.nodeExecutable
|
||||
exec.environment(
|
||||
@@ -45,7 +45,8 @@ abstract class YarnBasics : NpmApi {
|
||||
"$nodeExecutable${File.pathSeparator}${System.getenv("PATH")}"
|
||||
)
|
||||
|
||||
if (isStandalone) {
|
||||
val command = yarn.executable
|
||||
if (yarn.standalone) {
|
||||
exec.executable = command
|
||||
exec.args = arguments
|
||||
} else {
|
||||
|
||||
+2
-1
@@ -15,5 +15,6 @@ data class YarnEnv(
|
||||
val home: File,
|
||||
val executable: String,
|
||||
val ivyDependency: String,
|
||||
val standalone: Boolean
|
||||
val standalone: Boolean,
|
||||
val ignoreScripts: Boolean,
|
||||
) : Serializable
|
||||
|
||||
+4
-1
@@ -42,6 +42,8 @@ open class YarnRootExtension(
|
||||
var lockFileName by Property("kotlin-yarn.lock")
|
||||
var lockFileDirectory: File by Property(project.rootDir)
|
||||
|
||||
var ignoreScripts by Property(true)
|
||||
|
||||
val yarnSetupTaskProvider: TaskProvider<YarnSetupTask>
|
||||
get() = project.tasks
|
||||
.withType(YarnSetupTask::class.java)
|
||||
@@ -103,7 +105,8 @@ open class YarnRootExtension(
|
||||
home = home,
|
||||
executable = getExecutable("yarn", command, "cmd"),
|
||||
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,
|
||||
logger: Logger,
|
||||
nodeJs: NpmEnvironment,
|
||||
command: String,
|
||||
isStandalone: Boolean,
|
||||
yarn: YarnEnv,
|
||||
npmProjects: Collection<KotlinCompilationNpmResolution>,
|
||||
cliArgs: List<String>
|
||||
) {
|
||||
@@ -82,8 +81,7 @@ class YarnWorkspaces : YarnBasics() {
|
||||
services,
|
||||
logger,
|
||||
nodeJs,
|
||||
command,
|
||||
isStandalone,
|
||||
yarn,
|
||||
nodeJsWorldDir,
|
||||
NpmApi.resolveOperationDescription("yarn"),
|
||||
cliArgs
|
||||
|
||||
Reference in New Issue
Block a user