iphonelazext: fixed installation process, using simctl install to actually install an application to the simulator
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4413 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
861501fa99
commit
f92d194a8d
@ -516,7 +516,7 @@ begin
|
|||||||
prj := GetXcodeProjDirName;
|
prj := GetXcodeProjDirName;
|
||||||
IDEMsg('Build+Install Xcode project (xcodebuild)');
|
IDEMsg('Build+Install Xcode project (xcodebuild)');
|
||||||
|
|
||||||
if not InstallXcodePrj(prj, 'iphonesimulator') then begin
|
if not InstallXcodePrj(prj, 'iphonesimulator', EnvOptions.DefaultDeviceID) then begin
|
||||||
IDEMsg('xcodebuild failed');
|
IDEMsg('xcodebuild failed');
|
||||||
Exit;
|
Exit;
|
||||||
end else
|
end else
|
||||||
|
@ -28,7 +28,7 @@ type
|
|||||||
|
|
||||||
function ListDevice(lst: TList): Boolean;
|
function ListDevice(lst: TList): Boolean;
|
||||||
|
|
||||||
function InstallXcodePrj(const project, sdk: string): Boolean;
|
function InstallXcodePrj(const project, sdk, deviceid: string): Boolean;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TRWProcess }
|
{ TRWProcess }
|
||||||
@ -242,14 +242,67 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function InstallXcodePrj(const project, sdk: string): Boolean;
|
function checkOptVal(const s: string; nm: string; var vl: string): Boolean;
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
begin
|
||||||
|
i:=Pos(nm, s);
|
||||||
|
Result:=(i>0);
|
||||||
|
if not Result then Exit;
|
||||||
|
//if i<0 then
|
||||||
|
inc(i, length(nm));
|
||||||
|
for i:=i to length(s) do
|
||||||
|
if s[i]='=' then begin
|
||||||
|
vl:=trim(Copy(s, i+1, length(s)));
|
||||||
|
Result:=true;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function InstallXcodePrj(const project, sdk, deviceid: string): Boolean;
|
||||||
var
|
var
|
||||||
outstr: string;
|
outstr: string;
|
||||||
|
s : string;
|
||||||
|
l : string;
|
||||||
|
st : TStringList;
|
||||||
|
i : integer;
|
||||||
|
j : integer;
|
||||||
|
ip : string; // install path
|
||||||
|
fp : string; // content path
|
||||||
begin
|
begin
|
||||||
writeln('project = ', project);
|
Result:=RunCommand('xcodebuild',
|
||||||
writeln('sdk = ', sdk);
|
['install'
|
||||||
Result:=RunCommand('xcodebuild', ['install', '-project' ,project, '-sdk',sdk], outstr);
|
,'-project' ,project, '-sdk',sdk], outstr);
|
||||||
|
|
||||||
if not Result then Exit;
|
if not Result then Exit;
|
||||||
|
|
||||||
|
Result:=RunCommand('xcodebuild',
|
||||||
|
['install'
|
||||||
|
,'-project' ,project, '-sdk',sdk
|
||||||
|
,'-showBuildSettings'], outstr);
|
||||||
|
st:=TStringList.Create;
|
||||||
|
try
|
||||||
|
st.Text:=outstr;
|
||||||
|
ip:='';
|
||||||
|
fp:='';
|
||||||
|
for i:=st.Count-1 downto 0 do begin
|
||||||
|
s:=st[i];
|
||||||
|
l:=AnsiLowerCase(s);
|
||||||
|
if (ip='') then checkOptVal(s, 'INSTALL_DIR', ip);
|
||||||
|
if (fp='') then checkOptVal(s, 'CONTENTS_FOLDER_PATH', fp);
|
||||||
|
if pos('build settings for', l)>0 then Break;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
st.Free;
|
||||||
|
end;
|
||||||
|
Result:=(ip<>'') and (fp<>'');
|
||||||
|
|
||||||
|
if Result then begin
|
||||||
|
Result:=RunCommand('xcrun',
|
||||||
|
['simctl','install'
|
||||||
|
,deviceid, IncludeTrailingPathDelimiter(ip)+fp ], outstr);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Const
|
Const
|
||||||
|
Loading…
Reference in New Issue
Block a user