How to include a jar on disk as Gradle compile dependency - jar

compile files('lib/ssi-jar-with-dependencies.jar')
Does not work. It does not break the script but does not include the dependency either.

The above declaration is correct (assuming you put it in the right place). Either the path is wrong, or there is some other problem with the build script (or the Jar).

You can add Flat directory repository:
repositories {
flatDir {
dirs 'lib'
}
flatDir {
dirs 'lib1', 'lib2'
} }

Related

Gamemaker 1.4 android build.gradle edit

I spent much time by making my android game and i have problem now.
I cant upload it to playstore because of 64 requipment. I have readed i could add this line to build.gradle
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
Could you help me please with adding this to gradle.build?
i have found that file in Roaming\GameMaker-Studio\Android\runner\RootFiles
This is content of the file.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0+'
}
}
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
im not sure if this is correct file, tried adding this line bud has error while compiling.
Or maybe you know diffrent way to do this.
I am using GMS 1.4
I've been checking different ways to make 1.4 to generate a 64-bit compatible apk file but even if you achieve to add arm-v8a and x86_64 so Gradle try to generate it, it still needs libyoyo.so (and maybe others) compatible files for each of your new abis to make a 64bits android compatible apk.
The only way to get those files is to have the source code and cross-compile it for each of the 64-bit required abis.

Browserify failing with cannot find module "lodash" error for some files

I am running browserify for an app.js located at some path and it fails everytime with cannot find module lodash from [PATH].
Running "browserify:build" (browserify) task
Error: Cannot find module 'lodash' from '/var/lib/jenkins/buildcode/output/mydir/app_store_richUI/cartridge/js'
Warning: Error running grunt-browserify. Use --force to continue.
The [PATH] is same where the app.js file is present. But, if I change the file name to some other js file at same path, it works. So, the scene is that it succeeds for some js file and fails for others at same path.
Can someone suggest something ?
I have the Browserify.js script installed globally.
Browserify.js
module.exports = {
build: {
files: {
'<%= settings["local.build.dir"] %>/output/<%= grunt.config("build") %>/app_eyeconic_richUI/cartridge/static/default/js/eyeconic.app.js':'<%= settings["local.build.dir"] %>/output/<%= grunt.config("build") %>/app_eyeconic_richUI/cartridge/js/app.js'
},
}
}
The path is shown correctly in the logs with other files. It fails only with app.js file
It was a very trivial issue but took quite some time to resolve.
The issue was that the build suite was at a different location than the build source.
The browserify task contained require statements and it searches for modules in the parent directories so it was not able to find the required module.
After copying the build suite at the same path as the source, it worked.
So currently, my gruntfile.js(and other files/folders in the suite), exports and output directory at are same path.

Gradle project dependency does not reference SNAPSHOT jar

