Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 1.4.1 #293

Merged
merged 6 commits into from
Aug 27, 2024
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
1 change: 1 addition & 0 deletions local_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go install -ldflags="-X main.commit=$(git rev-parse HEAD)" github.com/Bedrock-OSS/regolith
15 changes: 14 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,23 @@ func main() {
eval.Init()

// Root command
versionTitle := "Regolith "
if buildSource != "DEV" {
versionTitle += version
} else {
versionTitle += "Dev Build"
}
if commit != "" {
versionTitle += " (#" + commit[0:7]
if date != "" {
versionTitle += " built at " + date
}
versionTitle += ")"
}
var rootCmd = &cobra.Command{
Use: "regolith",
Short: "Addon Compiler for the Bedrock Edition of Minecraft",
Long: regolithDesc,
Long: versionTitle + regolithDesc,
Version: version,
}
subcommands := make([]*cobra.Command, 0)
Expand Down
2 changes: 1 addition & 1 deletion regolith/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func ExportProject(ctx RunContext) error {
var exportedFilterNames []string
for filter := range profile.Filters {
filter := profile.Filters[filter]
usingDataPath, err := filter.IsUsingDataExport(dotRegolithPath)
usingDataPath, err := filter.IsUsingDataExport(dotRegolithPath, ctx)
if err != nil {
return burrito.WrapErrorf(
err,
Expand Down
4 changes: 2 additions & 2 deletions regolith/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ type FilterRunner interface {

// IsUsingDataExport returns whether the filter wants its data to be
// exported back to the data folder after running the profile.
IsUsingDataExport(dotRegolithPath string) (bool, error)
IsUsingDataExport(dotRegolithPath string, ctx RunContext) (bool, error)
}

func (f *Filter) CopyArguments(parent *RemoteFilter) {
Expand Down Expand Up @@ -256,7 +256,7 @@ func (f *Filter) IsDisabled(ctx RunContext) (bool, error) {
return false, nil
}

func (f *Filter) IsUsingDataExport(_ string) (bool, error) {
func (f *Filter) IsUsingDataExport(_ string, _ RunContext) (bool, error) {
return false, nil
}

Expand Down
18 changes: 18 additions & 0 deletions regolith/filter_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,21 @@ func (f *ProfileFilter) Check(context RunContext) error {
profile, f.Profile, *context.Config, &context,
context.DotRegolithPath)
}

func (f *ProfileFilter) IsUsingDataExport(dotRegolithPath string, ctx RunContext) (bool, error) {
profile := ctx.Config.Profiles[f.Profile]
for filter := range profile.Filters {
filter := profile.Filters[filter]
usingDataPath, err := filter.IsUsingDataExport(dotRegolithPath, ctx)
if err != nil {
return false, burrito.WrapErrorf(
err,
"Failed to check if profile is using data export.\n"+
"Profile: %s", f.Profile)
}
if usingDataPath {
return true, nil
}
}
return false, nil
}
2 changes: 1 addition & 1 deletion regolith/filter_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (f *RemoteFilter) GetCachedVersion(dotRegolithPath string) (*string, error)
return &version, nil
}

func (f *RemoteFilter) IsUsingDataExport(dotRegolithPath string) (bool, error) {
func (f *RemoteFilter) IsUsingDataExport(dotRegolithPath string, _ RunContext) (bool, error) {
// Load the filter.json file
filterJsonPath := filepath.Join(f.GetDownloadPath(dotRegolithPath), "filter.json")
file, err := os.ReadFile(filterJsonPath)
Expand Down
Loading