What is the difference between "configuration: 'android-endpoints'" and "configuration: 'endpoints'" in build.gradle in Android Studio? - google-app-engine

In my app module (which depends on my backend endpoints module), I have the following
dependencies {
compile project(path: ':backend', configuration: 'android-endpoints')
}
But the following also works.
dependencies {
compile project(path: ':backend', configuration: 'endpoints')
}
I see that the generated .jar file dependency has the "android" appended to its name in the former case. However, I suspect there is a more fundamental difference between the two. Does anyone know?
I found the following cryptic reference here:
https://github.com/GoogleCloudPlatform/gradle-appengine-plugin
search for "How do I use a compile dependency on my endpoints client libraries from another project?" in the FAQ section.
Thanks for your help and I hope this isn't a stupid question.

android-endpoints adds few a extra transitive dependencies to the artifact that are required to use endpoints with android, it also removes some that are already included with android.
included : "google-api-client-android"
excluded : "org.apache.httpcomponents:httpclient"
endpoints only adds "google-api-client" and doesn't exclude anything.

Related

Webpack external attribute meaning

I'm reading a react project. In this project, they defined an external like this:
webpackConfig.externals = {}
webpackConfig.externals['react/lib/ExecutionEnvironment'] = true
webpackConfig.externals['react/lib/ReactContext'] = true
webpackConfig.externals['react/addons'] = true
I have read Webpack document but I still don't understand above lines. What is the meaning when define those configurations ?
Thanks
The externals configuration option provides a way of excluding dependencies from the output bundles. Instead, the created bundle relies on that dependency to be present in the consumer's environment. This feature is typically most useful to library developers, however there are a variety of applications for it.
It is used to build a library with webpack that has dependencies to other libraries which should not be included in the compiled version. The externals option defines dependencies that should be resolved in the target environment.
Check these links for more explanation:
https://webpack.js.org/configuration/externals/
https://github.com/webpack/webpack/tree/master/examples/externals
http://tomasalabes.me/blog/_site/web-development/2016/04/30/Webpack-Series-Part-1.html

Prevent Composer from installing a second copy of CakePHP/2

