From 7eb9ac9aebceeff58119645a7956c03c3ca588e0 Mon Sep 17 00:00:00 2001 From: bang9 Date: Mon, 4 Nov 2024 18:56:23 +0900 Subject: [PATCH] fix: handle libraries using build.gradle.kts files --- .../src/config/__tests__/findLibraryName.test.ts | 2 +- packages/cli-platform-android/src/config/findLibraryName.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cli-platform-android/src/config/__tests__/findLibraryName.test.ts b/packages/cli-platform-android/src/config/__tests__/findLibraryName.test.ts index 143107400..96998d24e 100644 --- a/packages/cli-platform-android/src/config/__tests__/findLibraryName.test.ts +++ b/packages/cli-platform-android/src/config/__tests__/findLibraryName.test.ts @@ -86,7 +86,7 @@ describe('android::findLibraryName', () => { }); it('returns the library name if declared with inside a build.gradle.kts file', () => { - expect(findLibraryName('/', '/valid/singlequotes')).toBe('justalibrary'); + expect(findLibraryName('/', '/valid/gradlekts')).toBe('justalibrary'); }); it('returns the library name if defined inside codegenConfig', () => { diff --git a/packages/cli-platform-android/src/config/findLibraryName.ts b/packages/cli-platform-android/src/config/findLibraryName.ts index 318180d51..b442970b8 100644 --- a/packages/cli-platform-android/src/config/findLibraryName.ts +++ b/packages/cli-platform-android/src/config/findLibraryName.ts @@ -24,7 +24,9 @@ export function findLibraryName(root: string, sourceDir: string) { return undefined; } - const match = buildGradleContents.match(/libraryName = ["'](.+)["']/); + const match = + buildGradleContents.match(/libraryName = ["'](.+)["']/) ?? + buildGradleContents.match(/libraryName\.set\(["'](.+)["']\)/); if (match) { return match[1];