llgo.next: support build, run, cmptest
This commit is contained in:
26
cmd/llgo.next/build_cmd.gox
Normal file
26
cmd/llgo.next/build_cmd.gox
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2025 The GoPlus Authors (goplus.org). All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
import (
|
||||
self "github.com/goplus/llgo/cmd/internal/build"
|
||||
)
|
||||
|
||||
short "Compile packages and dependencies"
|
||||
|
||||
flagOff
|
||||
|
||||
run args => {
|
||||
self.Cmd.Run self.Cmd, args
|
||||
}
|
||||
26
cmd/llgo.next/cmptest_cmd.gox
Normal file
26
cmd/llgo.next/cmptest_cmd.gox
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2025 The GoPlus Authors (goplus.org). All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
import (
|
||||
self "github.com/goplus/llgo/cmd/internal/run"
|
||||
)
|
||||
|
||||
short "Compile and run with llgo, compare result (stdout/stderr/exitcode) with go or llgo.expect; generate llgo.expect file if -gen is specified"
|
||||
|
||||
flagOff
|
||||
|
||||
run args => {
|
||||
self.CmpTestCmd.Run self.CmpTestCmd, args
|
||||
}
|
||||
@@ -5,6 +5,8 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/goplus/cobra/xcmd"
|
||||
build1 "github.com/goplus/llgo/cmd/internal/build"
|
||||
run1 "github.com/goplus/llgo/cmd/internal/run"
|
||||
"github.com/goplus/llgo/internal/env"
|
||||
"github.com/qiniu/x/stringutil"
|
||||
"runtime"
|
||||
@@ -12,6 +14,18 @@ import (
|
||||
|
||||
const _ = true
|
||||
|
||||
type build struct {
|
||||
xcmd.Command
|
||||
*App
|
||||
}
|
||||
type cmptest struct {
|
||||
xcmd.Command
|
||||
*App
|
||||
}
|
||||
type run struct {
|
||||
xcmd.Command
|
||||
*App
|
||||
}
|
||||
type version struct {
|
||||
xcmd.Command
|
||||
*App
|
||||
@@ -21,17 +35,68 @@ type App struct {
|
||||
}
|
||||
|
||||
func (this *App) Main() {
|
||||
_gop_obj0 := &version{App: this}
|
||||
xcmd.Gopt_App_Main(this, _gop_obj0)
|
||||
_gop_obj0 := &build{App: this}
|
||||
_gop_obj1 := &cmptest{App: this}
|
||||
_gop_obj2 := &run{App: this}
|
||||
_gop_obj3 := &version{App: this}
|
||||
xcmd.Gopt_App_Main(this, _gop_obj0, _gop_obj1, _gop_obj2, _gop_obj3)
|
||||
}
|
||||
//line cmd/llgo/version_cmd.gox:7
|
||||
//line cmd/llgo.next/build_cmd.gox:20
|
||||
func (this *build) Main(_gop_arg0 string) {
|
||||
this.Command.Main(_gop_arg0)
|
||||
//line cmd/llgo.next/build_cmd.gox:20:1
|
||||
this.Short("Compile packages and dependencies")
|
||||
//line cmd/llgo.next/build_cmd.gox:22:1
|
||||
this.FlagOff()
|
||||
//line cmd/llgo.next/build_cmd.gox:24:1
|
||||
this.Run__1(func(args []string) {
|
||||
//line cmd/llgo.next/build_cmd.gox:25:1
|
||||
build1.Cmd.Run(build1.Cmd, args)
|
||||
})
|
||||
}
|
||||
func (this *build) Classfname() string {
|
||||
return "build"
|
||||
}
|
||||
//line cmd/llgo.next/cmptest_cmd.gox:20
|
||||
func (this *cmptest) Main(_gop_arg0 string) {
|
||||
this.Command.Main(_gop_arg0)
|
||||
//line cmd/llgo.next/cmptest_cmd.gox:20:1
|
||||
this.Short("Compile and run with llgo, compare result (stdout/stderr/exitcode) with go or llgo.expect; generate llgo.expect file if -gen is specified")
|
||||
//line cmd/llgo.next/cmptest_cmd.gox:22:1
|
||||
this.FlagOff()
|
||||
//line cmd/llgo.next/cmptest_cmd.gox:24:1
|
||||
this.Run__1(func(args []string) {
|
||||
//line cmd/llgo.next/cmptest_cmd.gox:25:1
|
||||
run1.CmpTestCmd.Run(run1.CmpTestCmd, args)
|
||||
})
|
||||
}
|
||||
func (this *cmptest) Classfname() string {
|
||||
return "cmptest"
|
||||
}
|
||||
//line cmd/llgo.next/run_cmd.gox:20
|
||||
func (this *run) Main(_gop_arg0 string) {
|
||||
this.Command.Main(_gop_arg0)
|
||||
//line cmd/llgo.next/run_cmd.gox:20:1
|
||||
this.Short("Compile and run Go program")
|
||||
//line cmd/llgo.next/run_cmd.gox:22:1
|
||||
this.FlagOff()
|
||||
//line cmd/llgo.next/run_cmd.gox:24:1
|
||||
this.Run__1(func(args []string) {
|
||||
//line cmd/llgo.next/run_cmd.gox:25:1
|
||||
run1.Cmd.Run(run1.Cmd, args)
|
||||
})
|
||||
}
|
||||
func (this *run) Classfname() string {
|
||||
return "run"
|
||||
}
|
||||
//line cmd/llgo.next/version_cmd.gox:22
|
||||
func (this *version) Main(_gop_arg0 string) {
|
||||
this.Command.Main(_gop_arg0)
|
||||
//line cmd/llgo/version_cmd.gox:7:1
|
||||
this.Short("print LLGo version")
|
||||
//line cmd/llgo/version_cmd.gox:9:1
|
||||
//line cmd/llgo.next/version_cmd.gox:22:1
|
||||
this.Short("Print LLGo version")
|
||||
//line cmd/llgo.next/version_cmd.gox:24:1
|
||||
this.Run__0(func() {
|
||||
//line cmd/llgo/version_cmd.gox:10:1
|
||||
//line cmd/llgo.next/version_cmd.gox:25:1
|
||||
fmt.Println(stringutil.Concat("llgo ", env.Version(), " ", runtime.GOOS, "/", runtime.GOARCH))
|
||||
})
|
||||
}
|
||||
@@ -39,6 +104,6 @@ func (this *version) Classfname() string {
|
||||
return "version"
|
||||
}
|
||||
func main() {
|
||||
//line cmd/llgo/version_cmd.gox:9:1
|
||||
//line cmd/llgo.next/version_cmd.gox:24:1
|
||||
new(App).Main()
|
||||
}
|
||||
|
||||
26
cmd/llgo.next/run_cmd.gox
Normal file
26
cmd/llgo.next/run_cmd.gox
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2025 The GoPlus Authors (goplus.org). All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
import (
|
||||
self "github.com/goplus/llgo/cmd/internal/run"
|
||||
)
|
||||
|
||||
short "Compile and run Go program"
|
||||
|
||||
flagOff
|
||||
|
||||
run args => {
|
||||
self.Cmd.Run self.Cmd, args
|
||||
}
|
||||
@@ -1,10 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2025 The GoPlus Authors (goplus.org). All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"github.com/goplus/llgo/internal/env"
|
||||
)
|
||||
|
||||
short "print LLGo version"
|
||||
short "Print LLGo version"
|
||||
|
||||
run => {
|
||||
echo "llgo ${env.version} ${runtime.GOOS}/${runtime.GOARCH}"
|
||||
|
||||
2
go.mod
2
go.mod
@@ -6,7 +6,7 @@ toolchain go1.24.1
|
||||
|
||||
require (
|
||||
github.com/goccy/go-yaml v1.17.1
|
||||
github.com/goplus/cobra v1.9.7 //gop:class
|
||||
github.com/goplus/cobra v1.9.8 //gop:class
|
||||
github.com/goplus/gogen v1.17.3
|
||||
github.com/goplus/lib v0.2.0
|
||||
github.com/goplus/llgo/runtime v0.0.0-00010101000000-000000000000
|
||||
|
||||
4
go.sum
4
go.sum
@@ -2,8 +2,8 @@ github.com/goccy/go-yaml v1.17.1 h1:LI34wktB2xEE3ONG/2Ar54+/HJVBriAGJ55PHls4YuY=
|
||||
github.com/goccy/go-yaml v1.17.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/goplus/cobra v1.9.7 h1:aG9WtC06MKEfu/g5XMPz8i1hwh0kS9AxuDyJmSW8xe8=
|
||||
github.com/goplus/cobra v1.9.7/go.mod h1:p4LhfNJDKEpiGjGiNn0crUXL5dUPA5DX2ztYpEJR34E=
|
||||
github.com/goplus/cobra v1.9.8 h1:4ZvhxUepT35vreZdxjl/bwnJdwhWyWCGnc60+v22x14=
|
||||
github.com/goplus/cobra v1.9.8/go.mod h1:p4LhfNJDKEpiGjGiNn0crUXL5dUPA5DX2ztYpEJR34E=
|
||||
github.com/goplus/gogen v1.17.3 h1:Xhoj2KQw4feRdPEtOYjTUe9lSvNIoxBG4urhdjf+fUg=
|
||||
github.com/goplus/gogen v1.17.3/go.mod h1:owX2e1EyU5WD+Nm6oH2m/GXjLdlBYcwkLO4wN8HHXZI=
|
||||
github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g=
|
||||
|
||||
Reference in New Issue
Block a user