Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: OrangeLabs-moe/gradle-actions@v5.0-openjdk-11
- uses: actions/setup-java@v4
with:
args: clean build test
distribution: 'temurin'
java-version: 11
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Run tests
run: ./gradlew build test
examples:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 0 additions & 2 deletions docs/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ yGuard does **not** support obfuscating multi-release Java archives which were i

Beginning with version 2.5, yGuard supports obfuscation of Java class files that contain the `invokedynamic` instruction, which was introduced with the Java 7 `.class` file format. JDK 7 does not contain any means of issuing this instruction, with JDK 8 it is being issued when using lambda expressions or default methods.

While yGuard does fully support obfuscating `invokedynamic` instructions and therefore default methods and lambda expressions, shrinking of Java class files that contain this instruction is not supported yet.

## Compatibility to 3rd party JVM

Obfuscating `dynamic` and `invokedynamic` instructions is a task that is theoretically infeasible. An obfuscation program cannot determine the type and parameters of such instructions in a generic way.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# yGuard

`yGuard` is an open-source Java obfuscation tool. With `yGuard`, it is easy as pie (🍰) to configure obfuscation through an extensive ant task.
This documentation explains how to use the `yGuard` Java obfuscation and shrinking software.
This documentation explains how to use the `yGuard` Java obfuscation software.

yGuard is brought to you by [yWorks GmbH](https://www.yworks.com/), creator of the family of graph and diagram visualization frameworks [yFiles](https://www.yworks.com/yfiles) and other excellent [products](https://www.yworks.com/products).

Expand Down
2 changes: 1 addition & 1 deletion docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies {

task yguard {
group 'yGuard'
description 'Obfuscates and shrinks the java archive.'
description 'Obfuscates the java archive.'

doLast {
ant.taskdef(
Expand Down
382 changes: 58 additions & 324 deletions docs/task_documentation.md

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Troubleshooting

There are a couple of things you should be aware of when obfuscating and shrinking software.
The weakest part of an application considering name obfuscation and code shrinking is code that uses reflection to dynamically load classes, invoke methods etc. Therefore, you have to be especially careful when using the yguard task on applications that rely on reflection.
There are a couple of things you should be aware of when obfuscating software.
The weakest part of an application considering name obfuscation is code that uses reflection to dynamically load classes, invoke methods etc. Therefore, you have to be especially careful when using the yguard task on applications that rely on reflection.
The most important facts to keep in mind when using yGuard are described here briefly:

- If you use the `rename` task, code in the form of `MyApplication.class` will break if `MyApplication` will be obfuscated by name and the obfuscation switch [replaceClassNameStrings](task_documentation.md#the-rename-element) is set to `false`. The `shrink` task will currently recognize code in the form of `MyApplication.class` only if the java files were compiled using an arbitrary version of the standard javac compiler (although the shrinking engine might recognize the `.class` construct also if the classes were compiled using a compiler that generates similar bytecode).
- Automatic introspection and reflection will break in most cases, when you decide to obfuscate the corresponding methods and fields. If you use the `shrink` task and your application uses reflection you should explicitly designate all entities loaded per reflection as code entrypoints using the [keep](task_documentation.md#the-keep-element) element.
If your application is broken after using the `shrink` task, consider using the [createStubs](task_documentation.md#the-shrink-element) attribute of the `shrink` task to find out which additional entities you need to include in the keep element.
- `Class.forName(className)` will not work when using the `rename` task unless you use the obfuscated name string in your variable or the String is a local constant and [replaceClassNameStrings](task_documentation.md#the-keep-element) is not set or set to `true`. If you use the `shrink` task, `className` should be contained in the list of entrypoints using the `keep` element.
- The customized serialization mechanism will not work if you obfuscated or shrinked the writeObject and readObject methods as well as the serializationUID field.
- If you use the `rename` task, code in the form of `MyApplication.class` will break if `MyApplication` will be obfuscated by name and the obfuscation switch [replaceClassNameStrings](task_documentation.md#the-rename-element) is set to `false`.
- Automatic introspection and reflection will break in most cases, when you decide to obfuscate the corresponding methods and fields.
- `Class.forName(className)` will not work when using the `rename` task unless you use the obfuscated name string in your variable or the String is a local constant and [replaceClassNameStrings](task_documentation.md#the-keep-element) is not set or set to `true`.
- The customized serialization mechanism will not work if you obfuscated the writeObject and readObject methods as well as the serializationUID field.
- Simple bean introspection will not work, if you decide to obfuscate your public accessor methods, since it makes use of reflection.
- If you do not set the `-Xmx` property for the Java virtual machine, the `yguard` Ant task might fail due to a `java.lang.OutOfMemoryError`.
To solve this problem, set the `-Xmx` option in the `ANT_OPTS` variable, e.g.:
Expand Down
6 changes: 3 additions & 3 deletions examples/external_library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Classes residing in `lib/gson-2.8.9.jar` will be used to resolve external
dependencies during the obfuscation run.

yGuard automatically detects externally declared methods and prevents renaming
and shrinking of these items.
of these items.

As a result, the shrinked and obfuscated jar file can be used together with
unmodified versions of external libraries without causing any problems.
As a result, the obfuscated jar file can be used together with unmodified
versions of external libraries without causing any problems.
3 changes: 0 additions & 3 deletions examples/serializable_exclusion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ More specifically, in this example the `implements` attribute of yGuard's
the same element could be used to exclude classes that extend a certain base
class).

Additionally, all classes that extend the base class for menu items,
`com.yworks.example.MyMenuItem`, are defined as entrypoints for the shrinking
engine using the extends attribute of the class element.
The `readObject` and `writeObject` methods and the field `serialVersionUID`
needed for serialization are excluded from name obfuscation as well.
20 changes: 0 additions & 20 deletions src/main/java/com/yworks/common/ResourcePolicy.java

This file was deleted.

14 changes: 0 additions & 14 deletions src/main/java/com/yworks/common/ShrinkBag.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,4 @@ public interface ShrinkBag {
* @return the boolean
*/
boolean isEntryPointJar();

/**
* Sets resources.
*
* @param resourcesStr the resources str
*/
void setResources( String resourcesStr );

/**
* Gets resources.
*
* @return the resources
*/
ResourcePolicy getResources();
}
54 changes: 0 additions & 54 deletions src/main/java/com/yworks/common/ant/EntryPointJar.java

This file was deleted.

102 changes: 0 additions & 102 deletions src/main/java/com/yworks/common/ant/EntryPointsSection.java

This file was deleted.

Loading
Loading