-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(main): support modifying built platforms
Bakelite now accepts a platform modification string vita the -platform flag. This string format for adding and removing the built platforms, including removing the default platforms entirely. It is processed left to right. bakelite -platform '-windows +linux/s390x' [packages] Would now build [packages] for all of the default platforms, except for Windows, and also build for the linux/s390x platform. bakelite -platform '- +linux +darwin' [packages] Would now build [packages] for the default platforms of only the Linux and Darwin operating systems. The platform modification string is parsed and turned into calls to a structure following the builder pattern. As the user can now modify the built platforms, Bakelite now exits with a non-zero exit code if any of the platforms fail to build. Change-Id: Iade51e17bbfda4e916394343a5f8cb3208f2b160
- Loading branch information
1 parent
4dabf65
commit 8e0f32e
Showing
5 changed files
with
527 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
"github.com/google/go-cmp/cmp/cmpopts" | ||
) | ||
|
||
func TestParsePlatforms(t *testing.T) { | ||
fields := []string{"+windows", "+plan9", "-windows/386"} | ||
plb, _ := NewPlatformBuilder() | ||
|
||
plb = parsePlatforms(plb, fields) | ||
|
||
pl := plb.Build() | ||
expected := []Platform{ | ||
{OS("windows"), Arch("amd64")}, | ||
{OS("plan9"), Arch("386")}, | ||
{OS("plan9"), Arch("amd64")}, | ||
} | ||
|
||
if diff := cmp.Diff(expected, pl, cmpopts.SortSlices(lessPlatforms)); diff != "" { | ||
t.Errorf("manifest differs. (-got +want):\n%s", diff) | ||
} | ||
} | ||
|
||
func TestParsePlatformsRemoveOS(t *testing.T) { | ||
fields := []string{"+windows", "+plan9", "-windows"} | ||
plb, _ := NewPlatformBuilder() | ||
|
||
plb = parsePlatforms(plb, fields) | ||
|
||
pl := plb.Build() | ||
expected := []Platform{ | ||
{OS("plan9"), Arch("386")}, | ||
{OS("plan9"), Arch("amd64")}, | ||
} | ||
|
||
if diff := cmp.Diff(expected, pl, cmpopts.SortSlices(lessPlatforms)); diff != "" { | ||
t.Errorf("manifest differs. (-got +want):\n%s", diff) | ||
} | ||
} | ||
func TestParsePlatformRemoveNothing(t *testing.T) { | ||
fields := []string{"+windows", "-"} | ||
plb, _ := NewPlatformBuilder() | ||
|
||
plb = parsePlatforms(plb, fields) | ||
|
||
pl := plb.Build() | ||
expected := []Platform{ | ||
{OS("windows"), Arch("amd64")}, | ||
{OS("windows"), Arch("386")}, | ||
} | ||
|
||
if diff := cmp.Diff(expected, pl, cmpopts.SortSlices(lessPlatforms)); diff != "" { | ||
t.Errorf("manifest differs. (-got +want):\n%s", diff) | ||
} | ||
} |
Oops, something went wrong.