Skip to content

Commit 48d48cf

Browse files
committed
Added notest option for template gen and allow for default naming
1 parent eae85a8 commit 48d48cf

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

build/BuildScriptGenerator.csx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ void Main() {
4242
While the options below are the common options technically you can specify any option in default_config.ini. When specifying an option you use its name without BLD_CONFIG_ prefix and case does not matter.
4343
4444
The default value for each arg is in brackets.
45-
45+
4646
For array args you can specify multiple separated by spaces until the next arg";
4747
usage += "\n" + bsgOpts.UsageStr();
4848

49-
var BUILD_NAME = opts.GetVal("BUILD_NAME");
49+
var BUILD_NAME = opts.GetVal("BUILD_NAME",true);
5050
if (showUsage || String.IsNullOrWhiteSpace(BUILD_NAME)) {
5151
Console.Error.WriteLine(usage);
5252
Environment.Exit(1);
@@ -74,9 +74,9 @@ void Main() {
7474

7575
var context = new TemplateContext();
7676
context.PushGlobal(scriptObjs);
77-
78-
79-
77+
78+
79+
8080
var full = template.Render(context).Replace("\r","");
8181
var blankRegex = new Regex(@"[ \t]*\n([ \t]*\n){2,}", RegexOptions.Singleline);
8282
full = blankRegex.Replace(full,"\n\n");
@@ -122,7 +122,7 @@ class BSGOpts {
122122
AddOtherOpt(BSG_OPT.GitRepo, "Primary git repository for cloning", "https://github.com/mitchcapper/BUILD_APP_NAME.git");
123123
AddOtherOpt(BSG_OPT.HaveOurPatch, "Do we do our normal patch apply for this repo (needs repo patch file in patches dir)", 1);
124124
AddOtherOpt(BSG_OPT.NoGnuLibButAutoconf, "Project does not use GNULib but does need an autoconf block, automatically sets GNU_LIBS_USED=0", 0);
125-
125+
126126
}
127127
public string UsageStr() {
128128
StringBuilder ret = new();
@@ -167,23 +167,25 @@ class BSGOpts {
167167

168168
class Opts {
169169
private ConfigRead config;
170+
public void CheckAllOpts() {
171+
GetArrVal("fullcheck"); // we will iterate everything and throw if any are invalid
172+
}
170173

171174
public Opts(ConfigRead config) {
172175
this.config = config;
173176
}
174177
public bool HasVal(String name) => GetArrVal(name).Count != 0;
175-
public string GetVal(String name) {
178+
public string GetVal(String name,bool allowMissing=false) {
176179
var vals = GetArrVal(name);
177-
if (vals.Count == 0)
180+
if (vals.Count == 0) {
181+
if (allowMissing)
182+
return null;
178183
throw new Exception($"No value found for: {name}");
184+
}
179185
if (vals.Count > 1)
180186
throw new Exception($"Expecting only one value for: {name} but got multiple: {String.Join(", ",vals)}");
181187
return vals[0];
182188
}
183-
184-
public void CheckAllOpts() {
185-
GetArrVal("fullcheck"); // we will iterate everything and throw if any are invalid
186-
}
187189
public static List<string> allCLIArgs = new(Environment.GetCommandLineArgs());
188190
public List<string> AllPassedConfigOpts=new();
189191
private readonly string[] OPTS_ALLOWED_TO_HAVE_UNESCAPED_DOUBLE_DASH_START = new []{"CONFIG_CMD_ADDL","CONFIG_CMD_ADDL_DEBUG","CONFIG_CMD_ADDL_STATIC","CONFIG_CMD_ADDL_SHARED","CONFIG_CMD_DEFAULT","CONFIG_CMD_GNULIB_ADDL", "GNU_LIBS_BOOTSTRAP_EXTRAS_ADD" };
@@ -192,7 +194,7 @@ class Opts {
192194
var including = false;
193195
var isFullCheck = name == "fullcheck";
194196
var RequestedOptRealName = BSGOpts.GetRealOptNameStr(name) ?? config.GetRealName(name);
195-
197+
196198
if (String.IsNullOrWhiteSpace(RequestedOptRealName) && ! isFullCheck)
197199
throw new Exception($"Internal error requesting a manual option of: {name} doesn't seem valid");
198200
string curOptName = null;

build/f_TEMPLATE_build.sbn-sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ fi
6666
{{else}}
6767
cmake_make
6868
cmake_install
69+
{{end}}
70+
{{if ! ours.enabled CONFIG_NO_TESTS }}
71+
make check
6972
{{end}}
7073
finalcommon;
7174
}

0 commit comments

Comments
 (0)