From 4580f609118e13337b91b312fb4b8efd29b90980 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sat, 24 Jan 2015 07:51:42 +0100 Subject: [PATCH] started to wrap DUB format as a TComponent --- lazproj/coedit.lpi | 7 +- lazproj/coedit.lpr | 2 +- src/ce_dubwrap.pas | 181 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 src/ce_dubwrap.pas diff --git a/lazproj/coedit.lpi b/lazproj/coedit.lpi index 01f20e84..859059e6 100644 --- a/lazproj/coedit.lpi +++ b/lazproj/coedit.lpi @@ -140,7 +140,7 @@ - + @@ -353,6 +353,11 @@ + + + + + diff --git a/lazproj/coedit.lpr b/lazproj/coedit.lpr index 9c17110d..a82cb151 100644 --- a/lazproj/coedit.lpr +++ b/lazproj/coedit.lpr @@ -8,7 +8,7 @@ uses {$ENDIF}{$ENDIF} Interfaces, Forms, lazcontrols, runtimetypeinfocontrols, ce_observer, ce_libman, ce_tools, ce_dcd, ce_main, ce_writableComponent, ce_options, ce_symstring, - ce_staticmacro, ce_icons; + ce_staticmacro, ce_icons, ce_dubwrap; {$R *.res} diff --git a/src/ce_dubwrap.pas b/src/ce_dubwrap.pas new file mode 100644 index 00000000..109b8d48 --- /dev/null +++ b/src/ce_dubwrap.pas @@ -0,0 +1,181 @@ +unit ce_dubwrap; + +{$I ce_defines.inc} + +interface + +uses + Classes, SysUtils, ce_common, ce_writableComponent; + +type + + TDubTargetType = ( autodetect, none, executable{, library}, sourceLibrary, + staticLibrary, dynamicLibrary); + + TCEDubSubPackageItem = class(TCollectionItem) + + end; + + TCEDubSubPacakges = class(TCollection) + + end; + + TCEDubConfigurationItem = class(TCollectionItem) + + end; + + TCEDubConfigurations = class(TCollection) + + end; + + TCEDubBuildTypeItem = class(TCollectionItem) + + end; + + TCEDubBuildTypes = class(TCollection) + + end; + + + (** + * Warps a DUB JSON project. + * JSON fields are converted to streamable/inspectable/published properties. + * + * the properties must produce the right JSON type when saved with TJSONStreamer. + *) + TCEDubProject = class(TWritableJsonComponent) + private + fUpdateCount: NativeInt; + // + fPackageName: string; + fDescription: string; + fHomepage: string; + fAuthors: string; + fCopyright: string; + fLicense: string; + // + //fDependencies: ["" : , "" : , ...] TCollection + fTargetType: TDubTargetType; + fSystemDependencies: string; + fTargetName: string; + fTargetPath: string; + fWorkingDirectory: string; + // fSubConfigurations: ["string" : "string", "string": string, ...] TCollection + fMainSourceFile: string; + fbuildRequirements: TStringList; + fbuildOptions: TStringList; + fLibs: TStringList; + fSourceFiles: TStringList; + fSourcePaths: TStringList; + fExcludedSourceFiles: TStringList; + fCopyFiles: TStringList; + fVersions: TStringList; + fDebugVersions: TStringList; + fImportPaths: TStringList; + fStringImportPaths: TStringList; + fPreGenerateCommands: TStringList; + fPostGenerateCommands: TStringList; + fPreBuildCommands: TStringList; + fPostBuildCommands: TStringList; + fDflags: TStringList; + fLflags: TStringList; + // + fSubPackages: TCEDubSubPacakges; + fConfigurations: TCEDubConfigurations; + fBuildTypes: TCEDubBuildTypes; + fDdoxFilterArgs: TStringList; + published + + // global + property packageName: string read fPackageName; + property description: string read fDescription; + property homepage: string read fHomepage; + property authors: string read fAuthors; + property copyright: string read fCopyright; + property license: string read fLicense; + + // common build settings + //dependencies; + property systemDependencies: string read fSystemDependencies; + property targetType: TDubTargetType read fTargetType; + property targetName: string read fTargetName; + property targetPath: string read fTargetPath; + property workingDirectory: string read fWorkingDirectory; + //subConfigurations; + property buildRequirements: TStringList read FbuildRequirements; + property buildOptions: TStringList read fBuildOptions; + property libs: TStringList read fLibs; + property sourceFiles: TStringList read fSourceFiles; + property sourcePaths: TStringList read fSourcePaths; + property excludedSourceFiles: TStringList read fExcludedSourceFiles; + property mainSourceFile: string read fMainSourceFile; + property copyFiles: TStringList read fCopyFiles; + property versions: TStringList read fVersions; + property debugVersions: TStringList read fDebugVersions; + property importPaths: TStringList read fImportPaths; + property stringImportPaths: TStringList read fStringImportPaths; + property preGenerateCommands: TStringList read fPreGenerateCommands; + property postGenerateCommands: TStringList read fPostGenerateCommands; + property preBuildCommands: TStringList read fPreBuildCommands; + property postBuildCommands: TStringList read fPostBuildCommands; + property dflags: TStringList read fDflags; + property lflags: TStringList read fLflags; + + // collections + property subPackages: TCEDubSubPacakges read fSubPackages; + property configurations: TCEDubConfigurations read fConfigurations; + property buildTypes: TCEDubBuildTypes read fBuildTypes; + property ddoxFilterArgs: TStringList read fDdoxFilterArgs; + public + constructor create(aOwner: TComponent); override; + destructor destroy; override; + // + procedure Update; + procedure beginUpdate; + procedure endUpdate; + // + procedure getSourcesList(aList: TStringList); + + end; + +implementation + + +constructor TCEDubProject.create(aOwner: TComponent); +begin + inherited; +end; + +destructor TCEDubProject.destroy; +begin + inherited; +end; + +procedure TCEDubProject.beginUpdate; +begin + fUpdateCount += 1; +end; + +procedure TCEDubProject.endUpdate; +begin + fUpdateCount -= 1; + if fUpdateCount <= 0 then + Update; +end; + +procedure TCEDubProject.Update; +begin + fUpdateCount := 0; +end; + +procedure TCEDubProject.getSourcesList(aList: TStringList); +begin + { + sourceFiles - excluded + sourcePath - excluded + auto detection - excluded + } +end; + +end. +