Skip to content

Commit 1f7bfb2

Browse files
Merge branch 'release-6.7.2' into release-7.0.2
Conflicts: engine/src/deploy.cpp ide version
2 parents d79517c + 3920d3f commit 1f7bfb2

File tree

6 files changed

+295
-18
lines changed

6 files changed

+295
-18
lines changed

docs/notes/bugfix-14422.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Binary submitted to App Store rejected due to minimum version mismatch

engine/rsrc/mobile-device-template.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<key>CFBundleDisplayName</key>
5858
${BUNDLE_DISPLAY_NAME_SUPPORT}
5959
<key>MinimumOSVersion</key>
60-
${MINIMUM_OS_SUPPORT}
60+
<string>${MINIMUM_OS_SUPPORT}</string>
6161
<key>UIDeviceFamily</key>
6262
<array>
6363
${DEVICE_SUPPORT}

engine/src/deploy.cpp

Lines changed: 120 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,88 @@ extern Boolean InitSSLCrypt(void);
9090

9191
////////////////////////////////////////////////////////////////////////////////
9292

93+
static const char *kMCDeployArchitectureStrings[] =
94+
{
95+
"",
96+
"i386",
97+
"x86-64",
98+
"armv6",
99+
"armv7",
100+
"armv7s",
101+
"arm64",
102+
"ppc",
103+
"ppc64",
104+
nil,
105+
};
106+
107+
typedef struct
108+
{
109+
MCDeployParameters* params;
110+
MCExecContext* ctxt;
111+
}
112+
MCDeployArrayApplyCallbackContext;
113+
114+
static bool MCDeployMapArchitectureString(MCStringRef p_string, MCDeployArchitecture& r_architecture)
115+
{
116+
for(uindex_t i = 0; kMCDeployArchitectureStrings[i] != nil; i++)
117+
{
118+
// As 'p_string' is an MCString the '==' operator does a caseless comparison.
119+
if (MCStringIsEqualToCString(p_string, kMCDeployArchitectureStrings[i], kMCStringOptionCompareCaseless))
120+
{
121+
r_architecture = (MCDeployArchitecture)i;
122+
return true;
123+
}
124+
}
125+
126+
return false;
127+
}
128+
129+
static bool MCDeployPushMinOSVersion(MCDeployParameters* p_params, MCDeployArchitecture p_arch, MCStringRef p_vers_string)
130+
{
131+
// Use sscanf to parse out the version string. We don't check the return value of
132+
// sscanf as we don't care - any malformed / missing components will come out as
133+
// 0.
134+
int t_major, t_minor, t_inc;
135+
t_major = t_minor = t_inc = 0;
136+
137+
MCAutoPointer<char> t_native_string;
138+
MCStringConvertToCString(p_vers_string, &t_native_string);
139+
sscanf(*t_native_string, "%d.%d.%d", &t_major, &t_minor, &t_inc);
140+
141+
if (!MCMemoryResizeArray(p_params -> min_os_version_count + 1, p_params -> min_os_versions, p_params -> min_os_version_count))
142+
return false;
143+
144+
uint32_t t_version;
145+
t_version = (t_major & 0xFFFF) << 16;
146+
t_version |= (t_minor & 0xFF) << 8;
147+
t_version |= (t_inc & 0xFF) << 0;
148+
149+
p_params -> min_os_versions[p_params -> min_os_version_count - 1] . architecture = p_arch;
150+
p_params -> min_os_versions[p_params -> min_os_version_count - 1] . version = t_version;
151+
152+
return true;
153+
}
154+
155+
static bool MCDeployGetArchitectures(void *context, MCArrayRef array, MCNameRef key, MCValueRef value)
156+
{
157+
MCDeployArrayApplyCallbackContext *t_context;
158+
t_context = (MCDeployArrayApplyCallbackContext*)context;
159+
160+
MCAutoStringRef t_value_as_string;
161+
MCDeployArchitecture t_arch;
162+
163+
if (!t_context -> ctxt -> ConvertToString(value, &t_value_as_string))
164+
return false;
165+
166+
if (!MCDeployMapArchitectureString(MCNameGetString(key), t_arch))
167+
return false;
168+
169+
if (MCDeployPushMinOSVersion(t_context -> params, t_arch, *t_value_as_string))
170+
return false;
171+
172+
return true;
173+
}
174+
93175
bool MCDeployParameters::InitWithArray(MCExecContext &ctxt, MCArrayRef p_array)
94176
{
95177
MCStringRef t_temp_string;
@@ -178,6 +260,42 @@ bool MCDeployParameters::InitWithArray(MCExecContext &ctxt, MCArrayRef p_array)
178260
return false;
179261
MCValueAssign(version_info, t_temp_array);
180262
MCValueRelease(t_temp_array);
263+
264+
// The 'min_os_version' is either a string or an array. If it is a string then
265+
// it encodes the version against the 'Unknown' architecture which is interpreted
266+
// by the deploy command to mean all architectures. Otherwise, the keys in the
267+
// array are assumed to be architecture names and each is pushed on the array.
268+
// If multiple entries are present, then the 'unknown' mapping is used for any
269+
// architecture not explicitly specified. The current architecture strings that are
270+
// known are:
271+
// i386, x86-64, armv6, armv7, armv7s, arm64, ppc, ppc64
272+
// The empty string is taken to be 'unknown'.
273+
if (!ctxt . CopyElementAsArray(p_array, MCNAME("min_os_version"), false, t_temp_array))
274+
return false;
275+
276+
// SN-2015-02-04: [[ Merge-6.7.2 ]] If the array is empty, try to convert to a string.
277+
if (!MCArrayIsEmpty(t_temp_array))
278+
{
279+
MCDeployArrayApplyCallbackContext t_context;
280+
t_context . ctxt = &ctxt;
281+
t_context . params = this;
282+
283+
bool t_success;
284+
t_success = MCArrayApply(t_temp_array, MCDeployGetArchitectures, (void*)&t_context);
285+
MCValueRelease(t_temp_array);
286+
287+
if (!t_success)
288+
return false;
289+
}
290+
else
291+
{
292+
MCValueRelease(t_temp_array);
293+
if (!ctxt . CopyElementAsString(p_array, MCNAME("min_os_version"), false, t_temp_string))
294+
return false;
295+
296+
MCDeployPushMinOSVersion(this, kMCDeployArchitecture_Unknown, t_temp_string);
297+
MCValueRelease(t_temp_string);
298+
}
181299

182300
return true;
183301
}
@@ -446,7 +564,7 @@ void MCIdeDeploy::exec_ctxt(MCExecContext& ctxt)
446564
if (!ctxt . EvalExprAsArrayRef(m_params, EE_UNDEFINED, &t_array))
447565
return;
448566

