How to remove an extension from Hybris? - sap-commerce-cloud

We have discontinued Print module from Hybris and we have stopped paying maintenance for Print module. Hence, we need to remove the Print references.
I believe just removing/commenting below entries from localextensions.xml will suffice. Is there anything else I need to look at?
<!-- ext-print -->
<extension name="print" />
<extension name="printcockpit" />
<extension name="printhmc" />

First of all you have to distinguish between 'modules' and 'extensions'.
A 'module' is a set of extensions to provide some functionality to the hybris platform, for example the 'print module'.
An 'extension' is one technical hybris project that provides some functionality for a module, so here the focus is on the technical architecture.
If you want to remove (for example) the 'print module', I think you have to do the following steps:
Look for all dependencies between the extensions for the module
Remove them from the 'localextensions.xml'
Do an 'ant clean all' to remove the old generated files and create only the needed ones
Do an Update on the hybris system in the /hac to update the database to the current stand
Look in the /hac for the 'remove orphaned types', that will delete all models that are not used anymore
So this I think are the default steps.

Related

How to rename an existing Hybris extension

I am working on Hybris and I generated a new extension using hybris command (ant extgen) with default settings. During extension generation, I did not change default values like I let the project name to be "training". I started developing some code just for the sake of trying it but now I wrote quite a lot of code and instead of generating a new extension, I am trying to rename "training" to a new name which is more suitable for my project.
My question is - Is there any shortcut to rename "training" to a new name. By rename I don't mean standard intellij or eclipse module rename but also updating all extension specific properties which are referring to extension name "training". Is there any hybris ant command for it?
Here is the way I can think of.
You can declare your extension as a template for extgen and then generate a new extension based on it with a new name and structure.
Let me take training as your current extension which you want to convert to some other name. Below are the steps you need to perform.
Make sure your extension (training) is there in the localextensions.xml
Update extensioninfo.xml to mark the extension as a template by adding below meta tag
<meta key="extgen-template-extension" value="true"/>
Look like
<coremodule generated="true" manager="org.training.jalo.TrainingManager" packageroot="org.training"/>
<meta key="extgen-template-extension" value="true"/>
<webmodule jspcompile="false" webroot="/training"/>
Create an extgen.properties inside training extension/folder with below properties
Please note, If your current extension is with a different name then training in that case you need to change below values accordingly.
extgen.properties:
YEXTNAME_TOKEN=training
YMODULE_TOKEN=training
YMODULE_PACKAGE_ROOT=training
YMODULE_CLASS_PREFIX=training
YPACKAGE_TOKEN=org.training
YMANAGER_TOKEN=TrainingManager
YCLASSPREFIX_TOKEN=Training
YGENERATED_TOKEN=Generated
Run ant extgen and select your extension (training) from the given selection option and give the name and package the way you want when it prompt for it.
Now replace training extension with the newly created extension inside localextensions.xml
Test and patch wherever needed! :-)
I don't think so. It might also be easier just to create a new one and move the code into the new extension.
No it is not possible. The generated extension itself was created from a template where the word "training" is inserted into many places (class names, package names, configurations...) .
The other approach would be to look into the ext-template folder (6.7). There are all templates. Search for any token in the templates and make appropriate change in your generated extensions.
Depending on the amount of your extensions, it will also take some time... and you need to understand how extgen works, first.

How to reuse Specflow steps from a CodedUITest project in different solution

