Skip to content

Commit

Permalink
fix(common-jvm): fix parent module not found when `runFromParentModul…
Browse files Browse the repository at this point in the history
…e` flag is `true`
  • Loading branch information
tinesoft committed Oct 31, 2023
1 parent f8f64c3 commit 840f8f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions packages/common-jvm/src/lib/builders/gradle-builder.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
BuilderCore,
BuildSystem,
} from './builder-core.interface';
import { hasGradleModule, hasGradleWrapper } from '../utils/gradle-utils';
import { hasGradleModule, hasGradleWrapper, hasGradleProject } from '../utils';
import { basename, resolve } from 'path';

export class GradleBuilder implements BuilderCore {
Expand All @@ -29,14 +29,14 @@ export class GradleBuilder implements BuilderCore {

if (options.runFromParentModule) {
let pathToModule:string[] = [];
const childModuleName = basename(options.cwd);
const childModuleName = basename(cwd);
do {
const module = basename(options.cwd);
pathToModule = [...pathToModule, module];
const module = basename(cwd);
cwd = resolve(cwd, '..');
pathToModule = [module, ...pathToModule];
} while (!hasGradleModule(cwd, childModuleName));

additionalArgs = `:${pathToModule.join(':')}:`;
additionalArgs = `-p ${pathToModule.join('/')} `;
}

return { cwd, command: `${additionalArgs}${this.commandAliases[alias]}` };
Expand Down
6 changes: 3 additions & 3 deletions packages/common-jvm/src/lib/builders/maven-builder.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export class MavenBuilder implements BuilderCore {

if(options.runFromParentModule){
let pathToModule:string[] = [];
const childModuleName = basename(options.cwd);
const childModuleName = basename(cwd);
do {
const module = basename(options.cwd);
pathToModule = [...pathToModule, module];
const module = basename(cwd);
cwd = resolve(cwd, '..');
pathToModule = [module, ...pathToModule];
} while (!hasMavenModule(cwd, childModuleName));

additionalArgs = `-f ${pathToModule.join('/')} `;
Expand Down

0 comments on commit 840f8f6

Please sign in to comment.