diff --git a/.gitignore b/.gitignore index 2025223..5fa397c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ userPreferences.*/ # Other Project/Trash -Settings/buildApp.4DSettings # System files .DS_Store @@ -23,8 +22,11 @@ Thumbs.db *.4dbase/ UT_*.log Build_*.log +*.license4D Artifacts/ -Test/ -Build/ -Build4D_UnitTests_Build/ -Build4D_External_Build/ +zzz*.4dm + +# Build +*Test/ +*Build/ +*buildApp.4DSettings diff --git a/Build4D/Documentation/Classes/CompiledProject.md b/Build4D/Documentation/Classes/CompiledProject.md index 6d9dd7e..a78c643 100644 --- a/Build4D/Documentation/Classes/CompiledProject.md +++ b/Build4D/Documentation/Classes/CompiledProject.md @@ -1,7 +1,7 @@ ## Description -This class allows you to create a compiled project. It is composed of: +This class allows you to create a compiled project. It is composed of the following: * a [Class constructor](#class-constructor) * a [build()](#build) function @@ -13,22 +13,22 @@ Class constructor($customSettings : Object) ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $customSettings | Object | in | $customSettings is a custom settings object overriding target default settings stored in "/RESOURCES/CompiledProject.json" file | +| $customSettings | Object | in | $customSettings is a custom settings object overriding target default settings stored in the "/RESOURCES/CompiledProject.json" file. | $customSettings is an object that contains the following parameters: | Attributes | Type | Description | |---|---|---| -|buildName | String | Name of the target build. Defined by the component if missing in the custom settings.| -|projectFile | File or String | Project file. Pass the project file path if you want to build an external project. Not necessary if it is a current project.| -|destinationFolder | Folder or String | Folder where the build will be generated. Defined by the component if missing in the custom settings.| -|compilerOptions | Object | Compile options. The object is passed as parameter to the "Compile project" command if is not null.| +|buildName | String | Name of the target build, defined by the component if missing in the custom settings.| +|projectFile | File or String | Project file (relative to the open project/absolute/filesystem). Pass the project file path if you want to build an external project (not necessary if building the current project).| +|destinationFolder | Folder or String | Folder where the build will be generated (relative to the open project/absolute/filesystem), defined by the component if missing in the custom settings.| +|compilerOptions | Object | Compile options. The object is passed as parameter to the "Compile project" command if it is not null. For more details about the object format, read the documentation of the Compile project command.| |packedProject | Boolean | True if the project is compressed into a 4DZ file.| -|obfuscated | Boolean | True if the 4DZ shall not be dezippable.| +|obfuscated | Boolean | True if the 4DZ is to not be dezippable.| |includePaths[] | Collection of Objects | Collection of folders and files to include.| -|includePaths[].source | String | Source folder or file path (relative to the built project/absolute/filesystem strings).| -|includePaths[].destination | String | Destination folder path (relative to the built project/absolute/filesystem strings).| -|deletePaths[] | Collection of Strings | Collection of paths to folders and files to be deleted (relative to the built project/absolute/filesystem strings).| +|includePaths[].source | Folder, File, or String | Source folder or file path (relative to the open project/absolute/filesystem strings).| +|includePaths[].destination | Folder, File, or String | Destination folder path (relative to the built project/absolute/filesystem).| +|deletePaths[] | Collection of Folders, Files, or Strings | Collection of paths to folders and files to be deleted (relative to the built project/absolute/filesystem).| |logger | Formula | Formula called when a log is written.| ### build() @@ -38,7 +38,7 @@ Function build() -> $status : Boolean ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $status | Boolean | out | True if the build has been correctly executed | +| $status | Boolean | out | True if the build has been correctly executed. | Builds the compiled project. diff --git a/Build4D/Documentation/Classes/Component.md b/Build4D/Documentation/Classes/Component.md index 744568c..fc7390d 100644 --- a/Build4D/Documentation/Classes/Component.md +++ b/Build4D/Documentation/Classes/Component.md @@ -1,7 +1,7 @@ ## Description -This class allows you to create a component. It is composed of: +This class allows you to create a component. It is composed of the following: * a [Class constructor](#class-constructor) * a [build()](#build) function @@ -13,22 +13,22 @@ Class constructor($customSettings : Object) ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $customSettings | Object | in | $customSettings is a custom settings object overriding target default settings stored in "/RESOURCES/Component.json" file | +| $customSettings | Object | in | $customSettings is a custom settings object overriding target default settings stored in the "/RESOURCES/Component.json" file. | $customSettings is an object that contains the following parameters: | Attributes | Type | Description | |---|---|---| -|buildName | String | Name of the target build. Defined by the component if missing in the custom settings.| -|projectFile | File or String | Project file. Pass the project file path if you want to build an external project. Not necessary if it is a current project.| -|destinationFolder | Folder or String | Folder where the build will be generated. Defined by the component if missing in the custom settings.| -|compilerOptions | Object | Compile options. The object is passed as parameter to the "Compile project" command if is not null.| +|buildName | String | Name of the target build, defined by the component if missing in the custom settings.| +|projectFile | File or String | Project file (relative to the open project/absolute/filesystem). Pass the project file path if you want to build an external project (not necessary if building the current project=.| +|destinationFolder | Folder or String | Folder where the build will be generated (relative to the open project/absolute/filesystem), defined by the component if missing in the custom settings.| +|compilerOptions | Object | Compile options. The object is passed as parameter to the "Compile project" command if it is not null. For more details about the object format, read the documentation of the Compile project command.| |packedProject | Boolean | True if the project is compressed into a 4DZ file.| -|obfuscated | Boolean | True if the 4DZ shall not be dezippable.| +|obfuscated | Boolean | True if the 4DZ is to not be dezippable.| |includePaths[] | Collection of Objects | Collection of folders and files to include.| -|includePaths[].source | String | Source folder or file path (relative to the built project/absolute/filesystem strings).| -|includePaths[].destination | String | Destination folder path (relative to the built project/absolute/filesystem strings).| -|deletePaths[] | Collection of Strings | Collection of paths to folders and files to be deleted (relative to the built project/absolute/filesystem strings).| +|includePaths[].source | Folder, File, or String | Source folder or file path (relative to the open project/absolute/filesystem).| +|includePaths[].destination | Folder, File, or String | Destination folder or file path (relative to the built project/absolute/filesystem).| +|deletePaths[] | Collection of Folders, Files, or Strings | Collection of paths to folders and files to be deleted (relative to the built project/absolute/filesystem strings).| |signApplication.macSignature | Boolean | Signs the built applications.| |signApplication.macCertificate | String | Certificate name used for signature.| |signApplication.adHocSignature | Boolean | Signs the built applications with AdHoc signature if macSignature not performed.| @@ -41,7 +41,7 @@ Function build() -> $status : Boolean ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $status | Boolean | out | True if the build has been correctly executed| +| $status | Boolean | out | True if the build has been correctly executed.| Build the component. diff --git a/Build4D/Documentation/Classes/Standalone.md b/Build4D/Documentation/Classes/Standalone.md new file mode 100644 index 0000000..c7281c3 --- /dev/null +++ b/Build4D/Documentation/Classes/Standalone.md @@ -0,0 +1,137 @@ + +## Description + +This class allows you to create a standalone application. It is composed of the following: + +* a [Class constructor](#class-constructor) +* a [\_renameExecutable](#renameExecutable) function +* a [build()](#build) function + +### Class constructor + +```4D +Class constructor($customSettings : Object) +``` +| Parameter | Type | in/out | Description | +|---|---|---|---| +| $customSettings | Object | in | $customSettings is a custom settings object overriding target default settings stored in the "/RESOURCES/Standalone.json" file. | + +$customSettings is an object that contains the following parameters: + +| Attributes | Type | Description | +|---|---|---| +|buildName | String | Name of the target build, defined by the component if missing in the custom settings.| +|projectFile | File or String | Project file (relative to the open project/absolute/filesystem). Pass the project file path if you want to build an external project (not necessary if building the current project).| +|destinationFolder | Folder or String | Folder where the build will be generated (relative to the open project/absolute/filesystem), defined by the component if missing in the custom settings.| +|sourceAppFolder| Folder or String | Folder of the 4D Volume Desktop (relative to the open project/absolute/filesystem).| +|compilerOptions | Object | Compile options. The object is passed as parameter to the "Compile project" command if it is not null. For more details about the object format, read the documentation of the Compile project command.| +|packedProject | Boolean | True if the project is compressed into a 4DZ file.| +|obfuscated | Boolean | True if the 4DZ is to not be dezippable.| +|lastDataPathLookup| String | Defines the way the application stores its link with the last data file. Possible values: "ByAppName" (Default value) and "ByAppPath".| +|useSDI| Boolean | Allows to use the SDI interface mode instead of the MDI (Windows only).| +|startElevated| Boolean | Allows to start the Updater with elevated privileges (Windows only).| +|iconPath| File or String | File path of the icon to be used instead of the 4D Volume Desktop icon.| +|versioning| Object | Object containing the contents of the application information.| +|versioning.version| String | Version number. | +|versioning.copyright| String | Copyright text. | +|versioning.companyName| String | Company name. | +|versioning.fileDescription| String | Description (Windows only).| +|versioning.internalName| String | Internal name (Windows only).| +|includePaths[] | Collection of Objects | Collection of folders and files to include.| +|includePaths[].source | Folder, File, or String | Source folder or file path (relative to the open project/absolute/filesystem).| +|includePaths[].destination | Folder, File, or String | Destination folder path (relative to the built project/absolute/filesystem).| +|deletePaths[] | Collection of Folder, File, or Strings | Collection of paths to folders and files to be deleted (relative to the built project/absolute/filesystem strings).| +|excludeModules| Collection of Strings | Collection of module names to exclude from final application. The module names can be found in the "BuildappOptionalModules.json" file in the resources of the 4D application.| +|license| File or String | Unlimited desktop license file (relative to the built project/absolute/filesystem).| +|signApplication.macSignature | Boolean | Signs the built applications.| +|signApplication.macCertificate | String | Certificate name used for signature.| +|signApplication.adHocSignature | Boolean | Signs the built applications with AdHoc signature if macSignature not performed.| +|logger | Formula | Formula called when a log is written.| + +

_renameExecutable

+ +```4D +Function _renameExecutable() -> $status : Boolean +``` +| Parameter | Type | in/out | Description | +|---|---|---|---| +| $status | Boolean | out | True if the executable has been correctly renamed. | + +Renames the executable. + +### build() + +```4D +Function build() -> $status : Boolean +``` +| Parameter | Type | in/out | Description | +|---|---|---|---| +| $status | Boolean | out | True if the standalone has been correctly executed.| + +Builds the standalone application. + +## Example + +This code is an example to generate a standalone application from an external project. + +```4D +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean + +$settings:={} + +// Define the external project file +$settings.projectFile:=Folder(fk documents folder).file("Contact/Project/Contact.4DProject") + +// Configure the application +$settings.buildName:="myApp" +$settings.destinationFolder:="Test/" +$settings.obfuscated:=True +$settings.packedProject:=True +$settings.useSDI:=False +$settings.startElevated:=False +$settings.lastDataPathLookup:="ByAppPath" + +// Specify the components required for compilation +$componentsFolder:=Folder(fk documents folder).folder("4D v20.0/4D.app/Contents/Components") +$components:=[] +$components.push($componentsFolder.file("4D WritePro Interface.4dbase/4D WritePro Interface.4DZ")) +$settings.compilerOptions:={components: $components} + +// Define the 4D Volume Desktop path +$settings.sourceAppFolder:=Folder(fk documents folder).folder("4D v20.0/4D Volume Desktop.app") + +// Delete the unnecessary module +$settings.excludeModules:=["CEF"; "MeCab"] + +// Include the folders and files +$settings.includePaths:=[] +$settings.includePaths.push({source: $componentsFolder.folder("4D WritePro Interface.4dbase").path; destination: "../Components/"}) +$settings.includePaths.push({source: $componentsFolder.folder("4D SVG.4dbase").path; destination: "../Components/"}) + +// Delete the folders and files +$settings.deletePaths:=[] +$settings.deletePaths.push("Resources/Dev/") + +// Add the application icon +$settings.iconPath:="/RESOURCES/myIcon.icns" + +// Add the application information +$settings.versioning:={} +$settings.versioning.version:="version" +$settings.versioning.copyright:="copyright" +$settings.versioning.companyName:="companyName" + +// Create the deployment license file +$settings.license:=Folder(fk licenses folder).file("XXXXX.license4D") + +// Sign the macOS appplication +$settings.signApplication:={} +$settings.signApplication.macSignature:=True +$settings.signApplication.macCertificate:="xxxxxx" + +// Launch the build +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() +``` diff --git a/Build4D/Documentation/Classes/_core.md b/Build4D/Documentation/Classes/_core.md index 34ccdc4..8c9251d 100644 --- a/Build4D/Documentation/Classes/_core.md +++ b/Build4D/Documentation/Classes/_core.md @@ -1,19 +1,22 @@ ## Description -This class is a base class used by the other classes to create a compiled project or a component. It is composed of: +This class is a base class used by the other classes to create a compiled project or a component. It is composed of the following: * [Class constructor](#class-constructor) * [Function \_checkDestinationFolder](#function-checkDestinationFolder) -* [Function \_checkSettings](#function-checkSettings) * [Function \_compileProject](#function-compileProject) +* [Function \_copySourceApp](#function-copySourceApp) * [Function \_create4DZ](#function-create4DZ) * [Function \_createStructure](#function-createStructure) * [Function \_deletePaths](#function-deletePaths) +* [Function \_excludeModules](#function-excludeModules) +* [Function \_generateLicense](#function-generateLicense) * [Function \_includePaths](#function-includePaths) * [Function \_log](#function-log) * [Function \_overrideSettings](#function-overrideSettings) * [Function \_resolvePath()](#function-resolvePath) +* [Function \_setAppOptions()](#function-setAppOptions) * [Function \_sign()](#function-sign) ### Class constructor @@ -23,19 +26,20 @@ Class constructor($target : Text; $customSettings : Object) ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $target | Text | in | The target to build. The possible values are "CompiledProject" or "Component". | -| $customSettings | Object | in | Object containing all settings for target build | +| $target | Text | in | The target to build, the possible values are "CompiledProject" or "Component". | +| $customSettings | Object | in | Object containing all settings for target build. | $customSettings is an object that contains the following parameters: | Attributes | Type | Description | |---|---|---| |\_validInstance | Boolean | True if the instanciated object can be used for build. False if a condition is not filled (e.g. project doesn't exist).| -|\_projectFile | File | Project file| +|\_projectFile | File | Project file.| |\_projectPackage | Folder | Folder of the project package.| |\_isCurrentProject | Boolean | True if the project is the current one.| |\_isDefaultDestinationFolder | Boolean | True if the destination folder is the one computed automatically.| -|settings | Object | Root object containing all settings for target build. Can be overriden by a constructor's parameter. The structure of the $settings object is described in each class corresponding to the target.| +|\_structureFolder | Folder | Folder of the destination structure.| +|settings | Object | Root object containing all settings for target build. It can be overriden by a constructor's parameter. The structure of the $settings object is described in each class corresponding to the target.|

Function _checkDestinationFolder

@@ -48,26 +52,28 @@ Function _checkDestinationFolder() -> $status : Boolean Checks the destination folder. -

Function _checkSettings

+

Function _compileProject

```4D -Function _checkSettings($settings : Collection) -> $status : Boolean +Function _compileProject() -> $status : Boolean ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $parameters | Collection | in | | -| $status | Boolean | out | | +| $status | Boolean | out | True if the compilation has succeeded. Otherwise, the compilation's result object is included in an error log. | -

Function _compileProject

+Compiles the project with the settings.compilerOptions (if it exists). + +

Function _copySourceApp

```4D -Function _compileProject() -> $status : Boolean +Function _copySourceApp() -> $status : Boolean ``` + | Parameter | Type | in/out | Description | |---|---|---|---| -| $status | Boolean | out | True if the compilation has succeeded. If not, the compilation's result object is included in an error log. | +| $status | Boolean | out | True if the copy is successful. | -Compiles the project, with the settings.compilerOptions if exists. +Copies the source application (4D Volume Desktop or 4D Server) in the destination folder.

Function _create4DZ

@@ -76,9 +82,9 @@ Function _create4DZ() -> $status : Boolean ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $status | Boolean | out | True if the compression has succeeded. If not, the archive creation result object is included in an error log. | +| $status | Boolean | out | True if the compression has succeeded. Otherwise, the archive creation's result object is included in an error log. | -Creates the 4DZ file of the project, and deletes the Project folder if successful. +Creates the 4DZ file of the project, and deletes the Project folder if successful.

Function _createStructure

@@ -96,24 +102,44 @@ Creates the destination structure folders and files. ```4D Function _deletePaths($paths : Collection) -> $status : Boolean ``` - | Parameter | Type | in/out | Description | |---|---|---|---| -| $paths | Collection of texts | in | List of folders and files to delete | -| $status | Boolean | out | True if all paths have been correctly removed. If not, an error log is created with "path" information. | +| $paths | Collection of texts | in | List of folders and files to delete. | +| $status | Boolean | out | True if all paths have been correctly removed. Otherwise, an error log is created with "path" information. | Deletes folders and files from the destination structure. +

Function _excludeModules

+ +```4D +Function _excludeModules() -> $status : Boolean +``` +| Parameter | Type | in/out | Description | +|---|---|---|---| +| $status | Boolean | out | True if all modules have been correctly removed. Otherwise, an error log is created with "path" information.| + +Deletes the folders and files composing the module to be removed according to the information in the "/RESOURCES/BuildappOptionalModules.json" file. + +

Function _generateLicense

+ +```4D +Function _generateLicense() -> $status : Boolean +``` +| Parameter | Type | in/out | Description | +|---|---|---|---| +| $status | Boolean | out | True if the deployment license have been correctly created. Otherwise, xxx.| + +Creates the deployment license file in the license folder of the generated application. +

Function _includePaths

```4D Function _includePaths($pathsObj : Collection) -> $status : Boolean ``` - | Parameter | Type | in/out | Description | |---|---|---|---| -| $paths | Collection of objects | in | List of folder and file objects to include | -| $status | Boolean | out | True if all paths have been correctly copied. If not, an error log is created with "sourcePath" and "destinationPath" information. | +| $paths | Collection of objects | in | List of folder and file objects to include. | +| $status | Boolean | out | True if all paths have been correctly copied. Otherwise, an error log is created with "sourcePath" and "destinationPath" information. | Includes folders and files into the destination structure. @@ -124,7 +150,9 @@ Function _log($log : Object) ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $log | Object | in | | +| $log | Object | in | Object containing the attributes: "function", "message", "messageSeverity", and optionnaly: "result", "path", "sourcePath", "destinationPath". | + +Calls the settings.formulaForLogs formula with the $log object parameter.

Function _overrideSettings

@@ -133,7 +161,7 @@ Function _overrideSettings($settings : Object) ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $settings | Object | in | | +| $settings | Object | in | Settings passed by the derived class to override the default settings. | Overrides the default target settings with the $settings parameter. @@ -144,11 +172,22 @@ Function _resolvePath($path : Text; $baseFolder : 4D.Folder) -> $object : Object ``` | Parameter | Type | in/out | Description | |---|---|---|---| -| $path | Text | in | | -| $baseFolder | 4D.Folder | in | | -| $object | 4D.Folder or 4D.File | out | Return a 4D folder or 4D File | +| $path | Text | in | Relative path to $baseFolder. | +| $baseFolder | 4D.Folder | in | Absolute path. | +| $object | 4D.Folder or 4D.File | out | 4D folder or 4D File. | + +Resolves a relative/absolute/filesystem string path to a Folder/File object. + +

