Skip to content

Commit

Permalink
fix: handle libraries using build.gradle.kts files
Browse files Browse the repository at this point in the history
  • Loading branch information
bang9 committed Nov 4, 2024
1 parent 134e23e commit 7eb9ac9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/cli-platform-android/src/config/findLibraryName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 7eb9ac9

Please sign in to comment.