I am trying to create a fat jar file in a multi-project Gradle build, something like the following:
root
+-- project1
+-- project2
project1 provides the basic functionality, which is then used by project2 to create an executable jar. The executable JAR needs to contain all of the code from the dependencies so that it can be run standalone.
For external dependencies this works fine. In project2 I create a new configuration:
apply plugin: 'maven'
apply plugin: 'java'
configurations {
// configuration for JARs that need to be included in the final packaging
includeInJar
}
and then add the dependencies:
dependencies {
includeInJar 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
...
configurations.compile.extendsFrom(configurations.includeInJar)
}
The packaging then looks like this:
jar {
manifest {
attributes "Main-Class": "com.acme.project1.MyTest"
}
// import all dependencies into the Jar so that it can be run easily
from {
configurations.includeInJar.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
The jar is correctly built with all of the files from the external dependencies. The problem comes with the project dependency to project1:
includeInJar project(':project1')
When this is present, I get an error when it tries to assemble the JAR that it can't find the jar (e.g. project1-0.4.0.jar) in the project1 build/libs directory as it does not exist. The message is correct, as project1 builds a SNAPSHOT jar (e.g. project1-0.4.0-SNAPSHOT.jar).
The question is, why does the configuration refer to the non-SNAPSHOT jar when the project is building SNAPSHOT jars? What can I change so that it finds the correct jar?
As a comment :
In my opinion, fatjar is not a great pattern. Maybe Gradle application plugin would fit your need ?
I found the answer to my own question.
The problem was that we have some additional scripting at the project level which is apparantly making a change to the version at the end of the configuration phase.
When the fat jar configuration is assembled, the 'plain' version is used. This is then changed to the -SNAPSHOT version before the jars are built.
Moving the from { ... } code into the build phase by wrapping it in doFirst { ... } is enough to fix the problem, although the real fix is obviously to avoid changing the version in the middle of the in the first place.

How can I properly config the uncss in grunt?

I've tried to configure uncss using grunt
I've installed
npm install grunt-uncss --save-dev
npm install grunt-processhtml --save-dev
Configuration
uncss: {
dist: {
files: { 'dist/css/clean.css': ['index.php'] }
}
}
at the end I load them in and register a default task like this :
grunt.loadNpmTasks('grunt-uncss');
grunt.loadNpmTasks('grunt-processhtml');
grunt.registerTask('default', ['uncss', 'processhtml']);
Result
When I run grunt
at the end I keep seeing :
Running "uncss:dist" (uncss) task
Fatal error: PhantomJS: Cannot open about:blank
Update
I added :
processhtml: {
dist: {
files: {
'index.php': ['index.php']
}
}
}
Still get the same error after running grunt
If this is all of your code, you are not referencing any stylesheets to remove code from. All you are doing is telling grunt where the cleaner file should go, and to remove any unused css from index.php. However, it doesn't know where the styles for index.php live, so it has nothing to do... You need to actually configure your processhtml and tell uncss which stylesheets you would like to clean up.
Read the directions friend:
grunt-uncss github readme.md
I have that problem with my project and the solution is here:
You need update the uncss module, remember grunt-uncss is only a way to use uncss node package. In my case my version of that was in 0.12.1 and updating that package the problem was fixed. Let me know if this help you.

Composer - require another package from my package/bundle but it just won't autoload. Solved in two other ways but not clean enough

I'm using Symfony 2.3 and Composer and using Composer to install my bundle from a remote repository. Doing this on its own works fine, but the problem I have is when I try to require another package from my Symfony2 bundle.
My bundle is in the src/ folder.
I've added this to my bundle's composer.json:
"require": {
"rackspace/php-opencloud": "1.10.*"
},
Everything installs but I now need to ensure the classes are autoloaded (registering namespaces I think), but it just won't do it.
I have actually solved this problem in two other ways, but they are not clean enough. I want my bundle to handle the dependency not the app folder or main Symfony2 composer.json.
Solutions that aren't good enough:
(1) If I add the Rackspace package to my symfony2/composer.json then everything works perfectly. But this is poor as the dependency is on my bundle not the whole Symfony2 framework.
(2) If I add these to app/autoload.php then it also works:
$loader->add('OpenCloud', __DIR__.'/../src/rackspace/php-opencloud/lib');
$loader->add('Guzzle\\Http', __DIR__.'/../src/guzzle/http');
$loader->add('Guzzle\\Common', __DIR__.'/../src/guzzle/common');
...but this is messy and again the dependency is on the bundle not the application.
I have tried various variations of this (in my bundle's composer.json) but it just won't work:
"autoload": {
"psr-0": { "OpenCloud": ["rackspace/php-opencloud/lib/", "rackspace/php-opencloud/tests/"] }
}
Normally, only relative paths are required.
"autoload": {
"psr-0": { "OpenCloud": ["lib/", "tests/"] }
}
I did not test with multiple paths for the same prefix. This may not be supported.
You can alternatively use the classmap autoloader, which will go through an entire folder and generate a static map from them. No prefix required.
"autoload": {
"classmap": ["lib/", "tests/"]
}
I rarely saw tests being included in the autoloading for external application however. PHPUnit handles class loading just fine.

Resources