449-
MCDeployParameters t_params;
567+
MCDeployParameters t_params;
450568
t_has_error = !t_params.InitWithArray(ctxt, *t_array);
451569

452570
// If platform is iOS and we are not Mac then error
@@ -505,11 +623,10 @@ void MCIdeDeploy::exec_ctxt(MCExecContext& ctxt)
505623
ctxt . SetTheResultToCString(MCDeployErrorToString(t_error));
506624
else
507625
ctxt . SetTheResultToEmpty();
508-
}
626+
}
509627

510628
if (t_has_error && !t_soft_error)
511629
ctxt . Throw();
512-
513630
}
514631

515632
////////////////////////////////////////////////////////////////////////////////

engine/src/deploy.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
2121

2222
////////////////////////////////////////////////////////////////////////////////
2323

24+
enum MCDeployArchitecture
25+
{
26+
kMCDeployArchitecture_Unknown,
27+
kMCDeployArchitecture_I386,
28+
kMCDeployArchitecture_X86_64,
29+
kMCDeployArchitecture_ARMV6,
30+
kMCDeployArchitecture_ARMV7,
31+
kMCDeployArchitecture_ARMV7S,
32+
kMCDeployArchitecture_ARM64,
33+
kMCDeployArchitecture_PPC,
34+
kMCDeployArchitecture_PPC64,
35+
};
36+
37+
struct MCDeployMinOSVersion
38+
{
39+
// The architecture this version applies to.
40+
MCDeployArchitecture architecture;
41+
// The version word encoded as nibbles XXXX.YY.ZZ for X.Y.Z.
42+
uint32_t version;
43+
};
44+
2445
struct MCDeployParameters
2546
{
2647
// The path to the engine binaries to use. On Windows and Linux this should
@@ -34,6 +55,11 @@ struct MCDeployParameters
3455
// fields.
3556
MCArrayRef version_info;
3657

58+
// When building for Mac/iOS, you can specify a min os version per arch
59+
// slice.
60+
MCDeployMinOSVersion *min_os_versions;
61+
uindex_t min_os_version_count;
62+
3763
// The root stackfile to be included in the standalone.
3864
MCStringRef stackfile;
3965

@@ -108,6 +134,7 @@ struct MCDeployParameters
108134
MCValueRelease(payload);
109135
MCValueRelease(spill);
110136
MCValueRelease(output);
137+
MCMemoryDeleteArray(min_os_versions);
111138
}
112139

113140
// Creates using an array of parameters

0 commit comments

Comments
 (0)