Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Support Kotlin Build Scripts in Gradle Project and Cdktf Version Detection #3760

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/@cdktf/commons/src/gradle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import { logger } from "./logging";
import { exec } from "./util";

export function isGradleProject(workingDirectory: string): boolean {
const buildGradlePath = path.join(workingDirectory, "build.gradle");
const buildGradlePath = path.join(
workingDirectory,
"build.gradle" || "build.gradle.kts"
);

try {
fs.accessSync(buildGradlePath, fs.constants.R_OK | fs.constants.W_OK);
Expand Down Expand Up @@ -151,7 +154,10 @@ export async function getGradlePackageVersion(packageName: string) {
}

export async function getGradlePackageVersionFromBuild(packageName: string) {
const buildGradlePath = path.join(process.cwd(), "build.gradle");
const buildGradlePath = path.join(
process.cwd(),
"build.gradle" || "build.gradle.kts"
);
const buildGradleContents = await fs.readFile(buildGradlePath, "utf-8");
const buildLines = buildGradleContents.split(/\r\n|\r|\n/);

Expand Down
Loading