diff --git a/cmd/llgo.next/gop_autogen.go b/cmd/llgo.next/gop_autogen.go deleted file mode 100644 index 902dfdff..00000000 --- a/cmd/llgo.next/gop_autogen.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by gop (Go+); DO NOT EDIT. - -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" -) - -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 -} -type App struct { - xcmd.App -} - -func (this *App) Main() { - _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.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.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.next/version_cmd.gox:25:1 - fmt.Println(stringutil.Concat("llgo ", env.Version(), " ", runtime.GOOS, "/", runtime.GOARCH)) - }) -} -func (this *version) Classfname() string { - return "version" -} -func main() { -//line cmd/llgo.next/version_cmd.gox:24:1 - new(App).Main() -} diff --git a/cmd/llgo/llgo.go b/cmd/llgo.old/llgo.go similarity index 100% rename from cmd/llgo/llgo.go rename to cmd/llgo.old/llgo.go diff --git a/cmd/llgo/llgo_test.go b/cmd/llgo.old/llgo_test.go similarity index 100% rename from cmd/llgo/llgo_test.go rename to cmd/llgo.old/llgo_test.go diff --git a/cmd/llgo.next/build_cmd.gox b/cmd/llgo/build_cmd.gox similarity index 100% rename from cmd/llgo.next/build_cmd.gox rename to cmd/llgo/build_cmd.gox diff --git a/cmd/llgo/clean_cmd.gox b/cmd/llgo/clean_cmd.gox new file mode 100644 index 00000000..8b167570 --- /dev/null +++ b/cmd/llgo/clean_cmd.gox @@ -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/clean" +) + +short "Remove object files and cached files" + +flagOff + +run args => { + self.Cmd.Run self.Cmd, args +} diff --git a/cmd/llgo.next/cmptest_cmd.gox b/cmd/llgo/cmptest_cmd.gox similarity index 100% rename from cmd/llgo.next/cmptest_cmd.gox rename to cmd/llgo/cmptest_cmd.gox diff --git a/cmd/llgo/get_cmd.gox b/cmd/llgo/get_cmd.gox new file mode 100644 index 00000000..3f90b7d1 --- /dev/null +++ b/cmd/llgo/get_cmd.gox @@ -0,0 +1,20 @@ +/* + * 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. + */ + +short "Add dependencies to current module and install them" + +run args => { + panic "todo" +} diff --git a/cmd/llgo/gop_autogen.go b/cmd/llgo/gop_autogen.go new file mode 100644 index 00000000..4c0e7284 --- /dev/null +++ b/cmd/llgo/gop_autogen.go @@ -0,0 +1,194 @@ +// Code generated by gop (Go+); DO NOT EDIT. + +package main + +import ( + "fmt" + "github.com/goplus/cobra/xcmd" + build1 "github.com/goplus/llgo/cmd/internal/build" + clean1 "github.com/goplus/llgo/cmd/internal/clean" + install1 "github.com/goplus/llgo/cmd/internal/install" + run1 "github.com/goplus/llgo/cmd/internal/run" + test1 "github.com/goplus/llgo/cmd/internal/test" + "github.com/goplus/llgo/internal/env" + "github.com/qiniu/x/stringutil" + "runtime" +) + +const _ = true + +type build struct { + xcmd.Command + *App +} +type clean struct { + xcmd.Command + *App +} +type cmptest struct { + xcmd.Command + *App +} +type get struct { + xcmd.Command + *App +} +type install struct { + xcmd.Command + *App +} +type run struct { + xcmd.Command + *App +} +type test struct { + xcmd.Command + *App +} +type version struct { + xcmd.Command + *App +} +type App struct { + xcmd.App +} + +func (this *App) Main() { + _gop_obj0 := &build{App: this} + _gop_obj1 := &clean{App: this} + _gop_obj2 := &cmptest{App: this} + _gop_obj3 := &get{App: this} + _gop_obj4 := &install{App: this} + _gop_obj5 := &run{App: this} + _gop_obj6 := &test{App: this} + _gop_obj7 := &version{App: this} + xcmd.Gopt_App_Main(this, _gop_obj0, _gop_obj1, _gop_obj2, _gop_obj3, _gop_obj4, _gop_obj5, _gop_obj6, _gop_obj7) +} +//line cmd/llgo/build_cmd.gox:20 +func (this *build) Main(_gop_arg0 string) { + this.Command.Main(_gop_arg0) +//line cmd/llgo/build_cmd.gox:20:1 + this.Short("Compile packages and dependencies") +//line cmd/llgo/build_cmd.gox:22:1 + this.FlagOff() +//line cmd/llgo/build_cmd.gox:24:1 + this.Run__1(func(args []string) { +//line cmd/llgo/build_cmd.gox:25:1 + build1.Cmd.Run(build1.Cmd, args) + }) +} +func (this *build) Classfname() string { + return "build" +} +//line cmd/llgo/clean_cmd.gox:20 +func (this *clean) Main(_gop_arg0 string) { + this.Command.Main(_gop_arg0) +//line cmd/llgo/clean_cmd.gox:20:1 + this.Short("Remove object files and cached files") +//line cmd/llgo/clean_cmd.gox:22:1 + this.FlagOff() +//line cmd/llgo/clean_cmd.gox:24:1 + this.Run__1(func(args []string) { +//line cmd/llgo/clean_cmd.gox:25:1 + clean1.Cmd.Run(clean1.Cmd, args) + }) +} +func (this *clean) Classfname() string { + return "clean" +} +//line cmd/llgo/cmptest_cmd.gox:20 +func (this *cmptest) Main(_gop_arg0 string) { + this.Command.Main(_gop_arg0) +//line cmd/llgo/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/cmptest_cmd.gox:22:1 + this.FlagOff() +//line cmd/llgo/cmptest_cmd.gox:24:1 + this.Run__1(func(args []string) { +//line cmd/llgo/cmptest_cmd.gox:25:1 + run1.CmpTestCmd.Run(run1.CmpTestCmd, args) + }) +} +func (this *cmptest) Classfname() string { + return "cmptest" +} +//line cmd/llgo/get_cmd.gox:16 +func (this *get) Main(_gop_arg0 string) { + this.Command.Main(_gop_arg0) +//line cmd/llgo/get_cmd.gox:16:1 + this.Short("Add dependencies to current module and install them") +//line cmd/llgo/get_cmd.gox:18:1 + this.Run__1(func(args []string) { +//line cmd/llgo/get_cmd.gox:19:1 + panic("todo") + }) +} +func (this *get) Classfname() string { + return "get" +} +//line cmd/llgo/install_cmd.gox:20 +func (this *install) Main(_gop_arg0 string) { + this.Command.Main(_gop_arg0) +//line cmd/llgo/install_cmd.gox:20:1 + this.Short("Compile and install packages and dependencies") +//line cmd/llgo/install_cmd.gox:22:1 + this.FlagOff() +//line cmd/llgo/install_cmd.gox:24:1 + this.Run__1(func(args []string) { +//line cmd/llgo/install_cmd.gox:25:1 + install1.Cmd.Run(install1.Cmd, args) + }) +} +func (this *install) Classfname() string { + return "install" +} +//line cmd/llgo/run_cmd.gox:20 +func (this *run) Main(_gop_arg0 string) { + this.Command.Main(_gop_arg0) +//line cmd/llgo/run_cmd.gox:20:1 + this.Short("Compile and run Go program") +//line cmd/llgo/run_cmd.gox:22:1 + this.FlagOff() +//line cmd/llgo/run_cmd.gox:24:1 + this.Run__1(func(args []string) { +//line cmd/llgo/run_cmd.gox:25:1 + run1.Cmd.Run(run1.Cmd, args) + }) +} +func (this *run) Classfname() string { + return "run" +} +//line cmd/llgo/test_cmd.gox:20 +func (this *test) Main(_gop_arg0 string) { + this.Command.Main(_gop_arg0) +//line cmd/llgo/test_cmd.gox:20:1 + this.Short("Compile and run Go test") +//line cmd/llgo/test_cmd.gox:22:1 + this.FlagOff() +//line cmd/llgo/test_cmd.gox:24:1 + this.Run__1(func(args []string) { +//line cmd/llgo/test_cmd.gox:25:1 + test1.Cmd.Run(test1.Cmd, args) + }) +} +func (this *test) Classfname() string { + return "test" +} +//line cmd/llgo/version_cmd.gox:22 +func (this *version) Main(_gop_arg0 string) { + this.Command.Main(_gop_arg0) +//line cmd/llgo/version_cmd.gox:22:1 + this.Short("Print LLGo version") +//line cmd/llgo/version_cmd.gox:24:1 + this.Run__0(func() { +//line cmd/llgo/version_cmd.gox:25:1 + fmt.Println(stringutil.Concat("llgo ", env.Version(), " ", runtime.GOOS, "/", runtime.GOARCH)) + }) +} +func (this *version) Classfname() string { + return "version" +} +func main() { +//line cmd/llgo/version_cmd.gox:24:1 + new(App).Main() +} diff --git a/cmd/llgo/install_cmd.gox b/cmd/llgo/install_cmd.gox new file mode 100644 index 00000000..31f4ebdd --- /dev/null +++ b/cmd/llgo/install_cmd.gox @@ -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/install" +) + +short "Compile and install packages and dependencies" + +flagOff + +run args => { + self.Cmd.Run self.Cmd, args +} diff --git a/cmd/llgo.next/run_cmd.gox b/cmd/llgo/run_cmd.gox similarity index 100% rename from cmd/llgo.next/run_cmd.gox rename to cmd/llgo/run_cmd.gox diff --git a/cmd/llgo/test_cmd.gox b/cmd/llgo/test_cmd.gox new file mode 100644 index 00000000..be1bc800 --- /dev/null +++ b/cmd/llgo/test_cmd.gox @@ -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/test" +) + +short "Compile and run Go test" + +flagOff + +run args => { + self.Cmd.Run self.Cmd, args +} diff --git a/cmd/llgo.next/version_cmd.gox b/cmd/llgo/version_cmd.gox similarity index 100% rename from cmd/llgo.next/version_cmd.gox rename to cmd/llgo/version_cmd.gox