Skip to content
This repository has been archived by the owner on Jan 2, 2018. It is now read-only.

Adding verbose **optional** property #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alipov
Copy link

@alipov alipov commented Jul 28, 2017

I've started to use this plugin, and found that it doesn't support verbose mode.

jarjar queries for it in com.tonicsystems.jarjar.Main#process method:

public void process(File rulesFile, File inJar, File outJar) throws IOException {
  if (rulesFile == null || inJar == null || outJar == null) {
    throw new IllegalArgumentException("rulesFile, inJar, and outJar are required");
  }
  List<PatternElement> rules = RulesFileParser.parse(rulesFile);
  boolean verbose = Boolean.getBoolean("verbose");
  boolean skipManifest = Boolean.getBoolean("skipManifest");
  MainProcessor proc = new MainProcessor(rules, verbose, skipManifest);
  StandaloneJarProcessor.run(inJar, outJar, proc);
  proc.strip(outJar);
}

I noticed it queries for skipManifest as well, so I've added support for passing both verbose and skipManifest as optional properties (default is false for both).

Tested on a demo project. When passing the following configuration:

jarjar {
    jarJarFile '../../tools/jarjar-1.4.jar'
    rules = [
            'rule com.squareup.okhttp.** ext.com.squareup.okhttp.@1'
    ]
    srcExcludes = ['META-INF/**']
    outputName 'build_repackaged.jar'
    outputDir 'libs'
    ignoreJarJarResult false
    verbose true
}

jarjar runs in verbose mode (as expected):

$ ./gradlew clean build
:demo:clean
:demo:createRawFatJar
:demo:createRulesFile
:demo:runJarJarRemoved META-INF/MANIFEST.MF
Renamed com/squareup/okhttp/ -> ext/com/squareup/okhttp/
Renamed com/squareup/okhttp/Address.class -> ext/com/squareup/okhttp/Address.class
Renamed com/squareup/okhttp/Authenticator.class -> ext/com/squareup/okhttp/Authenticator.class
Renamed com/squareup/okhttp/Cache$1.class -> ext/com/squareup/okhttp/Cache$1.class
Renamed com/squareup/okhttp/Cache$2.class -> ext/com/squareup/okhttp/Cache$2.class
// ...
// redacted
// ...
:demo:preBuild
// ....

If/once merged and published, I'll update the documentation and demo project.

…alse for both). Passing them to jarjar as system properties.
@alipov
Copy link
Author

alipov commented Jul 28, 2017

Just realized that skipManifest is just a special case of srcExcludes (all it does is exclude the META-INF/MANIFEST.MF file, which can already be done by srcExcludes).
I'll remove the skipManifest and update the PR.

… of srcExcludes property (all it does is exclude the META-INF/MANIFEST.MF file, which can already be done by srcExcludes).
@alipov alipov changed the title Adding verbose and skipManifest **optional** properties Adding verbose **optional** property Jul 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant