diff --git a/.github/workflows/plugin-cli-release.yml b/.github/workflows/plugin-cli-release.yml index a6b5ee26b4..180c66df8b 100644 --- a/.github/workflows/plugin-cli-release.yml +++ b/.github/workflows/plugin-cli-release.yml @@ -7,9 +7,9 @@ on: workflow_dispatch: inputs: version: - description: "Plugin CLI version to publish, for example 0.1.5" + description: "Plugin CLI version to publish, for example 0.1.6" required: true - default: "0.1.5" + default: "0.1.6" npm-tag: description: "npm distribution tag" required: true diff --git a/packages/plugin-cli-darwin-arm64/package.json b/packages/plugin-cli-darwin-arm64/package.json index 119c3e92ce..a5403c1914 100644 --- a/packages/plugin-cli-darwin-arm64/package.json +++ b/packages/plugin-cli-darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@dbx-app/plugin-cli-darwin-arm64", - "version": "0.1.5", + "version": "0.1.6", "description": "Precompiled DBX Plugin CLI binary for darwin arm64", "license": "Apache-2.0", "repository": { diff --git a/packages/plugin-cli-darwin-x64/package.json b/packages/plugin-cli-darwin-x64/package.json index c711c759b9..eca2cd3a59 100644 --- a/packages/plugin-cli-darwin-x64/package.json +++ b/packages/plugin-cli-darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@dbx-app/plugin-cli-darwin-x64", - "version": "0.1.5", + "version": "0.1.6", "description": "Precompiled DBX Plugin CLI binary for darwin x64", "license": "Apache-2.0", "repository": { diff --git a/packages/plugin-cli-linux-arm64-gnu/package.json b/packages/plugin-cli-linux-arm64-gnu/package.json index dbc77917de..c6d06afd61 100644 --- a/packages/plugin-cli-linux-arm64-gnu/package.json +++ b/packages/plugin-cli-linux-arm64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@dbx-app/plugin-cli-linux-arm64-gnu", - "version": "0.1.5", + "version": "0.1.6", "description": "Precompiled DBX Plugin CLI binary for linux arm64", "license": "Apache-2.0", "repository": { diff --git a/packages/plugin-cli-linux-x64-gnu/package.json b/packages/plugin-cli-linux-x64-gnu/package.json index 1d2ceada68..ac1736a61a 100644 --- a/packages/plugin-cli-linux-x64-gnu/package.json +++ b/packages/plugin-cli-linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@dbx-app/plugin-cli-linux-x64-gnu", - "version": "0.1.5", + "version": "0.1.6", "description": "Precompiled DBX Plugin CLI binary for linux x64", "license": "Apache-2.0", "repository": { diff --git a/packages/plugin-cli-win32-arm64/package.json b/packages/plugin-cli-win32-arm64/package.json index 6b954862c9..658bfa3518 100644 --- a/packages/plugin-cli-win32-arm64/package.json +++ b/packages/plugin-cli-win32-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@dbx-app/plugin-cli-win32-arm64", - "version": "0.1.5", + "version": "0.1.6", "description": "Precompiled DBX Plugin CLI binary for win32 arm64", "license": "Apache-2.0", "repository": { diff --git a/packages/plugin-cli-win32-x64/package.json b/packages/plugin-cli-win32-x64/package.json index 2f4288323a..c419b2108a 100644 --- a/packages/plugin-cli-win32-x64/package.json +++ b/packages/plugin-cli-win32-x64/package.json @@ -1,6 +1,6 @@ { "name": "@dbx-app/plugin-cli-win32-x64", - "version": "0.1.5", + "version": "0.1.6", "description": "Precompiled DBX Plugin CLI binary for win32 x64", "license": "Apache-2.0", "repository": { diff --git a/packages/plugin-cli/package.json b/packages/plugin-cli/package.json index d458aca809..6082e824fe 100644 --- a/packages/plugin-cli/package.json +++ b/packages/plugin-cli/package.json @@ -1,6 +1,6 @@ { "name": "@dbx-app/plugin-cli", - "version": "0.1.5", + "version": "0.1.6", "description": "Create and package DBX plugins without compiling the DBX plugin CLI", "keywords": [ "cli", @@ -34,12 +34,12 @@ "prepublishOnly": "npm run build && npm test" }, "optionalDependencies": { - "@dbx-app/plugin-cli-darwin-arm64": "0.1.5", - "@dbx-app/plugin-cli-darwin-x64": "0.1.5", - "@dbx-app/plugin-cli-linux-arm64-gnu": "0.1.5", - "@dbx-app/plugin-cli-linux-x64-gnu": "0.1.5", - "@dbx-app/plugin-cli-win32-arm64": "0.1.5", - "@dbx-app/plugin-cli-win32-x64": "0.1.5" + "@dbx-app/plugin-cli-darwin-arm64": "0.1.6", + "@dbx-app/plugin-cli-darwin-x64": "0.1.6", + "@dbx-app/plugin-cli-linux-arm64-gnu": "0.1.6", + "@dbx-app/plugin-cli-linux-x64-gnu": "0.1.6", + "@dbx-app/plugin-cli-win32-arm64": "0.1.6", + "@dbx-app/plugin-cli-win32-x64": "0.1.6" }, "engines": { "node": ">=18.18.0" diff --git a/plugins/sdk/cli/Cargo.lock b/plugins/sdk/cli/Cargo.lock index 6a5fad5ad5..47d6da7484 100644 --- a/plugins/sdk/cli/Cargo.lock +++ b/plugins/sdk/cli/Cargo.lock @@ -119,7 +119,7 @@ dependencies = [ [[package]] name = "dbx-plugin-cli" -version = "0.1.5" +version = "0.1.6" dependencies = [ "dbx-plugin-packager", "semver", diff --git a/plugins/sdk/cli/Cargo.toml b/plugins/sdk/cli/Cargo.toml index 11ea28e1b6..4a2340b18d 100644 --- a/plugins/sdk/cli/Cargo.toml +++ b/plugins/sdk/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dbx-plugin-cli" -version = "0.1.5" +version = "0.1.6" edition = "2021" license = "Apache-2.0" description = "Scaffold and package DBX plugins" diff --git a/plugins/sdk/cli/src/lib.rs b/plugins/sdk/cli/src/lib.rs index f5e1ac16cf..5421785124 100644 --- a/plugins/sdk/cli/src/lib.rs +++ b/plugins/sdk/cli/src/lib.rs @@ -1139,25 +1139,34 @@ fn build_go_backend( return Err(format!("Go backend is missing {}/go.mod", backend_directory.display())); } let mut command = Command::new("go"); - command.current_dir(&backend_directory).arg("build").arg("-trimpath").arg("-o").arg(staged_executable).arg("."); + command.current_dir(&backend_directory).arg("build").arg("-trimpath"); if let Some(sdk_root) = sdk_root_from_environment()? { let sdk = sdk_root.join("plugins/sdk/go/dbx-plugin-sdk"); if !sdk.join("go.mod").is_file() { return Err(format!("Go plugin SDK was not found at {}", sdk.display())); } fs::create_dir_all(build_directory).map_err(|error| error.to_string())?; - let work_file = build_directory.join("go.work"); - fs::write( - &work_file, - format!( - "go 1.22\n\nuse (\n\t{}\n\t{}\n)\n", - serde_json::to_string(&go_work_path(&backend_directory)).map_err(|error| error.to_string())?, - serde_json::to_string(&go_work_path(&sdk)).map_err(|error| error.to_string())? - ), - ) - .map_err(|error| error.to_string())?; - command.env("GOWORK", work_file); + let mod_file = build_directory.join("go.mod"); + fs::copy(backend_directory.join("go.mod"), &mod_file).map_err(|error| error.to_string())?; + let source_sum = backend_directory.join("go.sum"); + if source_sum.is_file() { + fs::copy(source_sum, build_directory.join("go.sum")).map_err(|error| error.to_string())?; + } + let mut replace = Command::new("go"); + replace + .current_dir(&backend_directory) + .arg("mod") + .arg("edit") + .arg("-modfile") + .arg(&mod_file) + .arg(format!( + "-replace=github.com/t8y2/dbx/plugins/sdk/go/dbx-plugin-sdk={}", + go_work_path(&sdk) + )); + run_command(&mut replace, "Go module setup")?; + command.env("GOWORK", "off").arg("-modfile").arg(&mod_file); } + command.arg("-o").arg(staged_executable).arg("."); run_command(&mut command, "Go backend build") } @@ -1834,7 +1843,7 @@ mod tests { let workflow = std::fs::read_to_string(directory.join(".github/workflows/plugin-release.yml")).unwrap(); assert!(!workflow.contains("signing-key-id")); assert!(!workflow.contains("DBX_PLUGIN_SIGNING_KEY")); - assert!(workflow.contains("plugin-cli-version: 0.1.5")); + assert!(workflow.contains("plugin-cli-version: 0.1.6")); assert!(!workflow.contains("sdk-ref:")); match template { diff --git a/plugins/sdk/cli/templates/common/github/plugin-release.yml b/plugins/sdk/cli/templates/common/github/plugin-release.yml index 13b2442062..ba07620ddd 100644 --- a/plugins/sdk/cli/templates/common/github/plugin-release.yml +++ b/plugins/sdk/cli/templates/common/github/plugin-release.yml @@ -15,4 +15,4 @@ jobs: package-command: dbx-plugin package . package-path: dist/*.dbxp metadata-path: dist/*.artifact.json - plugin-cli-version: 0.1.5 + plugin-cli-version: 0.1.6 diff --git a/plugins/sdk/cli/templates/frontend/github/plugin-release.yml b/plugins/sdk/cli/templates/frontend/github/plugin-release.yml index 05c3b78915..ce8cb7990e 100644 --- a/plugins/sdk/cli/templates/frontend/github/plugin-release.yml +++ b/plugins/sdk/cli/templates/frontend/github/plugin-release.yml @@ -15,5 +15,5 @@ jobs: package-command: dbx-plugin package . package-path: dist/*.dbxp metadata-path: dist/*.artifact.json - plugin-cli-version: 0.1.5 + plugin-cli-version: 0.1.6 build-matrix: '{"include":[{"runner":"ubuntu-24.04","target":"universal"}]}' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6725deeaa5..ed0c528e27 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -356,22 +356,22 @@ importers: packages/plugin-cli: optionalDependencies: '@dbx-app/plugin-cli-darwin-arm64': - specifier: 0.1.5 + specifier: 0.1.6 version: link:../plugin-cli-darwin-arm64 '@dbx-app/plugin-cli-darwin-x64': - specifier: 0.1.5 + specifier: 0.1.6 version: link:../plugin-cli-darwin-x64 '@dbx-app/plugin-cli-linux-arm64-gnu': - specifier: 0.1.5 + specifier: 0.1.6 version: link:../plugin-cli-linux-arm64-gnu '@dbx-app/plugin-cli-linux-x64-gnu': - specifier: 0.1.5 + specifier: 0.1.6 version: link:../plugin-cli-linux-x64-gnu '@dbx-app/plugin-cli-win32-arm64': - specifier: 0.1.5 + specifier: 0.1.6 version: link:../plugin-cli-win32-arm64 '@dbx-app/plugin-cli-win32-x64': - specifier: 0.1.5 + specifier: 0.1.6 version: link:../plugin-cli-win32-x64 packages/plugin-cli-darwin-arm64: {}