proguard - dupe zip entry ( after upgraded facebook parse UI lib to v4 ) - jar

---SOLVED : deleted 2 lines from :app:build.gradle---
compile files('ParseLoginUI/libs/Parse-1.9.1.jar')
compile files('ParseLoginUI/libs/ParseFacebookUtilsV4-1.9.1.jar')
the lib comment here can be interpreted as "you need these 2 statements in your proj.root.build.gradle. Well not true. I had to delete those in order not to get 'dupe zip' errors from proguard.
--Solved--
Upgrade of parseUI library from v3 to v4 went fine til i tried to run proguard within gradle "assembleRelease" task.
Error:
:proguardRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':proguardRelease'.
> java.io.IOException: Can't write [/home/rob/src/CastVideos-android/build/intermediates/classes-proguard/release/classes.jar]
(Can't read [/home/rob/src/CastVideos-android/build/intermediates/exploded-aar/CastVideos-android/ParseLoginUI/unspecified/libs/Parse-1.9.1.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [Parse-1.9.1.jar:com/parse/AnonymousAuthenticationProvider.class]))
I checked proguard faqs for "dupe zip" ...
I tried to figure out how the dependency tree might be handling a dupe of ./libs/Parse-1.9.1.jar in that library.
IM stuck
build.gradle...
packagingOptions {
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/MANIFEST'
...
buildTypes {
release {
minifyEnabled true
proguardFile 'proguard-android-optimize.txt'
signingConfig signingConfigs.release
}
...
dependencies {
compile files('libs/android-query.0.25.10.jar')
compile files('libs/jackson-core-lgpl-1.9.2.jar')
compile files('libs/jackson-mapper-lgpl-1.9.2.jar')
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
// to get around https://code.google.com/p/android/issues/detail?id=52962, we need to
// depend on both debug and release versions of the library
releaseCompile project(path: '..:CastCompanionLibrary-android', configuration: 'release')
debugCompile project(path: '..:CastCompanionLibrary-android', configuration: 'debug')
compile project(':ParseLoginUI')
compile files('ParseLoginUI/libs/Parse-1.9.1.jar')
compile files('ParseLoginUI/libs/ParseFacebookUtilsV4-1.9.1.jar')
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
}
dependency graph for "release"...
...
+--- project :ParseLoginUI
| +--- com.parse.bolts:bolts-android:1.2.0
| \--- com.android.support:support-v4:22.0.0
| \--- com.android.support:support-annotations:22.0.0
+--- com.facebook.android:facebook-android-sdk:4.0.1
| +--- com.android.support:support-v4:[21,22) -> 22.0.0 (*)
| \--- com.parse.bolts:bolts-android:1.1.4 -> 1.2.0
\--- project :..:CastCompanionLibrary-android
+--- com.android.support:appcompat-v7:22.+ -> 22.0.0
| \--- com.android.support:support-v4:22.0.0 (*)
+--- com.android.support:mediarouter-v7:22.+ -> 22.0.0
| \--- com.android.support:appcompat-v7:22.0.0 (*)
\--- com.google.android.gms:play-services-cast:7.+ -> 7.0.0
\--- com.google.android.gms:play-services-base:7.0.0
\--- com.android.support:support-v4:22.0.0 (*)
Under project.root, the only jar files are :
./ParseLoginUI/libs/ParseFacebookUtilsV4-1.9.1.jar
./ParseLoginUI/libs/Parse-1.9.1.jar
proguard config...
-keep class com.facebook.** { *; }
-keep class com.parse.** { *; }
-dontwarn com.parse.**
-dontnote com.parse.**

Related

How to remove steps from checkout in Sylius

I'm using sylius/sylius 1.3.9 with symfony/framework-bundle 4.2.4. Regarding the doc to remove states from checkout you have to replace the whole configuration of the Sylius core bundle.
I put my configuration into src/Resources/SyliusCoreBundle/config/app/state_machine/sylius_order_checkout.yml:
winzou_state_machine:
sylius_order_checkout:
class: '%sylius.model.order.class%'
property_path: checkoutState
graph: sylius_order_checkout
state_machine_class: '%sylius.state_machine.class%'
states:
cart: ~
addressed: ~
completed: ~
transitions:
address:
from: [cart, addressed]
to: addressed
complete:
from: [addressed]
to: completed
callbacks:
after:
sylius_process_cart:
on: [address]
do: ['#sylius.order_processing.order_processor', process]
args: [object]
sylius_create_order:
on: [complete]
do: ['#sm.callback.cascade_transition', apply]
args: [object, event, create, sylius_order]
sylius_save_checkout_completion_date:
on: [complete]
do: [object, completeCheckout]
args: [object]
After that I execute:
php bin/console cache:clear -e dev
[...]
php bin/console debug:winzou:state-machine sylius_order_checkout -e dev
+--------------------+
| Configured States: |
+--------------------+
| cart |
| addressed |
| shipping_selected |
| shipping_skipped |
| payment_skipped |
| payment_selected |
| completed |
+--------------------+
[...]
Nothing changed. When I follow the link in the doc it says:
Bundle inheritance was removed in Symfony 4.0 [...]
So is it still possible with Symfony 4.2 to replace a whole configuration file of a bundle like suggested by the docs or is this a regression in Sylius 1.3 and what would be a possible solution if I did nothing wrong?
You can try to create state_machine directory in config/packages, put your YAML file and add this line in configureContainer() method into src/Kernel:
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
...
$loader->load($confDir.'/state_machine/*'.self::CONFIG_EXTS, 'glob');
}

Why the QTCreator ignore a $BUILDDIR var to create a personal build directory

I'm using a qtcreator 4.0.3 and I try to create a directory struct to
all builds, like this:
~/Build/project01
~/Build/project02
...
~/Build/projectNN
I'm using this .pro file:
:><------- Cutting ------------
#
# BUILDDIR Where the executable file was create
#
BUILDDIR = $$HOME_PATH/Builds/$$APP_NAME
#
# All Directory of temporary files
#
OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc
RCC_DIR = $$BUILDDIR/rcc
UI_DIR = $$BUILDDIR/ui
DESTDIR = $$BUILDDIR/bin
#
# If the dirs not exists, I'll create it
#
THis instructions are ignored
Any directory was created.
!exists( $$DESTDIR ) {
message("Creating $$DESTDIR struct")
mkpath( $$DESTDIR )
}
!exists( $$OBJECTS_DIR ) {
message("Creating $$OBJECTS_DIR")
mkpath( $$OBJECTS_DIR )
}
!exists( $$MOC_DIR ) {
message("Creating $$MOC_DIR")
mkpath( $$MOC_DIR )
}
!exists( $$RCC_DIR ) {
message("Creating $$RCC_DIR")
mkpath( $$RCC_DIR )
}
!exists( $$UI_DIR ) {
message("Creating $$UI_DIR")
mkpath( $$UI_DIR )
}
:><------- Cutting ------------
But this not work. Always qtcreator use a default directory struct
configured in Tools->Options->Build and Run->Default build Directory.
Simple it's ignore this instructions ...
Am I doing something wrong??
This is an anti-pattern, and it generally won't work because no one using qmake projects expects them to behave that way: Qt Creator doesn't, other people don't, etc.
For any given project, you set the build directory by executing qmake in the build directory. E.g., supposed you have ~/src/myproject/myproject.pro that you wish to build:
mkdir -p ~/build/myproject
cd ~/build/myproject
qmake ~/src/myproject
gmake -j8
To build multiple projects in subfolders, you should have a top-level subdirs project that refers to them. E.g.
+--- myproject
+--- myproject.pro
+--- lib1
| +--- lib1.pro
| ...
+--- lib2
| +--- lib2.pro
| ...
+--- app1
. +--- app1.pro
. ...
etc.
The source directory structure will be replicated in the build folder. You generally shouldn't otherwise care what goes where in the build folder, except when referencing to targets built by subprojects, e.g. if app1 depends on lib2 you will need to add the build product as a dependency. This answer shows exactly how to do that.

how to set sbt plugins invoke scope?

val webAssemblyTask = TaskKey[Unit](
"web-assembly",
"assembly web/war like run-time package"
)
var out: TaskStreams = _
val baseSettings: Seq[Setting[_]] = Seq(
webAssemblyOutputDir <<= (sourceManaged) { _ / "build" },
webAssemblyTask <<= (
streams,
target,
sourceDirectory,
outputDirProjectName
) map {
(out_log, targetDir, sourceDir, outputDirProjectName) => {
out_log.log.info("web-assembly start")
out_log.log.info("sourceDir:" + sourceDir.getAbsolutePath)
out_log.log.info("targetDir:" + targetDir.getAbsolutePath)
val sourceAssetsDir = (sourceDir / "webapp" / "assets").toPath
val classesAssetsDir = (targetDir / "scala-2.10" / "classes" / "assets").toPath
Files.createSymbolicLink(classesAssetsDir, sourceAssetsDir)
}
}
)
val webAssemblySettings = inConfig(Runtime)(baseSettings)
I wrote a plugin of sbt.
I type webAssembly in sbt console, the plugin run ok.
But I want to run after compile, before runtime, how can I do it?
how to set sbt plugins invoke scope?
I think you're confusing the configuration (also known as Maven scope) name with tasks like compile and run. They happen to have related configuration, but that doesn't mean compile task is identical to Compile configuration.
I could interpret this question to be how can a plugin setting invoke tasks scoped in some other configuration. For that you use in method like: key in (Config) or key in (Config, task). Another way to interpret it may be how can plugin tasks be scoped in a configuration. You use inConfig(Config)(...), which you're already doing. But you'd typically want plugins to be configuration neutral. See my blog post for more details on this.
I want to run after compile, before run, how can I do it?
This makes much more sense. In sbt you mostly focus on the preconditions of the tasks. One of the useful command is inspect tree key. You can run that for run tasks and get the entire tasks/settings that it depends on. Here's where you see it calling compile:compile (another notation for compile in Compile):
helloworld> inspect tree run
[info] compile:run = InputTask[Unit]
[info] +-runtime:fullClasspath = Task[scala.collection.Seq[sbt.Attributed[java.io.File]]]
[info] | +-runtime:exportedProducts = Task[scala.collection.Seq[sbt.Attributed[java.io.File]]]
[info] | | +-compile:packageBin::artifact = Artifact(sbt-sequential,jar,jar,None,List(compile),None,Map())
[info] | | +-runtime:configuration = runtime
[info] | | +-runtime:products = Task[scala.collection.Seq[java.io.File]]
[info] | | | +-compile:classDirectory = target/scala-2.10/sbt-0.13/classes
[info] | | | +-compile:copyResources = Task[scala.collection.Seq[scala.Tuple2[java.io.File, java.io.File]]]
[info] | | | +-compile:compile = Task[sbt.inc.Analysis]
This is useful in discovering compile:products, which "Build products that get packaged" according to help products command:
helloworld> help products
Build products that get packaged.
Since runtime:products happens before compile:run, if it depended on your task, your task will be called before compile:run (inspect tree also shows that run resolved to that).
To simplify your plugin task, I'm just going to call it sayHello:
val sayHello = taskKey[Unit]("something")
sayHello := {
println("hello")
}
You can rewire products in Runtime as follows:
products in Runtime := {
val old = (products in Runtime).value
sayHello.value
old
}
This will satisfy "before run" part. You want to make sure that this runs after compile. Again, just add task dependency to it:
sayHello := {
(compile in Compile).value
println("hello")
}
When the user runs run task, sbt will correct calculate the dependencies and runs sayHello task somewhere between compile and run.

Gradle ear is putting JAR instead of WAR

I'm trying to build an ear using Gradle.
I've my project tree like:
/project
|
|--> /web-application
| |
| |--> /src (stuff of web app)
| |
| |--> build.gradle
|
|--> build-gradle
|--> settings.gradle
I'm trying to generate the ear using the ear plugin, but when I do gradle assemble I have the war created under the build directory of the web-application, but inside the generated ear I have a jar of the web application.
The gradle configuration files are very simple, here they are:
project/build.gradle
apply plugin: 'ear'
repositories {
mavenCentral()
}
dependencies {
deploy project(':web-application')
earlib group: 'log4j', name: 'log4j', version: '1.2.15', ext: 'jar'
}
project/web-application/build.gradle
apply plugin: 'war'
repositories {
mavenCentral()
}
dependencies {
compile group: 'log4j', name: 'log4j', version: '1.2.15', ext: 'jar'
}
What I did wrong?
I notice that also the bundled samples for the war plugin, have the same problem...
Thanks in advance
SOLVED!
It needs to configure the WAR module inside the EAR project as:
dependencies {
deploy project(path:':web-application', configuration:'archives')
earlib group: 'log4j', name: 'log4j', version: '1.2.15', ext: 'jar'
}
You can avoid specifying a configuration for each deploy dependency using something like this:
allprojects {
plugins.withType(WarPlugin) {
// Set default configuration as WAR archive if WAR plugin is used
configurations {
'default' {
extendsFrom = [archives]
}
}
}
}
...
dependencies {
deploy project(':web-application')
}

can't add custom SBT action

I just got started with SBT.
To add a custom action, I made a following task and add that .scala file to 'project' folder as SBT wiki guides.
//MyProject.scala
import sbt._
class HelloWorldProject(info: ProjectInfo) extends DefaultProject(info)
{
lazy val hi = task { println("Hello World"); None }
}
after adding the scala src file for configuration, layout of the project folder look like this.
/development/scala/SomeScalaProject/
|~lib/
|~project/
| |~boot/
| | |~scala-2.7.7/
| | | |~lib/
| | | | |-scala-compiler.jar [RO]
| | | | `-scala-library.jar [RO]
| | | `~org.scala-tools.sbt/
| | | `~sbt/
| | | `+0.7.4/
| | |~scala-2.8.1/
| | | `~lib/
| | | |-scala-compiler.jar [RO]
| | | `-scala-library.jar [RO]
| | `-sbt.boot.lock
| |-build.properties
| |
| `-MyProject.scala //here
|
|+src/
But even after 'reload' or 'update', running the hi task in SBT is not available at all. what am i missing?
D:\development\scala\SBEStudy>java -Xmx512M -jar "D:\development\.common\sbt-la
nch-0.7.4.jar" update
[info] Building project SomeScalaProject 1.0 against Scala 2.8.1
[info] using sbt.DefaultProject with sbt 0.7.4 and Scala 2.7.7
[info]
[info] == update ==
[warn] No dependency configuration found, using defaults.
[info] :: retrieving :: nephilim.practice#scalabyexample_2.8.1 [sync]
[info] confs: [default]
[info] 0 artifacts copied, 0 already retrieved (0kB/391ms)
[info] == update ==
[success] Successful.
[info]
[info] Total time: 1 s, completed 2010. 12. 8 오후 7:14:39
[info]
[info] Total session time: 2 s, completed 2010. 12. 8 오후 7:14:39
[success] Build completed successfully.
> reload
[info] Building project SomeScalaProject 1.0 against Scala 2.8.1
[info] using sbt.DefaultProject with sbt 0.7.4 and Scala 2.7.7
> hi
[error] No action named 'hi' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of availab
e project actions and methods.
It was my mistake. :(
"MyProject.scala" should be located under /project/build directory instead of /project directory.

Resources