Skip to content

Commit 75a25e6

Browse files
committed
Use static NuGet version for local builds, remove local-feed copy
Local builds now use a static `-snapshot` suffix instead of a timestamp, making the version cacheable across rebuilds. CI builds retain the timestamped suffix. Also removes the local-feed copy from csharpPublishLocal since the global cache install is sufficient.
1 parent 4c5ec0c commit 75a25e6

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

rewrite-csharp/build.gradle.kts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,14 @@ tasks.withType<Test> {
121121
// Generate a NuGet-compatible version
122122
// Snapshots use pre-release suffix with timestamp: 8.73.0-snapshot.20260110143252
123123
// Releases use clean version: 8.73.0
124-
val nugetVersion: String = project.version.toString().replace(
125-
"-SNAPSHOT",
126-
"-snapshot.${LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))}"
127-
)
124+
val nugetVersion: String = if (System.getenv("CI") != null) {
125+
project.version.toString().replace(
126+
"-SNAPSHOT",
127+
"-snapshot.${LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))}"
128+
)
129+
} else {
130+
project.version.toString().replace("-SNAPSHOT", "-snapshot")
131+
}
128132

129133
val generateVersionTxt by tasks.registering {
130134
group = "csharp"
@@ -278,16 +282,6 @@ val csharpPublishLocal by tasks.registering {
278282
logger.lifecycle(addOutput)
279283
}
280284

281-
// Also copy to local-feed for cross-repo consumption
282-
val localFeed = file("${System.getProperty("user.home")}/.nuget/local-feed")
283-
localFeed.mkdirs()
284-
csharpDir.resolve("dist").listFiles()
285-
?.filter { it.name.endsWith(".nupkg") }
286-
?.forEach { nupkg ->
287-
val target = localFeed.resolve(nupkg.name)
288-
nupkg.copyTo(target, overwrite = true)
289-
logger.lifecycle("Published ${nupkg.name} to ${localFeed.absolutePath}")
290-
}
291285
}
292286
}
293287

0 commit comments

Comments
 (0)