6 Commits
Author SHA1 Message Date
Igor Eisberg f25af7895c refactor: migrate to NIO and modernize (#4244) 2026-10-11 14:23:29 +03:00
4433d41587 build: move required build to JDK 17, support Java 8. (#4175)
* feat: move to v0.37.0

* chore: maven publish is jdk 17+

* wip

* build: test on Java 25 as well

* chore: fix feedback from Copilot

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* build: log test JVM path and version in doFirst to confirm toolchain selection

* build: add test summary and failed/skipped event logging to all Test tasks

* Some cleanup

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: IgorEisberg <[email protected]>
2026-07-24 06:22:19 -04:00
Igor Eisberg 5a1bd06031 refactor: convert meta classes to pojo, rework ARSC & rework cli parsing (#3868)
* refactor: convert meta classes to pojo

Wanted to make that change back when I converted Config class to POJO,
finishing the job now. This will guarantee safe access to all meta classes
(moved from brut.androlib.apk to brut.androlib.meta to make more sense).
All non-primitive fields are guaranteed to never be null.
Outputs clean apktool.yml without useless fields that don't affect the
rebuild procedure. Still backwards compatible, just cleaner output,
especially for JARs.

Cleaned some logic in a few classes, especially related to updateApkInfo
and loading of libraries/frameworks. It was a mess that was difficult to
make sense of.

Test issue1235 removed, it's a aapt1 duplicate of aapt2's issue2328/debuggable-false.

Misc style tweaks for consistency.

Tested on a ROM decompile/recompile, no regression detected.

* fix accessors

* fix flaw in net sec conf

* refactor ResConfigFlags and isInvalid logic

* git windows case issue (1)

* git windows case issue (2)

* style

* checker, wake up

* reorganize some classes and minimize reading signed data from arsc

Move:
* brut.util.AaptManager -> brut.androlib.AaptManager
* brut.androlib.BackgroundWorker -> brut.util.BackgroundWorker
* brut.androlib.meta.Yaml* -> brut.yaml

Removed useless "throws" on signatures of Yaml functions, none of
the Yaml functions throw any managed exceptions, it's a perfectly
generic set of classes that deserves a dedicated module.

Most of data in arsc is encoded as unsigned integers, so normally
we'd use readUnsignedByte/Short where possible (both return int)
to ensure the values are never negative.
Java doesn't have any valid unsigned counterpart for readInt, so
we'll have to live with it, it works for now. Java was never good
for dealing with raw binary data.

* remove useless semicolon

* cases ordered by value

* comment correction

* unneeded import

* use readBytes for clarity

* config options larping as flags

* config options larping as flags (2)

* refactor: command line parsing and Config

Make command line commands and options great again.
Each command has its own valid options, verified properly
like any good CLI application.
Instead of checking hasOption(shortName/longName), we do
hasOption(Option) on the option object, which maintains sanity and
very easy to manage. "allOptions" collection is no longer needed.
2025-05-14 08:02:52 -04:00
Igor Eisberg b49e77087d refactor: clean up external pull parser and introduce brut.j.xml (#3709)
* refactor: clean up external pull parser and introduce brut.j.xml

We have no need for an XML pull parser in the project,
it was only used for testing, which is now done with XPath.

The external xpp3 library from org.ogce is obsolete and has
the issue of including javax.xml.namespace.QName which conflicts
with the JRE implementation that exists for a very long time now.
This makes direct usages of QName produce very obscure NPEs that
took me hours to figure out. This patch will allow further
optimization that is WIP.
The external library was replaced by the basic xmlpull API.

The MXSerializer has been cleaned and the features used by apktool
have been integrated into the custom implementation, now part of
a separate module called brut.j.xml.
Writing has been optimized by buffering write operations, inspired
by KXmlSerializer used by Android itself.

A class XmlPullUtils also written that allows copying from a
XmlPullParser into a XmlSerializer with or without an EventHandler.
We use it for AndroidManifestPullStreamDecoder (with EventHandler,
to allow omitting the uses-sdk tag), and for ResXmlPullStreamDecoder
(direct copy, without EventHandler).

saveDocument in ResXmlPatcher was tweaked to output proper output -
a new line after declaration and a new line after root element's
end tag.

TL;DR mostly behind the scene refactor, no end user changes.
2024-10-15 06:54:03 -04:00
Connor Tumbleson 93c66ef373 build: migrate towards "libs.versions.toml" (#3353) 2023-10-01 06:08:47 -04:00
Connor Tumbleson 342ff67a4c Migrate to Gradle Kotlin DSL (#3249)
* feat: initial migration to kotlin

* feat: initial migration to kotlin

* fix: wire up dependencies

* fix: Deprecated tag for kotlin detection

* refactor: put all modules into sub-projects

* fix: include jar file (android framework)

* fix: add version message/info

* fix: wire up version/gitrev to properties

* fix: wire up proguard on cli

* fix: wire up proguard

* fix: wire up output cleaning command

* fix: drop license header on gradle files

 - fully rewritten from scratch by myself
 - no longer including license header on build files

* fix: add compile utf8/flags for java8

* refactor: remove unneeded curly braces

* feat: progress towards maven-publish

* build: publish to maven

* docs: update documentation

* refactor: prevent implicit order by removal of afterEvaluate

* build: remove unused license plugin
2023-08-05 06:28:31 -04:00