diff --git a/Build4D/Documentation/Classes/Component.md b/Build4D/Documentation/Classes/Component.md index 5e431c3..fee0091 100644 --- a/Build4D/Documentation/Classes/Component.md +++ b/Build4D/Documentation/Classes/Component.md @@ -23,6 +23,10 @@ $customSettings is an object that contains the following parameters: |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. Its contents are deleted before each build.| |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.| +|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. | |packedProject | Boolean | True if the project is compressed into a 4DZ file.| |obfuscated | Boolean | True if the 4DZ is to not be dezippable.| |includePaths[] | Collection of Objects | Collection of folders and files to include.| diff --git a/Build4D/Project/Sources/Classes/Component.4dm b/Build4D/Project/Sources/Classes/Component.4dm index 979752f..2dd99ab 100644 --- a/Build4D/Project/Sources/Classes/Component.4dm +++ b/Build4D/Project/Sources/Classes/Component.4dm @@ -10,7 +10,7 @@ Class constructor($customSettings : Object) This.settings.destinationFolder:=This.settings.destinationFolder.folder("Components/") End if This.settings.destinationFolder:=This.settings.destinationFolder.folder(This.settings.buildName+".4dbase/") - This._structureFolder:=This.settings.destinationFolder + This._structureFolder:=This.settings.destinationFolder.folder("Contents") This._log(New object(\ "function"; "Class constuctor"; \ "message"; "Class init successful."; \ @@ -22,6 +22,40 @@ Class constructor($customSettings : Object) "severity"; Error message)) End if + + //MARK:- + +Function _setAppOptions() : Boolean + var $infoFile : 4D.File + var $appInfo : Object:={} + + $infoFile:=(Is macOS) ? This.settings.destinationFolder.file("Contents/Info.plist") : This.settings.destinationFolder.file("Resources/Info.plist") + +/* + + +*/ + + + + //https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102364 + + $appInfo.CFBundleName:=This.settings.buildName + $appInfo.CFBundleDisplayName:=This.settings.buildName + + $appInfo.CFBundleVersion:=This.settings.versioning.version + $appInfo.CFBundleShortVersionString:=This.settings.versioning.version + + $appInfo.NSHumanReadableCopyright:=This.settings.versioning.copyright + + $infoFile.setAppInfo($appInfo) + + + + return $infoFile.exists + + + //MARK:- Function build()->$success : Boolean @@ -29,9 +63,11 @@ Function build()->$success : Boolean $success:=($success) ? This._checkDestinationFolder() : False $success:=($success) ? This._compileProject() : False $success:=($success) ? This._createStructure() : False + $success:=($success) ? This._setAppOptions() : False $success:=($success) ? This._includePaths(This.settings.includePaths) : False $success:=($success) ? This._deletePaths(This.settings.deletePaths) : False $success:=($success) ? This._create4DZ() : False + If (Is macOS) $success:=($success) ? This._sign() : False End if diff --git a/Build4D/Project/Sources/Classes/_core.4dm b/Build4D/Project/Sources/Classes/_core.4dm index 259d903..4fe95bf 100644 --- a/Build4D/Project/Sources/Classes/_core.4dm +++ b/Build4D/Project/Sources/Classes/_core.4dm @@ -349,7 +349,7 @@ Function _resolvePath($path : Variant; $baseFolder : 4D.Folder) : Object // a path on different volume ? - $_volume:=Get system info.volumes.query(" name = :1 "; $path_root) + $_volume:=System info.volumes.query(" name = :1 "; $path_root) If ($_volume.length>0) $absolutePath:=$path Else diff --git a/Build4D/Project/Sources/Methods/Compiler_Methods.4dm b/Build4D/Project/Sources/Methods/Compiler_Methods.4dm index c52fd66..c006e83 100644 --- a/Build4D/Project/Sources/Methods/Compiler_Methods.4dm +++ b/Build4D/Project/Sources/Methods/Compiler_Methods.4dm @@ -1,5 +1 @@ //%attributes = {"invisible":true} -C_BOOLEAN(onStartup; $1) - - -C_TEXT(showOnDisk_coop; $1) \ No newline at end of file diff --git a/Build4D/Project/Sources/Methods/buildComponent.4dm b/Build4D/Project/Sources/Methods/buildComponent.4dm index 62038c5..293bf83 100644 --- a/Build4D/Project/Sources/Methods/buildComponent.4dm +++ b/Build4D/Project/Sources/Methods/buildComponent.4dm @@ -19,6 +19,12 @@ destinationFolder: "../Build4D_UnitTests/Components/"; \ includePaths: [{source: "Documentation/"}]\ } + +$settings.versioning:={} +$settings.versioning.version:="20.7.0" +$settings.versioning.copyright:="4D SA" +$settings.versioning.companyName:="4D SA" + $build:=cs.Component.new($settings) $success:=$build.build() @@ -28,7 +34,9 @@ If (Not($success)) // Write logs if failed File("/PACKAGE/Build_failed.log").setText(JSON Stringify($build.logs; *)) End if -If (Not(Get application info.headless)) +If (Application info.headless) + +Else If ($success) ALERT("Build OK") Else diff --git a/Build4D/Project/Sources/Methods/onError.4dm b/Build4D/Project/Sources/Methods/onError.4dm index ab2c181..5741b54 100644 --- a/Build4D/Project/Sources/Methods/onError.4dm +++ b/Build4D/Project/Sources/Methods/onError.4dm @@ -1,4 +1,4 @@ //%attributes = {"invisible":true,"preemptive":"capable"} -This._log(New object("severity"; Error message; "callChain"; Get call chain; "errorCode"; Error; "errorMethod"; Error method; "errorLine"; Error line; "errorFormula"; Error formula)) +This._log(New object("severity"; Error message; "callChain"; Call chain; "errorCode"; Error; "errorMethod"; Error method; "errorLine"; Error line; "errorFormula"; Error formula)) This._noError:=False