i am so pleased that lambda expressions are finally added this is the only i needed now i will only use rush
Great was waiting and finally cameβ¦
@Akshat_Rana I feel as though your comment can be taken in a way you didnβt mean it and to me the comment screams βyou took too long.β Thank Shreyash for his hard work, not just a short, possibly petty comment.
shreyash i have a doubt does this require ant to be installed and second does it automatically proguard the extensions???
AFAIK, you need to set the optimize
to true in metadata file. And I think now it comes true default from new update. You just need to paas the -r
flag while building and the extension will be proguard.
I think no. I read somewhere in this topic that rush donβt require ant for building the extension.
And now I think shreyash only may confirm this.
when i try to run rush build -r
i get this error -
$ rush build -r
__
_______ _______/ /_
/ ___/ / / / ___/ __ \
/ / / /_/ (__ / / / /
/_/ \__,_/____/_/ /_/
β’ Build initialized
β Checking project files
β info Checking metadata file (rush.yml)
β info Checking AndroidManifest.xml file
β done
β Compiling source files
β info Picked 20 source files
β done
β Processing the extension
β info Desugaring Java 8 language features
β info Linking extension assets and dependencies
β info Optimizing the extension
β Picked up _JAVA_OPTIONS: -Xmx2048M
β
β note there were 5004 duplicate class definitions.
β (https://www.guardsquare.com/proguard/manual/troubleshooting#duplicateclass)
β
β warn org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ManagementFactory
β warn org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
β warn org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
β warn org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ManagementFactory
β warn org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
β warn org.junit.internal.runners.statements.FailOnTimeout: can't find referenced class java.lang.management.ThreadMXBean
β warn org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.ManagementFactory
β warn org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.RuntimeMXBean
β warn org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.ManagementFactory
β warn org.junit.rules.DisableOnDebug: can't find referenced class java.lang.management.RuntimeMXBean
β warn there were 10 unresolved references to classes or interfaces.
β You may need to add missing library jars or update their versions.
β If your code works fine without the missing classes, you can suppress
β the warnings with '-dontwarn' options.
β (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass)
β
β erro Please correct the above warnings first.
β failed
β’ Build failed [5s 854ms] [1 error; 11 warnings]
and same with rush build -o
but it works when i just run rush build
Yes, thatβs correct. Rush does not require Apache Ant in order to build extensions. It in itself is a build tool like Apache Ant, but designed specifically for building extensions.
Talking about optimizing your extensions with ProGuard, there are a couple of ways this can be done in Rush:
-
Using the
--release
flag (or-r
for short): This flag is used to generate a release build of your extensions. When it is detected, Rush performs a clean build of your extension, and optionally optimizes your extension ifbuild.release.optimize
is set to true in the metadata file. -
Using the
--optimize
flag (or-o
for short): This flags optimizes your extension no matter what the value ofbuild.release.optimize
. Unlike the release flag, this doesnβt invalidates the build cache, resulting in faster builds.
As the warning says, ProGuard is unable to find the mentioned classes. There are a couple of ways to solve these errors:
- By adding the mentioned classes to the classpath.
- By using the
-dontwarn
rule to the ProGuard rules file ONLY IF youβre sure that those missing classes wonβt affect the rest of your code. Here you can read more about the-dontwarn
rule: ProGuard Manual: Usage | Guardsquare
Please solve this error-
_______ _______/ /_
/ ___/ / / / ___/ __ \
/ / / /_/ (__ / / / /
/_/ \__,_/____/_/ /_/
β’ Build initialized
β Checking project files
β info Checking metadata file (rush.yml)
β info Checking AndroidManifest.xml file
β done
β Compiling source files
β info Picked 1 source file
β done
β Processing the extension
β info Desugaring Java 8 language features
β info Linking extension assets and dependencies
β info Optimizing the extension
β note there were 4810 duplicate class definitions.
β (https://www.guardsquare.com/proguard/manual/troubleshooting#duplicateclass)
β
β erro The output jar is empty. Did you specify the proper '-keep' options?
β failed
β’ Build failed [15s 328ms] [1 error]
Can you show me the contents of your proguard-rules.pro
file.
# Add any ProGuard configurations specific to this
# extension here.
-keep public class in.sonraj.qrlogo.Qrlogo {
public *;
}
-keeppackagenames gnu.kawa**, gnu.expr**
-optimizationpasses 4
-allowaccessmodification
-mergeinterfacesaggressively
-repackageclasses 'in/sonraj/qrlogo/repack'
-flattenpackagehierarchy
-dontpreverify
Okay, this is a bit weird. Make sure that:
- The Java file,
Qrlogo.java
, isnβt empty. - The package in which
Qrlogo.java
resides matches with this:in.sonraj.qrlogo
Will I able to write code in both Kotlin and Java?
Yes, you can.
is there any way to integrate xml in rush if yes it could be greatt
Please specify what do you mean by βintegrate XMLβ.
i mean like xml files eg, strings.xml, attrs.xml
Nope, thatβs not yet possible. Fyi, itβs not something that can be implemented entirely through Rush; some changes are necessary on the upstream (AI2) to support the use of XML resources in extensions.
Hello @Shreyash . First of all thanks for really great project Rush.
Iβm very new to rush and commands. and I tried to create extension by using Rush. It created my extension folder successfully but I got some errors on build.
- I have no spaces in my directory or in filename.
- Iβve tried on desktop and D drive to make my project. (same error everywhere)
- Iβm using Windows PowerShell
As you can see java & rush versions on my machine and successfully created extension project folder
But Iβm getting this error while building my project by using rush build -r
Your help will be appreciated