-
-
Notifications
You must be signed in to change notification settings - Fork 809
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Upgrading AGP to 7.4.0 * Making android test a standalone project * Adapting ByteBuddyLocalClassesEnhancerTask to the new 7.4.0 apis * Using ByteBuddyLocalClassesEnhancerTask with the new artifacts api * Avoiding compilation oom * Fixing "toTransform" method reflection * Splitting resources from classes for local projects * Using custom dependency rule to merge class dirs and resources from local and remote deps * Using custom dependency rule to merge class dirs and resources from local and remote deps * Using the last api's ALL scope * Adding SPI stability tests * Clean up tests * Updating tests * Fixing android descriptor * Removed project references in ByteBuddyLocalClassesEnhancerTask due to https://docs.gradle.org/8.3/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution * Update working regarding ByteBuddyLocalClassesEnhancerTask's scope * Update working regarding ByteBuddyLocalClassesEnhancerTask's scope * Update wordings and renaming methods in ByteBuddyAndroidPlugin * Renaming bytebuddy 7.4 transform tasks * Removed project references in ByteBuddyLocalClassesEnhancerTask due to https://docs.gradle.org/8.3/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution * Update working regarding ByteBuddyLocalClassesEnhancerTask's scope * Update working regarding ByteBuddyLocalClassesEnhancerTask's scope * Update wordings and renaming methods in ByteBuddyAndroidPlugin * Renaming bytebuddy 7.4 transform tasks * Clean up * Moving back ByteBuddyAndroidPlugin * Clean up test's properties * Removing "getProject()" calls in ByteBuddyLocalClassesEnhancerTask due to https://docs.gradle.org/8.3/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution * Renaming vars * Updating tests * Reverting indentation and gradle versions * Fixing indentation * Cleaning up the readme for tests * Using Task.getLogger in ByteBuddyLocalClassesEnhancerTask
- Loading branch information
1 parent
fe96422
commit 9495532
Showing
39 changed files
with
851 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build/ | ||
.gradle/ | ||
.idea/ | ||
local.properties | ||
captures/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...src/main/java/net/bytebuddy/android/test/aar/lib/service/TargetServiceImplementation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2014 - Present Rafael Winterhalter | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package net.bytebuddy.android.test.aar.lib.service; | ||
|
||
import com.service.definition.ServiceDefinition; | ||
|
||
public class TargetServiceImplementation implements ServiceDefinition { | ||
|
||
@Override | ||
public String getValue() { | ||
return "Target service impl"; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...uddy-target/src/main/resources/META-INF/services/com.service.definition.ServiceDefinition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
net.bytebuddy.android.test.aar.lib.service.TargetServiceImplementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 25 additions & 18 deletions
43
...n-test/app/src/androidTest/java/net/bytebuddy/android/test/ByteBuddyInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
package net.bytebuddy.android.test; | ||
|
||
import static androidx.test.espresso.Espresso.onView; | ||
import static androidx.test.espresso.assertion.ViewAssertions.matches; | ||
import static androidx.test.espresso.matcher.ViewMatchers.withId; | ||
import static androidx.test.espresso.matcher.ViewMatchers.withText; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import androidx.test.ext.junit.rules.ActivityScenarioRule; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
import com.service.definition.ServiceDefinition; | ||
|
||
import net.bytebuddy.android.test.aar.lib.SomeAarClass; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
class ByteBuddyInstrumentedTest { | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.ServiceLoader; | ||
|
||
@Rule | ||
public ActivityScenarioRule<MainActivity> activityRule = new ActivityScenarioRule<>(MainActivity.class); | ||
public class ByteBuddyInstrumentedTest { | ||
|
||
@Test | ||
public void bytecodeInstrumentation() { | ||
// On local java | ||
onView(withId(R.id.text_from_local_java_class)).check(matches(withText("bar"))); | ||
// On dependency class | ||
onView(withId(R.id.text_from_aar_dependency)).check(matches(withText("bar"))); | ||
// From aar | ||
onView(withId(R.id.text_instrumented_from_aar)).check(matches(withText("bar"))); | ||
assertEquals("instrumented local class from jar plugin", new SomeClass().method()); | ||
assertEquals("instrumented local class from aar plugin", new AnotherClass().method()); | ||
assertEquals("instrumented aar lib's class from jar plugin", new SomeAarClass().method()); | ||
} | ||
|
||
@Test | ||
public void verifySPIsAreNotMissing() { | ||
List<String> values = new ArrayList<>(); | ||
for (ServiceDefinition serviceDefinition : ServiceLoader.load(ServiceDefinition.class)) { | ||
values.add(serviceDefinition.getValue()); | ||
} | ||
|
||
assertEquals(3, values.size()); | ||
assertTrue(values.contains("Target service impl")); | ||
assertTrue(values.contains("Service implementation")); | ||
assertTrue(values.contains("Service implementation2")); | ||
} | ||
} |
21 changes: 1 addition & 20 deletions
21
byte-buddy-gradle-plugin/android-plugin-test/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="net.bytebuddy.android.test"> | ||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.Bytebuddygradleplugin"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
</manifest> | ||
<manifest package="net.bytebuddy.android.test" /> |
53 changes: 0 additions & 53 deletions
53
...plugin/android-plugin-test/app/src/main/java/net/bytebuddy/android/test/MainActivity.java
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
byte-buddy-gradle-plugin/android-plugin-test/app/src/main/res/layout/activity_main.xml
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-982 Bytes
byte-buddy-gradle-plugin/android-plugin-test/app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Binary file removed
BIN
-1.73 KB
...ddy-gradle-plugin/android-plugin-test/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary file not shown.
10 changes: 0 additions & 10 deletions
10
byte-buddy-gradle-plugin/android-plugin-test/app/src/main/res/values/colors.xml
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
byte-buddy-gradle-plugin/android-plugin-test/app/src/main/res/values/strings.xml
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
byte-buddy-gradle-plugin/android-plugin-test/app/src/main/res/values/themes.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
byte-buddy-gradle-plugin/android-plugin-test/bytebuddy.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dependencies { | ||
def location = new File("$rootDir/../../byte-buddy/target/byte-buddy-${byteBuddyVersion}.jar").canonicalFile | ||
implementation files(location.absolutePath) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
android.useAndroidX=true |
Oops, something went wrong.