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

Grant execute permissions for protoc-gen-doc on Linux/Mac OS #879

Merged
merged 1 commit into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion src/main/java/com/ly/doc/model/grpc/ProtoInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.ly.doc.constants.DocGlobalConstants;

import java.io.Serializable;
import java.util.logging.Logger;

/**
* proto info.
Expand All @@ -31,6 +32,8 @@
*/
public class ProtoInfo implements Serializable {

private static final Logger log = Logger.getLogger(ProtoInfo.class.getName());

private static final long serialVersionUID = 4962891140273167418L;

/**
Expand Down Expand Up @@ -84,6 +87,8 @@ private ProtoInfo() {
String os = System.getProperty("os.name").toLowerCase();
String arch = System.getProperty("os.arch").toLowerCase();

log.info("The os.name is:" + os + "and os.arch is: " + arch);

this.setTargetJsonDirectoryPath(targetJsonPath);
this.setJsonName("combined.json");
this.setTargetJsonFilePath(targetJsonPath + this.getJsonName());
Expand All @@ -93,7 +98,7 @@ private ProtoInfo() {
this.setSourcePaths("/protoc/win/protoc.exe", "/protoc/win/protoc-gen-doc.exe");
}
else if (os.contains("mac")) {
if (arch.contains("arm")) {
if (arch.contains("arm") || arch.contains("aarch")) {
this.setSourcePaths("/protoc/mac/arm/protoc", "/protoc/mac/arm/protoc-gen-doc");
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private void executeCommand(List<String> command, ProtoInfo protoInfo) {
// Grant execute permissions
Files.setPosixFilePermissions(Paths.get(protoInfo.getProtocPath()),
PosixFilePermissions.fromString("rwxr-xr-x"));
Files.setPosixFilePermissions(Paths.get(protoInfo.getProtocPath()),
Files.setPosixFilePermissions(Paths.get(protoInfo.getProtocGenDocPath()),
PosixFilePermissions.fromString("rwxr-xr-x"));
}
}
Expand Down