You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val allFiles = inputFiles.filter { it.file.isFile }
21
34
val gavPaths = allFiles.filter { it.normalizedPath.endsWith(".pom") || it.normalizedPath.endsWith(".module") }
@@ -24,137 +37,151 @@ fun publishFileByFile(
24
37
25
38
val lastUpdated = timestampNow()
26
39
27
-
gavPaths.forEach { gavPath ->
28
-
val gav =Gav.from(gavPath)
29
-
val version = gav.version
30
-
val gavFiles = allFiles.filter { it.normalizedPath.startsWith(gavPath) }
31
-
32
-
/**
33
-
* This is a proper directory containing artifacts
34
-
*/
35
-
if (version.endsWith("-SNAPSHOT")) {
36
-
/**
37
-
* This is a snapshot:
38
-
* - update the [version metadata](https://maven.apache.org/repositories/metadata.html).
39
-
* - patch the file names to include the new build number.
40
-
*
41
-
* See https://s01.oss.sonatype.org/content/repositories/snapshots/com/apollographql/apollo/apollo-api-jvm/maven-metadata.xml for an example.
42
-
*
43
-
* For snapshots, it's not 100% clear who owns the metadata as the repository might expire some snapshot and therefore need to rewrite the
44
-
* metadata to keep things consistent. This means there are 2 possibly concurrent writers to maven-metadata.xml: the repository and the
45
-
* publisher. Hopefully, it's not too much of a problem in practice.
46
-
*
47
-
* See https://github.com/gradle/gradle/blob/d1ee068b1ee7f62ffcbb549352469307781af72e/platforms/software/maven/src/main/java/org/gradle/api/publish/maven/internal/publisher/MavenRemotePublisher.java#L70.
48
-
*/
49
-
val versionMetadataPath ="$gavPath/maven-metadata.xml"
50
-
val localVersionMetadataFile = gavFiles.firstOrNull {
51
-
it.normalizedPath == versionMetadataPath
52
-
}
53
-
val localVersionMetadata =if (localVersionMetadataFile !=null) {
val gavFiles = allFiles.filter { it.normalizedPath.startsWith(gavPath) }
60
+
61
+
/**
62
+
* This is a proper directory containing artifacts
63
+
*/
64
+
if (version.endsWith("-SNAPSHOT")) {
104
65
/**
105
-
* Update the [artifact metadata](https://maven.apache.org/repositories/metadata.html).
66
+
* This is a snapshot:
67
+
* - update the [version metadata](https://maven.apache.org/repositories/metadata.html).
68
+
* - patch the file names to include the new build number.
69
+
*
70
+
* See https://s01.oss.sonatype.org/content/repositories/snapshots/com/apollographql/apollo/apollo-api-jvm/maven-metadata.xml for an example.
106
71
*
107
-
* See https://repo1.maven.org/maven2/com/apollographql/apollo/apollo-api-jvm/maven-metadata.xml for an example.
72
+
* For snapshots, it's not 100% clear who owns the metadata as the repository might expire some snapshot and therefore need to rewrite the
73
+
* metadata to keep things consistent. This means there are 2 possibly concurrent writers to maven-metadata.xml: the repository and the
74
+
* publisher. Hopefully, it's not too much of a problem in practice.
75
+
*
76
+
* See https://github.com/gradle/gradle/blob/d1ee068b1ee7f62ffcbb549352469307781af72e/platforms/software/maven/src/main/java/org/gradle/api/publish/maven/internal/publisher/MavenRemotePublisher.java#L70.
* See https://github.com/gradle/gradle/blob/cb0c615fb8e3690971bb7f89ad80f58943360624/platforms/software/maven/src/main/java/org/gradle/api/publish/maven/internal/publisher/AbstractMavenPublisher.java#L116.
141
-
*/
142
-
val versions = existingVersions.toMutableList()
143
-
if (!versions.none { it == gav.version }) {
144
-
versions.add(gav.version)
145
-
}
146
-
val newArtifactMetadata = localArtifactMetadata.copy(
* See https://github.com/gradle/gradle/blob/cb0c615fb8e3690971bb7f89ad80f58943360624/platforms/software/maven/src/main/java/org/gradle/api/publish/maven/internal/publisher/AbstractMavenPublisher.java#L116.
170
+
*/
171
+
val versions = existingVersions.toMutableList()
172
+
if (!versions.none { it == gav.version }) {
173
+
versions.add(gav.version)
174
+
}
175
+
val newArtifactMetadata = localArtifactMetadata.copy(
0 commit comments