Function _setAppOptions

+ +```4D +Function _setAppOptions()-> $status : Boolean +``` +| Parameter | Type | in/out | Description | +|---|---|---|---| +| $status | Boolean | out | True if the information has been correctly added. | -Resolves a relative/absolute/filesystem string path to Folder/File object. +Sets the information to the application.

Function _sign

diff --git a/Build4D/Project/Build4D.4DProject b/Build4D/Project/Build4D.4DProject index 256d302..0d4876d 100644 --- a/Build4D/Project/Build4D.4DProject +++ b/Build4D/Project/Build4D.4DProject @@ -1,5 +1,5 @@ { "$comment": "The project file serves as an anchor to locate other project files", - "compatibilityVersion": 1950, + "compatibilityVersion": 2000, "tokenizedText": false } diff --git a/Build4D/Project/Sources/Classes/CompiledProject.4dm b/Build4D/Project/Sources/Classes/CompiledProject.4dm index 8f70a84..5b2130b 100644 --- a/Build4D/Project/Sources/Classes/CompiledProject.4dm +++ b/Build4D/Project/Sources/Classes/CompiledProject.4dm @@ -9,6 +9,16 @@ Class constructor($customSettings : Object) If (This._isDefaultDestinationFolder) This.settings.destinationFolder:=This.settings.destinationFolder.folder("CompiledProject/"+This.settings.buildName+"/") End if + This._structureFolder:=This.settings.destinationFolder + This._log(New object(\ + "function"; "Class constuctor"; \ + "message"; "Class init successful."; \ + "severity"; Information message)) + Else + This._log(New object(\ + "function"; "Class constuctor"; \ + "message"; "Class init failed."; \ + "severity"; Error message)) End if //MARK:- @@ -27,5 +37,4 @@ Function build()->$success : Boolean "function"; "Build"; "message"; \ "Compiled project build successful."; \ "messageSeverity"; Information message)) - End if - \ No newline at end of file + End if \ No newline at end of file diff --git a/Build4D/Project/Sources/Classes/Component.4dm b/Build4D/Project/Sources/Classes/Component.4dm index 8353c82..51c1ad2 100644 --- a/Build4D/Project/Sources/Classes/Component.4dm +++ b/Build4D/Project/Sources/Classes/Component.4dm @@ -2,7 +2,6 @@ Class extends _core //MARK:- Class constructor($customSettings : Object) - // TODO: Include documentation of private functions and shared methods in the includePaths collection. Super("Component"; $customSettings) @@ -11,6 +10,16 @@ Class constructor($customSettings : Object) This.settings.destinationFolder:=This.settings.destinationFolder.folder("Component/") End if This.settings.destinationFolder:=This.settings.destinationFolder.folder(This.settings.buildName+".4dbase/") + This._structureFolder:=This.settings.destinationFolder + This._log(New object(\ + "function"; "Class constuctor"; \ + "message"; "Class init successful."; \ + "severity"; Information message)) + Else + This._log(New object(\ + "function"; "Class constuctor"; \ + "message"; "Class init failed."; \ + "severity"; Error message)) End if //MARK:- @@ -32,5 +41,4 @@ Function build()->$success : Boolean "function"; "Build"; \ "message"; "Component build successful."; \ "messageSeverity"; Information message)) - End if - \ No newline at end of file + End if \ No newline at end of file diff --git a/Build4D/Project/Sources/Classes/Standalone.4dm b/Build4D/Project/Sources/Classes/Standalone.4dm new file mode 100644 index 0000000..59884f5 --- /dev/null +++ b/Build4D/Project/Sources/Classes/Standalone.4dm @@ -0,0 +1,134 @@ +Class extends _core + +//MARK:- +Class constructor($customSettings : Object) + var $currentAppInfo; $sourceAppInfo : Object + var $fileCheck : Boolean + + Super("Standalone"; $customSettings) + + If (This._validInstance) + If (This._isDefaultDestinationFolder) + This.settings.destinationFolder:=This.settings.destinationFolder.folder("Standalone/") + End if + This.settings.destinationFolder:=This.settings.destinationFolder.folder(This.settings.buildName+Choose(Is macOS; ".app"; "")+"/") + This._structureFolder:=This.settings.destinationFolder.folder(Choose(Is macOS; "Contents/"; "")+"Database/") + + //Checking license + If ((This.settings.license=Null) || (Not(OB Instance of(This.settings.license; 4D.File)))) + This._validInstance:=False + This._log(New object(\ + "function"; "License file checking"; \ + "message"; "License file is not defined"; \ + "severity"; Error message)) + Else + If (Not(This.settings.license.exists)) + This._validInstance:=False + This._log(New object(\ + "function"; "License file checking"; \ + "message"; "License file doesn't exist"; \ + "severity"; Error message; \ + "path"; This.settings.license.path)) + End if + End if + + //Checking source app + If ((This.settings.sourceAppFolder=Null) || (Not(OB Instance of(This.settings.sourceAppFolder; 4D.Folder)))) + This._validInstance:=False + This._log(New object(\ + "function"; "Source application folder checking"; \ + "message"; "Source application folder is not defined"; \ + "severity"; Error message)) + Else + If (Not(This.settings.sourceAppFolder.exists)) + This._validInstance:=False + This._log(New object(\ + "function"; "Source application folder checking"; \ + "message"; "Source application folder doesn't exist"; \ + "severity"; Error message; \ + "sourceAppFolder"; $settings.sourceAppFolder.path)) + Else + $fileCheck:=(Is macOS) ? This.settings.sourceAppFolder.file("Contents/MacOS/4D Volume Desktop").exists : This.settings.sourceAppFolder.file("4D Volume Desktop.4DE").exists + If (Not($fileCheck)) + This._validInstance:=False + This._log(New object(\ + "function"; "Source application folder checking"; \ + "message"; "Source application is not a 4D Volume Desktop"; \ + "severity"; Error message; \ + "sourceAppFolder"; $settings.sourceAppFolder.path)) + Else // Versions checking + $sourceAppInfo:=(Is macOS) ? This.settings.sourceAppFolder.file("Contents/Info.plist").getAppInfo() : This.settings.sourceAppFolder.file("Resources/Info.plist").getAppInfo() + $currentAppInfo:=(Is macOS) ? Folder(Application file; fk platform path).file("Contents/Info.plist").getAppInfo() : File(Application file; fk platform path).parent.file("Resources/Info.plist").getAppInfo() + If (($sourceAppInfo.CFBundleVersion=Null) || ($currentAppInfo.CFBundleVersion=Null) || ($sourceAppInfo.CFBundleVersion#$currentAppInfo.CFBundleVersion)) + This._validInstance:=False + This._log(New object(\ + "function"; "Source application version checking"; \ + "message"; "Source application version doesn't match to current application version"; \ + "severity"; Error message; \ + "sourceAppFolder"; $settings.sourceAppFolder.path)) + End if + End if + End if + End if + + If (This._validInstance) + This._log(New object(\ + "function"; "Class constuctor"; \ + "message"; "Class init successful."; \ + "severity"; Information message)) + Else + This._log(New object(\ + "function"; "Class constuctor"; \ + "message"; "Class init failed."; \ + "severity"; Error message)) + End if + Else + This._log(New object(\ + "function"; "Class constuctor"; \ + "message"; "Class init failed."; \ + "severity"; Error message)) + End if + + //MARK:- +Function _renameExecutable() : Boolean + var $renamedExecutable : 4D.File + If (Is macOS) + $renamedExecutable:=This.settings.destinationFolder.file("Contents/MacOS/4D Volume Desktop").rename(This.settings.buildName) + Else + $renamedExecutable:=This.settings.destinationFolder.file("4D Volume Desktop.4DE").rename(This.settings.buildName+".exe") + This.settings.destinationFolder.file("4D Volume Desktop.rsr").rename(This.settings.buildName+".rsr") + End if + If ($renamedExecutable.name#This.settings.buildName) + This._log(New object(\ + "function"; "Source app copy"; \ + "message"; "Unable to rename the app: '"+This.settings.buildName+"'"; \ + "severity"; Error message)) + return False + End if + return True + + //MARK:- +Function build()->$success : Boolean + $success:=This._validInstance + $success:=($success) ? This._checkDestinationFolder() : False + $success:=($success) ? This._compileProject() : False + $success:=($success) ? This._createStructure() : False + $success:=($success) ? This._copySourceApp() : False + $success:=($success) ? This._renameExecutable() : False + $success:=($success) ? This._setAppOptions() : False + $success:=($success) ? This._excludeModules() : False + $success:=($success) ? This._includePaths(This.settings.includePaths) : False + $success:=($success) ? This._deletePaths(This.settings.deletePaths) : False + $success:=($success) ? This._create4DZ() : False + $success:=($success) ? This._generateLicense() : False + If (Is macOS) + $success:=($success) ? This._sign() : False + End if + + If ($success) + This._log(New object(\ + "function"; "Build"; \ + "message"; "Standalone application build successful."; \ + "messageSeverity"; Information message)) + End if + \ No newline at end of file diff --git a/Build4D/Project/Sources/Classes/_core.4dm b/Build4D/Project/Sources/Classes/_core.4dm index 4053d86..12754d5 100644 --- a/Build4D/Project/Sources/Classes/_core.4dm +++ b/Build4D/Project/Sources/Classes/_core.4dm @@ -1,61 +1,61 @@ +property _validInstance; _isCurrentProject; _isDefaultDestinationFolder; _noError : Boolean +property _projectFile : 4D.File +property _currentProjectPackage; _projectPackage; _structureFolder : 4D.Folder +property logs : Collection +property settings : Object + Class constructor($target : Text; $customSettings : Object) - ON ERR CALL("onError") + ON ERR CALL("onError"; ek global) var $settings : Object - If (Application version<"1940") - ALERT("Minimum version to use this component is 4D v19 R4!") - Else - - This.logs:=New collection - This.settings:=New object() - This.settings.includePaths:=New collection - This.settings.deletePaths:=New collection - - If (File("/RESOURCES/"+$target+".json").exists) - This._overrideSettings(JSON Parse(File("/RESOURCES/"+$target+".json").getText())) // Loads target default settings + This.logs:=New collection + This.settings:=New object() + This.settings.includePaths:=New collection + This.settings.deletePaths:=New collection + + If (File("/RESOURCES/"+$target+".json").exists) + This._overrideSettings(JSON Parse(File("/RESOURCES/"+$target+".json").getText())) // Loads target default settings + End if + This._isDefaultDestinationFolder:=False + + $settings:=($customSettings#Null) ? $customSettings : New object() + + This._validInstance:=True + This._isCurrentProject:=True + This._projectFile:=File(Structure file(*); fk platform path) + This._currentProjectPackage:=Folder(Folder("/PACKAGE/"; *).platformPath; fk platform path) + If (($settings#Null) && ($settings.projectFile#Null) && \ + ((Value type($settings.projectFile)=Is object) && OB Instance of($settings.projectFile; 4D.File)) || \ + ((Value type($settings.projectFile)=Is text) && ($settings.projectFile#""))) + This._isCurrentProject:=False + This._projectFile:=This._resolvePath($settings.projectFile; This._currentProjectPackage) + If (Not(This._projectFile.exists)) + This._validInstance:=False + This._log(New object(\ + "function"; "Class constuctor"; \ + "message"; "Project file doesn't exist, instanciated object is unusable."; \ + "severity"; Error message)) End if - This._isDefaultDestinationFolder:=False - - $settings:=($customSettings#Null) ? $customSettings : New object() - - This._validInstance:=True - This._isCurrentProject:=True - This._projectFile:=File(Structure file(*); fk platform path) - If (($settings#Null) && ($settings.projectFile#Null) && ($settings.projectFile#"")) - This._isCurrentProject:=False - This._projectFile:=This._resolvePath($settings.projectFile; Folder("/PACKAGE/"; *)) - If (Not(This._projectFile.exists)) - This._validInstance:=False - This._log(New object(\ - "function"; "Class constuctor"; \ - "message"; "Project file doesn't exist, instanciated object is unusable."; \ - "severity"; Error message)) - End if + End if + + This._projectPackage:=This._projectFile.parent.parent + + If (This._validInstance) + This._overrideSettings($settings) + If ((This.settings.buildName=Null) || (This.settings.buildName="")) + This.settings.buildName:=This._projectFile.name + This._log(New object(\ + "function"; "Settings checking"; \ + "message"; "Build name automatically defined."; \ + "severity"; Information message)) End if - - This._projectPackage:=This._projectFile.parent.parent - - If (This._validInstance) - This._overrideSettings($settings) - If ((This.settings.buildName=Null) || (This.settings.buildName="")) - This.settings.buildName:=This._projectFile.name - This._log(New object(\ - "function"; "Settings checking"; \ - "message"; "Build name automatically defined."; \ - "severity"; Information message)) - End if - If (This.settings.destinationFolder=Null) - This.settings.destinationFolder:=This._projectPackage.parent.folder(This._projectFile.name+"_Build/") - This._isDefaultDestinationFolder:=True - This._log(New object(\ - "function"; "Settings checking"; \ - "message"; "Destination folder automatically defined."; \ - "severity"; Information message)) - End if + If (This.settings.destinationFolder=Null) + This.settings.destinationFolder:=This._projectPackage.parent.folder(This._projectFile.name+"_Build/") + This._isDefaultDestinationFolder:=True This._log(New object(\ - "function"; "Class constuctor"; \ - "message"; "Class init successful."; \ + "function"; "Settings checking"; \ + "message"; "Destination folder automatically defined."; \ "severity"; Information message)) End if End if @@ -70,8 +70,7 @@ Function _overrideSettings($settings : Object) For each ($entry; $entries) Case of : ($entry.key="destinationFolder") - //$settings.destinationFolder:=($settings.destinationFolder="@/") ? $settings.destinationFolder : $settings.destinationFolder+"/" - This.settings.destinationFolder:=This._resolvePath($settings.destinationFolder; This._projectPackage) + This.settings.destinationFolder:=This._resolvePath($settings.destinationFolder; This._currentProjectPackage) If (Not(OB Instance of(This.settings.destinationFolder; 4D.Folder))) This._validInstance:=False Else @@ -80,6 +79,19 @@ Function _overrideSettings($settings : Object) : ($entry.key="includePaths") This.settings.includePaths:=This.settings.includePaths.concat($settings.includePaths) + + : ($entry.key="iconPath") + This.settings.iconPath:=This._resolvePath($settings.iconPath; This._currentProjectPackage) + + : ($entry.key="license") + This.settings.license:=This._resolvePath($settings.license; Null) + + : ($entry.key="sourceAppFolder") + If (Value type($settings.sourceAppFolder)=Is text) + $settings.sourceAppFolder:=($settings.sourceAppFolder="@/") ? $settings.sourceAppFolder : $settings.sourceAppFolder+"/" + End if + This.settings.sourceAppFolder:=This._resolvePath($settings.sourceAppFolder; This._currentProjectPackage) + Else This.settings[$entry.key]:=$entry.value End case @@ -94,57 +106,71 @@ Function _log($log : Object) End if //MARK:- -Function _resolvePath($path : Text; $baseFolder : 4D.Folder) : Object - - var $absolutePath : Text - var $absoluteFolder; $app : 4D.Folder +Function _resolvePath($path : Variant; $baseFolder : 4D.Folder) : Object - $absoluteFolder:=$baseFolder Case of - : ($path="./@") // Relative path inside $baseFolder - $path:=Substring($path; 3) - $absolutePath:=$absoluteFolder.path+$path - : ($path="../@") // Relative path outside $baseFolder - While ($path="../@") - $absoluteFolder:=$absoluteFolder.parent - $path:=Substring($path; 4) - End while - $absolutePath:=$absoluteFolder.path+$path - Else // Absolute path or custom fileSystem + : ((Value type($path)=Is object) && (OB Instance of($path; 4D.File) || OB Instance of($path; 4D.Folder))) // $path is a File or a Folder + return $path + + : (Value type($path)=Is text) // $path is a text + var $absolutePath : Text + var $absoluteFolder; $app : 4D.Folder + + $absoluteFolder:=$baseFolder Case of - : ($path="/4DCOMPONENTS/@") - $app:=(Is macOS) ? Folder(Application file; fk platform path).folder("Contents/Components") : File(Application file; fk platform path).parent.folder("Components") - $path:=$app.path+Substring($path; 15) - - : (($path="") | ($path="/")) // Base folder - $absolutePath:=$baseFolder.path - - Else // Absolute path or baseFolder subpath + : ($path="./@") // Relative path inside $baseFolder + $path:=Substring($path; 3) + $absolutePath:=$absoluteFolder.path+$path + : ($path="../@") // Relative path outside $baseFolder + While ($path="../@") + $absoluteFolder:=$absoluteFolder.parent + $path:=Substring($path; 4) + End while + $absolutePath:=$absoluteFolder.path+$path + Else // Absolute path or custom fileSystem + Case of + : ($path="/4DCOMPONENTS/@") + $app:=(Is macOS) ? Folder(Application file; fk platform path).folder("Contents/Components") : File(Application file; fk platform path).parent.folder("Components") + $absolutePath:=$app.path+Substring($path; 15) + + : (($path="") | ($path="/")) // Base folder + $absolutePath:=$baseFolder.path + + Else // Absolute path or baseFolder subpath + + var $pathExists : Boolean + $pathExists:=($path="@/") ? Folder(Folder($path; *).platformPath; fk platform path).exists : File(File($path; *).platformPath; fk platform path).exists + $absolutePath:=($pathExists) ? $path : Choose($baseFolder#Null; $absoluteFolder.path; "")+$path + End case - var $pathExists : Boolean - $pathExists:=($path="@/") ? Folder(Folder($path; *).platformPath; fk platform path).exists : File(File($path; *).platformPath; fk platform path).exists - $absolutePath:=($pathExists) ? $path : $absoluteFolder.path+$path End case + return ($absolutePath="@/") ? Folder(Folder($absolutePath; *).platformPath; fk platform path) : File(File($absolutePath; *).platformPath; fk platform path) + + Else + return Null End case - return ($absolutePath="@/") ? Folder(Folder($absolutePath; *).platformPath; fk platform path) : File(File($absolutePath; *).platformPath; fk platform path) - //MARK:- -Function _checkDestinationFolder()->$result : Boolean +Function _checkDestinationFolder() : Boolean - $result:=True - If (Not(This.settings.destinationFolder.exists)) - $result:=This.settings.destinationFolder.create() - If (Not($result)) - This._log(New object(\ - "function"; "Destination folder checking"; \ - "message"; "Destination folder doesn't exist and can't be created"; \ - "severity"; Error message); \ - "destinationFolder"; This.settings.destinationFolder.path) - End if + This._noError:=True + + If (This.settings.destinationFolder.exists) // Delete destination folder content if exists + This.settings.destinationFolder.delete(fk recursive) End if + If (Not(This.settings.destinationFolder.create())) + This._log(New object(\ + "function"; "Destination folder checking"; \ + "message"; "Destination folder doesn't exist and can't be created"; \ + "severity"; Error message); \ + "destinationFolder"; This.settings.destinationFolder.path) + return False + End if + + return This._noError + //MARK:- Function _compileProject() : Boolean @@ -176,37 +202,37 @@ Function _compileProject() : Boolean //MARK:- Function _createStructure() : Boolean - var $destinationFolder; $librariesFolder : 4D.Folder + var $structureFolder; $librariesFolder : 4D.Folder var $deletePaths : Collection - + var $result : Boolean If (This._validInstance) - $destinationFolder:=This.settings.destinationFolder + $structureFolder:=This._structureFolder // Copy Project Folder - If ($destinationFolder.exists) // Empty the destination folder - $destinationFolder.delete(fk recursive) - $destinationFolder.create() + If ($structureFolder.exists) // Empty the structure folder + $structureFolder.delete(fk recursive) End if + $structureFolder.create() - This._projectFile.parent.copyTo($destinationFolder; fk overwrite) + This._projectFile.parent.copyTo($structureFolder; fk overwrite) // Remove source methods $deletePaths:=New collection - $deletePaths.push($destinationFolder.folder("Project/Sources/Classes/")) - $deletePaths.push($destinationFolder.folder("Project/Sources/DatabaseMethods/")) - $deletePaths.push($destinationFolder.folder("Project/Sources/Methods/")) - $deletePaths.push($destinationFolder.folder("Project/Sources/Triggers/")) - $deletePaths.push($destinationFolder.folder("Project/Trash/")) + $deletePaths.push($structureFolder.folder("Project/Sources/Classes/")) + $deletePaths.push($structureFolder.folder("Project/Sources/DatabaseMethods/")) + $deletePaths.push($structureFolder.folder("Project/Sources/Methods/")) + $deletePaths.push($structureFolder.folder("Project/Sources/Triggers/")) + $deletePaths.push($structureFolder.folder("Project/Trash/")) If (This._deletePaths($deletePaths)) - $deletePaths:=$destinationFolder.files(fk recursive).query("extension =:1"; ".4DM") // Table Form, Form and Form object methods + $deletePaths:=$structureFolder.files(fk recursive).query("extension =:1"; ".4DM") // Table Form, Form and Form object methods If (($deletePaths.length>0) || (This._deletePaths($deletePaths))) // Copy Libraries folder $librariesFolder:=This._projectPackage.folder("Libraries") If (($librariesFolder.exists) && ($librariesFolder.files.length)) - $librariesFolder.copyTo($destinationFolder; fk overwrite) + $librariesFolder.copyTo($structureFolder; fk overwrite) End if return True End if @@ -228,35 +254,29 @@ Function _includePaths($pathsObj : Collection) : Boolean "severity"; Error message)) return False Else - Case of - : (Value type($pathObj.source)=Is text) - $sourcePath:=This._resolvePath($pathObj.source; This._projectPackage) - : ((OB Instance of($pathObj.source; 4D.Folder)) || (OB Instance of($pathObj.source; 4D.File))) - $sourcePath:=$pathObj.source - Else - This._log(New object(\ - "function"; "Paths include"; \ - "message"; "Collection.source must contain Posix text paths, 4D.File objects or 4D.Folder objects"; \ - "severity"; Error message)) - return False - End case + If ((Value type($pathObj.source)=Is text) || (OB Instance of($pathObj.source; 4D.Folder)) || (OB Instance of($pathObj.source; 4D.File))) + $sourcePath:=This._resolvePath($pathObj.source; This._currentProjectPackage) + Else + This._log(New object(\ + "function"; "Paths include"; \ + "message"; "Collection.source must contain Posix text paths, 4D.File objects or 4D.Folder objects"; \ + "severity"; Error message)) + return False + End if End if If (Undefined($pathObj.destination)) - $destinationPath:=This.settings.destinationFolder + $destinationPath:=This._structureFolder Else - Case of - : (Value type($pathObj.destination)=Is text) - $destinationPath:=This._resolvePath($pathObj.destination; This.settings.destinationFolder) - : (OB Instance of($pathObj.destination; 4D.Folder)) - $destinationPath:=$pathObj.destination - Else - This._log(New object(\ - "function"; "Paths include"; \ - "message"; "Collection.destination must contain Posix text paths or 4D.Folder objects"; \ - "severity"; Error message)) - return False - End case + If ((Value type($pathObj.destination)=Is text) || (OB Instance of($pathObj.destination; 4D.Folder))) + $destinationPath:=This._resolvePath($pathObj.destination; This._structureFolder) + Else + This._log(New object(\ + "function"; "Paths include"; \ + "message"; "Collection.destination must contain Posix text paths or 4D.Folder objects"; \ + "severity"; Error message)) + return False + End if End if If (Not($destinationPath.exists) && Not($destinationPath.create())) @@ -310,18 +330,15 @@ Function _deletePaths($paths : Collection) : Boolean If (($paths#Null) && ($paths.length>0)) For each ($path; $paths) - Case of - : (Value type($path)=Is text) - $deletePath:=This._resolvePath($path; This.settings.destinationFolder) - : ((OB Instance of($path; 4D.Folder)) || (OB Instance of($path; 4D.File))) - $deletePath:=$path - Else - This._log(New object(\ - "function"; "Paths delete"; \ - "message"; "Collection must contain Posix text paths, 4D.File objects or 4D.Folder objects"; \ - "severity"; Error message)) - return False - End case + If ((Value type($path)=Is text) || ((OB Instance of($path; 4D.Folder)) || (OB Instance of($path; 4D.File)))) + $deletePath:=This._resolvePath($path; This._structureFolder) + Else + This._log(New object(\ + "function"; "Paths delete"; \ + "message"; "Collection must contain Posix text paths, 4D.File objects or 4D.Folder objects"; \ + "severity"; Error message)) + return False + End if If ($deletePath.exists) $deletePath.delete(fk recursive) @@ -349,18 +366,18 @@ Function _deletePaths($paths : Collection) : Boolean //MARK:- Function _create4DZ() : Boolean - var $destinationFolder : 4D.Folder + var $structureFolder : 4D.Folder var $zipStructure : Object var $return : Object If ((This._validInstance) && (This.settings.packedProject)) - $destinationFolder:=This.settings.destinationFolder + $structureFolder:=This._structureFolder $zipStructure:=New object - $zipStructure.files:=New collection($destinationFolder.folder("Project")) + $zipStructure.files:=New collection($structureFolder.folder("Project")) $zipStructure.encryption:=(This.settings.obfuscated) ? -1 : ZIP Encryption none - $return:=ZIP Create archive($zipStructure; $destinationFolder.file(This.settings.buildName+".4DZ")) + $return:=ZIP Create archive($zipStructure; $structureFolder.file(This.settings.buildName+".4DZ")) If ($return.success) - $destinationFolder.folder("Project").delete(Delete with contents) + $structureFolder.folder("Project").delete(Delete with contents) Else This._log(New object(\ "function"; "Package compression"; \ @@ -372,6 +389,204 @@ Function _create4DZ() : Boolean End if return True + //MARK:- +Function _copySourceApp() : Boolean + This._noError:=True + This.settings.sourceAppFolder.copyTo(This.settings.destinationFolder.parent; This.settings.destinationFolder.fullName) + return This._noError + + //MARK:- +Function _excludeModules() : Boolean + var $excludedModule; $path; $basePath : Text + var $optionalModulesFile : 4D.File + var $optionalModules : Object + var $paths; $modules : Collection + + This._noError:=True + + If ((This.settings.excludeModules#Null) && (This.settings.excludeModules.length>0)) + $optionalModulesFile:=(Is macOS) ? Folder(Application file; fk platform path).file("Contents/Resources/BuildappOptionalModules.json") : File(Application file; fk platform path).parent.file("Resources/BuildappOptionalModules.json") + If ($optionalModulesFile.exists) + $paths:=New collection + $basePath:=(Is macOS) ? This.settings.destinationFolder.path+"Contents/" : This.settings.destinationFolder.path + $optionalModules:=JSON Parse($optionalModulesFile.getText()) + For each ($excludedModule; This.settings.excludeModules) + $modules:=$optionalModules.modules.query("name = :1"; $excludedModule) + If ($modules.length>0) + If (($modules[0].foldersArray#Null) && ($modules[0].foldersArray.length>0)) + For each ($path; $modules[0].foldersArray) + $paths.push($basePath+$path+"/") + End for each + End if + If (($modules[0].filesArray#Null) && ($modules[0].filesArray.length>0)) + For each ($path; $modules[0].filesArray) + $paths.push($basePath+$path) + End for each + End if + End if + End for each + This._deletePaths($paths) + Else + This._log(New object(\ + "function"; "Modules exclusion"; \ + "message"; "Unable to find the modules file: "+$optionalModulesFile.path; \ + "severity"; Error message)) + return False + End if + End if + + return This._noError + + //MARK:- +Function _setAppOptions() : Boolean + var $appInfo; $exeInfo : Object + var $infoFile; $exeFile; $manifestFile : 4D.File + var $identifier : Text + + This._noError:=True + + $infoFile:=(Is macOS) ? This.settings.destinationFolder.file("Contents/Info.plist") : This.settings.destinationFolder.file("Resources/Info.plist") + + If ($infoFile.exists) + $appInfo:=New object(\ + "com.4D.BuildApp.ReadOnlyApp"; "true"; \ + "com.4D.BuildApp.LastDataPathLookup"; Choose((This.settings.lastDataPathLookup="ByAppName") | (This.settings.lastDataPathLookup="ByAppPath"); This.settings.lastDataPathLookup; "ByAppName"); \ + "DataFileConversionMode"; "0"\ + ) + $appInfo.SDIRuntime:=((This.settings.useSDI#Null) && This.settings.useSDI) ? "1" : "0" + + If (Is macOS) + $appInfo.CFBundleName:=This.settings.buildName + $appInfo.CFBundleDisplayName:=This.settings.buildName + $appInfo.CFBundleExecutable:=This.settings.buildName + $identifier:=((This.settings.versioning.companyName#Null) && (This.settings.versioning.companyName#"")) ? This.settings.versioning.companyName : "com.4d" + $identifier+="."+This.settings.buildName + $appInfo.CFBundleIdentifier:=$identifier + Else + $exeInfo:=New object("ProductName"; This.settings.buildName) + End if + + If (This.settings.iconPath#Null) // Set icon + If (This.settings.iconPath.exists) + If (Is macOS) + $appInfo.CFBundleIconFile:=This.settings.iconPath.fullName + This.settings.iconPath.copyTo(This.settings.destinationFolder.folder("Contents/Resources/")) + This.settings.iconPath.copyTo(This.settings.destinationFolder.folder("Contents/Resources/Images/WindowIcons/"); "windowIcon_205.icns"; fk overwrite) + Else // Windows + $exeInfo.WinIcon:=This.settings.iconPath + End if + Else + This._log(New object(\ + "function"; "Icon integration"; \ + "message"; "Icon file doesn't exist: "+This.settings.iconPath.path; \ + "severity"; Error message)) + End if + End if + + If (This.settings.versioning#Null) // Set version info + If (Is macOS) + If (This.settings.versioning.version#Null) + $appInfo.CFBundleVersion:=This.settings.versioning.version + $appInfo.CFBundleShortVersionString:=This.settings.versioning.version + End if + If (This.settings.versioning.copyright#Null) + $appInfo.NSHumanReadableCopyright:=This.settings.versioning.copyright + // Force macOS to get copyright from info.plist file instead of localized strings file + var $subFolder : 4D.Folder + var $infoPlistFile : 4D.File + var $resourcesSubFolders : Collection + var $fileContent : Text + $resourcesSubFolders:=This.settings.destinationFolder.folder("Contents/Resources/").folders() + For each ($subFolder; $resourcesSubFolders) + If ($subFolder.extension=".lproj") + $infoPlistFile:=$subFolder.file("InfoPlist.strings") + If ($infoPlistFile.exists) + $fileContent:=$infoPlistFile.getText() + $fileContent:=Replace string($fileContent; "CFBundleGetInfoString ="; "CF4DBundleGetInfoString ="; 1) + $fileContent:=Replace string($fileContent; "NSHumanReadableCopyright ="; "NS4DHumanReadableCopyright ="; 1) + $infoPlistFile.setText($fileContent) + End if + End if + End for each + End if + + Else // Windows + If (This.settings.versioning.version#Null) + $exeInfo.ProductVersion:=This.settings.versioning.version + $exeInfo.FileVersion:=This.settings.versioning.version + End if + If (This.settings.versioning.copyright#Null) + $exeInfo.LegalCopyright:=This.settings.versioning.copyright + End if + If (This.settings.versioning.companyName#Null) + $exeInfo.CompanyName:=This.settings.versioning.companyName + End if + If (This.settings.versioning.fileDescription#Null) + $exeInfo.FileDescription:=This.settings.versioning.fileDescription + End if + If (This.settings.versioning.internalName#Null) + $exeInfo.InternalName:=This.settings.versioning.internalName + End if + End if + End if + + $infoFile.setAppInfo($appInfo) + + If ($exeInfo#Null) + $exeFile:=This.settings.destinationFolder.file(This.settings.buildName+".exe") + If ($exeFile.exists) + $exeInfo.OriginalFilename:=$exeFile.fullName + $exeFile.setAppInfo($exeInfo) + Else + This._log(New object(\ + "function"; "Setting app options"; \ + "message"; "Exe file doesn't exist: "+$exeFile.path; \ + "severity"; Warning message)) + return False + End if + End if + + Else + This._log(New object(\ + "function"; "Setting app options"; \ + "message"; "Info.plist file doesn't exist: "+$infoFile.path; \ + "severity"; Warning message)) + return False + End if + + If (Is Windows) // Updater elevation rights + $manifestFile:=((This.settings.startElevated#Null) && (This.settings.startElevated))\ + ? This.settings.destinationFolder.file("Resources/Updater/elevated.manifest")\ + : This.settings.destinationFolder.file("Resources/Updater/normal.manifest") + $manifestFile.copyTo(This.settings.destinationFolder.folder("Resources/Updater/"); "Updater.exe.manifest"; fk overwrite) + This.settings.destinationFolder.file("Resources/Updater/elevated.manifest").delete() + This.settings.destinationFolder.file("Resources/Updater/normal.manifest").delete() + End if + + return This._noError + + //MARK:- +Function _generateLicense() : Boolean + var $status : Object + + If ((This.settings.license#Null) && (This.settings.license.exists)) + $status:=Create deployment license(This.settings.destinationFolder; This.settings.license) + If ($status.success) + return True + Else + This._log(New object(\ + "function"; "Deployment license creation"; \ + "message"; "Deployment license creation failed"; \ + "severity"; Error message; \ + "result"; $status)) + End if + Else + This._log(New object(\ + "function"; "Deployment license creation"; \ + "message"; "License file doesn't exist: "+Choose(This.settings.license#Null; This.settings.license.path; "Undefined"); \ + "severity"; Error message)) + End if + //MARK:- Function _sign() : Boolean @@ -389,7 +604,7 @@ Function _sign() : Boolean var $commandLine; $certificateName : Text var $signatureWorker : 4D.SystemWorker - $certificateName:=(Not(This.settings.signApplication.macSignature) && This.settings.signApplication.adHocSignature) ? "-" : This.settings.signApplication.macCertificate // If nAdHocSignature, the certificate name shall be '-' + $certificateName:=(Not(This.settings.signApplication.macSignature) && This.settings.signApplication.adHocSignature) ? "-" : This.settings.signApplication.macCertificate // If AdHocSignature, the certificate name shall be '-' If ($certificateName#"") diff --git a/Build4D/Project/Sources/Methods/buildComponent.4dm b/Build4D/Project/Sources/Methods/buildComponent.4dm index b2453b1..4c1b795 100644 --- a/Build4D/Project/Sources/Methods/buildComponent.4dm +++ b/Build4D/Project/Sources/Methods/buildComponent.4dm @@ -15,7 +15,7 @@ $targets:=(Is macOS) ? New collection("x86_64_generic"; "arm64_macOS_lib") : New $settings:=New object(\ "buildName"; "Build4D"; \ "compilerOptions"; New object("targets"; $targets); \ -"destinationFolder"; "../Build4D_UnitTests/Build4D_UnitTests/Components/"; \ +"destinationFolder"; "../Build4D_UnitTests/Components/"; \ "includePaths"; New collection(New object("source"; "Documentation/"))\ ) diff --git a/Build4D/Project/Sources/Methods/onError.4dm b/Build4D/Project/Sources/Methods/onError.4dm index cc9aaa1..21aa4de 100644 --- a/Build4D/Project/Sources/Methods/onError.4dm +++ b/Build4D/Project/Sources/Methods/onError.4dm @@ -1,2 +1,3 @@ //%attributes = {} This._log(New object("severity"; Error message; "callChain"; Get call chain; "errorCode"; Error; "errorMethod"; Error method; "errorLine"; Error line; "errorFormula"; Error formula)) +This._noError:=False diff --git a/Build4D/Project/Sources/catalog.4DCatalog b/Build4D/Project/Sources/catalog.4DCatalog index 553f52b..f42fe38 100644 --- a/Build4D/Project/Sources/catalog.4DCatalog +++ b/Build4D/Project/Sources/catalog.4DCatalog @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/Build4D/Project/Sources/settings.4DSettings b/Build4D/Project/Sources/settings.4DSettings index 68d866b..8653716 100644 --- a/Build4D/Project/Sources/settings.4DSettings +++ b/Build4D/Project/Sources/settings.4DSettings @@ -1,4 +1,4 @@ - + diff --git a/Build4D/Resources/CompiledProject.json b/Build4D/Resources/CompiledProject.json index 8d791ca..e5c9852 100644 --- a/Build4D/Resources/CompiledProject.json +++ b/Build4D/Resources/CompiledProject.json @@ -1,7 +1,7 @@ { "//target":"CompiledProject", "packedProject":true, - "obfuscated4DZ":false, + "obfuscated":false, "includePaths":[], "deletePaths":[] } diff --git a/Build4D/Resources/Component.json b/Build4D/Resources/Component.json index 8c3b7cd..31e2cf0 100644 --- a/Build4D/Resources/Component.json +++ b/Build4D/Resources/Component.json @@ -1,7 +1,7 @@ { "//target":"Component", "packedProject":true, - "obfuscated4DZ":false, + "obfuscated":false, "includePaths": [ { diff --git a/Build4D/Resources/Standalone.json b/Build4D/Resources/Standalone.json new file mode 100644 index 0000000..4fcd66a --- /dev/null +++ b/Build4D/Resources/Standalone.json @@ -0,0 +1,23 @@ +{ + "//target":"Standalone", + "packedProject":true, + "obfuscated":false, + "lastDataPathLookup":"ByAppName", + "includePaths": + [ + { + "source":"./Libraries/", + "destination":"./" + }, + { + "source":"./Resources/", + "destination":"./" + } + ], + "deletePaths":[], + "signApplication":{ + "macSignature":false, + "macCertificate":"", + "adHocSignature":true + } +} \ No newline at end of file diff --git a/Build4D/Resources/en.lproj/syntaxEN.json b/Build4D/Resources/en.lproj/syntaxEN.json index 94522ca..ff4b9f2 100644 --- a/Build4D/Resources/en.lproj/syntaxEN.json +++ b/Build4D/Resources/en.lproj/syntaxEN.json @@ -1,7 +1,7 @@ { "_method_": {}, "cs.Build4D": { - "Component": { + "CompiledProject": { "new()": { "Syntax": "**.new**( *customSettings* : Object )", "Params": [ @@ -32,7 +32,7 @@ "Summary": "" } }, - "CompiledProject": { + "Component": { "new()": { "Syntax": "**.new**( *customSettings* : Object )", "Params": [ @@ -44,6 +44,41 @@ ], "Summary": "" } + }, + "Standalone": { + "new()": { + "Syntax": "**.new**( *customSettings* : Object )", + "Params": [ + [ + "customSettings", + "Object", + "->" + ] + ], + "Summary": "" + } + } + }, + "CompiledProject": { + "build()": { + "Syntax": "**.build**()->success : Boolean", + "Params": [ + [ + "success", + "Boolean", + "<-" + ] + ], + "Summary": "" + }, + "_inheritedFrom_": "_core" + }, + "_core": { + "settings": { + "Syntax": "settings : Object" + }, + "logs": { + "Syntax": "logs : Collection" } }, "Component": { @@ -60,8 +95,7 @@ }, "_inheritedFrom_": "_core" }, - "_core": {}, - "CompiledProject": { + "Standalone": { "build()": { "Syntax": "**.build**()->success : Boolean", "Params": [ diff --git a/Build4D/Settings/buildApp.4DSettings b/Build4D/Settings/buildApp.4DSettings deleted file mode 100644 index 75ea34f..0000000 --- a/Build4D/Settings/buildApp.4DSettings +++ /dev/null @@ -1,59 +0,0 @@ - - - - - False - True - True - False - - ByAppPath - - - - True - Macintosh HD:Applications:4D v0.0:4D Volume Desktop.app: - - False - False - False - - - - False - ByAppName - False - - False - False - 1 - - - Build4D - :Build: - - 0 - - - 0 - - - 0 - - - 0 - - - - 1 - Macintosh HD:Users:Damien:Library:Application Support:4D:Licenses:R-4UUD190UUS001BCKBT078EA.license4D - - - - True - Damien FUZEAU - True - - - - diff --git a/Build4D_UnitTests/Build4D.icns b/Build4D_UnitTests/Build4D.icns new file mode 100644 index 0000000..5385610 Binary files /dev/null and b/Build4D_UnitTests/Build4D.icns differ diff --git a/Build4D_UnitTests/Build4D.ico b/Build4D_UnitTests/Build4D.ico new file mode 100644 index 0000000..1221738 Binary files /dev/null and b/Build4D_UnitTests/Build4D.ico differ diff --git a/Build4D_UnitTests/Build4D_External/Project/Sources/catalog.4DCatalog b/Build4D_UnitTests/Build4D_External/Project/Sources/catalog.4DCatalog index f1fcf12..1d7f73b 100644 --- a/Build4D_UnitTests/Build4D_External/Project/Sources/catalog.4DCatalog +++ b/Build4D_UnitTests/Build4D_External/Project/Sources/catalog.4DCatalog @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/folders.json b/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/folders.json deleted file mode 100644 index 995cc8d..0000000 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/folders.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "Default Classes": {}, - "Default Folder": { - "groups": [ - "Default Classes", - "Default Forms", - "Default Project Methods", - "Default Tables" - ] - }, - "Default Forms": {}, - "Default Project Methods": {}, - "Default Tables": {}, - "R3484": { - "methods": [ - "ut_R3484_TC4725", - "ut_R3484_TC4732", - "ut_R3484_TC4733" - ] - }, - "R3485": { - "methods": [ - "ut_R3485_TC4734", - "ut_R3485_TC4736", - "ut_R3485_TC6022", - "ut_R3485_TC6023" - ] - }, - "R3486": { - "methods": [ - "mut_R3486_TC4743", - "mut_R3486_TC4749", - "ut_R3486_TC4737", - "ut_R3486_TC4739", - "ut_R3486_TC4741", - "ut_R3486_TC4745", - "ut_R3486_TC4746", - "ut_R3486_TC4747", - "ut_R3486_TC4750" - ] - }, - "R3487": { - "methods": [ - "ut_R3487_TC5165", - "ut_R3487_TC5167", - "ut_R3487_TC5169", - "ut_R3487_TC5170", - "ut_R3487_TC5182", - "ut_R3487_TC5183", - "ut_R3487_TC5184", - "ut_R3487_TC5185", - "ut_R3487_TC5186", - "ut_R3487_TC5187", - "ut_R3487_TC6295", - "ut_R3487_TC6296" - ] - }, - "R3488": { - "methods": [ - "ut_R3488_TC5311", - "ut_R3488_TC5313", - "ut_R3488_TC5314", - "ut_R3488_TC5315" - ] - }, - "R3489": { - "methods": [ - "ut_R3489_TC5319", - "ut_R3489_TC5321", - "ut_R3489_TC5322" - ] - }, - "R3490": { - "methods": [ - "ut_R3490_TC5331", - "ut_R3490_TC5333" - ] - }, - "R3491": { - "methods": [ - "ut_R3491_TC5334", - "ut_R3491_TC5336", - "ut_R3491_TC5337" - ] - }, - "trash": {} -} \ No newline at end of file diff --git a/Build4D_UnitTests/Build4D_UnitTests/README.md b/Build4D_UnitTests/Build4D_UnitTests/README.md deleted file mode 100644 index ee725c8..0000000 --- a/Build4D_UnitTests/Build4D_UnitTests/README.md +++ /dev/null @@ -1 +0,0 @@ -## Build4D_UnitTests: DO NOT REMOVE FOR UNIT TESTS \ No newline at end of file diff --git a/Build4D_UnitTests/Build4D_UnitTests/Resources/UnitTests.txt b/Build4D_UnitTests/Build4D_UnitTests/Resources/UnitTests.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Build4D_UnitTests/Build4D_UnitTests/Documentation/Methods/onStartup.md b/Build4D_UnitTests/Documentation/Methods/onStartup.md similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Documentation/Methods/onStartup.md rename to Build4D_UnitTests/Documentation/Methods/onStartup.md diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Build4D_UnitTests.4DProject b/Build4D_UnitTests/Project/Build4D_UnitTests.4DProject similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Build4D_UnitTests.4DProject rename to Build4D_UnitTests/Project/Build4D_UnitTests.4DProject diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/DatabaseMethods/onStartup.4dm b/Build4D_UnitTests/Project/Sources/DatabaseMethods/onStartup.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/DatabaseMethods/onStartup.4dm rename to Build4D_UnitTests/Project/Sources/DatabaseMethods/onStartup.4dm diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/compilationError.4dm b/Build4D_UnitTests/Project/Sources/Methods/compilationError.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/compilationError.4dm rename to Build4D_UnitTests/Project/Sources/Methods/compilationError.4dm diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/compilationTest.4dm b/Build4D_UnitTests/Project/Sources/Methods/compilationTest.4dm similarity index 51% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/compilationTest.4dm rename to Build4D_UnitTests/Project/Sources/Methods/compilationTest.4dm index 3e8d5fe..a76b29e 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/compilationTest.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/compilationTest.4dm @@ -1,2 +1,2 @@ //%attributes = {} -ut_R3490_TC5331 +ut_1_R3490_TC5331 diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/compilerMethods.4dm b/Build4D_UnitTests/Project/Sources/Methods/compilerMethods.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/compilerMethods.4dm rename to Build4D_UnitTests/Project/Sources/Methods/compilerMethods.4dm diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/logGitHubActions.4dm b/Build4D_UnitTests/Project/Sources/Methods/logGitHubActions.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/logGitHubActions.4dm rename to Build4D_UnitTests/Project/Sources/Methods/logGitHubActions.4dm diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/mut_R3486_TC4743.4dm b/Build4D_UnitTests/Project/Sources/Methods/mut_2_R3486_TC4743.4dm similarity index 94% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/mut_R3486_TC4743.4dm rename to Build4D_UnitTests/Project/Sources/Methods/mut_2_R3486_TC4743.4dm index 1fe008c..79776b3 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/mut_R3486_TC4743.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/mut_2_R3486_TC4743.4dm @@ -23,7 +23,7 @@ If (Is macOS) $settings.compilerOptions:=New object("targets"; New collection("x86_64_generic"; "arm64_macOS_lib")) // Silicon compilation mandatory, else no code to sign, so can't check requested result $settings.signApplication:=New object(\ "macSignature"; True; \ - "macCertificate"; "Damien FUZEAU") + "macCertificate"; Storage.settings.macCertificate) $build:=cs.Build4D.Component.new($settings) @@ -48,7 +48,7 @@ If (Is macOS) End if // Cleanup build folder - Folder("/PACKAGE/Test"; *).delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -76,8 +76,10 @@ If (Is macOS) End if // Cleanup build folder - Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) SET ASSERT ENABLED($assertions) +Else + ALERT("macOS only!") End if diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/mut_R3486_TC4749.4dm b/Build4D_UnitTests/Project/Sources/Methods/mut_2_R3486_TC4749.4dm similarity index 94% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/mut_R3486_TC4749.4dm rename to Build4D_UnitTests/Project/Sources/Methods/mut_2_R3486_TC4749.4dm index 37d9344..4a60354 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/mut_R3486_TC4749.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/mut_2_R3486_TC4749.4dm @@ -23,7 +23,7 @@ If (Is macOS) $settings.compilerOptions:=New object("targets"; New collection("x86_64_generic"; "arm64_macOS_lib")) // Silicon compilation mandatory, else no code to sign, so can't check requested result $settings.signApplication:=New object(\ "macSignature"; True; \ - "macCertificate"; "Damien FUZEAU"; \ + "macCertificate"; Storage.settings.macCertificate; \ "adHocSignature"; False) $build:=cs.Build4D.Component.new($settings) @@ -49,7 +49,7 @@ If (Is macOS) End if // Cleanup build folder - Folder("/PACKAGE/Test"; *).delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -77,8 +77,10 @@ If (Is macOS) End if // Cleanup build folder - Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) SET ASSERT ENABLED($assertions) +Else + ALERT("macOS only!") End if diff --git a/Build4D_UnitTests/Project/Sources/Methods/mut_3_R11086_TC11488.4dm b/Build4D_UnitTests/Project/Sources/Methods/mut_3_R11086_TC11488.4dm new file mode 100644 index 0000000..0594d24 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/mut_3_R11086_TC11488.4dm @@ -0,0 +1,46 @@ +//%attributes = {} +// Define an icon +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $link : Text +var $assertions : Boolean +var $log : Variant + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +$assertions:=Get assert enabled +SET ASSERT ENABLED(True) + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) +$settings.iconPath:=(Is macOS) ? File("/PACKAGE/Build4D.icns") : File("/PACKAGE/Build4D.ico") + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() +TRACE +// Check icon + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() +TRACE +// Check icon + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +SET ASSERT ENABLED($assertions) diff --git a/Build4D_UnitTests/Project/Sources/Methods/mut_3_R11087_TC11217.4dm b/Build4D_UnitTests/Project/Sources/Methods/mut_3_R11087_TC11217.4dm new file mode 100644 index 0000000..58195ff --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/mut_3_R11087_TC11217.4dm @@ -0,0 +1,78 @@ +//%attributes = {} +// Test application signature with certificate +If (Is macOS) + var $build : cs.Build4D.Standalone + var $settings : Object + var $success : Boolean + var $link : Text + var $assertions : Boolean + $link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + + $assertions:=Get assert enabled + SET ASSERT ENABLED(True) + + logGitHubActions(Current method name) + + // MARK:- Current project + + $settings:=New object() + $settings.formulaForLogs:=Formula(logGitHubActions($1)) + $settings.destinationFolder:="./Test/" + $settings.license:=Storage.settings.licenseUUD + $settings.compilerOptions:=New object("targets"; New collection("x86_64_generic"; "arm64_macOS_lib")) + $settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + $settings.signApplication:=New object(\ + "macSignature"; True; \ + "macCertificate"; Storage.settings.macCertificate; \ + "adHocSignature"; False) + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + ASSERT($success; "(Current project) Standalone build should success"+$link) + + var $verificationWorker : 4D.SystemWorker + $verificationWorker:=4D.SystemWorker.new("codesign -dv --verbose=4 "+$build.settings.destinationFolder.path) + $verificationWorker.wait(120) + If ($verificationWorker.terminated) + If ($verificationWorker.exitCode=0) + // The application is signed with certificate if a line "Authority=certificate name" exists + var $lines : Collection + $lines:=Split string($verificationWorker.responseError; "\n") + ASSERT(Not(Undefined($lines.find(Formula($1.value=$2); "Authority="+Storage.settings.macCertificate))); "(Current project) Standalone should be signed. Verification response: "+$verificationWorker.responseError+$link) + End if + End if + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) + + // MARK:- External project + + $settings.projectFile:=Storage.settings.externalProjectFile + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + ASSERT($success; "(External project) Standalone build should success"+$link) + + var $verificationWorker : 4D.SystemWorker + $verificationWorker:=4D.SystemWorker.new("codesign -dv --verbose=4 "+$build.settings.destinationFolder.path) + $verificationWorker.wait(120) + If ($verificationWorker.terminated) + If ($verificationWorker.exitCode=0) + // The application is signed with certificate if a line "Authority=certificate name" exists + var $lines : Collection + $lines:=New collection() + $lines:=Split string($verificationWorker.responseError; "\n") + ASSERT(Not(Undefined($lines.find(Formula($1.value=$2); "Authority="+Storage.settings.macCertificate))); "(External project) Standalone should be signed. Verification response: "+$verificationWorker.responseError+$link) + End if + End if + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) + + SET ASSERT ENABLED($assertions) + +Else + ALERT("macOS only!") +End if diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/onError.4dm b/Build4D_UnitTests/Project/Sources/Methods/onError.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/onError.4dm rename to Build4D_UnitTests/Project/Sources/Methods/onError.4dm diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/onStartup.4dm b/Build4D_UnitTests/Project/Sources/Methods/onStartup.4dm similarity index 57% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/onStartup.4dm rename to Build4D_UnitTests/Project/Sources/Methods/onStartup.4dm index fd5304f..23a0284 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/onStartup.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/onStartup.4dm @@ -3,25 +3,17 @@ If (Count parameters=0) // Execute code in a new worker - //var $rootFolder; $externalRootFolder : Text - //$rootFolder:=Folder(Folder(fk database folder; *).platformPath; fk platform path).path - //$externalRootFolder:=Folder($rootFolder).parent.folder("Build4D_External").path Use (Storage) - Storage.settings:=New shared object("rootFolder"; Folder(Folder(fk database folder; *).platformPath; fk platform path)) - //"projectName"; File(Structure file(*); fk platform path).name; \ - "externalRootFolder"; Folder(Folder(fk database folder; *).platformPath; fk platform path).parent.folder("Build4D_External"); \ - "externalProjectName"; ""; \ - "userInterface"; Not(Get application info.headless); \ - "logRunFile"; File($rootFolder+"UT_run.log").path; \ - "logErrorFile"; File($rootFolder+"UT_errors.log").path\ - ) + Storage.settings:=New shared object() + Storage.settings:=OB Copy(JSON Parse(File("/PACKAGE/Settings/UT_Settings.json").getText()); ck shared) End use Use (Storage.settings) + Storage.settings.rootFolder:=Folder(Folder(fk database folder; *).platformPath; fk platform path) Storage.settings.projectName:=File(Structure file(*); fk platform path).name Storage.settings.userInterface:=Not(Get application info.headless) - Storage.settings.externalProjectRootFolder:=Storage.settings.rootFolder.parent.folder("Build4D_External") + Storage.settings.externalProjectRootFolder:=Storage.settings.rootFolder.folder("Build4D_External") Storage.settings.externalProjectName:="Build4D_External" - Storage.settings.externalProjectFile:=Storage.settings.externalProjectRootFolder.path+"Project/Build4D_External.4DProject" + Storage.settings.externalProjectFile:=Storage.settings.externalProjectRootFolder.file("Project/Build4D_External.4DProject") Storage.settings.logRunFile:=Storage.settings.rootFolder.file("UT_run.log") Storage.settings.logErrorFile:=Storage.settings.rootFolder.file("UT_errors.log") End use diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/runAutomaticUnitTests.4dm b/Build4D_UnitTests/Project/Sources/Methods/runAutomaticUnitTests.4dm similarity index 65% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/runAutomaticUnitTests.4dm rename to Build4D_UnitTests/Project/Sources/Methods/runAutomaticUnitTests.4dm index 1b0eb95..8760621 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/runAutomaticUnitTests.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/runAutomaticUnitTests.4dm @@ -2,12 +2,14 @@ //Performs all automatic unit tests var $artifactsFolder : 4D.Folder +var $errorsLogFile : 4D.File $artifactsFolder:=Storage.settings.rootFolder.parent.parent.folder("Artifacts") $artifactsFolder.folder("Build4D.4dbase").delete(Delete with contents) +$errorsLogFile:=Storage.settings.logErrorFile Storage.settings.logRunFile.delete() Storage.settings.logErrorFile.delete() -Storage.settings.rootFolder.file("UT_start.log").setText(Timestamp) // Write a starting file to check for writing permission +Storage.settings.rootFolder.file("UT_start.log").setText(Timestamp) Storage.settings.rootFolder.file("UT_end.log").delete() var $errorMethod : Text @@ -22,30 +24,27 @@ logGitHubActions("::group::Storage content") logGitHubActions(New object("Storage content"; Storage)) logGitHubActions("::endgroup::") -var $errorsLogFile : 4D.File -$errorsLogFile:=Storage.settings.logErrorFile -If (Not($errorsLogFile.exists)) // If project unit tests failed, no need to perform component unit tests... - // Check compilation first - logGitHubActions("::group::Compilation checking (compilationTest)") - compilationTest - logGitHubActions("::endgroup::") +// Check compilation first +logGitHubActions("::group::Compilation checking (compilationTest)") +compilationTest +logGitHubActions("::endgroup::") + +If (Not($errorsLogFile.exists)) // Compilation Ok -> execute all unit tests methods + + // Execute all automatic test methods + ARRAY TEXT($methods; 0) + var $m : Integer + METHOD GET NAMES($methods; "ut_@") + SORT ARRAY($methods) + For ($m; 1; Size of array($methods)) + logGitHubActions("::group::"+$methods{$m}) + EXECUTE METHOD($methods{$m}) + logGitHubActions("::endgroup::") + End for - If (Not($errorsLogFile.exists)) // Compilation Ok -> execute all unit tests methods - - // Execute all automatic test methods - ARRAY TEXT($methods; 0) - var $m : Integer - METHOD GET NAMES($methods; "ut_@") - SORT ARRAY($methods) - For ($m; 1; Size of array($methods)) - logGitHubActions("::group::"+$methods{$m}) - EXECUTE METHOD($methods{$m}) - logGitHubActions("::endgroup::") - End for - - End if End if + Storage.settings.rootFolder.file("UT_end.log").setText(Timestamp) logGitHubActions("Unit Tests end") diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/runManualUnitTests.4dm b/Build4D_UnitTests/Project/Sources/Methods/runManualUnitTests.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/runManualUnitTests.4dm rename to Build4D_UnitTests/Project/Sources/Methods/runManualUnitTests.4dm diff --git a/Build4D_UnitTests/Project/Sources/Methods/runUnitTests1.4dm b/Build4D_UnitTests/Project/Sources/Methods/runUnitTests1.4dm new file mode 100644 index 0000000..5028544 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/runUnitTests1.4dm @@ -0,0 +1,47 @@ +//%attributes = {} +//Performs automatic unit tests on target 1: compiledProject + +var $target : Text +$target:=Substring(Current method name; Length(Current method name)) + +Storage.settings.logRunFile.delete() +Storage.settings.logErrorFile.delete() +Storage.settings.rootFolder.file("UT_start.log").setText(Timestamp) +Storage.settings.rootFolder.file("UT_end.log").delete() + +var $errorMethod : Text +$errorMethod:=Method called on error +ON ERR CALL("onError") + +METHOD SET CODE("compilationError"; ""; *) +SET ASSERT ENABLED(True) + +logGitHubActions("Unit Tests "+$target+" start") +logGitHubActions("::group::Storage content") +logGitHubActions(New object("Storage content"; Storage)) +logGitHubActions("::endgroup::") + +// Execute all automatic test methods +ARRAY TEXT($methods; 0) +var $m : Integer +METHOD GET NAMES($methods; "ut_"+$target+"_@") +SORT ARRAY($methods) +For ($m; 1; Size of array($methods)) + logGitHubActions("::group::"+$methods{$m}) + EXECUTE METHOD($methods{$m}) + logGitHubActions("::endgroup::") +End for + +Storage.settings.rootFolder.file("UT_end.log").setText(Timestamp) +logGitHubActions("Unit Tests "+$target+" end") + +If (Storage.settings.userInterface) + If (Storage.settings.logErrorFile.exists) + ALERT("Unit tests "+$target+" FAILED") + SHOW ON DISK(Storage.settings.logErrorFile.platformPath) + Else + ALERT("Unit tests "+$target+" passed") + End if +End if + +ON ERR CALL($errorMethod) diff --git a/Build4D_UnitTests/Project/Sources/Methods/runUnitTests2.4dm b/Build4D_UnitTests/Project/Sources/Methods/runUnitTests2.4dm new file mode 100644 index 0000000..a19e54e --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/runUnitTests2.4dm @@ -0,0 +1,47 @@ +//%attributes = {} +//Performs automatic unit tests on target 1: component + +var $target : Text +$target:=Substring(Current method name; Length(Current method name)) + +Storage.settings.logRunFile.delete() +Storage.settings.logErrorFile.delete() +Storage.settings.rootFolder.file("UT_start.log").setText(Timestamp) +Storage.settings.rootFolder.file("UT_end.log").delete() + +var $errorMethod : Text +$errorMethod:=Method called on error +ON ERR CALL("onError") + +METHOD SET CODE("compilationError"; ""; *) +SET ASSERT ENABLED(True) + +logGitHubActions("Unit Tests "+$target+" start") +logGitHubActions("::group::Storage content") +logGitHubActions(New object("Storage content"; Storage)) +logGitHubActions("::endgroup::") + +// Execute all automatic test methods +ARRAY TEXT($methods; 0) +var $m : Integer +METHOD GET NAMES($methods; "ut_"+$target+"_@") +SORT ARRAY($methods) +For ($m; 1; Size of array($methods)) + logGitHubActions("::group::"+$methods{$m}) + EXECUTE METHOD($methods{$m}) + logGitHubActions("::endgroup::") +End for + +Storage.settings.rootFolder.file("UT_end.log").setText(Timestamp) +logGitHubActions("Unit Tests "+$target+" end") + +If (Storage.settings.userInterface) + If (Storage.settings.logErrorFile.exists) + ALERT("Unit tests "+$target+" FAILED") + SHOW ON DISK(Storage.settings.logErrorFile.platformPath) + Else + ALERT("Unit tests "+$target+" passed") + End if +End if + +ON ERR CALL($errorMethod) diff --git a/Build4D_UnitTests/Project/Sources/Methods/runUnitTests3.4dm b/Build4D_UnitTests/Project/Sources/Methods/runUnitTests3.4dm new file mode 100644 index 0000000..578451f --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/runUnitTests3.4dm @@ -0,0 +1,47 @@ +//%attributes = {} +//Performs automatic unit tests on target 1: standalone + +var $target : Text +$target:=Substring(Current method name; Length(Current method name)) + +Storage.settings.logRunFile.delete() +Storage.settings.logErrorFile.delete() +Storage.settings.rootFolder.file("UT_start.log").setText(Timestamp) +Storage.settings.rootFolder.file("UT_end.log").delete() + +var $errorMethod : Text +$errorMethod:=Method called on error +ON ERR CALL("onError") + +METHOD SET CODE("compilationError"; ""; *) +SET ASSERT ENABLED(True) + +logGitHubActions("Unit Tests "+$target+" start") +logGitHubActions("::group::Storage content") +logGitHubActions(New object("Storage content"; Storage)) +logGitHubActions("::endgroup::") + +// Execute all automatic test methods +ARRAY TEXT($methods; 0) +var $m : Integer +METHOD GET NAMES($methods; "ut_"+$target+"_@") +SORT ARRAY($methods) +For ($m; 1; Size of array($methods)) + logGitHubActions("::group::"+$methods{$m}) + EXECUTE METHOD($methods{$m}) + logGitHubActions("::endgroup::") +End for + +Storage.settings.rootFolder.file("UT_end.log").setText(Timestamp) +logGitHubActions("Unit Tests "+$target+" end") + +If (Storage.settings.userInterface) + If (Storage.settings.logErrorFile.exists) + ALERT("Unit tests "+$target+" FAILED") + SHOW ON DISK(Storage.settings.logErrorFile.platformPath) + Else + ALERT("Unit tests "+$target+" passed") + End if +End if + +ON ERR CALL($errorMethod) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC4734.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC4734.4dm similarity index 78% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC4734.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC4734.4dm index a48a066..6d9abff 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC4734.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC4734.4dm @@ -19,7 +19,7 @@ $settings.buildName:="Build4D" $build:=cs.Build4D.CompiledProject.new($settings) $destinationFolder:=$build._projectPackage.parent.folder($build._projectFile.name+"_Build/CompiledProject/"+$build.settings.buildName) -ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(Current project) Wrong default destination folder: "+$build.settings.destinationFolder.platformPath+" (https://dev.azure.com/4dimension/4D/_workitems/edit/4734)") +ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(Current project) Wrong default destination folder: "+$build.settings.destinationFolder.platformPath+$link) $success:=$build.build() @@ -37,8 +37,8 @@ $settings.projectFile:=Storage.settings.externalProjectFile $build:=cs.Build4D.CompiledProject.new($settings) -$destinationFolder:=Storage.settings.externalProjectRootFolder.parent.folder($build._projectFile.name+"_Build/CompiledProject/"+$build.settings.buildName) -ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(External project) Wrong default destination folder: "+$build.settings.destinationFolder.platformPath+" (https://dev.azure.com/4dimension/4D/_workitems/edit/4734)") +$destinationFolder:=$build._projectPackage.parent.folder($build._projectFile.name+"_Build/CompiledProject/"+$build.settings.buildName) +ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(External project) Wrong default destination folder: "+$build.settings.destinationFolder.platformPath+$link) $success:=$build.build() @@ -48,5 +48,4 @@ $compiledProject:=$build.settings.destinationFolder.file($build.settings.buildNa ASSERT($compiledProject.exists; "(External project) Compiled project should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.parent.folder($build._projectFile.name+"_Build").delete(fk recursive) - +$build._projectPackage.parent.folder($build._projectFile.name+"_Build").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC4736.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC4736.4dm similarity index 80% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC4736.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC4736.4dm index 89d25b5..0c7e8a1 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC4736.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC4736.4dm @@ -19,8 +19,8 @@ $settings.destinationFolder:="./Test/" $build:=cs.Build4D.CompiledProject.new($settings) -$destinationFolder:=Folder("/PACKAGE/Test"; *) -ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(Current project) Wrong specified destination folder: "+$build.settings.destinationFolder.platformPath+" (https://dev.azure.com/4dimension/4D/_workitems/edit/4736)") +$destinationFolder:=Folder("/PACKAGE/Test") +ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(Current project) Wrong specified destination folder: "+$build.settings.destinationFolder.platformPath+$link) $success:=$build.build() @@ -30,7 +30,7 @@ $compiledProject:=$destinationFolder.file($build.settings.buildName+".4DZ") ASSERT($compiledProject.exists; "(Current project) Compiled project should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -38,8 +38,7 @@ $settings.projectFile:=Storage.settings.externalProjectFile $build:=cs.Build4D.CompiledProject.new($settings) -$destinationFolder:=Storage.settings.externalProjectRootFolder.folder("Test") -ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(External project) Wrong specified destination folder: "+$build.settings.destinationFolder.platformPath+" (https://dev.azure.com/4dimension/4D/_workitems/edit/4736)") +ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(External project) Wrong specified destination folder: "+$build.settings.destinationFolder.platformPath+$link) $success:=$build.build() @@ -49,5 +48,5 @@ $compiledProject:=$destinationFolder.file($build.settings.buildName+".4DZ") ASSERT($compiledProject.exists; "(External project) Compiled project should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC6022.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC6022.4dm similarity index 75% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC6022.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC6022.4dm index b544434..f73e951 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC6022.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC6022.4dm @@ -17,17 +17,17 @@ $settings.destinationFolder:="./Test/" $build:=cs.Build4D.CompiledProject.new($settings) -ASSERT($build.settings.buildName=Storage.settings.projectName; "(Current project) Wrong default build name: "+$build.settings.buildName+" (https://dev.azure.com/4dimension/4D/_workitems/edit/4736)") +ASSERT($build.settings.buildName=Storage.settings.projectName; "(Current project) Wrong default build name: "+$build.settings.buildName+$link) $success:=$build.build() ASSERT($success; "(Current project) Compiled project build should success"+$link) -$compiledProject:=Folder("/PACKAGE/Test"; *).file(Storage.settings.projectName+".4DZ") +$compiledProject:=Folder("/PACKAGE/Test").file(Storage.settings.projectName+".4DZ") ASSERT($compiledProject.exists; "(Current project) Compiled project should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -35,15 +35,15 @@ $settings.projectFile:=Storage.settings.externalProjectFile $build:=cs.Build4D.CompiledProject.new($settings) -ASSERT($build.settings.buildName=Storage.settings.externalProjectName; "(External project) Wrong default build name: "+$build.settings.buildName+" (https://dev.azure.com/4dimension/4D/_workitems/edit/4736)") +ASSERT($build.settings.buildName=Storage.settings.externalProjectName; "(External project) Wrong default build name: "+$build.settings.buildName+$link) $success:=$build.build() ASSERT($success; "(External project) Compiled project build should success"+$link) -$compiledProject:=Storage.settings.externalProjectRootFolder.folder("Test").file(Storage.settings.externalProjectName+".4DZ") +$compiledProject:=Folder("/PACKAGE/Test").file(Storage.settings.externalProjectName+".4DZ") ASSERT($compiledProject.exists; "(External project) Compiled project should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC6023.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC6023.4dm similarity index 68% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC6023.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC6023.4dm index 6782059..eded00e 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3485_TC6023.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3485_TC6023.4dm @@ -3,7 +3,6 @@ var $build : cs.Build4D.CompiledProject var $settings : Object var $success : Boolean -var $destinationFolder : 4D.Folder var $compiledProject : 4D.File var $link : Text $link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" @@ -19,18 +18,17 @@ $settings.buildName:="TEST" $build:=cs.Build4D.CompiledProject.new($settings) -$destinationFolder:=Folder("/PACKAGE/Test"; *) -ASSERT($build.settings.buildName="TEST"; "(Current project) Wrong specified build name: "+$build.settings.buildName+" (https://dev.azure.com/4dimension/4D/_workitems/edit/4736)") +ASSERT($build.settings.buildName="TEST"; "(Current project) Wrong specified build name: "+$build.settings.buildName+$link) $success:=$build.build() ASSERT($success; "(Current project) Compiled project build should success"+$link) -$compiledProject:=$destinationFolder.file("TEST.4DZ") +$compiledProject:=Folder("/PACKAGE/Test").file("TEST.4DZ") ASSERT($compiledProject.exists; "(Current project) Compiled project should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -38,15 +36,13 @@ $settings.projectFile:=Storage.settings.externalProjectFile $build:=cs.Build4D.CompiledProject.new($settings) -$destinationFolder:=Storage.settings.externalProjectRootFolder.folder("Test") -ASSERT($build.settings.buildName="TEST"; "(External project) Wrong specified build name: "+$build.settings.buildName+" (https://dev.azure.com/4dimension/4D/_workitems/edit/4736)") +ASSERT($build.settings.buildName="TEST"; "(External project) Wrong specified build name: "+$build.settings.buildName+$link) $success:=$build.build() ASSERT($success; "(External project) Compiled project build should success"+$link) -$compiledProject:=$destinationFolder.file("TEST.4DZ") ASSERT($compiledProject.exists; "(External project) Compiled project should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3489_TC5319.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3489_TC5319.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3489_TC5319.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3489_TC5319.4dm index 40147e6..27560be 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3489_TC5319.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3489_TC5319.4dm @@ -30,7 +30,7 @@ $zip:=ZIP Read archive($compiledProject) ASSERT($zip=Null; "(Current project) Compiled project 4DZ file shouldn't be unzippable"+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -47,4 +47,4 @@ $zip:=ZIP Read archive($compiledProject) ASSERT($zip=Null; "(External project) Compiled project 4DZ file shouldn't be unzippable"+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3489_TC5321.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3489_TC5321.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3489_TC5321.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3489_TC5321.4dm index 3fdd9cd..34795d2 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3489_TC5321.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3489_TC5321.4dm @@ -31,7 +31,7 @@ ASSERT($zip#Null; "(Current project) Compiled project 4DZ file should be unzippa $zip:=Null // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -49,4 +49,4 @@ ASSERT($zip#Null; "Compiled project 4DZ file should be unzippable"+$link) $zip:=Null // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3489_TC5322.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3489_TC5322.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3489_TC5322.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3489_TC5322.4dm index 82f985b..ca30c65 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3489_TC5322.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3489_TC5322.4dm @@ -29,7 +29,7 @@ ASSERT($zip#Null; "(Current project) Compiled project 4DZ file should be unzippa $zip:=Null // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -47,4 +47,4 @@ ASSERT($zip#Null; "(External project) Compiled project 4DZ file should be unzipp $zip:=Null // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3490_TC5331.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3490_TC5331.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3490_TC5331.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3490_TC5331.4dm diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3490_TC5333.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3490_TC5333.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3490_TC5333.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3490_TC5333.4dm diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3491_TC5334.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3491_TC5334.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3491_TC5334.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3491_TC5334.4dm index cc8e0a8..43a0b4d 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3491_TC5334.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3491_TC5334.4dm @@ -27,7 +27,7 @@ $compiledProject:=$build.settings.destinationFolder.file($build.settings.buildNa ASSERT($compiledProject.exists; "(Current project) Compiled project 4DZ file should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -43,4 +43,4 @@ $compiledProject:=$build.settings.destinationFolder.file($build.settings.buildNa ASSERT($compiledProject.exists; "(External project) Compiled project 4DZ file should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3491_TC5336.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3491_TC5336.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3491_TC5336.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3491_TC5336.4dm index da55787..0dd4817 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3491_TC5336.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3491_TC5336.4dm @@ -27,7 +27,7 @@ $compiledProject:=$build.settings.destinationFolder.file($build.settings.buildNa ASSERT($compiledProject.exists=False; "(Current project) Compiled project 4DZ file should not exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -43,4 +43,4 @@ $compiledProject:=$build.settings.destinationFolder.file($build.settings.buildNa ASSERT($compiledProject.exists=False; "(External project) Compiled project 4DZ file should not exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3491_TC5337.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3491_TC5337.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3491_TC5337.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_1_R3491_TC5337.4dm index a99f9d1..4d2b012 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3491_TC5337.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_1_R3491_TC5337.4dm @@ -26,7 +26,7 @@ $compiledProject:=$build.settings.destinationFolder.file($build.settings.buildNa ASSERT($compiledProject.exists; "(Current project) Compiled project 4DZ file should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -42,4 +42,4 @@ $compiledProject:=$build.settings.destinationFolder.file($build.settings.buildNa ASSERT($compiledProject.exists; "(External project) Compiled project 4DZ file should exist: "+$compiledProject.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3484_TC4725.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3484_TC4725.4dm similarity index 83% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3484_TC4725.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3484_TC4725.4dm index b3edb36..4a295f1 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3484_TC4725.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3484_TC4725.4dm @@ -18,7 +18,7 @@ $settings.destinationFolder:="Test/" $build:=cs.Build4D.Component.new($settings) -$destinationFolder:=Folder("/PACKAGE/Test"; *).folder($build.settings.buildName+".4dbase/") +$destinationFolder:=Folder("/PACKAGE/Test").folder($build.settings.buildName+".4dbase/") ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(Current project) Wrong custom destination folder: "+$build.settings.destinationFolder.platformPath+$link) $success:=$build.build() @@ -28,7 +28,7 @@ ASSERT($success; "(Current project) Component build should success"+$link) ASSERT($build.settings.destinationFolder.exists; "(Current project) Component should be placed in the custom destination folder: "+$build.settings.destinationFolder.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -36,7 +36,6 @@ $settings.projectFile:=Storage.settings.externalProjectFile $build:=cs.Build4D.Component.new($settings) -$destinationFolder:=Storage.settings.externalProjectRootFolder.folder("Test/"+$build.settings.buildName+".4dbase/") ASSERT($build.settings.destinationFolder.platformPath=$destinationFolder.platformPath; "(External project) Wrong custom destination folder: "+$build.settings.destinationFolder.platformPath+$link) $success:=$build.build() @@ -46,4 +45,4 @@ ASSERT($success; "(External project) Component build should success"+$link) ASSERT($build.settings.destinationFolder.exists; "(External project) Component should be placed in the custom destination folder: "+$build.settings.destinationFolder.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3484_TC4732.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3484_TC4732.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3484_TC4732.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3484_TC4732.4dm diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3484_TC4733.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3484_TC4733.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3484_TC4733.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3484_TC4733.4dm diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4737.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4737.4dm similarity index 99% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4737.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4737.4dm index 1402bbe..6f406eb 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4737.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4737.4dm @@ -18,7 +18,6 @@ If (Is macOS) $settings.compilerOptions:=New object("targets"; New collection("x86_64_generic"; "arm64_macOS_lib")) // Silicon compilation mandatory, else no code to sign, so can't check requested result $build:=cs.Build4D.Component.new($settings) - $success:=$build.build() ASSERT($success; "(Current project) Component build should success"+$link) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4739.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4739.4dm similarity index 95% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4739.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4739.4dm index 18c8513..c0ecf07 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4739.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4739.4dm @@ -41,7 +41,7 @@ If (Is macOS) End if // Cleanup build folder - Folder("/PACKAGE/Test"; *).delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -70,6 +70,6 @@ If (Is macOS) End if // Cleanup build folder - Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) End if diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4741.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4741.4dm similarity index 95% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4741.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4741.4dm index 8a04ade..5317cc1 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4741.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4741.4dm @@ -42,7 +42,7 @@ If (Is macOS) End if // Cleanup build folder - Folder("/PACKAGE/Test"; *).delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -71,5 +71,5 @@ If (Is macOS) End if // Cleanup build folder - Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) End if diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4745.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4745.4dm similarity index 95% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4745.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4745.4dm index 957df1e..f09472b 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4745.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4745.4dm @@ -44,7 +44,7 @@ If (Is macOS) End if // Cleanup build folder - Folder("/PACKAGE/Test"; *).delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -73,6 +73,6 @@ If (Is macOS) End if // Cleanup build folder - Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) End if diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4746.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4746.4dm similarity index 96% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4746.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4746.4dm index 003d1d9..dd02363 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4746.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4746.4dm @@ -44,7 +44,7 @@ If (Is macOS) End if // Cleanup build folder - Folder("/PACKAGE/Test"; *).delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -73,6 +73,6 @@ If (Is macOS) End if // Cleanup build folder - Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) End if diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4747.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4747.4dm similarity index 96% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4747.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4747.4dm index a1868f9..6e9f8d8 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4747.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4747.4dm @@ -44,7 +44,7 @@ If (Is macOS) End if // Cleanup build folder - Folder("/PACKAGE/Test"; *).delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -73,6 +73,6 @@ If (Is macOS) End if // Cleanup build folder - Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) End if diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4750.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4750.4dm similarity index 95% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4750.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4750.4dm index 54b0281..c551a77 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3486_TC4750.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3486_TC4750.4dm @@ -44,7 +44,7 @@ If (Is macOS) End if // Cleanup build folder - Folder("/PACKAGE/Test"; *).delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -73,6 +73,6 @@ If (Is macOS) End if // Cleanup build folder - Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) + Folder("/PACKAGE/Test").delete(fk recursive) End if diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5165.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5165.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5165.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5165.4dm index 63b8fd5..7d45ece 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5165.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5165.4dm @@ -30,7 +30,7 @@ $includedFolder:=$build.settings.destinationFolder.folder("Test/Documentation/") ASSERT($includedFolder.exists; "(Current project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -46,5 +46,5 @@ $includedFolder:=$build.settings.destinationFolder.folder("Test/Documentation/") ASSERT($includedFolder.exists; "(External project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5167.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5167.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5167.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5167.4dm index e035f9f..2e026c9 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5167.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5167.4dm @@ -30,7 +30,7 @@ $includedFile:=$build.settings.destinationFolder.file("Test/README.md") ASSERT($includedFile.exists; "(Current project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -46,5 +46,5 @@ $includedFile:=$build.settings.destinationFolder.file("Test/README.md") ASSERT($includedFile.exists; "(External project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5169.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5169.4dm similarity index 93% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5169.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5169.4dm index aec16f4..1d7c098 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5169.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5169.4dm @@ -30,7 +30,7 @@ $includedFolder:=$build.settings.destinationFolder.folder("Test/Documentation") ASSERT($includedFolder.exists; "(Current project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -50,4 +50,4 @@ $includedFolder:=$build.settings.destinationFolder.folder("Test/Documentation") ASSERT($includedFolder.exists; "(External project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5170.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5170.4dm similarity index 96% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5170.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5170.4dm index 20f2ef1..478dc69 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5170.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5170.4dm @@ -30,7 +30,7 @@ $includedFile:=$build.settings.destinationFolder.file("Test/README.md") ASSERT($includedFile.exists; "(Current project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project // Filesystems are relative to the project executing the code, so they can not be resolved related to an external project \ No newline at end of file diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5182.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5182.4dm similarity index 93% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5182.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5182.4dm index 74f96ba..8e8ccfe 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5182.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5182.4dm @@ -30,7 +30,7 @@ $includedFile:=$build.settings.destinationFolder.file("Test/README.md") ASSERT($includedFile.exists; "(Current project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -50,4 +50,4 @@ $includedFile:=$build.settings.destinationFolder.file("Test/README.md") ASSERT($includedFile.exists; "(External project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5183.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5183.4dm similarity index 80% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5183.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5183.4dm index 59f4d1c..c560328 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5183.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5183.4dm @@ -30,15 +30,11 @@ $includedFolder:=Folder(fk database folder; *).folder("Test/Documentation") ASSERT($includedFolder.exists; "(Current project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project $settings.projectFile:=Storage.settings.externalProjectFile -$settings.includePaths:=New collection(New object(\ -"source"; "./Documentation/"; \ -"destination"; Storage.settings.externalProjectRootFolder.folder("Test").path)\ -) $build:=cs.Build4D.Component.new($settings) @@ -46,8 +42,7 @@ $success:=$build.build() ASSERT($success; "(External project) Component build should success"+$link) -$includedFolder:=Storage.settings.externalProjectRootFolder.folder("Test/Documentation") ASSERT($includedFolder.exists; "(External project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5184.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5184.4dm similarity index 80% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5184.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5184.4dm index 3a2547a..f495a09 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5184.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5184.4dm @@ -30,15 +30,11 @@ $includedFile:=Folder(fk database folder; *).file("Test/README.md") ASSERT($includedFile.exists; "(Current project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project $settings.projectFile:=Storage.settings.externalProjectFile -$settings.includePaths:=New collection(New object(\ -"source"; "./README.md"; \ -"destination"; Storage.settings.externalProjectRootFolder.folder("Test").path)\ -) $build:=cs.Build4D.Component.new($settings) @@ -46,8 +42,7 @@ $success:=$build.build() ASSERT($success; "(External project) Component build should success"+$link) -$includedFile:=Storage.settings.externalProjectRootFolder.file("Test/README.md") ASSERT($includedFile.exists; "(External project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5185.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5185.4dm similarity index 79% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5185.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5185.4dm index cc25a3d..6476448 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5185.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5185.4dm @@ -30,15 +30,11 @@ $includedFolder:=Folder(fk database folder; *).folder("Test/Documentation") ASSERT($includedFolder.exists; "(Current project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project $settings.projectFile:=Storage.settings.externalProjectFile -$settings.includePaths:=New collection(New object(\ -"source"; Storage.settings.externalProjectRootFolder.folder("Documentation").path; \ -"destination"; Storage.settings.externalProjectRootFolder.folder("Test").path)\ -) $build:=cs.Build4D.Component.new($settings) @@ -46,8 +42,7 @@ $success:=$build.build() ASSERT($success; "(External project) Component build should success"+$link) -$includedFolder:=Storage.settings.externalProjectRootFolder.folder("Test/Documentation") ASSERT($includedFolder.exists; "(External project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5186.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5186.4dm similarity index 79% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5186.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5186.4dm index 4987522..67867a4 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5186.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5186.4dm @@ -30,15 +30,11 @@ $includedFile:=Folder(fk database folder; *).file("Test/README.md") ASSERT($includedFile.exists; "(Current project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project $settings.projectFile:=Storage.settings.externalProjectFile -$settings.includePaths:=New collection(New object(\ -"source"; Storage.settings.externalProjectRootFolder.file("README.md").path; \ -"destination"; Storage.settings.externalProjectRootFolder.folder("Test").path)\ -) $build:=cs.Build4D.Component.new($settings) @@ -46,8 +42,7 @@ $success:=$build.build() ASSERT($success; "(External project) Component build should success"+$link) -$includedFile:=Storage.settings.externalProjectRootFolder.file("Test/README.md") ASSERT($includedFile.exists; "(External project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5187.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5187.4dm similarity index 96% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5187.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5187.4dm index 9265b98..c076aa0 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC5187.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC5187.4dm @@ -30,7 +30,7 @@ $includedFile:=Folder(fk database folder; *).file("Test/README.md") ASSERT($includedFile.exists; "(Current project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project // Filesystems are relative to the project executing the code, so they can not be resolved related to an external project \ No newline at end of file diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC6295.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC6295.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC6295.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC6295.4dm index 70b90dd..2aa31db 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC6295.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC6295.4dm @@ -29,7 +29,7 @@ $includedFolder:=$build.settings.destinationFolder.folder("Documentation/") ASSERT($includedFolder.exists; "(Current project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -45,4 +45,4 @@ $includedFolder:=$build.settings.destinationFolder.folder("Documentation/") ASSERT($includedFolder.exists; "(External project) Included folder should exist: "+$includedFolder.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC6296.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC6296.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC6296.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC6296.4dm index 6bd70da..1e91fc2 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3487_TC6296.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3487_TC6296.4dm @@ -29,7 +29,7 @@ $includedFile:=$build.settings.destinationFolder.file("README.md") ASSERT($includedFile.exists; "(Current project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -45,4 +45,4 @@ $includedFile:=$build.settings.destinationFolder.file("README.md") ASSERT($includedFile.exists; "(External project) Included file should exist: "+$includedFile.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5311.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5311.4dm similarity index 92% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5311.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5311.4dm index 5cc07ba..858ee9e 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5311.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5311.4dm @@ -27,7 +27,7 @@ $deletedFile:=$build.settings.destinationFolder.file("Resources/UnitTests.txt") ASSERT($deletedFile.exists=False; "(Current project) Deleted file shouldn't exist: "+$deletedFile.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -43,4 +43,4 @@ $deletedFile:=$build.settings.destinationFolder.file("Resources/UnitTests.txt") ASSERT($deletedFile.exists=False; "(External project) Deleted file shouldn't exist: "+$deletedFile.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5313.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5313.4dm similarity index 91% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5313.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5313.4dm index e985ec8..1fc1e61 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5313.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5313.4dm @@ -27,7 +27,7 @@ $deletedFolder:=$build.settings.destinationFolder.folder("Resources") ASSERT($deletedFolder.exists=False; "(Current project) Deleted folder shouldn't exist: "+$deletedFolder.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project @@ -43,4 +43,4 @@ $deletedFolder:=$build.settings.destinationFolder.folder("Resources") ASSERT($deletedFolder.exists=False; "(External project) Deleted folder shouldn't exist: "+$deletedFolder.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5314.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5314.4dm similarity index 84% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5314.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5314.4dm index 5a0752d..c6d5afc 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5314.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5314.4dm @@ -27,12 +27,11 @@ $deletedFile:=$build.settings.destinationFolder.file("Resources/component.json") ASSERT($deletedFile.exists=False; "(Current project) Deleted file shouldn't exist: "+$deletedFile.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project $settings.projectFile:=Storage.settings.externalProjectFile -$settings.deletePaths:=New collection(File(Storage.settings.externalProjectRootFolder.path+"Test/"+$settings.buildName+".4dbase/Resources/UnitTests.txt")) $build:=cs.Build4D.Component.new($settings) @@ -44,4 +43,4 @@ $deletedFile:=$build.settings.destinationFolder.file("Resources/UnitTests.txt") ASSERT($deletedFile.exists=False; "(External project) Deleted file shouldn't exist: "+$deletedFile.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5315.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5315.4dm similarity index 85% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5315.4dm rename to Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5315.4dm index 2c2370b..6d09a53 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/Methods/ut_R3488_TC5315.4dm +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_2_R3488_TC5315.4dm @@ -27,12 +27,11 @@ $deletedFolder:=$build.settings.destinationFolder.folder("Resources") ASSERT($deletedFolder.exists=False; "(Current project) Deleted folder shouldn't exist: "+$deletedFolder.platformPath+$link) // Cleanup build folder -Folder("/PACKAGE/Test"; *).delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) // MARK:- External project $settings.projectFile:=Storage.settings.externalProjectFile -$settings.deletePaths:=New collection(Folder(Storage.settings.externalProjectRootFolder.path+"Test/"+$settings.buildName+".4dbase/Resources/")) $build:=cs.Build4D.Component.new($settings) @@ -44,4 +43,4 @@ $deletedFolder:=$build.settings.destinationFolder.folder("Resources") ASSERT($deletedFolder.exists=False; "(External project) Deleted folder shouldn't exist: "+$deletedFolder.platformPath+$link) // Cleanup build folder -Storage.settings.externalProjectRootFolder.folder("Test").delete(fk recursive) +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11077_TC11162.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11077_TC11162.4dm new file mode 100644 index 0000000..a4cdbe4 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11077_TC11162.4dm @@ -0,0 +1,50 @@ +//%attributes = {} +// Test _build() function with the default name +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $standaloneApp : 4D.File +var $link : Text +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build.settings.buildName=Storage.settings.projectName; "(Current project) Wrong default build name: "+$build.settings.buildName+$link) + +$success:=$build.build() + +ASSERT($success; "(Current project) Standalone build should success"+$link) + +$standaloneApp:=(Is macOS) ? Folder("/PACKAGE/Test/"+Storage.settings.projectName+".app") : Folder("/PACKAGE/Test/"+Storage.settings.projectName).file(Storage.settings.projectName+".exe") +ASSERT($standaloneApp.exists; "(Current project) Standalone should exist: "+$standaloneApp.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build.settings.buildName=Storage.settings.externalProjectName; "(External project) Wrong default build name: "+$build.settings.buildName+$link) + +$success:=$build.build() + +ASSERT($success; "(External project) Standalone build should success"+$link) + +$standaloneApp:=(Is macOS) ? Folder("/PACKAGE/Test/"+Storage.settings.externalProjectName+".app") : Folder("/PACKAGE/Test/"+Storage.settings.externalProjectName).file(Storage.settings.externalProjectName+".exe") +ASSERT($standaloneApp.exists; "(External project) Standalone should exist: "+$standaloneApp.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11077_TC11164.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11077_TC11164.4dm new file mode 100644 index 0000000..a09e7e6 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11077_TC11164.4dm @@ -0,0 +1,51 @@ +//%attributes = {} +// Test _build() function with a specific name +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $standaloneApp : 4D.File +var $link : Text +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) +$settings.buildName:="TEST" + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build.settings.buildName="TEST"; "(Current project) Wrong specified build name: "+$build.settings.buildName+$link) + +$success:=$build.build() + +ASSERT($success; "(Current project) Standalone build should success"+$link) + +$standaloneApp:=(Is macOS) ? Folder("/PACKAGE/Test/TEST.app") : File("/PACKAGE/Test/TEST/TEST.exe") +ASSERT($standaloneApp.exists; "(Current project) Standalone should exist: "+$standaloneApp.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build.settings.buildName="TEST"; "(External project) Wrong specified build name: "+$build.settings.buildName+$link) + +$success:=$build.build() + +ASSERT($success; "(External project) Standalone build should success"+$link) + +$standaloneApp:=(Is macOS) ? Folder("/PACKAGE/Test/TEST.app") : File("/PACKAGE/Test/TEST/TEST.exe") +ASSERT($standaloneApp.exists; "(External project) Standalone should exist: "+$standaloneApp.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11078_TC11169.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11078_TC11169.4dm new file mode 100644 index 0000000..01c06a0 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11078_TC11169.4dm @@ -0,0 +1,54 @@ +//%attributes = {} +// Define a wrong path of the Volume Desktop application +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $link : Text +var $log : Variant + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=Folder("/PACKAGE/") + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build._validInstance=False; "(Current project) Object instance shouldn't be valid"+$link) + +$log:=$build.logs.find(Formula($1.value.function=$2); "Source application folder checking") + +ASSERT((($log#Null) && ($log.severity=Error message)); "(Current project) Standalone build should generate an error"+$link) + +$success:=$build.build() + +ASSERT($success=False; "(Current project) Standalone build should fail"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build._validInstance=False; "(External project) Object instance shouldn't be valid"+$link) + +$log:=Null +$log:=$build.logs.find(Formula($1.value.function=$2); "Source application folder checking") + +ASSERT((($log#Null) && ($log.severity=Error message)); "(External project) Standalone build should generate an error"+$link) + +$success:=$build.build() + +ASSERT($success=False; "(External project) Standalone build should fail"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11078_TC11170.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11078_TC11170.4dm new file mode 100644 index 0000000..6e411b2 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11078_TC11170.4dm @@ -0,0 +1,53 @@ +//%attributes = {} +// Not define any path of Volume Desktop application +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $link : Text +var $log : Variant + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build._validInstance=False; "(Current project) Object instance shouldn't be valid"+$link) + +$log:=$build.logs.find(Formula($1.value.function=$2); "Source application folder checking") + +ASSERT((($log#Null) && ($log.severity=Error message)); "(Current project) Standalone build should generate an error"+$link) + +$success:=$build.build() + +ASSERT($success=False; "(Current project) Standalone build should fail"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build._validInstance=False; "(External project) Object instance shouldn't be valid"+$link) + +$log:=Null +$log:=$build.logs.find(Formula($1.value.function=$2); "Source application folder checking") + +ASSERT((($log#Null) && ($log.severity=Error message)); "(External project) Standalone build should generate an error"+$link) + +$success:=$build.build() + +ASSERT($success=False; "(External project) Standalone build should fail"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11079_TC11171.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11079_TC11171.4dm new file mode 100644 index 0000000..5272f74 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11079_TC11171.4dm @@ -0,0 +1,60 @@ +//%attributes = {} +// Define a 4D Volume Desktop with the version number is not match the 4D Developer Edition version number +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $link : Text +var $assertions : Boolean +var $log : Variant + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +$assertions:=Get assert enabled +SET ASSERT ENABLED(True) + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.invalid_macVolumeDesktop) : Folder(Storage.settings.invalid_winVolumeDesktop) + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build._validInstance=False; "(Current project) Object instance shouldn't be valid"+$link) + +$log:=$build.logs.find(Formula($1.value.function=$2); "Source application version checking") + +ASSERT((($log#Null) && ($log.severity=Error message)); "(Current project) Standalone build should generate an error"+$link) + +$success:=$build.build() + +ASSERT($success=False; "(Current project) Standalone build should fail"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT($build._validInstance=False; "(External project) Object instance shouldn't be valid"+$link) + +$log:=Null +$log:=$build.logs.find(Formula($1.value.function=$2); "Source application version checking") + +ASSERT((($log#Null) && ($log.severity=Error message)); "(External project) Standalone build should generate an error"+$link) + +$success:=$build.build() + +ASSERT($success=False; "(External project) Standalone build should fail"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +SET ASSERT ENABLED($assertions) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11081_TC.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11081_TC.4dm new file mode 100644 index 0000000..92b667b --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11081_TC.4dm @@ -0,0 +1,87 @@ +//%attributes = {} +// Define the version application information +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $infoFile; $exeFile : 4D.File +var $infos : Object + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) +$settings.versioning:=New object +$settings.versioning.version:="UT_version" +$settings.versioning.copyright:="UT_copyright" +$settings.versioning.companyName:="UT_companyName" +$settings.versioning.fileDescription:="UT_fileDescription" +$settings.versioning.internalName:="UT_internalName" + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +If (Is macOS) + $infoFile:=$build.settings.destinationFolder.file("Contents/Info.plist") + $infos:=$infoFile.getAppInfo() + ASSERT($infos.CFBundleVersion="UT_version"; "(Current project) Standalone version should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11179") + ASSERT($infos.CFBundleShortVersionString="UT_version"; "(Current project) Standalone version should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11179") + ASSERT($infos.NSHumanReadableCopyright="UT_copyright"; "(Current project) Standalone copyright should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11181") + ASSERT($infos.CFBundleIdentifier="UT_companyName@"; "(Current project) Standalone companyName should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11184") +Else + $exeFile:=$build.settings.destinationFolder.file($build.settings.buildName+".exe") + If ($exeFile.exists) + $infos:=$exeFile.getAppInfo() + ASSERT($infos.FileVersion="UT_version"; "(Current project) Standalone version should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11179") + ASSERT($infos.ProductVersion="UT_version"; "(Current project) Standalone version should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11179") + ASSERT($infos.LegalCopyright="UT_copyright"; "(Current project) Standalone copyright should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11181") + ASSERT($infos.CompanyName="UT_companyName"; "(Current project) Standalone companyName should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11184") + ASSERT($infos.FileDescription="UT_fileDescription"; "(Current project) Standalone fileDescription should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11185") + ASSERT($infos.InternalName="UT_internalName"; "(Current project) Standalone internalName should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11186") + ASSERT($infos.OriginalFilename=$exeFile.fullName; "(Current project) Standalone OriginalFilename should be set") + ASSERT($infos.ProductName=$build.settings.buildName; "(Current project) Standalone ProductName should be set") + Else + ASSERT(False; "(Current project) Standalone exe file does not exist:"+$exeFile.path) + End if +End if + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +If (Is macOS) + $infoFile:=$build.settings.destinationFolder.file("Contents/Info.plist") + $infos:=$infoFile.getAppInfo() + ASSERT($infos.CFBundleVersion="UT_version"; "(External project) Standalone version should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11179") + ASSERT($infos.CFBundleShortVersionString="UT_version"; "(External project) Standalone version should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11179") + ASSERT($infos.NSHumanReadableCopyright="UT_copyright"; "(External project) Standalone copyright should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11181") + ASSERT($infos.CFBundleIdentifier="UT_companyName@"; "(External project) Standalone companyName should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11184") +Else + $exeFile:=$build.settings.destinationFolder.file($build.settings.buildName+".exe") + If ($exeFile.exists) + $infos:=$exeFile.getAppInfo() + ASSERT($infos.FileVersion="UT_version"; "(Current project) Standalone version should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11179") + ASSERT($infos.ProductVersion="UT_version"; "(Current project) Standalone version should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11179") + ASSERT($infos.LegalCopyright="UT_copyright"; "(Current project) Standalone copyright should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11181") + ASSERT($infos.CompanyName="UT_companyName"; "(Current project) Standalone companyName should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11184") + ASSERT($infos.FileDescription="UT_fileDescription"; "(Current project) Standalone fileDescription should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11185") + ASSERT($infos.InternalName="UT_internalName"; "(Current project) Standalone internalName should be set (https://dev.azure.com/4dimension/4D/_workitems/edit/11186") + ASSERT($infos.OriginalFilename=$exeFile.fullName; "(Current project) Standalone OriginalFilename should be set") + ASSERT($infos.ProductName=$build.settings.buildName; "(Current project) Standalone ProductName should be set") + Else + ASSERT(False; "(Current project) Standalone exe file does not exist:"+$exeFile.path) + End if +End if + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11083_TC11190.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11083_TC11190.4dm new file mode 100644 index 0000000..ce2833e --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11083_TC11190.4dm @@ -0,0 +1,44 @@ +//%attributes = {} +// Define the data linking mode as By application name +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $infoFile : 4D.File +var $infos : Object + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) +$settings.lastDataPathLookup:="ByAppName" + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +$infoFile:=(Is macOS) ? $build.settings.destinationFolder.file("Contents/Info.plist") : $build.settings.destinationFolder.file("Resources/Info.plist") +$infos:=$infoFile.getAppInfo() +ASSERT($infos["com.4D.BuildApp.LastDataPathLookup"]="ByAppName"; "(Current project) Standalone lastDataPathLookup should be set to byAppName"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +$infoFile:=(Is macOS) ? $build.settings.destinationFolder.file("Contents/Info.plist") : $build.settings.destinationFolder.file("Resources/Info.plist") +$infos:=$infoFile.getAppInfo() +ASSERT($infos["com.4D.BuildApp.LastDataPathLookup"]="ByAppName"; "(External project) Standalone lastDataPathLookup should be set to byAppName"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11083_TC11192.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11083_TC11192.4dm new file mode 100644 index 0000000..700811d --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11083_TC11192.4dm @@ -0,0 +1,44 @@ +//%attributes = {} +// Define the data linking mode as By application path +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $infoFile : 4D.File +var $infos : Object + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) +$settings.lastDataPathLookup:="ByAppPath" + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +$infoFile:=(Is macOS) ? $build.settings.destinationFolder.file("Contents/Info.plist") : $build.settings.destinationFolder.file("Resources/Info.plist") +$infos:=$infoFile.getAppInfo() +ASSERT($infos["com.4D.BuildApp.LastDataPathLookup"]="ByAppPath"; "(Current project) Standalone lastDataPathLookup should be set to ByAppPath"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +$infoFile:=(Is macOS) ? $build.settings.destinationFolder.file("Contents/Info.plist") : $build.settings.destinationFolder.file("Resources/Info.plist") +$infos:=$infoFile.getAppInfo() +ASSERT($infos["com.4D.BuildApp.LastDataPathLookup"]="ByAppPath"; "(External project) Standalone lastDataPathLookup should be set to ByAppPath"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11083_TC11958.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11083_TC11958.4dm new file mode 100644 index 0000000..26768c2 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11083_TC11958.4dm @@ -0,0 +1,44 @@ +//%attributes = {} +// Define the data linking mode as other value than By application name or application path +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $infoFile : 4D.File +var $infos : Object + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) +$settings.lastDataPathLookup:="AnotherValue" + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +$infoFile:=(Is macOS) ? $build.settings.destinationFolder.file("Contents/Info.plist") : $build.settings.destinationFolder.file("Resources/Info.plist") +$infos:=$infoFile.getAppInfo() +ASSERT($infos["com.4D.BuildApp.LastDataPathLookup"]="ByAppName"; "(Current project) Standalone lastDataPathLookup should be set to byAppName"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +$infoFile:=(Is macOS) ? $build.settings.destinationFolder.file("Contents/Info.plist") : $build.settings.destinationFolder.file("Resources/Info.plist") +$infos:=$infoFile.getAppInfo() +ASSERT($infos["com.4D.BuildApp.LastDataPathLookup"]="ByAppName"; "(External project) Standalone lastDataPathLookup should be set to byAppName"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11084_TC11200.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11084_TC11200.4dm new file mode 100644 index 0000000..22133d0 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11084_TC11200.4dm @@ -0,0 +1,43 @@ +//%attributes = {} +// Don't define the data linking mode +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $infoFile : 4D.File +var $infos : Object + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +$infoFile:=(Is macOS) ? $build.settings.destinationFolder.file("Contents/Info.plist") : $build.settings.destinationFolder.file("Resources/Info.plist") +$infos:=$infoFile.getAppInfo() +ASSERT($infos["com.4D.BuildApp.LastDataPathLookup"]="ByAppName"; "(Current project) Standalone lastDataPathLookup should be set to byAppName"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +$infoFile:=(Is macOS) ? $build.settings.destinationFolder.file("Contents/Info.plist") : $build.settings.destinationFolder.file("Resources/Info.plist") +$infos:=$infoFile.getAppInfo() +ASSERT($infos["com.4D.BuildApp.LastDataPathLookup"]="ByAppName"; "(External project) Standalone lastDataPathLookup should be set to byAppName"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11085_TC11204.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11085_TC11204.4dm new file mode 100644 index 0000000..4b8da67 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11085_TC11204.4dm @@ -0,0 +1,48 @@ +//%attributes = {} +// Define an invalid licence +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $link : Text +var $log : Variant + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.invalid_LicenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success=False; "(Current project) Standalone build should fail with invalid license"+$link) + +$log:=$build.logs.find(Formula($1.value.function=$2); "Deployment license creation") + +ASSERT((($log#Null) && ($log.severity=Error message)); "(Current project) Standalone license error should be logged"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success=False; "(External project) Standalone build should fail with invalid license"+$link) + +$log:=Null +$log:=$build.logs.find(Formula($1.value.function=$2); "Deployment license creation") + +ASSERT((($log#Null) && ($log.severity=Error message)); "(External project) Standalone license error should be logged"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11085_TC11206.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11085_TC11206.4dm new file mode 100644 index 0000000..a67372c --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11085_TC11206.4dm @@ -0,0 +1,45 @@ +//%attributes = {} +// Build without any licence +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $link : Text +var $log : Variant + +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success=False; "(Current project) Standalone build should fail without any license"+$link) + +$log:=$build.logs.find(Formula($1.value.function=$2); "License file checking") +ASSERT((($log#Null) && ($log.severity=Error message)); "(Current project) Standalone license error should be logged"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success=False; "(External project) Standalone build should fail without any license"+$link) + +$log:=Null +$log:=$build.logs.find(Formula($1.value.function=$2); "License file checking") +ASSERT((($log#Null) && ($log.severity=Error message)); "(External project) Standalone license error should be logged"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11087_TC11207.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11087_TC11207.4dm new file mode 100644 index 0000000..6f3e188 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11087_TC11207.4dm @@ -0,0 +1,65 @@ +//%attributes = {} +// Test application adhoc signature +If (Is macOS) + var $build : cs.Build4D.Standalone + var $settings : Object + var $success : Boolean + var $link : Text + $link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + + logGitHubActions(Current method name) + + // MARK:- Current project + + $settings:=New object() + $settings.formulaForLogs:=Formula(logGitHubActions($1)) + $settings.destinationFolder:="./Test/" + $settings.license:=Storage.settings.licenseUUD + $settings.compilerOptions:=New object("targets"; New collection("x86_64_generic"; "arm64_macOS_lib")) + $settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + ASSERT($success; "(Current project) Standalone build should success"+$link) + + var $verificationWorker : 4D.SystemWorker + $verificationWorker:=4D.SystemWorker.new("codesign -dv --verbose=4 "+$build.settings.destinationFolder.path) + $verificationWorker.wait(120) + If ($verificationWorker.terminated) + If ($verificationWorker.exitCode=0) + // The application is signed adhoc if a line "Signature=adhoc" exists + var $lines : Collection + $lines:=Split string($verificationWorker.responseError; "\n") + ASSERT(Not(Undefined($lines.find(Formula($1.value=$2); "Signature=adhoc"))); "(Current project) Standalone should be signed. Verification response: "+$verificationWorker.responseError+$link) + End if + End if + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) + + // MARK:- External project + + $settings.projectFile:=Storage.settings.externalProjectFile + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + ASSERT($success; "(External project) Standalone build should success"+$link) + + var $verificationWorker : 4D.SystemWorker + $verificationWorker:=4D.SystemWorker.new("codesign -dv --verbose=4 "+$build.settings.destinationFolder.path) + $verificationWorker.wait(120) + If ($verificationWorker.terminated) + If ($verificationWorker.exitCode=0) + // The application is signed adhoc if a line "Signature=adhoc" exists + var $lines : Collection + $lines:=New collection() + $lines:=Split string($verificationWorker.responseError; "\n") + ASSERT(Not(Undefined($lines.find(Formula($1.value=$2); "Signature=adhoc"))); "(External project) Standalone should be signed. Verification response: "+$verificationWorker.responseError+$link) + End if + End if + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) +End if diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11088_TC11220.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11088_TC11220.4dm new file mode 100644 index 0000000..d06a3b0 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11088_TC11220.4dm @@ -0,0 +1,48 @@ +//%attributes = {} +// Add a file located at a relative path to a destination located at a relative path +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $includedFile : 4D.File +var $link : Text +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) +$settings.includePaths:=New collection(New object(\ +"source"; "./README.md"; \ +"destination"; "./Test/")\ +) + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success; "(Current project) Standalone build should success"+$link) + +$includedFile:=$build._structureFolder.file("Test/README.md") +ASSERT($includedFile.exists; "(Current project) Included file should exist: "+$includedFile.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success; "(External project) Standalone build should success"+$link) + +$includedFile:=$build._structureFolder.file("Test/README.md") +ASSERT($includedFile.exists; "(External project) Included file should exist: "+$includedFile.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11089_TC11233.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11089_TC11233.4dm new file mode 100644 index 0000000..a1c64e2 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11089_TC11233.4dm @@ -0,0 +1,45 @@ +//%attributes = {} +// Remove a file located at a relative path +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $deletedFile : 4D.File +var $link : Text +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) +$settings.deletePaths:=New collection("./Resources/UnitTests.txt") + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success; "(Current project) Standalone build should success"+$link) + +$deletedFile:=$build.settings.destinationFolder.file("Resources/UnitTests.txt") +ASSERT($deletedFile.exists=False; "(Current project) Deleted file shouldn't exist: "+$deletedFile.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success; "(External project) Standalone build should success"+$link) + +$deletedFile:=$build.settings.destinationFolder.file("Resources/UnitTests.txt") +ASSERT($deletedFile.exists=False; "(Current project) Deleted file shouldn't exist: "+$deletedFile.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11090_TC12455.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11090_TC12455.4dm new file mode 100755 index 0000000..af57677 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11090_TC12455.4dm @@ -0,0 +1,51 @@ +//%attributes = {} +// Check the custom elevation right for the Updater (normal) +If (Is Windows) // Only on Windows + + var $build : cs.Build4D.Standalone + var $settings : Object + var $success : Boolean + var $manifestFile : 4D.File + var $manifestContent : Text + + $link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + + logGitHubActions(Current method name) + + // MARK:- Current project + + $settings:=New object() + $settings.formulaForLogs:=Formula(logGitHubActions($1)) + $settings.destinationFolder:="./Test/" + $settings.license:=Storage.settings.licenseUUD + $settings.sourceAppFolder:=Folder(Storage.settings.winVolumeDesktop) + $settings.startElevated:=False + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + $manifestFile:=$build.settings.destinationFolder.file("Resources/Updater/Updater.exe.manifest") + ASSERT($manifestFile.exists; "(Current project) Standalone Updater manifest should exist: "+$manifestFile.platformPath+$link) + + $manifestContent:=$manifestFile.getText() + ASSERT($manifestContent="@level=\"asInvoker\"@"; "(Current project) Standalone Updater manifest should contain normal rights"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) + + // MARK:- External project + + $settings.projectFile:=Storage.settings.externalProjectFile + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + $manifestFile:=$build.settings.destinationFolder.file("Resources/Updater/Updater.exe.manifest") + ASSERT($manifestFile.exists; "(External project) Standalone Updater manifest should exist: "+$manifestFile.platformPath+$link) + + $manifestContent:=$manifestFile.getText() + ASSERT($manifestContent="@level=\"asInvoker\"@"; "(External project) Standalone Updater manifest should contain normal rights"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) +End if diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11090_TC12456.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11090_TC12456.4dm new file mode 100755 index 0000000..a60b67e --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11090_TC12456.4dm @@ -0,0 +1,51 @@ +//%attributes = {} +// Check the custom elevation right for the Updater (elevated) +If (Is Windows) // Only on Windows + + var $build : cs.Build4D.Standalone + var $settings : Object + var $success : Boolean + var $manifestFile : 4D.File + var $manifestContent : Text + + $link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + + logGitHubActions(Current method name) + + // MARK:- Current project + + $settings:=New object() + $settings.formulaForLogs:=Formula(logGitHubActions($1)) + $settings.destinationFolder:="./Test/" + $settings.license:=Storage.settings.licenseUUD + $settings.sourceAppFolder:=Folder(Storage.settings.winVolumeDesktop) + $settings.startElevated:=True + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + $manifestFile:=$build.settings.destinationFolder.file("Resources/Updater/Updater.exe.manifest") + ASSERT($manifestFile.exists; "(Current project) Standalone Updater manifest should exist: "+$manifestFile.platformPath+$link) + + $manifestContent:=$manifestFile.getText() + ASSERT($manifestContent="@level=\"requireAdministrator\"@"; "(Current project) Standalone Updater manifest should contain elevated rights"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) + + // MARK:- External project + + $settings.projectFile:=Storage.settings.externalProjectFile + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + $manifestFile:=$build.settings.destinationFolder.file("Resources/Updater/Updater.exe.manifest") + ASSERT($manifestFile.exists; "(External project) Standalone Updater manifest should exist: "+$manifestFile.platformPath+$link) + + $manifestContent:=$manifestFile.getText() + ASSERT($manifestContent="@level=\"requireAdministrator\"@"; "(External project) Standalone Updater manifest should contain elevated rights"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) +End if diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11090_TC12457.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11090_TC12457.4dm new file mode 100755 index 0000000..4e662a8 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11090_TC12457.4dm @@ -0,0 +1,50 @@ +//%attributes = {} +// Check the default elevation right for the Updater (normal) +If (Is Windows) // Only on Windows + + var $build : cs.Build4D.Standalone + var $settings : Object + var $success : Boolean + var $manifestFile : 4D.File + var $manifestContent : Text + + $link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + + logGitHubActions(Current method name) + + // MARK:- Current project + + $settings:=New object() + $settings.formulaForLogs:=Formula(logGitHubActions($1)) + $settings.destinationFolder:="./Test/" + $settings.license:=Storage.settings.licenseUUD + $settings.sourceAppFolder:=Folder(Storage.settings.winVolumeDesktop) + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + $manifestFile:=$build.settings.destinationFolder.file("Resources/Updater/Updater.exe.manifest") + ASSERT($manifestFile.exists; "(Current project) Standalone Updater manifest should exist: "+$manifestFile.platformPath+$link) + + $manifestContent:=$manifestFile.getText() + ASSERT($manifestContent="@level=\"asInvoker\"@"; "(Current project) Standalone Updater manifest should contain normal rights"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) + + // MARK:- External project + + $settings.projectFile:=Storage.settings.externalProjectFile + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + $manifestFile:=$build.settings.destinationFolder.file("Resources/Updater/Updater.exe.manifest") + ASSERT($manifestFile.exists; "(External project) Standalone Updater manifest should exist: "+$manifestFile.platformPath+$link) + + $manifestContent:=$manifestFile.getText() + ASSERT($manifestContent="@level=\"asInvoker\"@"; "(External project) Standalone Updater manifest should contain normal rights"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) +End if diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11092_TC11241.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11092_TC11241.4dm new file mode 100644 index 0000000..5525b4d --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11092_TC11241.4dm @@ -0,0 +1,22 @@ +//%attributes = {} +// The default value of "obfuscated" shall be "False" +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $link : Text +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT((($build.settings.obfuscated#Null) && ($build.settings.obfuscated=False)); "Standalone: obfuscated default setting shall be false"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11094_TC11250.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11094_TC11250.4dm new file mode 100644 index 0000000..83f7481 --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11094_TC11250.4dm @@ -0,0 +1,30 @@ +//%attributes = {} +// The default value of "packedProject" shall be "True" +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $link : Text +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=Folder(Storage.settings.winVolumeDesktop) +$settings.excludeModules:=New collection("mecab") + + +logGitHubActions(Current method name) + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + +$build:=cs.Build4D.Standalone.new($settings) + +ASSERT((($build.settings.packedProject#Null) && ($build.settings.packedProject)); "Standalone: obfuscated default setting shall be false"+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11095_TC11481.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11095_TC11481.4dm new file mode 100644 index 0000000..1d7237c --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11095_TC11481.4dm @@ -0,0 +1,45 @@ +//%attributes = {} +// Remove a file located at a relative path +var $build : cs.Build4D.Standalone +var $settings : Object +var $success : Boolean +var $modulePath : 4D.Folder +var $link : Text +$link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + +logGitHubActions(Current method name) + +// MARK:- Current project + +$settings:=New object() +$settings.formulaForLogs:=Formula(logGitHubActions($1)) +$settings.destinationFolder:="./Test/" +$settings.license:=Storage.settings.licenseUUD +$settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) +$settings.excludeModules:=New collection("mecab") + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success; "(Current project) Standalone build should success"+$link) + +$modulePath:=$build._structureFolder.parent.folder("Resources/mecab/") +ASSERT($modulePath.exists=False; "(Current project) Module folder shouldn't exist: "+$modulePath.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) + +// MARK:- External project + +$settings.projectFile:=Storage.settings.externalProjectFile + +$build:=cs.Build4D.Standalone.new($settings) +$success:=$build.build() + +ASSERT($success; "(External project) Standalone build should success"+$link) + +$modulePath:=$build._structureFolder.parent.folder("Resources/mecab/") +ASSERT($modulePath.exists=False; "(Current project) Module folder shouldn't exist: "+$modulePath.platformPath+$link) + +// Cleanup build folder +Folder("/PACKAGE/Test").delete(fk recursive) diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11097_TC11483.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11097_TC11483.4dm new file mode 100644 index 0000000..a56a39a --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11097_TC11483.4dm @@ -0,0 +1,46 @@ +//%attributes = {} +// Use SDI mode on Windows +If (Is Windows) + var $build : cs.Build4D.Standalone + var $settings; $info : Object + var $success : Boolean + var $link : Text + $link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + + logGitHubActions(Current method name) + + // MARK:- Current project + + $settings:=New object() + $settings.formulaForLogs:=Formula(logGitHubActions($1)) + $settings.destinationFolder:="./Test/" + $settings.license:=Storage.settings.licenseUUD + $settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + $settings.useSDI:=True + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + ASSERT($success; "(Current project) Standalone build should success"+$link) + + $info:=$build.settings.destinationFolder.file("Resources/Info.plist").getAppInfo() + ASSERT($info.SDIRuntime="1"; "(Current project) Standalone SDI mode should be true"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) + + // MARK:- External project + + $settings.projectFile:=Storage.settings.externalProjectFile + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + ASSERT($success; "(External project) Standalone build should success"+$link) + + $info:=$build.settings.destinationFolder.file("Resources/Info.plist").getAppInfo() + ASSERT($info.SDIRuntime="1"; "(Current project) Standalone SDI mode should be true"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) +End if diff --git a/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11097_TC11485.4dm b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11097_TC11485.4dm new file mode 100755 index 0000000..324b23a --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/Methods/ut_3_R11097_TC11485.4dm @@ -0,0 +1,46 @@ +//%attributes = {} +// Use MDI mode on Windows +If (Is Windows) + var $build : cs.Build4D.Standalone + var $settings; $info : Object + var $success : Boolean + var $link : Text + $link:=" (https://dev.azure.com/4dimension/4D/_workitems/edit/"+Substring(Current method name; Position("_TC"; Current method name)+3)+")" + + logGitHubActions(Current method name) + + // MARK:- Current project + + $settings:=New object() + $settings.formulaForLogs:=Formula(logGitHubActions($1)) + $settings.destinationFolder:="./Test/" + $settings.license:=Storage.settings.licenseUUD + $settings.sourceAppFolder:=(Is macOS) ? Folder(Storage.settings.macVolumeDesktop) : Folder(Storage.settings.winVolumeDesktop) + $settings.useSDI:=False + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + ASSERT($success; "(Current project) Standalone build should success"+$link) + + $info:=$build.settings.destinationFolder.file("Resources/Info.plist").getAppInfo() + ASSERT($info.SDIRuntime="0"; "(Current project) Standalone SDI mode should be true"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) + + // MARK:- External project + + $settings.projectFile:=Storage.settings.externalProjectFile + + $build:=cs.Build4D.Standalone.new($settings) + $success:=$build.build() + + ASSERT($success; "(External project) Standalone build should success"+$link) + + $info:=$build.settings.destinationFolder.file("Resources/Info.plist").getAppInfo() + ASSERT($info.SDIRuntime="0"; "(Current project) Standalone SDI mode should be true"+$link) + + // Cleanup build folder + Folder("/PACKAGE/Test").delete(fk recursive) +End if diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/catalog.4DCatalog b/Build4D_UnitTests/Project/Sources/catalog.4DCatalog similarity index 78% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/catalog.4DCatalog rename to Build4D_UnitTests/Project/Sources/catalog.4DCatalog index 20d010a..d041cf8 100644 --- a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/catalog.4DCatalog +++ b/Build4D_UnitTests/Project/Sources/catalog.4DCatalog @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/Build4D_UnitTests/Project/Sources/folders.json b/Build4D_UnitTests/Project/Sources/folders.json new file mode 100644 index 0000000..286eb9b --- /dev/null +++ b/Build4D_UnitTests/Project/Sources/folders.json @@ -0,0 +1,209 @@ +{ + "1_R3485": { + "methods": [ + "ut_1_R3485_TC4734", + "ut_1_R3485_TC4736", + "ut_1_R3485_TC6022", + "ut_1_R3485_TC6023" + ] + }, + "1_R3489": { + "methods": [ + "ut_1_R3489_TC5319", + "ut_1_R3489_TC5321", + "ut_1_R3489_TC5322" + ] + }, + "1_R3490": { + "methods": [ + "ut_1_R3490_TC5331", + "ut_1_R3490_TC5333" + ] + }, + "1_R3491": { + "methods": [ + "ut_1_R3491_TC5334", + "ut_1_R3491_TC5336", + "ut_1_R3491_TC5337" + ] + }, + "2_R3484": { + "methods": [ + "ut_2_R3484_TC4725", + "ut_2_R3484_TC4732", + "ut_2_R3484_TC4733" + ] + }, + "2_R3486": { + "methods": [ + "mut_2_R3486_TC4743", + "mut_2_R3486_TC4749", + "ut_2_R3486_TC4737", + "ut_2_R3486_TC4739", + "ut_2_R3486_TC4741", + "ut_2_R3486_TC4745", + "ut_2_R3486_TC4746", + "ut_2_R3486_TC4747", + "ut_2_R3486_TC4750" + ] + }, + "2_R3487": { + "methods": [ + "ut_2_R3487_TC5165", + "ut_2_R3487_TC5167", + "ut_2_R3487_TC5169", + "ut_2_R3487_TC5170", + "ut_2_R3487_TC5182", + "ut_2_R3487_TC5183", + "ut_2_R3487_TC5184", + "ut_2_R3487_TC5185", + "ut_2_R3487_TC5186", + "ut_2_R3487_TC5187", + "ut_2_R3487_TC6295", + "ut_2_R3487_TC6296" + ] + }, + "2_R3488": { + "methods": [ + "ut_2_R3488_TC5311", + "ut_2_R3488_TC5313", + "ut_2_R3488_TC5314", + "ut_2_R3488_TC5315" + ] + }, + "3_R11077": { + "methods": [ + "ut_3_R11077_TC11162", + "ut_3_R11077_TC11164" + ] + }, + "3_R11078": { + "methods": [ + "ut_3_R11078_TC11169", + "ut_3_R11078_TC11170" + ] + }, + "3_R11079": { + "methods": [ + "ut_3_R11079_TC11171" + ] + }, + "3_R11081": { + "methods": [ + "ut_3_R11081_TC" + ] + }, + "3_R11083": { + "methods": [ + "ut_3_R11083_TC11190", + "ut_3_R11083_TC11192", + "ut_3_R11083_TC11958" + ] + }, + "3_R11084": { + "methods": [ + "ut_3_R11084_TC11200" + ] + }, + "3_R11085": { + "methods": [ + "ut_3_R11085_TC11204", + "ut_3_R11085_TC11206" + ] + }, + "3_R11086": { + "methods": [ + "mut_3_R11086_TC11488" + ] + }, + "3_R11087": { + "methods": [ + "mut_3_R11087_TC11217", + "ut_3_R11087_TC11207" + ] + }, + "3_R11088": { + "methods": [ + "ut_3_R11088_TC11220" + ] + }, + "3_R11089": { + "methods": [ + "ut_3_R11089_TC11233" + ] + }, + "3_R11090": { + "methods": [ + "ut_3_R11090_TC12455", + "ut_3_R11090_TC12456", + "ut_3_R11090_TC12457" + ] + }, + "3_R11092": { + "methods": [ + "ut_3_R11092_TC11241" + ] + }, + "3_R11094": { + "methods": [ + "ut_3_R11094_TC11250" + ] + }, + "3_R11095": { + "methods": [ + "ut_3_R11095_TC11481" + ] + }, + "3_R11097": { + "methods": [ + "ut_3_R11097_TC11483", + "ut_3_R11097_TC11485" + ] + }, + "CompiledProject": { + "groups": [ + "1_R3485", + "1_R3489", + "1_R3490", + "1_R3491" + ], + "methods": [ + "runUnitTests1" + ] + }, + "Component": { + "groups": [ + "2_R3484", + "2_R3486", + "2_R3487", + "2_R3488" + ], + "methods": [ + "runUnitTests2" + ] + }, + "Standalone": { + "groups": [ + "3_R11077", + "3_R11078", + "3_R11079", + "3_R11081", + "3_R11083", + "3_R11084", + "3_R11085", + "3_R11086", + "3_R11087", + "3_R11088", + "3_R11089", + "3_R11090", + "3_R11092", + "3_R11094", + "3_R11095", + "3_R11097" + ], + "methods": [ + "runUnitTests3" + ] + }, + "trash": {} +} \ No newline at end of file diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/menus.json b/Build4D_UnitTests/Project/Sources/menus.json similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/menus.json rename to Build4D_UnitTests/Project/Sources/menus.json diff --git a/Build4D_UnitTests/Build4D_UnitTests/Project/Sources/settings.4DSettings b/Build4D_UnitTests/Project/Sources/settings.4DSettings similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Project/Sources/settings.4DSettings rename to Build4D_UnitTests/Project/Sources/settings.4DSettings diff --git a/Build4D_UnitTests/README.md b/Build4D_UnitTests/README.md new file mode 100644 index 0000000..eac998b --- /dev/null +++ b/Build4D_UnitTests/README.md @@ -0,0 +1,64 @@ +Build4D_UnitTests User Manual += +>To test the latest version of Build4D, open the Build4D project and run the buildComponent method. This will build the component directly in the Build4D_UnitTests project. + +User settings +- +User settings are mandatory to perform the unit tests on your computer. They are stored in the **Settings/UT_Settings.json** file. +| Attribut | Description | +| :- | :- | +| macCertificate | Certificate name for macOS signature | +| licenseUUD | POSIX path to a **valid** UUD licence file | +| invalid_LicenseUUD | POSIX path to an **invalid** licence file (not a UUD file) | +| macVolumeDesktop | POSIX path to the macOS Volume Desktop folder | +| winVolumeDesktop | POSIX path to the Windows Volume Desktop folder | +| invalid_macVolumeDesktop | POSIX path to a macOS Volume Desktop folder with different version from running 4D version | +| invalid_winVolumeDesktop | POSIX path to a Windows Volume Desktop folder with different version from running 4D version | + +Nomenclature +- +Unit tests methods are formatted this way: **{m}ut_{scope}_R{requirement id}_TC{test case id}**. + +Each automatic unit test method is prefixed with **ut_**. + +Each manual unit test method is prefixed **mut_**. These tests needs human actions such as certificate password for macOS signature or icon checking. + +The scopes are: +| Scope | Description | +| :- | :- | +| 1 | Compiled project | +| 2 | Component | +| 3 | Standalone application | +| 4 | Client application | +| 5 | Server application | + +Run Unit Tests +- +Manual unit tests can be performed by running the **runManualUnitTests** method. + +Automatic unit tests can be performed by running the **runAutomaticUnitTests** method. + +Automatic unit tests for a specified scope can be performed by running the **runUnitTests1{scope}** method. + +Each unit test is performed related to the current project and, if it's relevant, related to an external project. + +Run Unit Tests in CLI +- +Running all automatic unit tests can be performed from CLI using the parameter: +**--user-param "test"**. + +Reports +- +When starting a test method, the timestamp is stored in the **UT_start.log** file, in the project package. + +When ending a test method, the timestamp is stored in the **UT_end.log** file, in the project package. + +When running a unit test method, the unit test method name and the timestamp is stored in the **UT_run.log** file, in the project package. Code errors are also logged in this file. + +When a false assertion is encountered in a unit test method, the assertion details is stored in the **UT_errors.log** file, in the project package. At the end, if this file does not exist, unit tests passed. + +Note that **.log** files can be opened in the console during tests execution to check the content evolution. + +Miscellaneous +- +The **logGitHubActions** formats messages in GitHub Actions fomat so that they can be viewed in live in its console. diff --git a/Build4D_UnitTests/Resources/UnitTests.txt b/Build4D_UnitTests/Resources/UnitTests.txt new file mode 100644 index 0000000..4f2ff29 --- /dev/null +++ b/Build4D_UnitTests/Resources/UnitTests.txt @@ -0,0 +1 @@ +DO NOT REMOVE: MANDATORY FOR UNIT TESTS \ No newline at end of file diff --git a/Build4D_UnitTests/Build4D_UnitTests/Resources/compilationError.4dm b/Build4D_UnitTests/Resources/compilationError.4dm similarity index 100% rename from Build4D_UnitTests/Build4D_UnitTests/Resources/compilationError.4dm rename to Build4D_UnitTests/Resources/compilationError.4dm diff --git a/Build4D_UnitTests/Settings/UT_Settings.json b/Build4D_UnitTests/Settings/UT_Settings.json new file mode 100644 index 0000000..4cad522 --- /dev/null +++ b/Build4D_UnitTests/Settings/UT_Settings.json @@ -0,0 +1,9 @@ +{ + "licenseUUD":"/PACKAGE/Settings/4UUD.license4D", + "invalid_LicenseUUD":"/PACKAGE/Settings/invalid_4UUD.license4D", + "macVolumeDesktop":"/Applications/4D v20.0/4D Volume Desktop.app/", + "winVolumeDesktop":"C:/Program Files/4D/4D v20.0/4D Volume Desktop/", + "invalid_macVolumeDesktop":"/Applications/4D v0.0/4D Volume Desktop.app/", + "invalid_winVolumeDesktop":"C:/Program Files/4D/4D v0.0/4D Volume Desktop/", + "macCertificate":"Damien FUZEAU" +} \ No newline at end of file diff --git a/README.md b/README.md index 8374747..c4ea3b6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Welcome to Build4D! This 4D project allows you to compile, build and sign: * compiled projects * components -* standalone applications (planned) +* standalone applications * server applications (planned) * client applications (planned) @@ -15,4 +15,5 @@ Several classes are available. For more details, please refer to the class docum * [CompiledProject](./Build4D/Documentation/Classes/CompiledProject.md) * [Component](./Build4D/Documentation/Classes/Component.md) +* [Standalone](./Build4D/Documentation/Classes/Standalone.md) * [_core](./Build4D/Documentation/Classes/_core.md)