Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Build4D/Documentation/Classes/Component.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.|
Expand Down
38 changes: 37 additions & 1 deletion Build4D/Project/Sources/Classes/Component.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -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."; \
Expand All @@ -22,16 +22,52 @@ 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

$success:=This._validInstance
$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
Expand Down
2 changes: 1 addition & 1 deletion Build4D/Project/Sources/Classes/_core.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions Build4D/Project/Sources/Methods/Compiler_Methods.4dm
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
//%attributes = {"invisible":true}
C_BOOLEAN(onStartup; $1)


C_TEXT(showOnDisk_coop; $1)
10 changes: 9 additions & 1 deletion Build4D/Project/Sources/Methods/buildComponent.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Build4D/Project/Sources/Methods/onError.4dm
Original file line number Diff line number Diff line change
@@ -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