Skip to content

Commit 2337ef3

Browse files
committed
Prepare for publishing NuGet packages into Maven
1 parent 570efdc commit 2337ef3

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

build.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,12 @@
147147
</filterchain>
148148
</copy>
149149
</target>
150-
</project>
150+
151+
<target name="nuget-unpack">
152+
<exec dir="." executable="powershell.exe">
153+
<arg line="-ExecutionPolicy bypass" />
154+
<arg value="-Command" />
155+
<arg value="&amp; { &amp; '${home}/src/main/msbuild/NuGet-Unpack.ps1' '${build}/.nuget/packages.list' }" />
156+
</exec>
157+
</target>
158+
</project>

nuget.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<add key="gh-ikvmnet" value="https://nuget.pkg.github.com/ikvmnet/index.json" protocolVersion="3" />
88
</packageSources>
99
<packageSourceMapping>
10+
<packageSource key="MavenFailNuget">
11+
<package pattern="Cyberduck*" />
12+
</packageSource>
1013
<packageSource key="nuget.org">
1114
<package pattern="IKVM.ByteCode" />
1215
<package pattern="*" />

src/main/msbuild/NuGet-Unpack.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[CmdletBinding()]
2+
param (
3+
# Source path, where all .nupkgs are stored.
4+
[Parameter()]
5+
[string]
6+
$PackagesListPath
7+
)
8+
9+
if (-not (Test-Path -Path $PackagesListPath -PathType Leaf)) {
10+
return;
11+
}
12+
13+
$NugetParent = [System.IO.Path]::GetDirectoryName($PackagesListPath)
14+
$CachePath = "$NugetParent\cache"
15+
$PackagesPath = "$NugetParent\packages"
16+
17+
foreach ($line in Get-Content $PackagesListPath) {
18+
$line = $line.Trim()
19+
if ($line -notmatch "\s*(?<group>[^:]+):(?<artifact>[^:]+):(?<type>[^:]+):(?<version>[^:]+):(?<scope>[^:]+)$") {
20+
continue
21+
}
22+
23+
$artifact = $Matches["artifact"]
24+
$version = $Matches["version"]
25+
26+
$NupkgFile = "$CachePath\$artifact-$version.nupkg"
27+
$NupkgZip = "$CachePath\$artifact-$version.zip"
28+
$TargetDirectory = "$PackagesPath\$artifact\$version"
29+
Copy-Item $NupkgFile $NupkgZip
30+
Expand-Archive $NupkgZip $TargetDirectory -Force
31+
Remove-Item $NupkgZip
32+
Set-Content "$TargetDirectory\.nupkg.metadata" '{}'
33+
}

0 commit comments

Comments
 (0)