UNPKG

@nx/gradle

Version:

The Nx Plugin for Gradle allows Gradle tasks to be run through Nx

33 lines (32 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = update; const devkit_1 = require("@nx/devkit"); const has_gradle_plugin_1 = require("../../utils/has-gradle-plugin"); // This function add options includeSubprojectsTasks as true in nx.json for gradle plugin function update(tree) { const nxJson = (0, devkit_1.readNxJson)(tree); if (!nxJson) { return; } if (!(0, has_gradle_plugin_1.hasGradlePlugin)(tree)) { return; } let gradlePluginIndex = nxJson.plugins.findIndex((p) => typeof p === 'string' ? p === '@nx/gradle' : p.plugin === '@nx/gradle'); let gradlePlugin = nxJson.plugins[gradlePluginIndex]; if (typeof gradlePlugin === 'string') { gradlePlugin = { plugin: '@nx/gradle', options: { includeSubprojectsTasks: true, }, }; nxJson.plugins[gradlePluginIndex] = gradlePlugin; } else { gradlePlugin.options ??= {}; gradlePlugin.options.includeSubprojectsTasks = true; } (0, devkit_1.updateNxJson)(tree, nxJson); }