Skip to content
Draft
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
13 changes: 13 additions & 0 deletions examples/basicapp/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,16 @@ build:windows --define=protobuf_allow_msvc=true

common --enable_platform_specific_config

common \
--incremental_dexing=true \
--define=android_dexmerger_tool=d8_dexmerger \
--define=android_incremental_dexing_tool=d8_dexbuilder \
--define=android_standalone_dexing_tool=d8_compat_dx \
--experimental_use_dex_splitter_for_incremental_dexing=true \
--experimental_incremental_dexing_after_proguard_by_default=true \
--experimental_incremental_dexing_after_proguard=50 \
--java_language_version=11 --tool_java_language_version=11 \
--java_runtime_version=21 --tool_java_runtime_version=21 \
--desugar_java8_libs --experimental_check_desugar_deps=false \
--@rules_android//rules/flags:manifest_merge_order=legacy

1 change: 1 addition & 0 deletions examples/basicapp/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ remote_android_extensions = use_extension(
use_repo(remote_android_extensions, "android_tools")

android_sdk_repository_extension = use_extension("@rules_android//rules/android_sdk_repository:rule.bzl", "android_sdk_repository_extension")
android_sdk_repository_extension.configure(api_level = 32)
use_repo(android_sdk_repository_extension, "androidsdk")

register_toolchains("@androidsdk//:sdk-toolchain", "@androidsdk//:all")
Expand Down
2 changes: 1 addition & 1 deletion examples/basicapp/java/com/basicapp/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package="com.basicapp" >

<uses-sdk
android:minSdkVersion="21"
android:minSdkVersion="28"
android:targetSdkVersion="30" />

<application
Expand Down
8 changes: 8 additions & 0 deletions examples/basicapp/java/com/basicapp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ load(
"android_library",
"android_application",
)
load("@rules_java//java:java_library.bzl", "java_library")

android_binary(
name = "basic_app",
manifest = "AndroidManifest.xml",
deps = [":basic_lib"],
proguard_specs = ["proguard.cfg"],
)

android_library(
name = "basic_lib",
srcs = ["BasicActivity.java"],
manifest = "AndroidManifest.xml",
resource_files = glob(["res/**"]),
deps = [":basic_dep"],
)

java_library(
name = "basic_dep",
srcs = ["BasicDep.java"],
)

android_application(
Expand Down
5 changes: 4 additions & 1 deletion examples/basicapp/java/com/basicapp/BasicActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.basicapp.basicdep.BasicDep;
import java.time.Duration;

/**
* The main activity of the Basic Sample App.
Expand All @@ -41,7 +43,8 @@ protected void onCreate(Bundle savedInstanceState) {
public void onClick(View v) {
TextView tv = findViewById(R.id.text_hello);
if (v.getId() == R.id.button_id_fizz) {
tv.setText("fizz");
BasicDep bd = new BasicDep(Duration.ofMillis(System.currentTimeMillis()));
tv.setText("fizz" + bd.toString());
} else if (v.getId() == R.id.button_id_buzz) {
tv.setText("buzz");
}
Expand Down
25 changes: 25 additions & 0 deletions examples/basicapp/java/com/basicapp/BasicDep.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.basicapp.basicdep;

import java.time.Duration;
import java.util.concurrent.TimeUnit;

public class BasicDep {
Duration d;
public BasicDep(Duration d_) {
this.d = d_;
}
public BasicDep() {
this(Duration.ZERO);
}
public Duration getDuration() {
return this.d;
}
public String toString() {
// return this.d.toString();
return Long.toString(this.toLong());
}
public long toLong() {
// return TimeUnit.MILLISECONDS.convert(this.d.toMillis(), TimeUnit.MILLISECONDS);
return TimeUnit.MILLISECONDS.convert(this.d);
}
}
2 changes: 2 additions & 0 deletions examples/basicapp/java/com/basicapp/proguard.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-dontobfuscate
-keepattributes SourceFile,LineNumberTable
2 changes: 1 addition & 1 deletion rules/min_sdk_version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
visibility(PROJECT_VISIBILITY)

_SETTING = "//rules/flags:min_sdk_version"
_DEPOT_FLOOR = 23
_DEPOT_FLOOR = 28
_MIN_SDK_LEVELS = sorted([_DEPOT_FLOOR, 24])

_ATTRS = dict(
Expand Down