-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix examples/android code to actually run successfully #443
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't these depend on the binary name rather than a dependency? This feels closer to how it would actually be used - the libraries have their own manifests. Right now you also still have two binaries with the same package name (
app
andapp3
) as they both define this aslib
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well no, this variable is used to inherit the right entry main activity which is currently inherited from the library package name since this binary target doesn't actually have any sources. For both
app
andapp3
the samelib
is used so it inherits the same MainActivity which is fine.I guess the more proper fix which will resemble reality better is to have a unique AndroidManifest.xml per
android_binary
target which I'm happy to do if you think it's worth it?