I'm making first steps with an SBT plugin.
object WoahPlugin extends Plugin {
override lazy val settings = commands += thingCommand
lazy val thingCommand = Command.command("thing") {state: State =>
println("this is the thing~!")
state
}
}
After defining a command, I want to try it out. Do I need to build the plugin and define a new project that uses it in order to try it out? Or can I open an SBT session in the plugin's project and import it directly?
tl;dr You can't have a plugin project and be able to test it out without another project that uses it.
A plugin enhances a build definition of a project so you set up a plugin that expands the project with capabilities you want - additional settings and tasks. See Plugins in the official documentation of sbt.
You set up plugins in meta-project under project directory, by convention usually in project/plugins.sbt (but any project/*.sbt file would do).
If you need to test a plugin you've got two notable choices that all boil down to having a separate project for the plugin and another to use it - the choice is about the place where the test project is as compared to the plugin project under test.
Plugin project in project metaproject
You can have the sources of the plugin under project/src/main/scala so they belong to their own project, but because of the directory they live in project, they automatically become part of the metaproject for another project one level up.
With the plugin's sources inside the meta-project project you can define a plugin dependency in project/plugins.sbt and have the plugin installed (given the recent changes to sbt since 0.13.5 it doesn't necessarily mean the plugin's enabled).
Plugin project anywhere
The plugin project is a sbt project and as such can be referenced from another sbt project using ProjectRef. If it's a git:// or file:// project, you declare the dependency on the plugin project using dependsOn and the project reference with ProjectRef.
See Can multi-projects from GIT be used as SBT dependencies? and How can sbt pull dependency artifacts from git?.
Related
I have successfully integrated DocFx with a Visual Studio project, using docfx.console, as described here and here.
Under this setup, the building of the project triggers DocFx to process the docfx.json and markdown files found under the project. I do not directly execute docfx.exe. This works both when building the project manually in Visual Studio, and when building on a build server.
I am using the default DocFx template (there is no extracted template in my project) and docfx.console 2.48.1 (the latest as of now).
I am now trying to integrate a custom DocFx plugin & post processor. I have taken two samples from Github (RtfDocumentProcessor & DocFx.Plugin.LastModified) and created a new .NET Framework 4.7.2 class library, which builds OK.
The problem is how to modify the docfx.json to tell DocFx to use the plugin & post processor. The above articles assume docfx.exe is run directly, and also that there is a "template" folder, for example:
Build our project.
Copy the output dll files to:
Global: the folder with name Plugins under DocFX.exe
Non-global: the folder with name Plugins under a template folder. Then run DocFX build command with parameter -t {template}.
I have tried putting my class library DLL in many different folders, and tried modifying the "template" and "postProcessors" settings in docfx.json, but in every case the build fails with a message like this (this is complaining about the DocFx.Plugin.LastModified post processor, which I tried running by setting: "postProcessors": [ "ExtractSearchIndex", "LastModifiedPostProcessor" ]):
Warning:[BuildCommand]Can't import: LastModifiedPostProcessor,
System.Composition.Hosting.CompositionFailedException: No export was
found for the contract 'IPostProcessor "LastModifiedPostProcessor"'.
Does anyone have instructions on how to get this to work with docfx.console?
My main project needs to generate a sub-project with its own build.sbt and then compile and use the sub-project. If the sub-project was pre-generated, I could reference it from the main build.sbt with RootProject. But if the sub-project is not yet generated, any attempt to use a value of lazy val sub = RootProject(subBaseDir) fails.
Is it possible to load the sub-project that does not exist at the moment of sbt start, so some tasks of the main project depended of the sub-project?
Yes, it should be possible in SBT 0.13.13 using its new feature called "Synthetic subprojects". You won't have a build.sbt file for such synthetic projects, since they're, well, completely synthetic. But otherwise they're completely functional projects, and you should be able to set up the dependencies between tasks of current project and its derived projects.
Disclaimer: I haven't tried this new feature myself yet.
I am new to alfresco-sdk. I am used to have old style AMP modules and then run ant script to combine them into alfresco WAR file.
I have followed tutorials of alfresco-sdk for
alfresco all in one
alfresco AMP
alfresco share
archetypes and it ran successfully.
I could not figure out if I have three different AMP modules, how can I combine them in one?
Say for example, currently I following AMP modules in my repo -
alfresco-DEF-AMP
alfresco-generic-AMP
alresco-ABC-AMP
What should I do such that when I give amp-to-war command, it takes customization from above three modules and puts then into alfresco WAR.
I think you should stick with using a seperate archetype alfresco (AKA repository) AMP for each of your existing modules.
By Running the alfresco SDK maven build with target mvn package on each module, will create an amp file for you. These amps can then be deployed to your alfresco instance (with apply_amps.bat), just like you probably are used to, with ant builds.
You don t have to execute the maven build via run.bat file, which starts alfresco with your module in an embedded container.
If you really want to combine them into one, I suppose you ll have to merge your code of the 3 modules into one module of type alfresco AMP, and still work the above way.
We can use alfresco All-in-one archetype for that.
We can use overlays to include our custom modules such as
alfresco-DEF-AMP
alfresco-generic-AMP
alresco-ABC-AMP
to generate single WAR file (alfresco/repo.war)
Below link is very useful
http://docs.alfresco.com/sdk2.1/concepts/alfresco-sdk-advanced-add-custom-amps.html
I have wrote a Qt Quick Desktop application in c++ qnd Qt Creator(QML) on Windows7. Now I have to deploy it.
I'm using Qt Quick Desktop Components plugin in my application, I've installed it according to these instructions, and I'm using it with:"import Qt.labs.components", as written there.
I tried adding to the .pro file:
QML_IMPORT_PATH = C:\QtSDK\Desktop\Qt\4.7.4\mingw\imports\Qt\labs\components
but I saw it's working well without it, and I removed it.
I've read a guide how to deploy such an application here, and followed it; I have now a deployment folder, with: the .exe file, the needed dll's, and a folder hierarchy like:Qt/labs/components.
in components I put the styleplugin.dll(for desktop components), and a qmldir file, with the content: plugin styleplugin, excactly like in the doc.
but when I'm runnig my application.exe from the deployment folder in another computer, I'm getting a white, empty window, means: It didn't find the .dll file.
Should you explain me please what's wrong?
I know two reasons, when app can not load plugin dll:
Some of dependecies of the plugin dll are missing or can not be found and that is why it can not be loaded. Qt Creator or Visual Studio environment can be different than the system one. For example, your IDE can modify PATH environment variable. Check plugin's dependencies availability with Microsoft Dependency Walker tool in the same environment where you launch your app.
App can not find plugin in standard directories. To check this you should specify plugin import directory explicitly:
QDeclarativeView *rootView = new QDeclarativeView()
rootView->engine()->addImportPath(QLatin1String("path/to/your/imports"));
I have a CMake project for a Qt based application using plugins.
The standard way to create a plugin is CMake (on all platforms) is with:
ADD_LIBRARY(${PROJECT_NAME} MODULE ...)
This creates a libxxx.so plugin (instead of a libxxx.dylib, if SHARED is used instead of MODULE above).
Now, when running inside an IDE like Xcode or QtCreator, the application works fine, the plugin is loaded and works.
But if I create the .app bundle, the application does not start, saying "libxxx.so is not a valid Qt plugin"! How could be that possible? Maybe some library dependency is not found, but how can i check that? I have used tool -L and I think all the libraries are ok.
You may need a "qt.conf" file in your bundle to tell Qt where the plugins are.
You should read up on CMake's BundleUtilities fixup_bundle function and let it do all that "otool -L" and "install_name_tool" stuff for you.
See this recent related stackoverflow question and answer:
CMake: Copy Frameworks into App Bundle