@nx/gradle 19.0.0-beta.7 → 19.0.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/gradle",
3
- "version": "19.0.0-beta.7",
3
+ "version": "19.0.0-beta.9",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
6
6
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "migrations": "./migrations.json"
34
34
  },
35
35
  "dependencies": {
36
- "@nx/devkit": "19.0.0-beta.7"
36
+ "@nx/devkit": "19.0.0-beta.9"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
@@ -1,4 +1,4 @@
1
- import { CreateNodes, TargetConfiguration } from '@nx/devkit';
1
+ import { CreateNodes, ProjectConfiguration, TargetConfiguration } from '@nx/devkit';
2
2
  export interface GradlePluginOptions {
3
3
  testTargetName?: string;
4
4
  classesTargetName?: string;
@@ -8,11 +8,11 @@ export interface GradlePluginOptions {
8
8
  export declare const calculatedTargets: Record<string, {
9
9
  name: string;
10
10
  targets: Record<string, TargetConfiguration>;
11
- targetGroups: Record<string, string[]>;
11
+ metadata: ProjectConfiguration['metadata'];
12
12
  }>;
13
13
  export declare function writeTargetsToCache(targets: Record<string, {
14
14
  name: string;
15
15
  targets: Record<string, TargetConfiguration>;
16
- targetGroups: Record<string, string[]>;
16
+ metadata: ProjectConfiguration['metadata'];
17
17
  }>): void;
18
18
  export declare const createNodes: CreateNodes<GradlePluginOptions>;
@@ -33,12 +33,7 @@ exports.createNodes = [
33
33
  exports.calculatedTargets[hash] = targetsCache[hash];
34
34
  return {
35
35
  projects: {
36
- [projectRoot]: {
37
- ...targetsCache[hash],
38
- metadata: {
39
- technologies: ['gradle'],
40
- },
41
- },
36
+ [projectRoot]: targetsCache[hash],
42
37
  },
43
38
  };
44
39
  }
@@ -59,18 +54,15 @@ exports.createNodes = [
59
54
  }
60
55
  const outputDirs = gradleFileToOutputDirsMap.get(gradleFilePath);
61
56
  const { targets, targetGroups } = createGradleTargets(tasks, projectRoot, options, context, outputDirs);
62
- exports.calculatedTargets[hash] = {
63
- name: projectName,
64
- targets,
65
- targetGroups,
66
- };
67
57
  const project = {
68
58
  name: projectName,
69
59
  targets,
70
60
  metadata: {
61
+ targetGroups,
71
62
  technologies: ['gradle'],
72
63
  },
73
64
  };
65
+ exports.calculatedTargets[hash] = project;
74
66
  return {
75
67
  projects: {
76
68
  [projectRoot]: project,
@@ -90,9 +82,8 @@ function createGradleTargets(tasks, projectRoot, options, context, outputDirs) {
90
82
  for (const task of tasks) {
91
83
  const targetName = options?.[`${task.name}TargetName`] ?? task.name;
92
84
  const outputs = outputDirs.get(task.name);
93
- const path = (0, node_path_1.relative)((0, node_path_1.join)(context.workspaceRoot, projectRoot), (0, exec_gradle_1.getGradleBinaryPath)());
94
85
  targets[targetName] = {
95
- command: `${path} ${task.name}`,
86
+ command: `${(0, exec_gradle_1.getGradleRelativePath)((0, node_path_1.join)(context.workspaceRoot, projectRoot))} ${task.name}`,
96
87
  options: {
97
88
  cwd: projectRoot,
98
89
  },
@@ -100,6 +91,9 @@ function createGradleTargets(tasks, projectRoot, options, context, outputDirs) {
100
91
  inputs: inputsMap[task.name],
101
92
  outputs: outputs ? [outputs] : undefined,
102
93
  dependsOn: dependsOnMap[task.name],
94
+ metadata: {
95
+ technologies: ['gradle'],
96
+ },
103
97
  };
104
98
  if (!targetGroups[task.type]) {
105
99
  targetGroups[task.type] = [];
@@ -4,4 +4,5 @@ import { ExecFileOptions } from 'child_process';
4
4
  import { ExecFileSyncOptionsWithBufferEncoding } from 'node:child_process';
5
5
  export declare function execGradle(args: string[], execOptions?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
6
6
  export declare function getGradleBinaryPath(): string;
7
+ export declare function getGradleRelativePath(path: string): string;
7
8
  export declare function execGradleAsync(args: ReadonlyArray<string>, execOptions?: ExecFileOptions): Promise<Buffer>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execGradleAsync = exports.getGradleBinaryPath = exports.execGradle = void 0;
3
+ exports.execGradleAsync = exports.getGradleRelativePath = exports.getGradleBinaryPath = exports.execGradle = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const node_child_process_1 = require("node:child_process");
6
6
  const node_fs_1 = require("node:fs");
@@ -21,6 +21,17 @@ function getGradleBinaryPath() {
21
21
  return gradleBinaryPath;
22
22
  }
23
23
  exports.getGradleBinaryPath = getGradleBinaryPath;
24
+ function getGradleRelativePath(path) {
25
+ const gradleBinaryPath = getGradleBinaryPath();
26
+ let relativePath = (0, node_path_1.relative)(path, gradleBinaryPath);
27
+ if (relativePath.startsWith('gradlew')) {
28
+ relativePath = process.platform.startsWith('win')
29
+ ? `.\\${relativePath}`
30
+ : `./${relativePath}`;
31
+ }
32
+ return relativePath;
33
+ }
34
+ exports.getGradleRelativePath = getGradleRelativePath;
24
35
  function execGradleAsync(args, execOptions) {
25
36
  const gradleBinaryPath = getGradleBinaryPath();
26
37
  return new Promise((res, rej) => {