Skip to content

Commit

Permalink
feat: use multiroot package settings
Browse files Browse the repository at this point in the history
  • Loading branch information
DenKoren committed Aug 29, 2024
1 parent 1922637 commit f64b374
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 83 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 48 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{
"name": "@milaboratory/small-binaries",
"version": "1.7.2",
"version": "1.7.3",
"description": "Small cross-platform binaries, like 'sleep' or 'hello-world', suitable for test needs",
"scripts": {
"cleanup": "rm -rf ./pkg-*.tgz && rm -rf ./build/ && rm -rf ./dist/",
"build": "true",
"build": "npm run pkg:build",

"pkg:build": "./scripts/build.sh",
"release:packages": "./scripts/publish.sh",
"release:descriptors": "pl-pkg publish descriptors",
"release": "npm run pkg:build && npm run release:packages && npm run release:descriptors"
"pkg:sign": "pl-pkg sign --all-platforms --sign-util='gcloud-kms-sign'",
"pkg:publish": "pl-pkg publish packages --all-platforms",
"pkg:release": "npm run pkg:build && npm run pkg:sign && npm run pkg:publish",

"descriptors:build": "pl-pkg build descriptors",
"descriptors:publish": "pl-pkg publish descriptors",
"descriptors:release": "npm run descriptors:build && npm run descriptors:publish",

"release": "npm run pkg:release && npm run descriptors:release"
},
"block-software": {
"packages": {
Expand All @@ -17,7 +24,13 @@
"registry": { "name": "milaboratories" },
"name": "common/hello-world",
"version": "1.6.3",
"root": "./nonexistent/",
"roots": {
"linux-x64": "./build/linux-x64/hello-world",
"linux-aarch64": "./build/linux-aarch64/hello-world",
"macosx-x64": "./build/macosx-x64/hello-world",
"macosx-aarch64": "./build/macosx-aarch64/hello-world",
"windows-x64": "./build/windows-x64/hello-world"
},
"entrypoints": {
"hello-world": { "cmd": [ "{pkg}/main" ] }
}
Expand All @@ -28,7 +41,13 @@
"registry": { "name": "milaboratories" },
"name": "common/sleep",
"version": "1.6.3",
"root": "./nonexistent/",
"roots": {
"linux-x64": "./build/linux-x64/sleep",
"linux-aarch64": "./build/linux-aarch64/sleep",
"macosx-x64": "./build/macosx-x64/sleep",
"macosx-aarch64": "./build/macosx-aarch64/sleep",
"windows-x64": "./build/windows-x64/sleep"
},
"entrypoints": {
"sleep": { "cmd": [ "{pkg}/main" ] }
}
Expand All @@ -39,7 +58,13 @@
"registry": { "name": "milaboratories" },
"name": "common/guided-command",
"version": "1.6.3",
"root": "./nonexistent/",
"roots": {
"linux-x64": "./build/linux-x64/guided-command",
"linux-aarch64": "./build/linux-aarch64/guided-command",
"macosx-x64": "./build/macosx-x64/guided-command",
"macosx-aarch64": "./build/macosx-aarch64/guided-command",
"windows-x64": "./build/windows-x64/guided-command"
},
"entrypoints": {
"guided-command": { "cmd": [ "{pkg}/main" ] }
}
Expand All @@ -50,7 +75,13 @@
"registry": { "name": "milaboratories" },
"name": "common/read-file-to-stdout-with-sleep",
"version": "1.6.3",
"root": "./nonexistent/",
"roots": {
"linux-x64": "./build/linux-x64/read-file-to-stdout-with-sleep",
"linux-aarch64": "./build/linux-aarch64/read-file-to-stdout-with-sleep",
"macosx-x64": "./build/macosx-x64/read-file-to-stdout-with-sleep",
"macosx-aarch64": "./build/macosx-aarch64/read-file-to-stdout-with-sleep",
"windows-x64": "./build/windows-x64/read-file-to-stdout-with-sleep"
},
"entrypoints": {
"read-file-to-stdout-with-sleep": { "cmd": [ "{pkg}/main" ] }
}
Expand All @@ -62,7 +93,13 @@
"name": "common/runenv-java-stub",
"version": "1.0.1",
"type": "java",
"root": "./nonexistent/",
"roots": {
"linux-x64": "./build/linux-x64/runenv-java-stub",
"linux-aarch64": "./build/linux-aarch64/runenv-java-stub",
"macosx-x64": "./build/macosx-x64/runenv-java-stub",
"macosx-aarch64": "./build/macosx-aarch64/runenv-java-stub",
"windows-x64": "./build/windows-x64/runenv-java-stub"
},
"binDir": ".",
"entrypointName": "runenv-java-stub"
}
Expand All @@ -74,6 +111,6 @@
],
"license": "UNLICENSED",
"devDependencies": {
"@milaboratory/pl-package-builder": "^2.4.0"
"@milaboratory/pl-package-builder": "^2.6.1"
}
}
8 changes: 0 additions & 8 deletions pl.package.yaml

This file was deleted.

20 changes: 5 additions & 15 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,13 @@ build_binary() {
local _arch_reg="${5}"
local _ext="${6:-}"

local _group="${_os_go}-${_arch_go}"
local _platform="${_os_reg}-${_arch_reg}"

printf "## os='%s', arch='%s':\n" "${_os_go}" "${_arch_go}"

env GOOS="${_os_go}" GOARCH="${_arch_go}" \
go build \
-o "${BUILD_DIR}/${_group}/${_bin_name}/main${_ext}" \
-o "${BUILD_DIR}/${_platform}/${_bin_name}/main${_ext}" \
"./${_bin_name}.go"
printf "\n"

pl-pkg build packages \
--package-id="${_bin_name}" \
--os="${_os_reg}" \
--arch="${_arch_reg}" \
--content-root="${BUILD_DIR}/${_group}/${_bin_name}/"
printf "\n"
}

build_binaries() {
Expand All @@ -45,7 +36,7 @@ build_binaries() {
# amd64 -> x64
# arm64 -> aarch64

printf "\n# Building '%s'...\n\n" "${_bin_name}"
printf "\n# Building '%s'...\n" "${_bin_name}"

build_binary "${_bin_name}" "windows" "amd64" "windows" "x64" ".exe"

Expand All @@ -54,9 +45,6 @@ build_binaries() {

build_binary "${_bin_name}" "darwin" "amd64" "macosx" "x64"
build_binary "${_bin_name}" "darwin" "arm64" "macosx" "aarch64"

pl-pkg build descriptors \
--package-id="${_bin_name}"
}

rm -rf "${script_dir}/${BUILD_DIR}"
Expand All @@ -67,6 +55,8 @@ build_binaries "guided-command"
build_binaries "sleep"
build_binaries "read-file-to-stdout-with-sleep"

pl-pkg build packages --all-platforms

echo ""
echo "All binaries are saved to '$(pwd)/${BUILD_DIR}'"
echo "All packages are saved to '$(pwd)/pkg-*.tgz' archives"
Expand Down
43 changes: 0 additions & 43 deletions scripts/publish.sh

This file was deleted.

0 comments on commit f64b374

Please sign in to comment.