-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix examples/android code to actually run successfully
- Add a manifest with a main activity to launch - Use ``${lib_name}`` manifest variable in order to reuse the same manifest from multiple libs and inherit the right `MainActivity` from the right lib - Define `resource_files` attr to actually include the resource dir. Modify the code to actually use the resources. - Fixed the code to extend from `AppCompatActivity` in order to actually use `androidx.appcompat` and not crash on launch - Renamed `lib` target to `my_kt` and `lib2` to `my_android` in order to make it easier to distinguish between the generated output files during debugging. - Added `my_java` target to help with debugging when comparing plugin generation for java vs native android vs kotlin - Added `.bazelproject` file for IDE
- Loading branch information
1 parent
35cb119
commit 2ec60f9
Showing
25 changed files
with
135 additions
and
25 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,17 @@ | ||
directories: | ||
# Add the directories you want added as source here | ||
# By default, we've added your entire workspace ('.') | ||
. | ||
|
||
# Automatically includes all relevant targets under the 'directories' above | ||
derive_targets_from_directories: true | ||
|
||
targets: | ||
# If source code isn't resolving, add additional targets that compile it here | ||
//...:all | ||
additional_languages: | ||
kotlin | ||
|
||
|
||
# Please uncomment an android-SDK platform. Available SDKs are: | ||
android_sdk_platform: android-29 |
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 was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="examples.android.lib2" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<uses-sdk | ||
android:minSdkVersion="23" | ||
android:targetSdkVersion="23" | ||
android:maxSdkVersion="29" /> | ||
</manifest> |
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
File renamed without changes.
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,22 @@ | ||
load("@rules_java//java:defs.bzl", "java_plugin") | ||
|
||
java_plugin( | ||
name = "autovalue", | ||
generates_api = 1, | ||
processor_class = "com.google.auto.value.processor.AutoValueProcessor", | ||
deps = ["@maven//:com_google_auto_value_auto_value"], | ||
) | ||
|
||
java_library( | ||
name = "my_java", | ||
srcs = [ | ||
"src/main/java/examples/java/lib/JavaAutoValueProvider.java", | ||
"src/main/java/examples/java/lib/TestJavaValue.java", | ||
], | ||
plugins = [ | ||
":autovalue", | ||
], | ||
deps = [ | ||
"@maven//:com_google_auto_value_auto_value_annotations", | ||
], | ||
) |
9 changes: 9 additions & 0 deletions
9
examples/android/libJava/src/main/java/examples/java/lib/JavaAutoValueProvider.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,9 @@ | ||
package examples.java.lib; | ||
|
||
public class JavaAutoValueProvider { | ||
|
||
public TestJavaValue getAutoValue() { | ||
return new AutoValue_TestJavaValue.Builder().setName("Auto Value Test").build(); | ||
|
||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
examples/android/libJava/src/main/java/examples/java/lib/TestJavaValue.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,19 @@ | ||
package examples.java.lib; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class TestJavaValue { | ||
abstract String name(); | ||
|
||
Builder builder() { | ||
return new AutoValue_TestJavaValue.Builder(); | ||
} | ||
|
||
@AutoValue.Builder | ||
abstract static class Builder { | ||
abstract Builder setName(String name); | ||
|
||
abstract TestJavaValue build(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<string name="where_you_at">Where you at?</string> | ||
</resources> |
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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="examples.android.lib" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<uses-sdk | ||
android:minSdkVersion="23" | ||
android:targetSdkVersion="23" | ||
android:maxSdkVersion="29" /> | ||
</manifest> |
File renamed without changes.
13 changes: 7 additions & 6 deletions
13
...tlin/examples/android/lib/MainActivity.kt → ...java/examples/android/lib/MainActivity.kt
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
File renamed without changes.