45 Commits

Author SHA1 Message Date
Thomas Vochten
174d3f4155 Upgrade Gradle, upgrade dependencies, bump version to 7.6.1 2024-11-29 08:49:38 +01:00
James Hamilton
aa43b9dc21 Update versions for 7.5 (#404)
Updates ProGuardCORE + other required dependencies for Kotlin 2 + Java 22; including running tests with Java 22.
2024-05-23 14:01:48 +02:00
Cristian Garcia
5a8d50090a Replace project usages in ProGuardTask by injected Gradle services (#380)
fixes #254
2024-01-19 18:40:33 +01:00
Fergal Whyte
0070bc9e80 Fix incorrectly configured unit tests 2023-10-25 17:44:11 +02:00
Joren Hannes
8afa59e7ce Keep methods that look like ClassValue's computeValue of Java 7 2023-06-08 15:26:37 +02:00
Simon Schiller
1b40f8d9cc Run CI on Windows in addition to Ubuntu (#277)
Co-authored-by: James Hamilton <mrjameshamilton@gmail.com>
2022-09-17 11:43:43 +02:00
Tony Robalik
3f8d78322d Don't fail when --configuration-cache is used. (#258) 2022-07-05 11:33:28 +02:00
sleticalboy
e21af254d1 Update AndroidProjectBuilder.kt (#255)
String end expected
2022-06-03 08:54:07 +02:00
Nadeesh T V
ccab80e755 Replace deprecated VersionNumber with semver.Version 2022-02-27 20:27:33 +01:00
James Hamilton
1035f18f65 Exclude androidx.window consumer rules by default 2022-02-11 16:59:55 +01:00
James Hamilton
6dc3ae5b98 Add consumerRuleFilter to ProGuard Gradle plugin 2022-02-11 16:59:55 +01:00
anatawa12
d9ab10c273 Use canonicalPath instead of absolutePath to make test passed on macOS (#218) 2022-01-27 18:38:42 +01:00
maqsood ahmad
45798d2f96 Add Pass/AppView classes and port changes upto clearPreverification.
Add AppView and Pass classes

Port changes to the following:
- InputReader
- ProGuard
- UpToDateChecker
- ProGuardGUI

Ignoring the changes for:
- ConfigurationChecker
- ConfigurationParser and ConfigurationParserTest
- ConfigurationWriter
- GPL
2022-01-04 11:38:22 +01:00
Joren Van Hecke
121ac840a7 Fix test for non-existing ProGuard Gradle Plugin configurations.
Fix test for non-existing ProGuard Gradle Plugin configurations. The test was broken, after the error message had been changed.
2021-09-03 14:25:12 +02:00
Joren Van Hecke
7b7e4aaafc Correct error message for invalid configuration in ProGuard Gradle Plugin. 2021-09-02 15:46:06 +02:00
Joren Van Hecke
a40b8326a1 Use correct default configuration when specifying proguard-android-optimize.txt 2021-09-02 15:46:06 +02:00
Toon Willemot
806cf96d83 Update Gradle deprecation in ProGuardCacheRelocateabilityIntegrationTest 2021-07-23 16:38:11 +02:00
James Hamilton
efd665afac Fix collection of AAPT rules 2021-06-15 16:08:57 +02:00
James Hamilton
601affb88b Upgrade proguard-gradle module clash warning to error if newer ProGuardTask method is missing 2021-06-15 16:08:57 +02:00
James Hamilton
da524a3499 Change plugin ID from proguard to com.guardsquare.proguard 2021-06-15 16:08:57 +02:00
James Hamilton
689fdaaadb Re-add deprecated KeepClassSpecification constructor
The AGP integration might use this constructor that was removed during a
refactor when using the legacy ProGuard integration method (dependency
substition).
2021-06-15 16:08:57 +02:00
James Hamilton
5650e9e06a Add legacy AGP ProGuard integration test 2021-06-15 16:08:57 +02:00
Jelle De Coninck
9c3027ad43 Added warning when old proguard is found on classpath
Detect when an old version of proguard (net.sf.proguard:proguard-gradle) bundled with AGP < 7 is on the classpath, and print a warning showing how to exclude it.
2021-06-15 16:08:57 +02:00
James Hamilton
60da6a571e Fix Kotlin lint issues in gradle-plugin 2021-06-15 16:08:57 +02:00
Jelle De Coninck
021bbb1f82 Add task to create directory for aapt_rules.pro 2021-06-15 16:08:57 +02:00
James Hamilton
5c0478b6a1 Add aapt generated rules in Gradle Plugin 2021-05-27 17:19:05 +02:00
James Hamilton
566026eba6 Add ProGuard config files to secondary inputs 2021-05-27 17:18:55 +02:00
James Hamilton
de986fad86 Remove needless blank lines 2021-05-27 17:18:51 +02:00
James Hamilton
1a7959d978 Add checks for configured variants 2021-05-25 16:51:41 +02:00
James Hamilton
6cf1999f52 Create collectConsumerRulesTask only when variant is configured 2021-05-25 16:51:31 +02:00
James Hamilton
6330b9eff9 Include configuration files in the order they were specified 2021-05-25 16:51:21 +02:00
James Hamilton
d9c64430b4 Fix formatting issues in gradle-plugin tests 2021-05-25 16:51:11 +02:00
James Hamilton
465304515b Fix minifyEnabled = true check that checked all variants 2021-05-25 16:50:50 +02:00
Sven Cuyt
8b1bd44bca Add a check of the AGP version 2021-05-25 16:50:36 +02:00
James Hamilton
4d84aa543f Add check to verify that minifyEnabled = false configured variants 2021-05-25 16:50:02 +02:00
James Hamilton
5f69246e3a Update ProGuard Gradle plugin to be compatible with AGP 7 2021-05-25 16:49:18 +02:00
James Hamilton
e00da102f4 Add internal extraJar option 2021-05-25 16:48:27 +02:00
Benedikt Ritter
dd1a2583f9 Make ProGuardTask output properties public (#159)
With this change users can now wire up ProGuardTask with other tasks. Gradle will then automatically track the task dependency between ProGuard and the consuming task.
2021-05-06 15:34:26 +02:00
Daz DeBoer
cb7928d19a Simpify proguard.gradle.ProGuardTask implementation (#151)
* Revert "Improve handling of Gradle task inputs and outputs (#139)"

This reverts commit b5fbefb87c.

* Add more test coverage of Gradle plugin

- Rename `gradlekotlindsl` sample to `gradle-kotlin-dsl`
- Use `gradle-kotlin-dsl` as basis for plugin testing
- Add coverage for loading from external config file

* Register Proguard output files as Gradle task outputs

These outputs file may be consumed by other Gradle tasks, and
this change makes the output file locations available programatically.

We use this internally to publish the generated mapping file to internal
repository, which makes it easier to later deobfuscate stack traces. eg:

publishing {
    publications {
        register("sourcemap", MavenPublication) {
            artifact tasks.named("proguard").map { it.printMappingFile }
        }
    }
}
2021-04-27 17:56:23 +02:00
Daz DeBoer
b5fbefb87c Improve handling of Gradle task inputs and outputs (#139)
Previously, Task inputs and outputs were declared in an ad-hoc manner,
resulting in confusing source code and inconsistent behaviour with up-to-date checks. 

Specifically:

- If an input (`-injars`, `-libraryjars`) was configured via a ProGuard config file, 
  then changes to these inputs were not detected as part of up-to-date checks
- Similar for output files: if an output added with `-outjars` was deleted, the task
  would not detect this and would not re-execute
- Many task inputs were not registered at all, meaning that the task would be incorrectly
  considered up-to-date when these inputs were changed (eg `keep`, `dontshrink`, 
  `assumeNoSideEffects`, `obfuscationDictionary`, etc)
- Many output files were not tracked at all (eg printMapping). This meant that changes
  to these files were not detected, and they were not restored correctly from cache.

A few further notes:

- To avoid having to wrap the `ClassSpecification` and `MemberSpecification` types
(and subtypes), these classes were declared as `Serializable`. 
- The existing properties on `ProGuardTask` were left unchanged, to avoid changing the
  task API and to retain support for the existing DSL configuration.
- Since `programJars` and `libraryJars` can contain a mix of files and directories, 
  inputs and outputs, each entry is exposed as a `WrappedClassPathEntry`, with subtypes
  representing the actual input/output file/directory.
- Use a `Provider<Configuration>` to defer initial instantiation of `Configuration`
- Provider is a mapping from configuration input files, which means it will carry
  task dependency information 
- Provider implementation loads the configuration on first use, memoizing for later uses.

* Simplify the task configuration model to make it possible to defer loading configuration

The first attempt modeled each input file as a `@Nested` object containing the File
reference as well as the filters attached to that file. While this closely modelled
the true configuration, it meant that each nested instance was instantiated early
in order to inspect the properties.

With this change, all input files are merged into a single `FileCollection` property,
and the filters for all files are merged into a separate `List<Serializable>` property.
This structure will later allow us to defer loading these property values until the
task begins executing.

* Correctly handle output directories

By borrowing the file detection logic from Proguard core, we can determine if
a configured output file is a file (with a known extension) or a directory.
This is required to correctly register the file as an `OutputFile` or `OutputDirectory`.

Using `.isFile()` and `.isDirectory()` is not sufficient, as the file may not exist.

* Defer loading of Proguard configuration until task is executed

By default, all `@InputFile` properties are resolved when building the task
graph. By declaring these input properties as a mapping from the configuration-file
inputs, the provider contains enough context to avoid realizing the actual properties.

Since realizing these properties involves loading the Proguard configuration, this
change allows this work to be deferred until the task inputs are actually calculated
as part of task execution.

* Track direct task inputs separately, to preserve task dependencies

The input files for the proguard task are a combination of files loaded via a
configuration file and files directly configured via the Gradle DSL. The latter
can carry task dependency information, but this is being lost when we merge
the set of input files.

This change adds separate `@Classpath` properties to the task to track the files
added directly via the Gradle DSL, thus preserving task dependencies for these inputs.

* Workaround limitation in Gradle 6.x

In older versions of Gradle, all `InputFile` properties of type `Provider`
are realized when building the task graph in order to check for existence.
This happens even when these were mapped from a known producer, resulting in
early loading of the ProGuard configuration file(s).

In order to workaround this issue, a custom `Provider` implementation is
used for Gradle versions <= 7.0

* Renamed from `gradlekotlindsl` -> `gradle-kotlin-dsl`

Closes: #139, #106, #136
2021-03-27 17:03:47 +01:00
Nelson Osacky
613af185f3 Add cache relocatability to proguard task. (#119)
* Add cache relocatability to proguard task.

This allows the Proguard Task to take advantage of the Gradle Build cache and re-use outputs from other builds.

This also adds a simple test for cache relocateability

* Address review comments

* Use regex to replace build.gradle file

* Use jar in spring boot sample.
2021-01-26 21:18:34 +01:00
James Hamilton
8ce02565e6 Update error message wording in Gradle plugin 2020-12-17 20:35:44 +01:00
James Hamilton
c1f4ce0553 Remove Gradle plugin hard dependency on Android build tools
Changes the dependency on the Android build tools to `compileOnly` and improves the error message when using the plugin in a non-Android project.

Fixes: #66
2020-12-15 11:44:34 +01:00
Eric Lafortune
3dc5906a6d Renamed option -adaptkotlinmetadata to -keepkotlinmetadata. 2020-06-05 13:58:05 +02:00
EricSalemi
15430a28b9 Added CI github workflow and CD infrastructure 2020-05-28 15:37:40 +02:00