Skip to content

Commit

Permalink
Merge pull request #4232 from andydotxyz/fix/consistentjsnaming
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz authored Sep 18, 2023
2 parents 3ee5a3e + c436909 commit 066aa79
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions cmd/fyne/internal/commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func checkVersion(output string, versionConstraint *version.ConstraintGroup) err
}

func isWeb(goos string) bool {
return goos == "gopherjs" || goos == "wasm"
return goos == "js" || goos == "wasm"
}

func checkGoVersion(runner runner, versionConstraint *version.ConstraintGroup) error {
Expand Down Expand Up @@ -202,7 +202,7 @@ func (b *Builder) build() error {
goos = targetOS()
}

if goos == "gopherjs" && runtime.GOOS == "windows" {
if goos == "js" && runtime.GOOS == "windows" {
return errors.New("gopherjs doesn't support Windows. Only wasm target is supported for the web output. You can also use fyne-cross to solve this")
}

Expand Down Expand Up @@ -267,7 +267,7 @@ func (b *Builder) build() error {
tags = append(tags, "release")
}
if len(tags) > 0 {
if goos == "gopherjs" {
if goos == "js" {
args = append(args, "--tags")
} else {
args = append(args, "-tags")
Expand All @@ -285,7 +285,7 @@ func (b *Builder) build() error {
versionConstraint = version.NewConstrainGroupFromString(">=1.17")
env = append(env, "GOARCH=wasm")
env = append(env, "GOOS=js")
} else if goos == "gopherjs" {
} else if goos == "js" {
_, err := b.runner.runOutput("version")
if err != nil {
fmt.Fprintf(os.Stderr, "Can not execute `gopherjs version`. Please do `go install github.com/gopherjs/gopherjs@latest`.\n")
Expand Down Expand Up @@ -364,7 +364,7 @@ func (b *Builder) updateAndGetGoExecutable(goos string) runner {
fyneGoModRunner = newCommand(goBin)
b.runner = fyneGoModRunner
} else {
if goos != "gopherjs" {
if goos != "js" {
b.runner = newCommand("go")
} else {
b.runner = newCommand("gopherjs")
Expand Down
2 changes: 1 addition & 1 deletion cmd/fyne/internal/commands/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func Test_BuildGopherJSReleaseVersion(t *testing.T) {
}

gopherJSBuildTest := &testCommandRuns{runs: expected, t: t}
b := &Builder{appData: &appData{}, os: "gopherjs", srcdir: "myTest", release: true, runner: gopherJSBuildTest}
b := &Builder{appData: &appData{}, os: "js", srcdir: "myTest", release: true, runner: gopherJSBuildTest}
err := b.build()
if runtime.GOOS == "windows" {
assert.NotNil(t, err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/fyne/internal/commands/package-web.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (p *Packager) packageWasm() error {
}

func (p *Packager) packageGopherJS() error {
appDir := util.EnsureSubDir(p.dir, "gopherjs")
appDir := util.EnsureSubDir(p.dir, "js")

tpl := webData{
AppName: p.Name,
Expand Down
6 changes: 3 additions & 3 deletions cmd/fyne/internal/commands/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Package() *cli.Command {
&cli.StringFlag{
Name: "target",
Aliases: []string{"os"},
Usage: "The mobile platform to target (android, android/arm, android/arm64, android/amd64, android/386, ios, iossimulator, wasm, gopherjs, web).",
Usage: "The mobile platform to target (android, android/arm, android/arm64, android/amd64, android/386, ios, iossimulator, wasm, js, web).",
Destination: &p.os,
},
&cli.StringFlag{
Expand Down Expand Up @@ -248,7 +248,7 @@ func (p *Packager) buildPackage(runner runner, tags []string) ([]string, error)
}

bGopherJS := &Builder{
os: "gopherjs",
os: "js",
srcdir: p.srcDir,
target: p.exe + ".js",
release: p.release,
Expand Down Expand Up @@ -327,7 +327,7 @@ func (p *Packager) doPackage(runner runner) error {
return p.packageIOS(p.os, tags)
case "wasm":
return p.packageWasm()
case "gopherjs":
case "js":
return p.packageGopherJS()
case "web":
return p.packageWeb()
Expand Down
22 changes: 11 additions & 11 deletions cmd/fyne/internal/commands/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func Test_buildPackageGopherJS(t *testing.T) {

p := &Packager{
appData: &appData{},
os: "gopherjs",
os: "js",
srcDir: "myTest",
exe: "myTest.js",
release: true,
Expand Down Expand Up @@ -394,7 +394,7 @@ func Test_PackageGopherJS(t *testing.T) {
Name: "myTest",
icon: "myTest.png",
},
os: "gopherjs",
os: "js",
srcDir: "myTest",
dir: "myTestTarget",
exe: "myTest.js",
Expand All @@ -409,7 +409,7 @@ func Test_PackageGopherJS(t *testing.T) {

expectedEnsureSubDirRuns := mockEnsureSubDirRuns{
expected: []mockEnsureSubDir{
{"myTestTarget", "gopherjs", "myTestTarget/gopherjs"},
{"myTestTarget", "js", "myTestTarget/js"},
},
}
utilEnsureSubDirMock = func(parent, name string) string {
Expand All @@ -428,12 +428,12 @@ func Test_PackageGopherJS(t *testing.T) {

expectedWriteFileRuns := mockWriteFileRuns{
expected: []mockWriteFile{
{filepath.Join("myTestTarget", "gopherjs", "index.html"), nil},
{filepath.Join("myTestTarget", "gopherjs", "spinner_light.gif"), nil},
{filepath.Join("myTestTarget", "gopherjs", "spinner_dark.gif"), nil},
{filepath.Join("myTestTarget", "gopherjs", "light.css"), nil},
{filepath.Join("myTestTarget", "gopherjs", "dark.css"), nil},
{filepath.Join("myTestTarget", "gopherjs", "webgl-debug.js"), nil},
{filepath.Join("myTestTarget", "js", "index.html"), nil},
{filepath.Join("myTestTarget", "js", "spinner_light.gif"), nil},
{filepath.Join("myTestTarget", "js", "spinner_dark.gif"), nil},
{filepath.Join("myTestTarget", "js", "light.css"), nil},
{filepath.Join("myTestTarget", "js", "dark.css"), nil},
{filepath.Join("myTestTarget", "js", "webgl-debug.js"), nil},
},
}
utilWriteFileMock = func(target string, _ []byte) error {
Expand All @@ -442,8 +442,8 @@ func Test_PackageGopherJS(t *testing.T) {

expectedCopyFileRuns := mockCopyFileRuns{
expected: []mockCopyFile{
{source: "myTest.png", target: filepath.Join("myTestTarget", "gopherjs", "icon.png")},
{source: "myTest.js", target: filepath.Join("myTestTarget", "gopherjs", "myTest.js")},
{source: "myTest.png", target: filepath.Join("myTestTarget", "js", "icon.png")},
{source: "myTest.js", target: filepath.Join("myTestTarget", "js", "myTest.js")},
},
}
utilCopyFileMock = func(source, target string) error {
Expand Down

0 comments on commit 066aa79

Please sign in to comment.