Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
*.txt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*.txt is a very broad ignore pattern. It won't un-track already-committed files, but any newly added .txt will be silently ignored — including build-critical / fixture files this repo relies on (e.g. internal/build/testdata/.../CMakeLists.txt, config.txt, expected-output .txt). That's easy to forget and can produce non-reproducible CI. Recommend scoping it to specific artifact paths. Also, coverage.txt on line 30 becomes redundant once *.txt is present.

Minor: the # gop / # gopfmt / # goptestgo comments on lines 9-11 are stale relative to the XGo migration.

*.cache
.DS_Store

# gop
# gopfmt
# goptestgo

# Folders
_obj
_test
_old
_t

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go
coverage.txt

xgo_autogen*.go
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

[![Test](https://github.com/goplus/llar/actions/workflows/go.yml/badge.svg)](https://github.com/goplus/llar/actions/workflows/go.yml)
[![codecov](https://codecov.io/gh/goplus/llar/branch/main/graph/badge.svg)](https://codecov.io/gh/goplus/llar)
[![Language](https://img.shields.io/badge/language-XGo-blue.svg)](https://github.com/goplus/gop)
[![Language](https://img.shields.io/badge/language-XGo-blue.svg)](https://github.com/goplus/xgo)

LLAR is a cloud-based multi-language package manager built with [XGo](https://github.com/goplus/gop). It resolves dependencies, downloads source code, and builds libraries from source using declarative formulas.
LLAR is a cloud-based multi-language package manager built with [XGo](https://github.com/goplus/xgo). It resolves dependencies, downloads source code, and builds libraries from source using declarative formulas.

## Installation

Expand Down
12 changes: 7 additions & 5 deletions cmp/cmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ package cmp

import "github.com/goplus/llar/mod/module"

const GopPackage = true
const (
XGoPackage = true
)

type CmpApp struct {
fCompareVer func(a, b module.Version) int
}

// The provided function fn will be used to compare version strings
// when resolving dependencies for those versions which are not in Debian-style.
func (f *CmpApp) CompareVer(fn func(a, b module.Version) int) {
f.fCompareVer = fn
func (app *CmpApp) CompareVer(fn func(a, b module.Version) int) {
app.fCompareVer = fn
}

// Gopt_CmpApp_Main is main entry of this classfile.
func Gopt_CmpApp_Main(this interface{ MainEntry() }) {
// XGot_CmpApp_Main is main entry of this classfile.
func XGot_CmpApp_Main(this interface{ MainEntry() }) {
this.MainEntry()
}
10 changes: 7 additions & 3 deletions formula/classfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import (
"github.com/qiniu/x/gsh"
)

const GopPackage = true
const (
XGoPackage = true
)

// -----------------------------------------------------------------------------

Expand Down Expand Up @@ -269,11 +271,13 @@ func (p *ModuleF) OnTest(f func(ctx *Context, proj *Project, out *TestResult)) {

// -----------------------------------------------------------------------------

// Gopt_ModuleF_Main is main entry of this classfile.
func Gopt_ModuleF_Main(this interface {
// XGot_ModuleF_Main is main entry of this classfile.
func XGot_ModuleF_Main(this interface {
app() *gsh.App
MainEntry()
}) {
this.MainEntry()
gsh.InitApp(this.app())
}

// -----------------------------------------------------------------------------
4 changes: 2 additions & 2 deletions formula/classfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func (f *testFormula) MainEntry() {
// the unexported app() helper it dispatches through.
func TestGopt_ModuleF_Main(t *testing.T) {
f := &testFormula{}
Gopt_ModuleF_Main(f)
XGot_ModuleF_Main(f)

if !f.mainCalled {
t.Fatal("MainEntry was not invoked by Gopt_ModuleF_Main")
t.Fatal("MainEntry was not invoked by XGot_ModuleF_Main")
}
if f.modPath != "foo/bar" {
t.Errorf("Id: modPath = %q, want %q", f.modPath, "foo/bar")
Expand Down
31 changes: 31 additions & 0 deletions formula/demo/zlib/zlib_llar.gox
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
id "madler/zlib"

fromVer "1.0.0"

onBuild (ctx, proj, out) => {
installDir, err := ctx.outputDir()
if err != nil {
out.addErr err
return
}

a := autotools.new(ctx.SourceDir, ctx.SourceDir+"/_build", installDir)

err = a.configure("--static")
if err != nil {
out.addErr err
return
}
err = a.build()
if err != nil {
out.addErr err
return
}
err = a.install()
if err != nil {
out.addErr err
return
}

out.setMetadata "-lz"
}
11 changes: 11 additions & 0 deletions gox.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
xgo 1.6

project *_llar.gox ModuleF github.com/goplus/llar/formula

import github.com/goplus/llar/x/autotools
import github.com/goplus/llar/x/cmake

project *_cmp.gox CmpApp github.com/goplus/llar/cmp

import golang.org/x/mod/semver
import github.com/goplus/llar/x/gnu
4 changes: 2 additions & 2 deletions internal/ixgo/pkg/github.com/goplus/llar/formula/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ func init() {
AliasTypes: map[string]reflect.Type{},
Vars: map[string]reflect.Value{},
Funcs: map[string]reflect.Value{
"Gopt_ModuleF_Main": reflect.ValueOf(q.Gopt_ModuleF_Main),
"XGot_ModuleF_Main": reflect.ValueOf(q.XGot_ModuleF_Main),
"NewContext": reflect.ValueOf(q.NewContext),
},
TypedConsts: map[string]ixgo.TypedConst{},
UntypedConsts: map[string]ixgo.UntypedConst{
"GopPackage": {"untyped bool", constant.MakeBool(bool(q.GopPackage))},
"XGoPackage": {"untyped bool", constant.MakeBool(bool(q.XGoPackage))},
},
})
}
Loading