From 5617ac9a18c581150b7c9daeeecf9940894b85fb Mon Sep 17 00:00:00 2001 From: stirante Date: Tue, 9 Jul 2024 11:28:16 +0200 Subject: [PATCH 1/3] Add version and commit has to title of the root command --- main.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 17b2403b..1e90ccc7 100644 --- a/main.go +++ b/main.go @@ -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) From 72d3e63ac4223947b569a6a363f82b9ad1f09aad Mon Sep 17 00:00:00 2001 From: stirante Date: Tue, 9 Jul 2024 11:31:41 +0200 Subject: [PATCH 2/3] Add small script for compiling a local version with commit hash included --- local_install.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 local_install.sh diff --git a/local_install.sh b/local_install.sh new file mode 100644 index 00000000..96ec3af5 --- /dev/null +++ b/local_install.sh @@ -0,0 +1 @@ +go install -ldflags="-X main.commit=$(git rev-parse HEAD)" github.com/Bedrock-OSS/regolith \ No newline at end of file From 09a6be3123f7635af2a75b052ba2800c2abe74bb Mon Sep 17 00:00:00 2001 From: Nusiq Date: Tue, 27 Aug 2024 14:40:54 +0200 Subject: [PATCH 3/3] Fixed exporting files to the data folder using nested profiles. --- regolith/export.go | 2 +- regolith/filter.go | 4 ++-- regolith/filter_profile.go | 18 ++++++++++++++++++ regolith/filter_remote.go | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/regolith/export.go b/regolith/export.go index 593f0d61..fbb05fce 100644 --- a/regolith/export.go +++ b/regolith/export.go @@ -200,7 +200,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, diff --git a/regolith/filter.go b/regolith/filter.go index 49fbab06..96ca2321 100644 --- a/regolith/filter.go +++ b/regolith/filter.go @@ -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) { @@ -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 } diff --git a/regolith/filter_profile.go b/regolith/filter_profile.go index f447cf6a..51777ee6 100644 --- a/regolith/filter_profile.go +++ b/regolith/filter_profile.go @@ -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 +} diff --git a/regolith/filter_remote.go b/regolith/filter_remote.go index 66bfeb14..8b932366 100644 --- a/regolith/filter_remote.go +++ b/regolith/filter_remote.go @@ -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)