I'd like to use Composer to install some libraries inside my app directory but the src/app/composer.json lists CakePHP as non-dev dependency:
"require": {
"php": ">=5.3.0",
"ext-mcrypt": "*",
"cakephp/cakephp": "~2.9"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
That causes a second copy of CakePHP getting installed into my app/Vendor directory. It's annoying because it uses disc space and gets on the way of IDE's code intelligence.
What's the best way to prevent that? Is it safe to just remove the dependency altogether?
The reason why CakePHP is listed as core dependency in the first place it that it's actually possible to install CakePHP/2.x itself. It's explained in the Advanced Installation chapter.
Apart from the use of Composer, initial set-up needs some additional manual steps that are not required in tarball installations but nothing that is not clearly documented. You also have to use the cake bake shell to create your initial app files (rather than just start typing in already present files), what produces a different structure than you may be used to:
my_project/ 🢀 My stuff comes here
<my app files>
Vendor/
cakephp/
cakephp/
... instead of:
my_project/
<cakephp files>
app/ 🢀 My stuff used to be here
If you opt for traditional (aka manual) installation you are no longer meeting the dependency so it's up to you what to do:
Leave it as is and mark the extra copy as ignored in your editor/IDE
Delete the dependency from app/composer.json and pray you don't need a library that requires it

Reagent build without minified React library

I would like to get a more helpful exception that this one:
Uncaught Error: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.
I am trying to build a Reagent app without the usual minified React JavaScript library. This is where I have got so far with the project.clj file:
(defproject cljsbin "0.1.0-SNAPSHOT"
:dependencies [
[org.clojure/clojure "1.7.0"]
[compojure "1.1.8"]
[hiccup "1.0.5"]
[ring "1.3.0"]
[ring/ring-json "0.3.1"]
[org.clojure/clojurescript "1.7.48"]
[me.raynes/fs "1.4.6"]
[reagent "0.5.1-rc3"]
;[re-com "0.6.1"]
]
:cljsbuild { :builds [ :optimizations :none]}
:main ^:skip-aot core)
So far I have put the important (is it?) :optimizations :none in a few places in the lein project file, but always the minified React library is included.
Later...
Well I'm now quite sure I should be looking at the artifacts. What :optimizations means is covered here: https://github.com/clojure/clojurescript/wiki/Quick-Start: having optmizations gets rid of the 'goog' is undefined error messages.
So I am now using this:
;[reagent "0.5.1-rc3"]
[reagent "0.5.1-rc3" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons "0.13.3-0"]
, which is important because it shows (definitively) that the reagent library includes the react library, and that this react library can be modified. Now just to find out how to get the non-minified version and I'll be able to answer my own question...
Are you sure that once you use the add-ons version, your not already getting the mimified version? I ask as the docs on the cljs/package site say
The externs file includes definitions for TestUtils but to use those with :advanced optimizations you'll need to override :file-min to use non-minified version:
which would indicate that perhaps this uses the non-mimified version unless you use :advanced compilation flag? Perhaps check the externs file and see what it has?
The other solution might be to adopt the approach on the reagent page for using your own build of reagent. To do this, I'm assuming you have to provide a bare bones cljs/react file and add the react js directly into your page?

Sencha Cmd build error while building an ExtJs App extending 3rd party classes (non-extJs classes)

I have an extJs 4 app that is extending 3rd party non-extJs classes. I just can't seem to build the app. It keeps giving me the error below. Objective is to minify the app with appropriate dependencies since it is taking longer time to load both libraries and slowing down the application.
I am using Sencha Cmd v4.0.4.84.
/*********************************************/
C2008: Requirement had no matching files
[ERR]
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExBuild: Failed to find any files
/*********************************************/
Any help is truly appreciated.
So far I have tried:
1) modified app/.sencha/app/sencha.cfg classpath to include the external library. No luck.
2) Added to section of the index.html. No luck.
3) Added loaders and set path of the external library. No luck.
External library is already on my local machine inside of the app folder.
Anyone out there?
I take you out for a lunch if you help me resolve this issue. No seriously!
This is really a showstopper for me.
Thank you,
Ritesh
Issue is resolved in the Sencha Forum post below.
http://www.sencha.com/forum/showthread.php?285252-Sencha-Cmd-build-ExtJs-with-external-library&p=1043385#post1043385
If you can't get to the link then....
If a testing build works and production build does not you might try disabling optimizations. If you look in ".sencha/app/production.defaults.properties" you will see the various settings that make production builds unique.
Try adding this setting:
build.optimize=${build.optimize.disable}
Hope this will help someone.
Thanks,
Ritesh
You cannot extend a 3rd party class as Ext.define expects that all classes inherit from Ext.Base what is unlikely for non-ext 3rd party lib.
Of course, you can use a third party lib by including its javascript outside of <x-compile> block in your index.html

jTwitter, oAuth, and Google App Engine. NoClassDefFoundError

I'm trying to use jTwitter to get an oauth instance to twitter with my consumer key/secret and access token/secret. This is well documented in the javadoc here. I have downloaded signpost, signpost-jetty, and the jtwitter library, but after deploying and running the servlet, I get a error java.lang.NoClassDefFoundError: winterwell/jtwitter/OAuthSignpostClient Eclipse isn't complaining about the class not being there, because it is there-- I can see it in the JAR file itself, which is in my project. So, I said forget it, I'll try out OAuthScribeClient instead, but this generated a VERY SIMILAR ERROR java.lang.NoClassDefFoundError: org/scribe/oauth/Token This one confuses me even further because I have the following code in my java file, and it compiles without error or warning:
import org.scribe.oauth.Token;
Token token = new Token("myaccesstokeninfo", "accesstokensecret");
Clearly, I'm missing something very fundamental, but I am at an absolute loss as to what it may be. Thanks.
Usually "NoClassDefFoundError" happens when you forget to copy all jar-files to your "/war/WEB-INF/lib" directory, so those libs will be unavailable from server-side.
Xo4yHaMope is probably right.
If you're working from Eclipse but running using a web container, then your runtime classpath might be different from your project classpath - which can cause this error.
In order to complete Ben Winters answer what I actually did and worked is add the jar in
the libs folder within the project
see also here about folder hierarchy.
When you do this eclipse will normally add the jar to the android dependencies before launching the application. What I realise is that adding a jar in the build path will make classes available only during the build

Resources