Merge branch 'master' into linux-ibus-keyman

This commit is contained in:
glasseyes 2018-12-04 14:04:48 +07:00
commit 2fa98de85e
15 changed files with 216 additions and 102 deletions

View file

@ -11,9 +11,9 @@
set -e
all_distributions="bionic xenial"
all_distributions="bionic"
distributions=""
all_projects="kmflcomp libkmfl ibus-kmfl keyman-config"
all_projects="kmflcomp libkmfl keyman-keyboardprocessor ibus-kmfl keyman-config ibus-keyman"
projects=""
echo "all_distributions: ${all_distributions}"
echo "all_projects: ${all_projects}"
@ -75,6 +75,7 @@ echo "distributions: ${distributions}"
echo "projects: ${projects}"
BASEDIR=`pwd`
#echo "basedir is $BASEDIR"
mkdir -p builddebs
@ -82,14 +83,18 @@ mkdir -p builddebs
cd builddebs
for proj in ${projects}; do
vers=`ls ../dist/${proj}_*.orig.tar.gz`
# echo "${vers}"
#echo "vers1:${vers}"
vers=${vers##*_}
# echo "${vers}"
#echo "vers2:${vers}"
vers=${vers%*.orig.tar.gz}
# echo "${vers}"
#echo "vers3:${vers}"
cp -a ../dist/${proj}_${vers}.orig.tar.gz .
tar xfz ${proj}_${vers}.orig.tar.gz
cp -a ../${proj}/debian ${proj}-${vers}
if [ "keyman-keyboardprocessor" == "$proj" ]; then
cp -a ../../common/engine/keyboardprocessor/debian ${proj}-${vers}
else
cp -a ../${proj}/debian ${proj}-${vers}
fi
cd ${proj}-${vers}
dch -v ${vers}-1 "local build"
echo "${proj}-${vers}"

View file

@ -81,7 +81,7 @@ for proj in ${extra_projects}; do
datevers=`TZ=UTC git log -1 --pretty=format:%cd --date=format-local:%Y%m%d%H%M`
kbpvers="keyman-keyboardprocessor-$vers~$datevers"
cp -a keyboardprocessor $kbpvers
tar czf $kbpvers.tar.gz --exclude='debian/' --exclude='build/' $kbpvers
tar czf $kbpvers.tar.gz --exclude=debian\/ --exclude=build\/ --exclude=.gitignore $kbpvers
rm -rf $kbpvers
cp $kbpvers.tar.gz ../../linux/dist
fi

View file

@ -3,15 +3,24 @@
. $HOME/ci-builder-scripts/bash/common.sh
init --no-package
if [ "$1" == "keyman-keyboardprocessor" ]; then
sourcename="keyboardprocessor"
else
sourcename="$1"
fi
# clean up prev deb builds
log "cleaning previous builds of $1"
rm -rf builddebs
rm -rf $1/${1}_*.{dsc,build,buildinfo,changes,tar.?z,log}
rm -rf ${1}_*.{dsc,build,buildinfo,changes,tar.?z,log}
log "Make source package for $1"
JENKINS="yes" ./scripts/reconf.sh $1
./scripts/dist.sh origdist $1
log "Make source package for $sourcename"
log "reconfigure"
JENKINS="yes" ./scripts/reconf.sh $sourcename
log "Make origdist"
./scripts/dist.sh origdist $sourcename
log "Make deb source"
./scripts/deb.sh sourcepackage $1
#sign source package
@ -20,4 +29,5 @@ for file in `ls builddebs/*.dsc`; do
debsign -k$2 $file
done
mkdir -p $1
mv builddebs/* $1

View file

@ -14,6 +14,31 @@ set -e
# see ../test.sh for script to bring in
# maybe make it a function to get the minor number?
BASEDIR=`pwd`
echo "basedir is $BASEDIR"
autotool_projects="kmflcomp libkmfl ibus-kmfl ibus-keyman"
extra_projects="keyboardprocessor keyman-config"
if [ "$1" != "" ]; then
if [ "$1" == "keyboardprocessor" ]; then
echo "reconfiguring only keyboardprocessor"
extra_projects="keyboardprocessor"
autotool_projects=""
elif [ ! -d "$1" ]; then
echo "project $1 does not exist"
exit 1
elif [ "$1" == "keyman-config" ]; then
echo "reconfiguring only keyman-config"
extra_projects="keyman-config"
autotool_projects=""
else
echo "reconfiguring only $1"
autotool_projects="$1"
extra_projects=""
fi
fi
JENKINS=${JENKINS:="no"}
oldvers=`cat VERSION`
@ -22,28 +47,6 @@ oldvers=`cat VERSION`
version
echo "version: ${newvers}"
BASEDIR=`pwd`
autotool_projects="kmflcomp libkmfl ibus-kmfl ibus-keyman"
extra_projects="keyboardprocessor keyman-config"
if [ "$1" != "" ]; then
if [ "$1" == "keyboardprocessor" ]; then
extra_projects="keyboardprocessor"
autotool_projects=""
elif [ ! -d "$1" ]; then
echo "project $1 does not exist"
exit 1
fi
if [ "$1" == "keyman-config" ]; then
extra_projects="keyman-config"
autotool_projects=""
else
autotool_projects="$1"
extra_projects=""
fi
fi
echo "${newvers}" > VERSION
# autoreconf the projects

View file

@ -567,6 +567,7 @@ uses
kmxfile,
OnlineConstants,
Keyman.Developer.System.Project.Project,
Keyman.Developer.System.Project.kmnProjectFileAction,
Keyman.Developer.UI.Project.ProjectFileUI,
RegExpr,
ErrorControlledRegistry,
@ -1838,7 +1839,7 @@ begin
Result := inherited GetProjectFile;
if not Assigned(Result) then
begin
FStandaloneProjectFile := TkmnProjectFile.Create(nil, FileName, nil);
FStandaloneProjectFile := TkmnProjectFileAction.Create(nil, FileName, nil);
Result := FStandaloneProjectFile;
end;
end;

View file

@ -298,6 +298,7 @@ uses
CharMapInsertMode,
CompilePackageInstaller,
Keyman.Developer.System.Project.kpsProjectFile,
Keyman.Developer.System.Project.kpsProjectFileAction,
OnlineConstants,
KeymanVersion,
Keyman.System.PackageInfoRefreshKeyboards,
@ -467,7 +468,7 @@ begin
Result := inherited GetProjectFile;
if not Assigned(Result) then
begin
FStandaloneProjectFile := TkpsProjectFile.Create(nil, FileName, nil);
FStandaloneProjectFile := TkpsProjectFileAction.Create(nil, FileName, nil);
Result := FStandaloneProjectFile;
end;
end;

View file

@ -7,7 +7,9 @@ uses
IdCustomHTTPServer,
IdHTTPServer,
Keyman.Developer.System.HttpServer.Base;
Keyman.Developer.System.HttpServer.Base,
utilfiletypes;
// /app
@ -35,13 +37,13 @@ uses
System.JSON,
System.SysUtils,
System.Variants,
Winapi.Windows,
Xml.XMLDoc,
Xml.XMLIntf,
JsonUtil,
KeymanDeveloperOptions,
Keyman.Developer.System.Project.ProjectFile,
Keyman.Developer.System.Project.ProjectSaver,
RedistFiles;
{ TAppHttpServer }
@ -108,7 +110,7 @@ procedure TAppHttpResponder.RespondProject(doc: string; AContext: TIdContext;
path := ARequestInfo.Params.Values['path'];
if (Path <> '') and (not FileExists(path) or not SameText(ExtractFileExt(path), '.kpj')) then
if (Path <> '') and (not FileExists(path) or not SameText(ExtractFileExt(path), Ext_ProjectSource)) then
begin
AResponseInfo.ResponseNo := 404;
AResponseInfo.ResponseText := 'Project file '+path+' does not exist.';
@ -116,7 +118,7 @@ procedure TAppHttpResponder.RespondProject(doc: string; AContext: TIdContext;
end;
// Transform the .kpj
with TProject.Create(path, (path='')) do
with TProject.Create(path) do
try
AResponseInfo.ContentType := 'text/html; charset=UTF-8';
AResponseInfo.ContentText := Render;
@ -164,7 +166,8 @@ procedure TAppHttpResponder.RespondProject(doc: string; AContext: TIdContext;
var
displayState, path: string;
xmldoc: IXMLDocument;
FProject: TProject;
FNewDisplayState: PChar;
FNewPath: PChar;
begin
with TStringStream.Create('', TEncoding.UTF8) do
try
@ -194,19 +197,21 @@ procedure TAppHttpResponder.RespondProject(doc: string; AContext: TIdContext;
// Saving state
if (Path <> '') and (not FileExists(path) or not SameText(ExtractFileExt(path), '.kpj')) then
if (Path <> '') and (not FileExists(path) or not SameText(ExtractFileExt(path), Ext_ProjectSource)) then
begin
AResponseInfo.ResponseNo := 404;
AResponseInfo.ResponseText := 'Project file '+path+' does not exist.';
Exit;
end;
FProject := TProject.Create(path, (path = ''));
try
FProject.DisplayState := displayState;
FProject.SaveUser;
finally
FProject.Free;
if GlobalProjectStateWndHandle <> 0 then
begin
// Potential for a race condition here as the window
// may be destroyed before we post to it. Can only happen at
// process destruction time and really not worth worrying about.
FNewDisplayState := StrNew(PChar(displayState));
FNewPath := StrNew(PChar(Path));
PostMessage(GlobalProjectStateWndHandle, WM_USER_ProjectUpdateDisplayState, NativeInt(FNewPath), NativeInt(FNewDisplayState));
end;
end;
begin

View file

@ -337,6 +337,7 @@ type
procedure LoadDockLayout;
procedure SaveDockLayout;
procedure CEFShutdownComplete(Sender: TObject);
procedure ActivateActiveChild;
protected
procedure WndProc(var Message: TMessage); override;
@ -1095,16 +1096,17 @@ begin
end;
end;
procedure TfrmKeymanDeveloper.ActivateActiveChild;
begin
if Assigned(ActiveChild) then
SendMessage(ActiveChild.Handle, CM_ACTIVATE, 0, 0);
end;
procedure TfrmKeymanDeveloper.pagesChange(Sender: TObject);
begin
inherited;
//CharacterMapFormChanged(ActiveChild);
if Assigned(ActiveChild) then
begin
//if ActiveChild.SetFocus;
SendMessage(ActiveChild.Handle, CM_ACTIVATE, 0, 0);
if ActiveChild.Visible and Visible and CanFocus then ActiveChild.SetFocus;
end;
ActivateActiveChild;
cbTextFileFormat.Enabled := Assigned(ActiveChild) and (ActiveChild is TfrmTikeEditor); // I3733
FocusActiveChild;
@ -1125,7 +1127,7 @@ begin
try
ext := LowerCase(ExtractFileExt(FFileName));
if ext = '.kpj' then
if ext = Ext_ProjectSource then
modActionsMain.OpenProject(FFileName)
else
begin
@ -1340,6 +1342,7 @@ begin
//CharacterMapFormChanged(nil);
Window.Parent := nil;
pages.Pages[i].Free;
ActivateActiveChild;
FocusActiveChild;
if FIsClosing then

View file

@ -70,6 +70,7 @@ uses
System.SysUtils,
System.Types,
System.WideStrings,
Winapi.Messages,
Winapi.msxml,
Winapi.Windows,
Xml.Win.msxmldom,
@ -106,7 +107,6 @@ type
FFileName: string;
FFiles: TProjectFileList;
FDisplayState: WideString;
FTempFileName: TTempFile; // I4181
FMRU: TMRUList;
FOptions: TProjectOptions;
@ -122,13 +122,14 @@ type
procedure MRUChange(Sender: TObject);
procedure UpdateFileParameters;
procedure LoadPersistedUntitledProject;
procedure PersistUntitledProjectUser;
function GetSavedUserFileName: string;
protected
procedure DoRefresh; virtual;
procedure DoRefreshCaption; virtual;
property State: TProjectState read FState;
property SavedFileName: string read GetSavedFileName;
property SavedUserFileName: string read GetSavedUserFileName;
public
procedure Log(AState: TProjectLogState; Filename, Msg: string); virtual;
@ -149,6 +150,8 @@ type
class function StandardTemplatePath: string;
class function StringsTemplatePath: string;
class function GetUntitledProjectFilename(CurrentProcess: Boolean): string;
function GetTargetFilename(ATargetFile, ASourceFile, AVersion: string): string; // I4688
//procedure AddMRU(const FFileName: string);
@ -167,6 +170,7 @@ type
property Busy: Boolean read FBusy write FBusy;
property MustSave: Boolean read FMustSave write FMustSave;
public
class var CompilerMessageFile: TProjectFile; // I4694
end;
@ -297,6 +301,10 @@ type
property CompilerWarningsAsErrors: Boolean read FCompilerWarningsAsErrors write FCompilerWarningsAsErrors; // I4865
end;
const
WM_USER_ProjectUpdateDisplayState = WM_USER;
function GlobalProjectStateWndHandle: THandle;
function ProjectCompilerMessage(line: Integer; msgcode: LongWord; text: PAnsiChar): Integer; stdcall; // I3310 // I4694
implementation
@ -319,6 +327,7 @@ uses
UMD5Hash,
Unicode,
utildir,
utilfiletypes,
utilsystem;
{ TProjectFileList }
@ -471,7 +480,7 @@ begin
if not Assigned(AProject) then // I4720
CheckGetFileParameters;
if Assigned(FDoCreateProjectFileUI) then // I4702
if (GetCurrentThreadId = MainThreadID) and Assigned(FDoCreateProjectFileUI) then // I4702
FDoCreateProjectFileUI(Self); // I4687
UpdateID;
@ -676,23 +685,30 @@ begin
inherited Create;
FMRU := TMRUList.Create('');
FMRU.OnChange := MRUChange;
FTempFileName := TTempFileManager.Get('.kpj'); // I4181
FFileName := AFileName;
FFiles := TProjectFileList.Create;
FFiles.OnChange := ListNotify;
FState := psReady;
FMustSave := False;
if (FFileName = '') and (ALoadPersistedUntitledProject) then
LoadPersistedUntitledProject // I1010: Persist untitled project
begin
FMustSave := True;
LoadPersistedUntitledProject; // I1010: Persist untitled project
end
else if not Load then // I4703
begin
FFileName := '';
LoadPersistedUntitledProject; // I4703
if not Load then
begin
FMustSave := True;
LoadPersistedUntitledProject; // I4703
end;
end;
FBusy := True;
FMustSave := False;
i := 0;
while i < FFiles.Count do
begin
@ -710,7 +726,6 @@ begin
FFiles.Free;
FMRU.Free;
FreeAndNil(FOptions); // I4688
FreeAndNil(FTempFileName); // I4181
inherited Destroy;
end;
@ -783,7 +798,7 @@ end;
procedure TProject.LoadPersistedUntitledProject;
begin
FFileName := GetFolderPath(CSIDL_APPDATA) + SFolderKeymanDeveloper + '\Untitled.kps';
FFileName := TProject.GetUntitledProjectFilename(False);
try
Load;
finally
@ -800,7 +815,7 @@ procedure TProject.PersistUntitledProject;
var
path: string;
begin
path := GetFolderPath(CSIDL_APPDATA) + SFolderKeymanDeveloper + '\Untitled.kps';
path := TProject.GetUntitledProjectFilename(False);
FState := psSaving;
with TProjectSaver.Create(Self, path) do
@ -809,22 +824,7 @@ begin
finally
Free;
end;
FState := psReady;
end;
procedure TProject.PersistUntitledProjectUser;
var
path: string;
begin
path := GetFolderPath(CSIDL_APPDATA) + SFolderKeymanDeveloper + '\Untitled.kps';
FState := psSaving;
with TProjectSaver.Create(Self, path) do
try
SaveUser;
finally
Free;
end;
FState := psReady;
end;
@ -854,12 +854,13 @@ begin
// Inject the user settings to the loaded file
//
if FileExists(SavedFileName + '.user') then // I4698
if FileExists(SavedUserFileName) then // I4698
begin
userdoc := MSXMLDOMDocumentFactory.CreateDOMDocument;
try
userdoc.async := False;
userdoc.load(SavedFileName + '.user');
userdoc.load(SavedUserFileName);
for i := 0 to userdoc.documentElement.childNodes.length - 1 do
doc.documentElement.appendChild(userdoc.documentElement.childNodes.item[i].cloneNode(true));
finally
@ -973,15 +974,12 @@ function TProject.SaveUser: Boolean;
begin
FState := psSaving;
try
if FFilename = '' then
PersistUntitledProjectUser
else
with TProjectSaver.Create(Self, SavedFileName) do
try
SaveUser;
finally
Free;
end;
with TProjectSaver.Create(Self, SavedFileName) do
try
SaveUser;
finally
Free;
end;
finally
FState := psReady;
end;
@ -992,10 +990,15 @@ end;
function TProject.GetSavedFileName: string;
begin
if FFileName = ''
then Result := FTempFileName.Name // I4181
then Result := TProject.GetUntitledProjectFilename(True) // I4181
else Result := FFileName;
end;
function TProject.GetSavedUserFileName: string;
begin
Result := ChangeFileExt(SavedFileName, Ext_ProjectSourceUser);
end;
function TProject.GetTargetFilename(ATargetFile, ASourceFile, AVersion: string): string; // I4688
begin
Result := Trim(Options.BuildPath);
@ -1031,6 +1034,13 @@ begin
end;
end;
class function TProject.GetUntitledProjectFilename(CurrentProcess: Boolean): string;
begin
if CurrentProcess
then Result := GetFolderPath(CSIDL_APPDATA) + SFolderKeymanDeveloper + '\Untitled.' + IntToStr(GetCurrentProcessId) + Ext_ProjectSource
else Result := GetFolderPath(CSIDL_APPDATA) + SFolderKeymanDeveloper + '\Untitled' + Ext_ProjectSource;
end;
procedure TProject.UpdateFileParameters; // I4688 // I4710
var
i: Integer;
@ -1167,4 +1177,72 @@ begin
CompilerWarningsAsErrors := False; // I4865
end;
type
TGlobalProjectStateWnd = class
private
procedure WndProc(var Message: TMessage);
constructor Create;
destructor Destroy; override;
end;
var
FGlobalProjectStateWnd: TGlobalProjectStateWnd = nil;
// Make this a global to prevent potential race
// condition causing an access violation. If it
// is an invalid window handle or 0 at destruction time,
// it's no big deal...
FGlobalProjectStateWndHandle: THandle = 0;
{ TGlobalProjectStateWnd }
constructor TGlobalProjectStateWnd.Create;
begin
inherited Create;
FGlobalProjectStateWndHandle := AllocateHWnd(WndProc);
end;
destructor TGlobalProjectStateWnd.Destroy;
var
h: THandle;
begin
h := FGlobalProjectStateWndHandle;
FGlobalProjectStateWndHandle := 0;
DeallocateHWnd(h);
inherited Destroy;
end;
procedure TGlobalProjectStateWnd.WndProc(var Message: TMessage);
var
PPath, PDisplayState: PChar;
begin
if Message.Msg = WM_USER_ProjectUpdateDisplayState then
begin
PPath := PChar(Message.WParam);
PDisplayState := PChar(Message.LParam);
if Assigned(FGlobalProject) and (FGlobalProject.FileName = PPath) then
begin
FGlobalProject.DisplayState := PDisplayState;
FGlobalProject.SaveUser;
end;
StrDispose(PDisplayState);
StrDispose(PPath);
end;
DefWindowProc(FGlobalProjectStateWndHandle, Message.Msg, Message.WParam, Message.LParam);
end;
function GlobalProjectStateWndHandle: THandle;
begin
Result := FGlobalProjectStateWndHandle;
end;
initialization
FGlobalProjectStateWnd := TGlobalProjectStateWnd.Create;
finalization
if FileExists(TProject.GetUntitledProjectFilename(True)) then
System.SysUtils.DeleteFile(TProject.GetUntitledProjectFilename(True));
if FileExists(ChangeFileExt(TProject.GetUntitledProjectFilename(True),Ext_ProjectSourceUser)) then
System.SysUtils.DeleteFile(ChangeFileExt(TProject.GetUntitledProjectFilename(True),Ext_ProjectSourceUser));
FGlobalProjectStateWnd.Free;
end.

View file

@ -60,7 +60,9 @@ uses
Keyman.Developer.System.Project.kmnProjectFile,
Keyman.Developer.System.Project.kpsProjectFile,
Keyman.Developer.System.Project.ProjectFiles,
Keyman.Developer.System.Project.ProjectFileType;
Keyman.Developer.System.Project.ProjectFileType,
utilfiletypes;
{ TProjectLoader }
@ -163,9 +165,9 @@ var
state: IXMLDocument;
viewState: IXMLNode;
begin
if not FileExists(FFileName + '.user') then Exit;
if not FileExists(ChangeFileExt(FFileName, Ext_ProjectSourceUser)) then Exit;
doc := LoadXMLDocument(FFileName + '.user'); //TXMLDocument.Create(nil);
doc := LoadXMLDocument(ChangeFileExt(FFileName, Ext_ProjectSourceUser)); //TXMLDocument.Create(nil);
root := doc.DocumentElement;
if root.NodeName <> 'KeymanDeveloperProjectUser' then
@ -182,7 +184,7 @@ begin
viewState.ChildNodes.Add(state.DocumentElement.ChildNodes[i].CloneNode(True));
try
doc.SaveToFile(FFileName + '.user');
doc.SaveToFile(ChangeFileExt(FFileName, Ext_ProjectSourceUser));
except
on E:EOleException do // I4212
begin
@ -191,6 +193,12 @@ begin
end;
end;
viewState := root.ChildNodes.FindNode('ViewState');
if Assigned(viewState) then
begin
FProject.DisplayState := viewState.XML;
end;
{ Load root nodes first - I708 }
fsroot := root.ChildNodes.FindNode('FileStates');
@ -216,7 +224,6 @@ begin
FProject.MRU.Append(node.ChildNodes[i].ChildNodes['FullPath'].NodeValue);
end;
end;
end;
end.

View file

@ -64,7 +64,8 @@ uses
System.Win.ComObj,
OnlineConstants,
Keyman.Developer.System.Project.ProjectFiles;
Keyman.Developer.System.Project.ProjectFiles,
utilfiletypes;
{ TProjectSaver }
@ -151,7 +152,7 @@ begin
end;
end;
doc.SaveToFile(FFileName + '.user');
doc.SaveToFile(ChangeFileExt(FFileName, Ext_ProjectSourceUser));
end;
end.

View file

@ -83,7 +83,7 @@ uses
PackageInfo;
{-------------------------------------------------------------------------------
- TkmnProjectFile -
- TkpsProjectFile -
-------------------------------------------------------------------------------}
procedure TkpsProjectFile.GetFileParameters;

View file

@ -213,12 +213,12 @@ begin
// Inject the user settings to the loaded file
//
if FileExists(SavedFileName + '.user') then // I4698
if FileExists(SavedUserFileName) then // I4698
begin
userdoc := MSXMLDOMDocumentFactory.CreateDOMDocument;
try
userdoc.async := False;
userdoc.load(SavedFileName + '.user');
userdoc.load(SavedUserFileName);
for i := 0 to userdoc.documentElement.childNodes.length - 1 do
doc.documentElement.appendChild(userdoc.documentElement.childNodes.item[i].cloneNode(true));
finally

View file

@ -271,8 +271,7 @@ function savestate() {
var xmlDoc = document.implementation.createDocument(null, "state");
appendElement(xmlDoc, 'path', projectPath);
appendElement(xmlDoc, 'tab', tabselected);
appendElement(xmlDoc, 'tab', tabselected.toString());
appendElement(xmlDoc, 'showhelp', document.getElementById('upperexpand').className == 'checkbox' ? "0":"1");
var files = document.getElementsByTagName('span');

View file

@ -51,6 +51,7 @@ const
Ext_KeymanSource = '.kmn';
Ext_Icon = '.ico';
Ext_ProjectSource = '.kpj';
Ext_ProjectSourceUser = '.kpj.user';
Ext_Javascript = '.js';
const ExtFileTypes: array[0..12] of TKMFileTypeInfo = (