This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


The following commit(s) were added to refs/heads/master by this push:
     new 679b6a8e newt: Add possibility to mark package as experimental
679b6a8e is described below

commit 679b6a8e93bdcec9cdf3ea00fb461043083a632b
Author: Michal Gorecki <michal.gore...@codecoup.pl>
AuthorDate: Fri Jan 12 13:50:49 2024 +0100

    newt: Add possibility to mark package as experimental
    
    This adds possibility to mark package as experimental
    by adding "pkg.experimental: 1" line in the pkg.yml file.
---
 newt/builder/targetbuild.go |  6 +++++-
 newt/resolve/resolve.go     | 19 ++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/newt/builder/targetbuild.go b/newt/builder/targetbuild.go
index 675d4e01..c7efc03a 100644
--- a/newt/builder/targetbuild.go
+++ b/newt/builder/targetbuild.go
@@ -284,7 +284,11 @@ func (t *TargetBuilder) validateAndWriteCfg() error {
                log.Warn(line)
        }
 
-       for _, line := range t.res.ExperimentalWarning() {
+       for _, line := range t.res.CfgExperimentalWarning() {
+               log.Warn(line)
+       }
+
+       for _, line := range t.res.PkgExperimentalWarning() {
                log.Warn(line)
        }
 
diff --git a/newt/resolve/resolve.go b/newt/resolve/resolve.go
index c04d3336..ef883de5 100644
--- a/newt/resolve/resolve.go
+++ b/newt/resolve/resolve.go
@@ -1358,10 +1358,27 @@ func (res *Resolution) DeprecatedWarning() []string {
        return res.Cfg.DeprecatedWarning()
 }
 
-func (res *Resolution) ExperimentalWarning() []string {
+func (res *Resolution) CfgExperimentalWarning() []string {
        return res.Cfg.ExperimentalWarning()
 }
 
+func (res *Resolution) PkgExperimentalWarning() []string {
+       lines := []string{}
+
+       for pkg := range res.LpkgRpkgMap {
+               experimental, err := pkg.PkgY.GetValBool("pkg.experimental", 
nil)
+               if err != nil {
+                       log.Errorf("Internal error; Could not read package %s 
yml file", pkg.Name())
+               }
+               if experimental {
+                       lines = append(lines,
+                               fmt.Sprintf("Use of experimental package %s", 
pkg.Name()))
+               }
+       }
+
+       return lines
+}
+
 func LogTransientWarning(lpkg *pkg.LocalPackage) {
        if lpkg.Type() == pkg.PACKAGE_TYPE_TRANSIENT {
                log.Warnf("Transient package %s used, update configuration "+

Reply via email to