mirror of
https://github.com/moby/moby.git
synced 2026-01-10 18:21:35 +00:00
cmd: fix winresources and move them out cli package
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
|
||||
# build artifacts
|
||||
/bundles/
|
||||
/cli/winresources/dockerd/winres.json
|
||||
/cli/winresources/dockerd/*.syso
|
||||
/cmd/dockerd/winresources/winres.json
|
||||
/cmd/dockerd/*.syso
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -15,8 +15,8 @@ thumbs.db
|
||||
|
||||
# build artifacts
|
||||
/bundles/
|
||||
/cli/winresources/dockerd/*.syso
|
||||
/cli/winresources/dockerd/winres.json
|
||||
/cmd/dockerd/winresources/winres.json
|
||||
/cmd/dockerd/*.syso
|
||||
|
||||
# ci artifacts
|
||||
*.exe
|
||||
|
||||
@@ -579,7 +579,6 @@ RUN <<EOT
|
||||
fi
|
||||
EOT
|
||||
RUN --mount=type=bind,target=.,rw \
|
||||
--mount=type=tmpfs,target=cli/winresources/dockerd \
|
||||
--mount=type=cache,target=/root/.cache/go-build,id=moby-build-$TARGETPLATFORM <<EOT
|
||||
set -e
|
||||
target=$([ "$DOCKER_STATIC" = "1" ] && echo "binary" || echo "dynbinary")
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
package builtins
|
||||
@@ -1,5 +0,0 @@
|
||||
//go:generate go-winres make --arch=386,amd64,arm,arm64 --in=../../../cli/winresources/dockerd/winres.json --out=../../../cli/winresources/dockerd/resource
|
||||
|
||||
package builtins
|
||||
|
||||
import _ "github.com/docker/docker/cli/winresources/dockerd"
|
||||
@@ -11,8 +11,6 @@ import (
|
||||
"github.com/moby/term"
|
||||
|
||||
"github.com/docker/docker/daemon/command"
|
||||
|
||||
_ "github.com/docker/docker/cmd/dockerd/builtins"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
5
cmd/dockerd/main_windows.go
Normal file
5
cmd/dockerd/main_windows.go
Normal file
@@ -0,0 +1,5 @@
|
||||
//go:generate go-winres make --arch=386,amd64,arm,arm64 --in=./winresources/winres.json --out=./resource
|
||||
|
||||
package main
|
||||
|
||||
import _ "github.com/docker/docker/cmd/dockerd/winresources"
|
||||
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
@@ -7,6 +7,6 @@
|
||||
// * Events message table
|
||||
//
|
||||
// The resource object files are generated when building with go-winres
|
||||
// in hack/make/.go-autogen and are located in cli/winresources.
|
||||
// This occurs automatically when you cross build against Windows OS.
|
||||
// in hack/make/.go-autogen. This occurs automatically when you cross build
|
||||
// against Windows OS.
|
||||
package winresources
|
||||
@@ -72,7 +72,7 @@ try {
|
||||
$mkwinresContents = '{
|
||||
"RT_GROUP_ICON": {
|
||||
"#1": {
|
||||
"0409": "../../winresources/docker.ico"
|
||||
"0409": "docker.ico"
|
||||
}
|
||||
},
|
||||
"RT_MANIFEST": {
|
||||
@@ -99,7 +99,7 @@ try {
|
||||
},
|
||||
"RT_MESSAGETABLE": {
|
||||
"#1": {
|
||||
"0409": "../../winresources/event_messages.bin"
|
||||
"0409": "event_messages.bin"
|
||||
}
|
||||
},
|
||||
"RT_VERSION": {
|
||||
@@ -127,17 +127,11 @@ try {
|
||||
}'
|
||||
|
||||
# Write the file
|
||||
$outputFile="$(Get-Location)\cli\winresources\dockerd\winres.json"
|
||||
$outputFile="$(Get-Location)\cmd\dockerd\winresources\winres.json"
|
||||
if (Test-Path $outputFile) { Remove-Item $outputFile }
|
||||
[System.IO.File]::WriteAllText($outputFile, $mkwinresContents)
|
||||
Get-Content $outputFile | Out-Host
|
||||
|
||||
# Create winresources package stub if removed while using tmpfs in Dockerfile
|
||||
$stubPackage="$(Get-Location)\cli\winresources\dockerd\winresources.go"
|
||||
if(![System.IO.File]::Exists($stubPackage)){
|
||||
Set-Content -NoNewline -Path $stubPackage -Value 'package winresources'
|
||||
}
|
||||
|
||||
# Generate
|
||||
go generate -v "github.com/docker/docker/cmd/dockerd"
|
||||
if ($LASTEXITCODE -ne 0) { Throw "Failed to generate version info" }
|
||||
|
||||
@@ -16,11 +16,11 @@ VERSION_QUAD=$(printf "%s" "$VERSION" | sed -re 's/^([0-9.]*).*$/\1/' | sed -re
|
||||
# Microsoft Windows Version Information and an icon using go-winres.
|
||||
# https://docs.microsoft.com/en-us/windows/win32/menurc/stringfileinfo-block
|
||||
# https://github.com/tc-hib/go-winres#json-format
|
||||
cat > "./cli/winresources/${BINARY_NAME}/winres.json" << EOL
|
||||
cat > "./cmd/${BINARY_NAME}/winresources/winres.json" << EOL
|
||||
{
|
||||
"RT_GROUP_ICON": {
|
||||
"#1": {
|
||||
"0409": "../../winresources/docker.ico"
|
||||
"0409": "docker.ico"
|
||||
}
|
||||
},
|
||||
"RT_MANIFEST": {
|
||||
@@ -47,7 +47,7 @@ cat > "./cli/winresources/${BINARY_NAME}/winres.json" << EOL
|
||||
},
|
||||
"RT_MESSAGETABLE": {
|
||||
"#1": {
|
||||
"0409": "../../winresources/event_messages.bin"
|
||||
"0409": "event_messages.bin"
|
||||
}
|
||||
},
|
||||
"RT_VERSION": {
|
||||
@@ -76,10 +76,5 @@ cat > "./cli/winresources/${BINARY_NAME}/winres.json" << EOL
|
||||
EOL
|
||||
(
|
||||
set -x
|
||||
cat "./cli/winresources/${BINARY_NAME}/winres.json"
|
||||
cat "./cmd/${BINARY_NAME}/winresources/winres.json"
|
||||
)
|
||||
|
||||
# Create winresources package stub if removed while using tmpfs in Dockerfile
|
||||
if [ ! -f "./cli/winresources/${BINARY_NAME}/winresources.go" ]; then
|
||||
echo "package winresources" > "./cli/winresources/${BINARY_NAME}/winresources.go"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user