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

create: add --go-mod option #6475

Merged
merged 3 commits into from
Sep 24, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion Library/Homebrew/dev-cmd/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def create_args
description: "Create a basic template for an Autotools-style build."
switch "--cmake",
description: "Create a basic template for a CMake-style build."
switch "--go",
description: "Create a basic template for a Go build."
switch "--meson",
description: "Create a basic template for a Meson-style build."
switch "--no-fetch",
Expand All @@ -40,7 +42,7 @@ def create_args
switch :force
switch :verbose
switch :debug
conflicts "--autotools", "--cmake", "--meson"
conflicts "--autotools", "--cmake", "--go", "--meson"
end
end

Expand Down Expand Up @@ -73,6 +75,8 @@ def create
:autotools
elsif args.meson?
:meson
elsif args.go?
:go
end

if fc.name.nil? || fc.name.strip.empty?
Expand Down
6 changes: 5 additions & 1 deletion Library/Homebrew/formula_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class #{Formulary.class_s(name)} < Formula

<% if mode == :cmake %>
depends_on "cmake" => :build
<% elsif mode == :go %>
depends_on "go" => :build
<% elsif mode == :meson %>
depends_on "meson" => :build
depends_on "ninja" => :build
Expand All @@ -116,6 +118,8 @@ def install
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=\#{prefix}"
<% elsif mode == :go %>
system "go", "build", "-o", "\#{bin}/\#{name}"
<% elsif mode == :meson %>
mkdir "build" do
system "meson", "--prefix=\#{prefix}", ".."
Expand All @@ -130,7 +134,7 @@ def install
"--prefix=\#{prefix}"
# system "cmake", ".", *std_cmake_args
<% end %>
<% if mode != :meson %>
<% if mode != :meson and mode != :go %>
system "make", "install" # if this fails, try separate make/make install steps
<% end %>
end
Expand Down
2 changes: 2 additions & 0 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ a simple example. For the complete API, see:
Create a basic template for an Autotools-style build.
* `--cmake`:
Create a basic template for a CMake-style build.
* `--go`:
Create a basic template for a Go build.
* `--meson`:
Create a basic template for a Meson-style build.
* `--no-fetch`:
Expand Down
4 changes: 4 additions & 0 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,10 @@ Create a basic template for an Autotools\-style build\.
Create a basic template for a CMake\-style build\.
.
.TP
\fB\-\-go\fR
Create a basic template for a Go build\.
.
.TP
\fB\-\-meson\fR
Create a basic template for a Meson\-style build\.
.
Expand Down