We have Specflow layer on top of our CodedUITest project. We have some common steps in one CodedUITest project(CodedUITestProject1), which we want to use in another CodedUITest project (CodedUITestProejct2) in different solution.
We have created dll of the CodedUITestProject1 and added its reference in CodedUITestProejct2. Also updated the CodedUITestProject2's App.config file to use bindings from External Assembly like this, but is not working. Any thoughts on this.
<specFlow>
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --><unitTestProvider name="MsTest" />
<plugins>
<add name="CodedUi" type="Generator" path="." />
</plugins>
<stepAssemblies>
<stepAssembly assembly="CodedUITestProject1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</stepAssemblies>
</specFlow>
The Visual Studio Integration has some bugs when it comes to additional step assemblies.
So syntax highlighting, IntelliSense and "Go To Definition" can sometimes not work.
Try to delete the specflow-stepmap* files from %temp%.
There are no problems at runtime.
Sometimes VS decides on its own to not copy the referenced DLL if no code usages are done in the consuming project.
Double check your bin folder for CodedUITestProject1.dll it should be missing if VS has decided that you don't need it.
If this is the case then you may need to create a dummy instance of a type from CodedUITestProject1.dll in your hooks (or anywhere in the code) so VS can see that you are using something from CodedUITestProject1.dll. Once the project is built then you may remove the dummy code you have entered.
Another option could be just to References -> CodedUITestProject1 -> Properties-> Set copy local to True. (not confirmed its fixing the problem).
Note: When using BDD steps from external DLL navigation (F12 on a step) is not working.

Website project: want to generate XML documentation on build

For legacy reasons, I'm maintaining a Web Site Project for which I want to provide up-to-date documentation from the XML documentation comments. I gather I can do that by tweaking the <compilers> section in web.config. I finally reached this point:
<system.codedom>
<compilers>
<compiler
language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider"
compilerOptions="/optimize /doc:C:\temp\my-output-here.xml"
warningLevel="1" />
</compilers>
</system.codedom>
Now when I start the website with (and thus invoke just-in-time compilation) I do get an XML file in the requested location but it's minimal:
<?xml version="1.0"?>
<doc>
<assembly>
<name>App_global.asax.abqhzva4</name>
</assembly>
<members>
</members>
</doc>
It seems like the <compiler> tag doesn't quite do what I want. It must be generating XML for the project folder itself rather than the .cs files, or it's getting overwritten with each compilation unit and I'm only seeing the trivial last one, or... I don't know. I'm not sure. This config tag is not well documented.
Long story short, I'm looking for a way to get XML documentation for all the .cs files in this website project. It doesn't matter if it's all in one file, in separate files, or even shoved into memory at run time.
I'm aware of the prior question on this, but the link provided there has been redirected to the Sandcastle site. That's great, but it's way more than I'm actually going to use on this project. Simply getting XML documentation at build time or run time is all that is necessary.
My question then is: What do I need to do to get the <compiler> config entry to generate XML docs for a Website Project?
I have an ugly workaround as well... But here goes!
1. Download the latest Sandcastle Installer from this page - https://github.com/EWSoftware/SHFB/releases
2. Unzip and run the installer
3. Copy EWSoftware.CodeDom.dll into your website's \bin directory. The default location of this file is - C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\Extras\EWSoftware.CodeDom.dll
4. Modify web.config as follows:
<configuration>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
compilerOptions="/docpath:C:\Publish\Docs"
type="EWSoftware.CodeDom.CSharpCodeProviderWithDocs, EWSoftware.CodeDom"
>
<!-- NOTE: Change version value as needed (v3.5, v4.0, etc.) -->
<providerOption name="CompilerVersion" value="v4.0"/>
</compiler>
</compilers>
</system.codedom>
</configuration>
Source: http://ewsoftware.github.io/EWSoftwareCodeDom/html/40ba6bda-95d6-4a64-834f-f7cedcb589d1.htm
5. Rebuild your solution and voila! The folder specified with the /docpath option will contain your XML documentation.

Add Visual C++ property sheets using CMake

