From 44cab89a0fc6c13d5093db680cd3d66a88c7b9a6 Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Thu, 29 Jun 2023 09:24:53 +0200 Subject: [PATCH 1/7] check if windows, then change command --- .../io/sentry/UploadSourceBundleMojo.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/sentry/UploadSourceBundleMojo.java b/src/main/java/io/sentry/UploadSourceBundleMojo.java index aefe45d..d822ee3 100644 --- a/src/main/java/io/sentry/UploadSourceBundleMojo.java +++ b/src/main/java/io/sentry/UploadSourceBundleMojo.java @@ -13,13 +13,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; +import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; import static org.twdata.maven.mojoexecutor.MojoExecutor.*; @@ -144,6 +145,16 @@ private void uploadSourceBundle(File sourceBundleTargetDir) throws MojoExecution } private void runSentryCli(String sentryCliCommand) throws MojoExecutionException { + boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("windows"); + + String executable = "/bin/sh"; + String cArg = "-c"; + + if(isWindows) { + executable = "cmd.exe"; + cArg = "/c"; + } + // TODO probably won't work on windows executeMojo( plugin( @@ -156,9 +167,9 @@ private void runSentryCli(String sentryCliCommand) throws MojoExecutionException element(name("target"), element(name("exec"), attributes( - attribute("executable", "/bin/sh") + attribute("executable", executable) ), - element(name("arg"), attributes(attribute("value", "-c"))), + element(name("arg"), attributes(attribute("value", cArg))), element(name("arg"), attributes(attribute("value", sentryCliExecutablePath + " " + sentryCliCommand))) ) ) From e75947810413bf2916081656b21f9e1f4111eb9b Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Thu, 29 Jun 2023 11:35:54 +0200 Subject: [PATCH 2/7] check for url and auth parameters in upload command --- src/main/java/io/sentry/UploadSourceBundleMojo.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/io/sentry/UploadSourceBundleMojo.java b/src/main/java/io/sentry/UploadSourceBundleMojo.java index d822ee3..14643dd 100644 --- a/src/main/java/io/sentry/UploadSourceBundleMojo.java +++ b/src/main/java/io/sentry/UploadSourceBundleMojo.java @@ -130,6 +130,13 @@ private void uploadSourceBundle(File sourceBundleTargetDir) throws MojoExecution command.add("--log-level=debug"); } + if (url != null) { + command.add("--url=" + url); + } + if (authToken != null) { + command.add("--auth-token=" + authToken); + } + command.add("debug-files"); command.add("upload"); command.add("--type=jvm"); From 979569f216f10dd96eda41efe6e1fdac4291c245 Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Thu, 29 Jun 2023 12:04:33 +0200 Subject: [PATCH 3/7] remove comment about this not working on windows --- src/main/java/io/sentry/UploadSourceBundleMojo.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/sentry/UploadSourceBundleMojo.java b/src/main/java/io/sentry/UploadSourceBundleMojo.java index 14643dd..a140c73 100644 --- a/src/main/java/io/sentry/UploadSourceBundleMojo.java +++ b/src/main/java/io/sentry/UploadSourceBundleMojo.java @@ -162,7 +162,6 @@ private void runSentryCli(String sentryCliCommand) throws MojoExecutionException cArg = "/c"; } - // TODO probably won't work on windows executeMojo( plugin( groupId("org.apache.maven.plugins"), From 06d4febfe16b05b82b1537ef536432bb09078b4b Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Thu, 29 Jun 2023 12:07:12 +0200 Subject: [PATCH 4/7] use shorthand for selecting windows cli arguments --- src/main/java/io/sentry/UploadSourceBundleMojo.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/sentry/UploadSourceBundleMojo.java b/src/main/java/io/sentry/UploadSourceBundleMojo.java index a140c73..8d138f5 100644 --- a/src/main/java/io/sentry/UploadSourceBundleMojo.java +++ b/src/main/java/io/sentry/UploadSourceBundleMojo.java @@ -154,13 +154,8 @@ private void uploadSourceBundle(File sourceBundleTargetDir) throws MojoExecution private void runSentryCli(String sentryCliCommand) throws MojoExecutionException { boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("windows"); - String executable = "/bin/sh"; - String cArg = "-c"; - - if(isWindows) { - executable = "cmd.exe"; - cArg = "/c"; - } + String executable = isWindows ? "cmd.exe" : "/bin/sh"; + String cArg = isWindows ? "/c" : "-c"; executeMojo( plugin( From 138d4f30b166e88ba31b73dc3926da6e5b19acb7 Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Thu, 29 Jun 2023 12:08:32 +0200 Subject: [PATCH 5/7] bump sentry sdk version of example --- examples/sentry-maven-plugin-example/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sentry-maven-plugin-example/pom.xml b/examples/sentry-maven-plugin-example/pom.xml index 81de0cd..8a17707 100644 --- a/examples/sentry-maven-plugin-example/pom.xml +++ b/examples/sentry-maven-plugin-example/pom.xml @@ -79,7 +79,7 @@ io.sentry sentry - 6.19.1-SNAPSHOT + 6.21.0 junit From 10a1bfc3a1eb4155ef00986614f99ae40f558963 Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Thu, 29 Jun 2023 12:23:48 +0200 Subject: [PATCH 6/7] add changelog, bump version of java sdk --- CHANGELOG.md | 10 ++++++++++ examples/sentry-maven-plugin-example/pom.xml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1359399..c936bd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## Unreleased + +### Features + +- Add support for building on Windows + +### Fixes + +- Also use `url` and `authToken` for upload command + ## 0.0.2 ### Features diff --git a/examples/sentry-maven-plugin-example/pom.xml b/examples/sentry-maven-plugin-example/pom.xml index 735b9fe..2ccf340 100644 --- a/examples/sentry-maven-plugin-example/pom.xml +++ b/examples/sentry-maven-plugin-example/pom.xml @@ -79,7 +79,7 @@ io.sentry sentry - 6.21.0 + 6.24.0 junit From 49fd3b055dcbfd7df5744e66cfcfb6963c215baa Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Thu, 29 Jun 2023 12:25:19 +0200 Subject: [PATCH 7/7] link PR --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c936bd6..760a4b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,11 @@ ### Features -- Add support for building on Windows +- Add support for building on Windows ([#7](https://github.com/getsentry/sentry-maven-plugin/pull/7)) ### Fixes -- Also use `url` and `authToken` for upload command +- Also use `url` and `authToken` for upload command ([#7](https://github.com/getsentry/sentry-maven-plugin/pull/7)) ## 0.0.2