From 3743479c642f4031045b1265143eab064401641d Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 15 May 2024 13:14:12 +0200 Subject: [PATCH] feat: Publish Gradle module metadata for Maven target --- src/targets/__tests__/maven.test.ts | 6 +++--- src/targets/maven.ts | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/targets/__tests__/maven.test.ts b/src/targets/__tests__/maven.test.ts index 9720d51e..57617057 100644 --- a/src/targets/__tests__/maven.test.ts +++ b/src/targets/__tests__/maven.test.ts @@ -388,11 +388,11 @@ describe('upload', () => { expect(cmdArgs[1]).toMatch(new RegExp(`-Dfile=${tmpDirName}.+`)); expect(cmdArgs[2]).toMatch( new RegExp( - `-Dfiles=${tmpDirName}.+-javadoc\\.jar,${tmpDirName}.+-sources\\.jar` + `-Dfiles=${tmpDirName}.+-javadoc\\.jar,${tmpDirName}.+-sources\\.jar,${tmpDirName}.+\\.module` ) ); - expect(cmdArgs[3]).toBe(`-Dclassifiers=javadoc,sources`); - expect(cmdArgs[4]).toBe(`-Dtypes=jar,jar`); + expect(cmdArgs[3]).toBe(`-Dclassifiers=javadoc,sources,`); + expect(cmdArgs[4]).toBe(`-Dtypes=jar,jar,module`); expect(cmdArgs[5]).toMatch( new RegExp(`-DpomFile=${tmpDirName}.+pom-default\\.xml`) ); diff --git a/src/targets/maven.ts b/src/targets/maven.ts index a1720c8b..1fe5df3e 100644 --- a/src/targets/maven.ts +++ b/src/targets/maven.ts @@ -484,6 +484,7 @@ export class MavenTarget extends BaseTarget { javadocFile, sourcesFile, pomFile, + moduleFile, } = this.getFilesForMavenPomDist(distDir); // Maven central is very flaky, so retrying with an exponential delay in @@ -491,9 +492,9 @@ export class MavenTarget extends BaseTarget { await retrySpawnProcess(this.mavenConfig.mavenCliPath, [ 'gpg:sign-and-deploy-file', `-Dfile=${targetFile}`, - `-Dfiles=${javadocFile},${sourcesFile}`, - `-Dclassifiers=javadoc,sources`, - `-Dtypes=jar,jar`, + `-Dfiles=${javadocFile},${sourcesFile},${moduleFile}`, + `-Dclassifiers=javadoc,sources,`, + `-Dtypes=jar,jar,module`, `-DpomFile=${pomFile}`, `-DrepositoryId=${this.mavenConfig.mavenRepoId}`, `-Durl=${this.mavenConfig.mavenRepoUrl}`, @@ -518,6 +519,7 @@ export class MavenTarget extends BaseTarget { javadocFile: join(distDir, `${moduleName}-javadoc.jar`), sourcesFile: join(distDir, `${moduleName}-sources.jar`), pomFile: join(distDir, 'pom-default.xml'), + moduleFile: join(distDir, `${moduleName}.module`) }; } @@ -557,7 +559,6 @@ export class MavenTarget extends BaseTarget { files['klibFiles'] = cinteropFiles; } - files['moduleFile'] = join(distDir, `${moduleName}.module`); } return files; }