@@ -2,6 +2,7 @@ package nmcp.transport
22
33import gratatouille.tasks.FileWithPath
44import gratatouille.tasks.GInputFiles
5+ import java.io.File
56import java.security.MessageDigest
67import java.time.Instant
78import java.time.ZoneOffset
@@ -28,6 +29,27 @@ fun publishFileByFile(
2829 return publishFileByFile(transport, inputFiles, defaultParallelism)
2930}
3031
32+ /* *
33+ * Publishes to a local repository.
34+ *
35+ * [publishFileByFile] computes the group and version maven-metadata.xml files.
36+ *
37+ * @param from a directory containing the files to publish as a m2 layout without maven-metadata.xml.
38+ * @param into the destination directory.
39+ */
40+ fun publishFileByFile (
41+ from : File ,
42+ into : File ,
43+ ) {
44+ return publishFileByFile(
45+ FilesystemTransport (into.absolutePath),
46+ from.walk().filter { it.isFile }.map {
47+ FileWithPath (it, it.relativeTo(from).path)
48+ }.toList(),
49+ defaultParallelism,
50+ )
51+ }
52+
3153fun publishFileByFile (
3254 transport : Transport ,
3355 inputFiles : GInputFiles ,
@@ -93,7 +115,8 @@ private fun publishGav(
93115 return @forEach
94116 }
95117 val artifact = Artifact .from(it.file.name, gav.artifactId, gav.baseVersion)
96- val newVersion = " ${gav.baseVersion.removeSuffix(" -SNAPSHOT" )} -${lastUpdated.asTimestamp(true )} -$buildNumber "
118+ val newVersion =
119+ " ${gav.baseVersion.removeSuffix(" -SNAPSHOT" )} -${lastUpdated.asTimestamp(true )} -$buildNumber "
97120 val newArtifact = artifact.copy(version = newVersion)
98121 val newName = newArtifact.fileName()
99122 renamedFiles.add(FileWithPath (it.file, " $gavPath /${newName} " ))
0 commit comments