how do I test ng-add schematics - unit-testing

I decided to add an ng-add schematic to my library, since there are additional setup steps when installing it past running npm/yarn install. This way, users will be able to run ng add #myorg/mylib and the schematics will run
I am having difficulty test running the schematic. Angular Guide only mentions how to test generate schematics, not add ones. The problem is that the schematic is supposed to run when I install the library, however ng add command always seems to install the repository version, and not the local one even if I link my library with yarn link
Thanks for your help.

Ok, I got an answer before I submitted the question.
Do yarn link mylibrary, and then ng add mylibrary. ng add doesn't require the library not to be installed, it will try to install, but fail gracefully if the library is already installed with a warning
Skipping installation: Package already installed
Your ng-add script probably contains context.addTask(new NodePackageInstallTask());. Since link already "installed" the library in your node_modules, this will fail. The solution is to comment this line out while you're developing, and reenable it before publishing.

Related

How can I build an individual boost library forked cloned from git?

Boost using this build system I'm not otherwise familiar with, based on "Jam" files. Now, I've forked and cloned a specific Boost library (program_options), and I want to build it and perhaps also run the tests. I notice a build/Jamfile.v2 - what should I do with it?
I tried apt-get install jam on my distribution, but that did not get me very far:
$ jam -fbuild/Jamfile.v2
warning: unknown rule project
warning: unknown rule boost-lib
don't know how to make all
...found 2 target(s)...
...can't find 1 target(s)...
Also, do I have to get the absolute latest development version of all of Boost to build the cloned library against, or can I use a local boost release I already have?
Notes:
I'm on a recent GNU/Linux distribution (Mint 18.3 but this shouldn't matter).
What I've done, based on #SergeyA and others' advice, is:
Clone all of Boost, recursively (see this page (this will create a boost/ folder )
cd boost
in .git/modules/my_boost_lib/config, change the origin URL to your fork
in .gitmodules, under [submodule "my_boost_lib"], change the URL to your fork
execute git submodule update --init libs/my_boost_lib/ (perhaps after deleting that library; not sure if that's actually necessary)
cd libs/my_boost_lib/build
../../../b2
The latter works because b2 looks for a Jamfile.v2 in its current working directory, and that file exists and is intended to build just the library. The build results will be located outside of libs/my_boost_lib though.
Note: To build run the library tests, build the same way but from libs/my_boost_lib/test.
Essentially the build steps is
Run bootstrap to build the build tool b2
Build boost with b2 install or similar. You may want to provide options to it.
Read more in the boost getting started document:
http://www.boost.org/doc/libs/1_66_0/more/getting_started/index.html
(hint, look at lower right to go to next page..)
If you are on windows / VS2017, the use of vcpkg to get boost is very easy.

Tensorflow inception final layer bazel retain error

following example in Tensorflow site;
i am trying to retrain inception model final layer in Ubuntu+python 2.7 environment.when running below command
$ bazel build /home/incept/tensorflow/tensorflow/examples/image_retraining:retrain
it gives an error.
ERROR: not a valid absolute pattern (absolute target patterns must start with exactly two slashes)
any suggestion to fix this? example mention try
$ bazel build tensorflow/examples/image_retraining:retrain
Just to summarize general TensorFlow build issue debugging (on Linux) in case other people end up here with similar issues:
Make sure you're in the directory you checked out. So if git clone made you a tensorflow directory, bazel commands should be run in that directory tree. It doesn't matter where in the tree if the build target is absolute (//tensorflow/...).
Run ./configure in the tensorflow directory. This fetches necessary dependencies in addition to allowing you to configure the build (you can yes "" | ./configure if you don't want to bother answering the questions and just want the defaults).
Make sure you have the latest version of Bazel and a compatible Java installation.
The git repository changes quite a bit. git pull will get you the latest (git checkout can get you any version you'd like).

Loris package installing issue

I'm trying to install Loris package link which is a library also for Python (my language). I have installed the package through bash commands in my OSX 10.12 system following these steps:
cd to the directory containing the package's source code and type
./configure to configure the package for your system. If you're
using csh on an old version of System V, you might need to type
sh ./configure instead to prevent csh from trying to execute
configure itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
Type `make' to compile the package.
Optionally, type `make check' to run any self-tests that come with
the package.
Type `make install' to install the programs and any data files and
documentation.
You can remove the program binaries and object files from the
source code directory by typing make clean. To also remove the
files that configure created (so you can compile the package for
a different kind of computer), type make distclean. There is
also a make maintainer-clean target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
The problem is that when I run both python 2.7 IDLE and the Atom editor it says that the module named Loris was not found. By default, make install will install the package's files in
/usr/local/bin,/usr/local/man.
Is this the problem? How can I install properly this library?

VisualGDB c++ to RaPi Poco no such file or directory

I am taking over a project and am pretty new with this entire setup (linux/gdb/c++). This project did work at 1 point, on RaPi 1.
Using VisualGdb to compile a c++ program to run on a RaspberryPi 2. I've seen similar questions, but either the answers didn't work or I don't fully understand how to implement.
When I try to compile, I get a fatal error: library name: No such file or directory.
2 that I know of so far are:
include "Poco/Data/Common.h"
include "Poco/Data/SQLite/Connector.h"
I have a similar program that uses different poco libraries and it compiles fine. If I look in the External Dependencies of the project, I see Common.h and Connector.h. The GDB Makefile settings have pthread PocoFoundation PocoData PocoDatad PocoDataSQLite PocoDataSQLited libraries listed.
Tried a few things, but not really sure how to debug this. I don't seem to be able to find the files on the RaPi using find -iname "Common.h", but I can't find the ones that are working in the other project either using that method.
I've done the Complete Edition install of poco and run sudo apt-get update; sudo apt-get upgrade; sudo rpi-update.
Tried to give as much info as I understand of this, but sure I missed something. Any help/suggestions would be great. Let me know if you need more info on something I didn't include.
Thanx ahead of time.
In case anyone else has this issue.
libmysqlclient-dev needs to be installed first for these libraries to get installed with the poco install.

Building c++ project in Ubuntu Linux with Makefile.am/Makefile.in

I am new in Ubuntu/Linux and I've been working with java using the NetBeans IDE, so I don't have much experience with building c++ projects. But now I have to provide a proof of concept and I need to connect a C++ client with my ActiveMQ server. I downloaded The ActiveMQ-CPP API from this link, but I can't build/run it.
The download came with the files: Maklefile.am and Makefile.in. I searched it and I found that I need automake/autoconf to build it. I tried running ./configure but it says that it couldn't find such file or directory. I tried
sudo apt-get update
sudo apt-get install automake
sudo apt-get install autoconf
and a lot of other commands that I found on the Internet. None of then worked. I know that this question is really basic and it seems to be already answered somewhere else, but every attempt I've made failed. I think I'm missing something. I even tried the solution provided in the last message in this topic but it didn't work either.
Can anyone help me install autoconf/automake, or tell me how to use Makefile.am / Makefile.in to build the project I downloaded, or even suggest me some other way of building it?
Since you're open to other methods of building your project, I'm going to suggest CMake. It is a far better build system than autotools (at least from where I stand).
#CMakeLists.txt
project(MyProject CXX)
set_minimum_required(VERSION 2.8)
add_executable(foobar foo.cpp bar.cpp)
That example will build an executable called "foobar" by compiling and linking foo.cpp and bar.cpp. Put the above code in a file called CMakeLists.txt, then run the following commands:
cmake <path to project> #run in the folder you want to build in
make #this does the actual work
The really cool thing about CMake is that it generates a build system (Makefiles by default) but you can use it to generate project files for Eclipse, a Visual Studio solution, and a bunch of other things. If you want more information, I'd check out their documentation.
The "configure" script should be in your ActiveMQ-cpp source directory. From the Linux command line, you should be able to:
1) "cd" into your ActiveMQ* directory
2) "ls -l" to see the "configure" script
3) "./configure" to set things up for building the library\
4) "make" to actually build the library
This is mentioned in comments, but this particular point of confusion has been common for well over a decade and I think needs to be clarified as often as possible. You DO NOT need to have autoconf or automake installed to build a project that used those tools. The entire point of the autotools is to generate a build system that will build on a system using only the standard tools (make, a c compiler, sh, and few others.) Unfortunately, many developers release tarballs that do not build cleanly. If you unpack the tarball and it does not contain a configure script, or if the configure script is broken, that is a bug in the package. The solution is absolutely not to install autoconf/automake/libtool and try to produce a working configure script. The solution is to report the build error as a bug to the package maintainer.
The world would be a better place if Linux distributions stopped installing multiple versions of the autotools by default as less than .002% of the population needs those tools, and anyone who actually needs to have the tools should be capable of installing it themselves. Anyone incapable of acquiring and installing the tools has no business using them.