Skip to content

Commit

Permalink
build: work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
khalilou88 committed Jul 29, 2023
1 parent 953412f commit 27fa85b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/gradle/src/generators/application/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ import {
} from '@jnxplus/common';
import { LinterType } from '@jnxplus/common';
import { NxGradleAppGeneratorSchema } from './schema';
import { addProjectToGradleSetting, getDsl, getQuarkusVersion } from '../../.';
import {
addProjectToGradleSetting,
getDsl,
getQuarkusVersion,
useVersionCatalog,
} from '../../.';
import * as fs from 'fs';

interface NormalizedSchema extends NxGradleAppGeneratorSchema {
Expand All @@ -36,6 +41,7 @@ interface NormalizedSchema extends NxGradleAppGeneratorSchema {
dsl: DSLType;
kotlinExtension: string;
quarkusVersion: string;
versionManagement: 'properties' | 'version-catalog';
}

function normalizeOptions(
Expand Down Expand Up @@ -115,6 +121,10 @@ function normalizeOptions(
}
}

const versionManagement = useVersionCatalog(tree)
? 'version-catalog'
: 'properties';

return {
...options,
projectName,
Expand All @@ -129,6 +139,7 @@ function normalizeOptions(
dsl,
kotlinExtension,
quarkusVersion: qVersion,
versionManagement,
};
}

Expand Down
10 changes: 10 additions & 0 deletions packages/gradle/src/lib/utils/generators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ export function getDsl(tree: Tree): DSLType {
return 'kotlin';
}

export function useVersionCatalog(tree: Tree): boolean {
const filePath = join('gradle', 'libs.versions.toml');

if (tree.exists(filePath)) {
return true;
}

return false;
}

export function addOrUpdateGitattributes(tree: Tree) {
const gitattributesPath = `.gitattributes`;
const gradleWrapperGitattributes = `#\n# https://help.github.com/articles/dealing-with-line-endings/\n#\n# Linux start script should use lf\ngradlew text eol=lf\n# Windows script files should use crlf\n*.bat text eol=crlf`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
addProjectToGradleSetting,
getProjectPathFromProjectRoot,
getRootProjectName,
useVersionCatalog,
} from '@jnxplus/gradle';
import {
ProjectConfiguration,
Expand Down Expand Up @@ -41,6 +42,7 @@ interface NormalizedSchema extends NxGradleKotlinMultiplatformGeneratorSchema {
relativePathToSharedLib: string;
relativePathToPodfile: string;
appName: string;
versionManagement: 'properties' | 'version-catalog';
}

function normalizeOptions(
Expand Down Expand Up @@ -149,6 +151,10 @@ function normalizeOptions(

const appName = names(prefix).className;

const versionManagement = useVersionCatalog(tree)
? 'version-catalog'
: 'properties';

return {
...options,
androidAppName,
Expand All @@ -171,6 +177,7 @@ function normalizeOptions(
relativePathToSharedLib,
relativePathToPodfile,
appName,
versionManagement,
};
}

Expand Down

0 comments on commit 27fa85b

Please sign in to comment.