Skip to content

Commit

Permalink
More work!
Browse files Browse the repository at this point in the history
  • Loading branch information
RedstoneWizard08 committed Dec 13, 2024
1 parent 8d12e79 commit 60566e4
Show file tree
Hide file tree
Showing 32 changed files with 416 additions and 139 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ jobs:
run: |
[[ -f bld ]] && rm -f bld
go build -buildvcs=false -o bld ./builder
./bld b
mkdir dist
mv *.zip *.tar.gz *.mrpack dist
./bld version bundle-all
- name: Upload Artifacts
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ server
/bld
.build
/bld.exe
dist
2 changes: 2 additions & 0 deletions build.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ pack_author = "HappyRedstone Modding"
pack_version = "3.0.0"
enabled = true
common = "common"
versions = "versions"
temp = ".build/temp"
output = "dist"

[[multi_version.bootstrap_mods]]
id = "reeses-sodium-options"
Expand Down
9 changes: 8 additions & 1 deletion builder/cmd/client/bundle/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bundle

import (
"github.com/HappyRedstone/SodiumPlus/builder/internal/client"
"github.com/packwiz/packwiz/core"
"github.com/spf13/cobra"
)

Expand All @@ -13,6 +14,12 @@ var AllCommand = &cobra.Command{
SilenceUsage: true,

RunE: func(cmd *cobra.Command, args []string) error {
return client.Bundle()
pack, err := core.LoadPack()

if err != nil {
return err
}

return client.Bundle("output", &pack)
},
}
9 changes: 8 additions & 1 deletion builder/cmd/client/bundle/curseforge.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bundle

import (
"github.com/HappyRedstone/SodiumPlus/builder/internal/client"
"github.com/packwiz/packwiz/core"
"github.com/spf13/cobra"
)

Expand All @@ -13,6 +14,12 @@ var CurseforgeCommand = &cobra.Command{
SilenceUsage: true,

RunE: func(cmd *cobra.Command, args []string) error {
return client.CurseForge()
pack, err := core.LoadPack()

if err != nil {
return err
}

return client.CurseForge("output", &pack)
},
}
9 changes: 8 additions & 1 deletion builder/cmd/client/bundle/modrinth.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bundle

import (
"github.com/HappyRedstone/SodiumPlus/builder/internal/client"
"github.com/packwiz/packwiz/core"
"github.com/spf13/cobra"
)

Expand All @@ -13,6 +14,12 @@ var ModrinthCommand = &cobra.Command{
SilenceUsage: true,

RunE: func(cmd *cobra.Command, args []string) error {
return client.Modrinth()
pack, err := core.LoadPack()

if err != nil {
return err
}

return client.Modrinth("output", &pack)
},
}
9 changes: 8 additions & 1 deletion builder/cmd/client/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package client

import (
internalClient "github.com/HappyRedstone/SodiumPlus/builder/internal/client"
"github.com/packwiz/packwiz/core"
"github.com/spf13/cobra"
)

Expand All @@ -12,6 +13,12 @@ var CleanCommand = &cobra.Command{
Aliases: []string{"c"},

RunE: func(cmd *cobra.Command, args []string) error {
return internalClient.Clean()
pack, err := core.LoadPack()

if err != nil {
return err
}

return internalClient.Clean(&pack)
},
}
9 changes: 8 additions & 1 deletion builder/cmd/server/bundle/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bundle

import (
"github.com/HappyRedstone/SodiumPlus/builder/internal/server"
"github.com/packwiz/packwiz/core"
"github.com/spf13/cobra"
)

Expand All @@ -13,6 +14,12 @@ var AllCommand = &cobra.Command{
SilenceUsage: true,

RunE: func(cmd *cobra.Command, args []string) error {
return server.Bundle()
pack, err := core.LoadPack()

if err != nil {
return err
}

return server.Bundle("output", &pack)
},
}
9 changes: 8 additions & 1 deletion builder/cmd/server/bundle/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bundle

import (
"github.com/HappyRedstone/SodiumPlus/builder/internal/server"
"github.com/packwiz/packwiz/core"
"github.com/spf13/cobra"
)

Expand All @@ -13,6 +14,12 @@ var TarCommand = &cobra.Command{
SilenceUsage: true,

RunE: func(cmd *cobra.Command, args []string) error {
return server.Tar()
pack, err := core.LoadPack()

if err != nil {
return err
}

return server.Tar(&pack)
},
}
9 changes: 8 additions & 1 deletion builder/cmd/server/bundle/zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bundle

