Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Support for Maven Plugin #7

Merged
merged 8 commits into from
Jun 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## Unreleased

### Features

- 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 ([#7](https://github.com/getsentry/sentry-maven-plugin/pull/7))

## 0.0.2

### Features
2 changes: 1 addition & 1 deletion examples/sentry-maven-plugin-example/pom.xml
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
<version>6.19.1-SNAPSHOT</version>
<version>6.24.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
24 changes: 18 additions & 6 deletions src/main/java/io/sentry/UploadSourceBundleMojo.java
Original file line number Diff line number Diff line change
@@ -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.*;

@@ -129,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");
@@ -144,7 +152,11 @@ private void uploadSourceBundle(File sourceBundleTargetDir) throws MojoExecution
}

private void runSentryCli(String sentryCliCommand) throws MojoExecutionException {
// TODO probably won't work on windows
boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("windows");

String executable = isWindows ? "cmd.exe" : "/bin/sh";
String cArg = isWindows ? "/c" : "-c";

executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
@@ -156,9 +168,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)))
)
)