I'm currently porting a gcc project to Visual C++. It's defined in a CMake file, and I have created a Visual C++ property sheet to aid in compatibility (GccCompat.props). Everytime the Visual C++ project files are regenerated by CMake, the property sheet has to be added manually, since I don't know how to add it automatically. So, the question is:
How can I tell CMake to add a property sheet to the generated Visual C++ solution?
This functionality has made it into the nightly build of CMake (https://gitlab.kitware.com/cmake/cmake/commit/e390991846825799e619e072a28f1da58b7c89ba), although not into a stable release yet. Theoretically, it will be in the next release, and CMake releases are made relatively frequently.
To use, you would set the VS_USER_PROPS property on a target. Eg. set_target_properties(foo PROPERTIES VS_USER_PROPS "${props_file}").
However, it doesn't appear that you can use multiple property sheets with this option, and, it replaces the default user property file ($(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props). To workaround this, property sheets can include other property sheets, so, you could make a 'master' property sheet which includes any other property sheets that you would like to use (including the default user property sheet).
This question is a little bit old but I have recently stumbled upon the same problem while integrating GStreamer into my project. GStreamer comes with a set of extremely well prepared and high quality Property Sheets and I wanted to use them instead of hacking things around in CMake.
Fortunately, this issue is only limited to Windows and Visual Studio. So here's my solution:
The idea is to use Visual Studio's .user file feature. CMake does not generate this file so it's pretty safe to generate it at configure-time. At configure time you may generate a file that has the EXACT name as your project file but ends with a .user extension.
Partial Solution:
If your project file is named my_project.vcxproj, you need to create another file next to it called my_project.vcxproj.user. According to MSDN:
A user file (.vcxproj.user) stores user-specific properties, for
example, debugging and deployment settings. The vcxproj.user file
applies to all projects for a particular user.
The contents of this file for importing property sheets is something like this:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="/path/to/sheet1.props" />
<Import Project="/path/to/sheet2.props" />
</Project>
Not flawless, but works until CMake starts supporting property sheets. The file can be created by using CMake's file command at configure-time.
Potential Caveat:
I have noticed when I add property sheets this way, sometimes they do not show in the Property Manager window (might be a bug in Visual Studio Community 2013) but they always are imported properly and dependencies are resolved correctly.
Not sure which properties you need. A few could be set directly in CMake, like in this example for multiple configurations:
set (CMAKE_CONFIGURATION_TYPES "A;B;C;D" CACHE STRING "Configurations" FORCE)
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
set (CMAKE_CXX_FLAGS_${OUTPUTCONFIG} "/ZI /Od")
set (CMAKE_EXE_LINKER_FLAGS_${OUTPUTCONFIG} "/debug")
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
Apart from variables listed here, I think CMake has no possibility to attach property sheets.
in my master props file main.props:
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
then, in CMakeLists.txt:
set_target_properties(foo PROPERTIES VS_USER_PROPS "main.props")

Deployment of custom content type, forms, cqwp, and xsl

Right now I have a visual studio project which contains a custom content type that I made. It also contains all the necessary files for making a sharepoint solution (wsp) file and a script to generate this.
Now, I would like to do 2 things.
First, I'd like to create a custom display form for the content type and include it in my solution so that it is automatically deployed when I deploy my solution. How do I include this in my solution and make my content type use it?
Secondly, you can query this type with the CQWP. I've thought about exporting it, adding more common view fields, and then modifying the XSL that is used to render it. How do I include this into my solution so that it is also deployed. I know i can export the CQWP webpart once it's all setup and include it in my project as a feature. But what abuot the XSL?
Looking forward to see your suggestions, cheers.
Did as described in the first answer. Worked like a charm.
Use STSDev to create the solution package.
That should help with creating the WSP. The custom form, CQWP webpart and the .xls file should also be deployable within the project.
To deploy the xslt, your feature will have an
<ElementManifest Location="mywebpartManifest.xml">
This then points to a files such as
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="Yourfile.xslt" Url="Style Library" Path="" RootWebOnly="TRUE">
<File Url="yourfile.xslt" Type="GhostableInLibrary" />
</Module>
</Elements>
for the webpart:
<Module Name="myWebpart" List="113" Url="_catalogs/wp" RootWebOnly="FALSE">
<File Url="myWebpart.webpart" Type="GhostableInLibrary" />
</Module>
Now that file will need to be contained in the solution manifest.xml. This is done automatically from the STSDev project.
e.g.
<Resources>
<Resource Location="SimpleFeature\Feature.xml"/>
The actual schemas are:
Site
Solution
Feature
and a link to someone else with the issue
But where in the folder structure do you deploy the form and the .xsl to?
I have followed your guide and although it deploys the xslt to the feature in 12 Hive it does not place it in the correct style library folder
You need to deactivate / reactivate the feature. This will give you any error messages that are associated with copying the file over.

Resources