import (
"github.com/HappyRedstone/SodiumPlus/builder/internal/server"
"github.com/packwiz/packwiz/core"
"github.com/spf13/cobra"
)

Expand All @@ -13,6 +14,12 @@ var ZipCommand = &cobra.Command{
SilenceUsage: true,

RunE: func(cmd *cobra.Command, args []string) error {
return server.Zip()
pack, err := core.LoadPack()

if err != nil {
return err
}

return server.Zip(&pack)
},
}
9 changes: 8 additions & 1 deletion builder/cmd/server/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package server

import (
internalServer "github.com/HappyRedstone/SodiumPlus/builder/internal/server"
"github.com/packwiz/packwiz/core"
"github.com/spf13/cobra"
)

Expand All @@ -12,6 +13,12 @@ var CleanCommand = &cobra.Command{
Aliases: []string{"c"},

RunE: func(cmd *cobra.Command, args []string) error {
return internalServer.Clean()
pack, err := core.LoadPack()

if err != nil {
return err
}

return internalServer.Clean("output", &pack)
},
}
46 changes: 46 additions & 0 deletions builder/cmd/version/bundle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package version

import (
"os"
"path/filepath"

"github.com/HappyRedstone/SodiumPlus/builder/internal/config"
"github.com/HappyRedstone/SodiumPlus/builder/internal/multiver"
"github.com/spf13/cobra"
)

var BundleCommand = CreateBundleCommand()

func CreateBundleCommand() *cobra.Command {
cmd := cobra.Command{
Use: "bundle [minecraft version] [loader]",
Short: "Bundle a version of a multiversion pack.",
Long: `Bundle a version of a multiversion pack.`,
Aliases: []string{"b", "export"},
Args: cobra.MinimumNArgs(2),

RunE: func(cmd *cobra.Command, args []string) error {
root, err := os.Getwd()

if err != nil {
return err
}

cfg, err := config.GetConfig()

if err != nil {
return err
}

outDir, err := filepath.Abs(cfg.MultiVersion.OutDir)

if err != nil {
return err
}

return multiver.BundlePack(outDir, cfg, root, args[0], args[1])
},
}

return &cmd
}
71 changes: 71 additions & 0 deletions builder/cmd/version/bundle_all.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package version

import (
"fmt"
"os"
"path"
"path/filepath"

"github.com/HappyRedstone/SodiumPlus/builder/internal/config"
"github.com/HappyRedstone/SodiumPlus/builder/internal/multiver"
"github.com/spf13/cobra"
)

var BundleAllCommand = CreateBundleAllCommand()

func CreateBundleAllCommand() *cobra.Command {
cmd := cobra.Command{
Use: "bundle-all",
Short: "Bundle all version of a multiversion pack.",
Long: `Bundle all version of a multiversion pack.`,
Aliases: []string{"B", "export-all"},

RunE: func(cmd *cobra.Command, args []string) error {
baseRoot, err := os.Getwd()

if err != nil {
return err
}

root, err := filepath.Abs(baseRoot)

if err != nil {
return err
}

cfg, err := config.GetConfig()

if err != nil {
return err
}

outDir, err := filepath.Abs(cfg.MultiVersion.OutDir)

if err != nil {
return err
}

items, err := multiver.FindVersions(path.Join(root, cfg.MultiVersion.VersionsDir))

if err != nil {
return err
}

for ver, loaders := range items {
for _, loader := range loaders {
fmt.Printf("Bundling for %s %s...\n", loader, ver)

err = multiver.BundlePack(outDir, cfg, root, ver, loader)

if err != nil {
return err
}
}
}

return nil
},
}

return &cmd
}
57 changes: 0 additions & 57 deletions builder/cmd/version/expand.go

This file was deleted.

3 changes: 1 addition & 2 deletions builder/cmd/version/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var BasePath string
var Force bool
var UseLatest bool
var InitCommand = CreateInitCommand()
var Loaders = []string{"Forge", "Fabric", "NeoForge", "Quilt", "LiteLoader"}

func CreateInitCommand() *cobra.Command {
cmd := cobra.Command{
Expand Down Expand Up @@ -78,7 +77,7 @@ func InitFor(versions []string, ver string, loader string) error {
found_loader := false

// Use custom logic so we can properly capitalize the loader name
for _, loader_id := range Loaders {
for _, loader_id := range multiver.Loaders {
if strings.EqualFold(loader_id, loader) {
found_loader = true
loader = loader_id
Expand Down
Loading

0 comments on commit 60566e4

Please sign in to comment.