I want to merge the .class files from a subproject in the main jar file.
I try
into('') {
from project(":audit-reactive-lib").buildDir;
}
I guess what you want is a big jar.
If you want to code it on your own, your do it like this:
jar {
from {
project(":audit-reactive-lib").sourceSets.main.output.classesDir
}
}
Next time search before you ask, or take more effort in your question.
Related
I have a project that's roughly structured as:
main.c
premake5.lua
moduleA/
premake5.lua
include/modulea.h
src/modulea.c
moduleB/
premake5.lua
include/moduleb.h
src/moduleb.c
My top level premake5.lua is fairly simple:
workspace "myproject"
configurations { "Debug", "Release" }
include "moduleA"
include "moduleB"
project "myproject"
kind "ConsoleApp"
language "C"
files { "main.c" }
includedirs { "." }
links { "moduleA" , "moduleB" }
I would like to be able to express my modules' configuration/dependencies without hard-coding conventions used in the containing project. Modules A and B will be re-used in other projects, so I want to avoid having to do:
project "moduleA"
kind "StaticLib"
-- files, etc
include { "..", "../moduleB/include" }
links { "moduleB" }
The include lines containing .. makes assumptions about a parent project structure that may not always hold.
Is there some way for a higher-level Premake script to "tell" these sub-projects "here is the base for includedirs/sysincludedirs"? Even if it involves writing those dependency projects in a different way to accept that information?
For example (and let me stress I don't know enough Lua or Premake to know how much sense this makes), my modules could say "make sure you set MODULE_INCLUDE_BASE and MODULE_SYS_INCLUDE_BASE" and then use:
project "moduleA"
-- etc
include { "%{MODULE_INCLUDE_BASE}/moduleB/include" }
Higher-level dependent projects could then... set?... these variables before including the dependency configs. (Again, this is just an example, maybe there's a more elegant way to do it.)
One option is to defer evaluation by wrapping the project call in a function itself:
function project_A()
project "moduleA"
kind "StaticLib"
language "C"
files { "moduleA/src/*.c" }
includedirs { '.' }
end
When this is called from the top level premake5.lua, the '.' is evaluated in the context of the top level script:
workspace "myproject"
configurations { "Debug", "Release" }
include "moduleA"
include "moduleB"
module_process()
module_protocol()
-- ...
Includes are then done relative to this top level script.
I would suggest checking the export module for premake
https://github.com/Meoo/premake-export
projects can define stuff that the need to export to other libraries or applications.
In turn other libraries can import the projects that they depend on
It's very handy and the syntax is very expressive !
I'm using Flow to help author a JS project. If I want to provide a libdef file to supplement it do I need to create it manually, or am I able to execute some magic command that I'm not aware of yet which will generate the lib def for me?
Something like $ flow-typed doyourmagic would be nice.
EDIT:
Found this https://stackoverflow.com/a/38906578/192999
Which says:
There's two things:
If the file is owned by you (i.e. not a third party lib inside node_modules or such), then you can create a *.js.flow file next to it that documents its exports.
If the file is not owned by you (i.e. third party lib inside node_modules or such), then you can create a libdef file inside flow-typed/name-of-library.js
For .js.flow files
you write the definitions like this:
// #flow
declare module.exports: { ... }
For libdef files you write the definitions like this:
declare module "my-third-party-library" { declare module.exports: {... } }
For my question I fall into the "is owned by you" camp.
I guess I'm confused as to:
How I write these files.
How/where I publish these files to package it up for another project to reference.
Also, why do I need to create the .js.flow file manually? Can this not be magically generated? Perhaps that's the intention going forward but not implemented yet.
I found a nice guide showing how to package flow code together with the compiled code. So:
You do not have to write your own libdefs, you can use the entire flow source code. If you want a definition with only the type declarations, you can look into flow gen-flow-files, although that is still experimental and might fail.
You can package them as *.js.flow and the flow checker will automatically pick those up when you import your library.
I want to remove part of a filename of several files, with different extensions, that are in separate folders, i.e., I have a 'master folder' that has 90 folders, and the files are in these folders. How could I remove just part of all files, in all folders, automaticaly.
Regards
What you can do is create a recursive method that renames all files in a directory and then calls the method for other directories in that one. The code below should serve you as guideline (it cuts the first 5 chars of the filename):
public void RenameFiles(DirectoryInfo dir)
{
foreach (var file in dir.GetFiles())
{
file.MoveTo(Path.Combine(file.Directory.FullName, file.Name.Substring(5)));
}
foreach(var directory in dir.GetDirectories())
{
RenameFiles(directory);
}
}
I assumed you use C# because this is my main language. The mechanism is the same regardless the language.
As part of my build process, I have an archive that I need to extract. I can use prebuildcommands to always extract it, but that is repetitive and will slow the build.
How do say "run this command only if the extracted directory does not exist".
It would be good to also extract the file if the archive is new than the directory, but I'm less concerned about that, as I do not expect the archive to change often.
Edit: I have an external requirement to use Premake 4.
It looks like the documentation is a little incomplete, but (using Premake5) maybe something like this?
buildcommands { "cmd to unarchive the file" }
buildinputs { "name of archive" }
buildoutputs { "name of a file from the archive" }
I followed the database creation app on http://developer.blackberry.com/native/sampleapps/ but I can't figure out how can I create the database/retrieve data when my app loads. Can someone help me with good reference books for using sqlite3 with cascades, I can't find any good source for it.
There are a few ways, but I used this one so far (it's not perfect but good enough).
First save customsqldatasource.cpp and customsqldatasource.h inside your /src directory.
Open your applicationui.cpp and add to the top
#include "customsqldatasource.h"
and add this inside ApplicationUI to expose it to QML:
qmlRegisterType<CustomSqlDataSource>("com.myapp.data", 1, 0, "CustomSqlDataSource");
Add LIBS += -lbbdata to your .pro file
add your database in /assets; location is up to you, just make sure it matches source in CustomSqlDataSource
add import com.myapp.data 1.0 to your .qml file
Within attachedObjects add this:
CustomSqlDataSource {
id: asynkDataSource
source: "sql/mydatabase.db"
query: "SELECT * FROM recent_searches GROUP BY fromCity, toCity ORDER BY id DESC"
onDataLoaded: {
if (data.length > 0) {
//use data
}
}
}
Now all you need to do is add the following line inside onCreationCompleted to load it
asynkDataSource.load();
I hope I didn't forget anything. A few important things: /assets folder is read only, therefore your .db is copied to /data folder (this script does it).