GeneXus: How to export properties of Knowledge Base / Version / Generators / Environments with an MSBUILD task? - msbuild

It is easy to export the KB properties to a file with the Genexus IDE.
Is it possible to do the same using MSBUILD tasks?

Currently this is not fully supported. The Export MSBuild task lacks the necessary properties to allow stating that KB, version or environment properties should be exported.
There are several getter properties tasks, that allow reading single properties for different elements, although it's cumbersome to use them to export all properties of a given element.
As of build 161356 of the beta channel, it's possible to set the boolean properties ExportKBProperties, ExportVersionProperties and ExportEnvironmentProperties in the Export MSBuild task, in order to export those kind of properties.

Related

How to add top level KDoc for a file?

Is there a way to add a piece of top level KDoc for a Kotlin file?
Since Kotlin supports multiple variables, functions, classes, etc. in a single file, it makes sense to document the file as a whole. However, Documenting Kotlin Code - Kotlin Programming Language seems not to have any instructions on this.
There's no such feature; however, packages and modules can be documented like in Java
In Dokka, additional documentation files are added with include property (e.g. Gradle configuration).

Customizing msbuild for .NET Core with something like CustomBeforeMicrosoftCommonTargets

For a long time, I have been very successful at non-invasively customizing many .NET Framework builds by setting CustomBeforeMicrosoftCommonTargets and CustomAfterMicrosoftCommonTargets as environment variables in a command-line shell that corresponds to a given development/build workspace.
I would set these environment variables to point to custom msbuild targets files that would then be automatically imported (before and after respectively) the import of the standard Microsoft provided targets files. This has worked great for a long time, but now .NET Core comes along and I find no mechanism quite like that.
I am aware of Directory.Build.props and that does not appear to be equivalent. For one, it is invasive requiring me to add a file to a source tree that I don't want to necessarily touch in order to customize its build (maybe its an open source project and I don't want to be injecting new files into it). For two, it doesn't provide the dual Before/After import hooks which are very important (if this duality weren't important Microsoft would never have provided it).
I also don't like dropping magic files in magic global locations as my build policies/customizations are themselves versioned source code which can vary from one developer workspace to another (even on the very same machine for the very same developer).
It seems odd that Microsoft would fail to retain such a long-standing and fundamentally useful msbuild customization capability in .NET Core. Am I missing an equivalently powerful, easy to use and non-invasive mechanism? Is it there and I just haven't found it?
CustomBeforeMicrosoftCommonTargets and CustomAfterMicrosoftCommonTargets are still part of MSBuild 15 which is included in VS 2017 and the .NET Core SDK.
Setting them as global variables will still import them and override the default locations used if not set. Use the /bl argument to generate a binary build log and the MSBuild structured log viewer to diagnose issues you may have with it.

Creating jar out of chosen classes with structure

Finally I've found a way to export single classes to jar file. My problem now is that it doesn't export structure but only single classes.
How can I export chosen classes and export it with the current directory structure? (so its in i.e /src/org/smth/cmp/asd/MyClass.class inside of jar)
Some things in IDEA are really counterintuitive in comparison how easy that was in Eclipse where selecting classes and simply using Export... function in context menu did what I'm talking about... Still like lots of its features though

Merge build definition changes back into build template in TFS 2013

How can one persist or version-control a detailed history of build modifications (not just template modifications)?
In Visual Studio 2013 using a TFS build server, we know of two places where you can edit a TFS build configuration (screenshots below):
In the build template xaml file, using the Workflow Designer:
In the build definition directly, using the build editor:
I know you can version control the xaml build template, edit it, check it in, and refresh the build definition from that. The question is, how can someone go the other way—edit the build template using the same editor that the build definition uses? The actual build editor exposes myriad properties that the Workflow Designer conceals or abstracts away in undefined variables.
How can you modify build settings—like run settings, code coverage, and code analysis—across a very large number of solutions? The Workflow Designer doesn't appear to expose these, and build modifications are absent from the server-side xaml that the Download link yields (I've edited and saved builds, and diffed the new vs. old xaml; they're identical).
Build definition changes aren't completely inaccessible as code, are they?
Editor screenshots:
Editing the build template xaml file, using the Workflow Designer:
Editing the build definition directly, using the Team Build editor:
Note: Microsoft's guide to customizing your build process template doesn't address this. It describes template editing & deployment, but doesn't speak to the difference in properties exposed by the build editor vs. the template editor (a.k.a. workflow designer).
Conceptually a template is the workflow that drives the build, a template exposes Arguments that can be populated by the Build definition. A single template can be consumed by multiple build definitions, with the differences being the arguments that are passed from the build definition to the template. Changing the build definition DOES NOT in any way alter the template
Standard arguments that are passed in are the workspace, the solution to build and any arguments that need to passed to the test runner, such as a run settings file.
I have a standard template that i use for 95% of my builds, this is customised to update assembly versions, run stylecop, display a warning if code coverage falls below a threshold and other little tweeks.
if you want to apply something accross multiple builds then you need to customise the template, for arguments that are exposed to the build definition you can supply default values. This then means that all of your builds will follow the same process.
when you then create a build definition you can use the same template and just supply information specific to that build such as solution file and run settings, you can override the default settings that you created for an argument in the template with specific values for that particular build.
As an example, in my template i have an Argument of TargetCodeCoverage, this has a default value of 70, so all definitions will have a default value of 70, if for a specific build i want 80 i can just change that value in the build definition.
Build definitions have been hard to track as they exist in the database and are not as such source controlled, if you install Community TFS Build Manager, you can right click on a build definition and export it. you can then save this exported file in Source control.
Another way to 'standardise' your definitions is to create a definition you are happy with and then just clone it, repeatedly, this will then give you all of the same setting that you created on the first and you can then just update the workspace and the solution file

Third-party custom loggers for MSBuild

Are there any interesting custom loggers for MSBuild already written? I am especially interested in loggers that would record system load (CPU/Memory/IO) data during the build and relate that to actions performed by the build.
Checkout the MSBuild Extension pack. This contains a lot of extra custom tasks and loggers.
I don't know about your specific needs for the logger. Remember that the purpose of the logger is only to report on different steps of the build. It only accepts a message and an importance property. You would need to add system load collection by yourself. But again, I don't think this kind of code would belong in a custom logger.