blob: 3da3a51d40e5c510a353e2e3e35af306a23abcbb [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
configure([project(":solr:packaging"), project(":solr:solr-ref-guide"), project(":solr:webapp")]) {
apply plugin: "com.github.node-gradle.node"
def npmRegistry = "${ -> propertyOrEnvOrDefault("solr.npm.registry", "SOLR_NPM_REGISTRY", '') }"
if (!npmRegistry.isEmpty()) {
tasks.npmSetup {
args.addAll(['--registry', npmRegistry])
}
afterEvaluate {
tasks.withType(NpmTask).each { npmTask ->
npmTask.environment.put('NPM_CONFIG_REGISTRY', npmRegistry)
}
tasks.withType(NpxTask).each { npxTask ->
npxTask.environment.put('NPM_CONFIG_REGISTRY', npmRegistry)
}
}
}
ext {
rootNodeDir = "$rootDir/.gradle/node"
nodeProjectDir = file("$rootNodeDir/$project.name")
}
node {
download = true
version = "16.20.2" // LTS
def nodeDistUrl = "${ -> propertyOrEnvOrDefault("solr.node.distUrl", "SOLR_NODE_DIST_URL", '') }"
if (!nodeDistUrl.isEmpty()) {
distBaseUrl = nodeDistUrl
}
// The directory where Node.js is unpacked (when download is true)
workDir = file("${project.ext.rootNodeDir}/nodejs")
// The directory where npm is installed (when a specific version is defined)
npmWorkDir = file("${project.ext.rootNodeDir}/npm")
// The Node.js project directory location
// This is where the package.json file and node_modules directory are located
// By default it is at the root of the current project
nodeProjectDir = project.ext.nodeProjectDir
}
}