-
Notifications
You must be signed in to change notification settings - Fork 211
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
Ci jetpack compose #657
Ci jetpack compose #657
Changes from all commits
bb2b0f9
4474dff
2c23ecb
ebd6b32
d209e99
8c84347
f27aa5c
0e437dc
6f33f41
b5eac74
f235954
f93c3e1
ad15326
5f09f7a
7218233
57ceed5
fb3b782
ebf6d9b
dd1a5aa
195c959
c1920ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Enable d8 merger | ||
build --define=android_dexmerger_tool=d8_dexmerger | ||
|
||
# Flags for the D8 dexer | ||
build --define=android_incremental_dexing_tool=d8_dexbuilder | ||
build --define=android_standalone_dexing_tool=d8_compat_dx | ||
build --nouse_workers_with_dexbuilder |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
_COMPOSE_VERSION = "1.1.0-beta03" | ||
|
||
_KOTLIN_COMPILER_VERSION = "1.5.31" | ||
|
||
_KOTLIN_COMPILER_SHA = "661111286f3e5ac06aaf3a9403d869d9a96a176b62b141814be626a47249fe9e" | ||
|
||
# Setup Kotlin | ||
|
||
local_repository( | ||
name = "release_archive", | ||
path = "../../src/main/starlark/release_archive", | ||
|
@@ -9,138 +19,82 @@ archive_repository( | |
name = "io_bazel_rules_kotlin", | ||
) | ||
|
||
load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") | ||
load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version", "versions") | ||
|
||
kotlin_repositories() | ||
kotlin_repositories( | ||
compiler_release = kotlinc_version( | ||
release = _KOTLIN_COMPILER_VERSION, | ||
sha256 = _KOTLIN_COMPILER_SHA, | ||
), | ||
) | ||
|
||
register_toolchains("//:kotlin_toolchain") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
_KOTLIN_COMPILER_VERSION = "1.4.21" | ||
|
||
## JVM External | ||
|
||
_RULES_JVM_EXTERNAL_VERSION = "4.0" | ||
|
||
_RULES_JVM_EXTERNAL_SHA = "31701ad93dbfe544d597dbe62c9a1fdd76d81d8a9150c2bf1ecf928ecdf97169" | ||
|
||
http_archive( | ||
name = "rules_jvm_external", | ||
sha256 = _RULES_JVM_EXTERNAL_SHA, | ||
strip_prefix = "rules_jvm_external-{}".format(_RULES_JVM_EXTERNAL_VERSION), | ||
urls = [ | ||
"https://github.com/bazelbuild/rules_jvm_external/archive/{}.zip".format(_RULES_JVM_EXTERNAL_VERSION), | ||
], | ||
sha256 = versions.RULES_JVM_EXTERNAL_SHA, | ||
strip_prefix = "rules_jvm_external-%s" % versions.RULES_JVM_EXTERNAL_TAG, | ||
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % versions.RULES_JVM_EXTERNAL_TAG, | ||
) | ||
|
||
load("@rules_jvm_external//:defs.bzl", "maven_install") | ||
|
||
maven_install( | ||
artifacts = [ | ||
"org.jetbrains.kotlin:kotlin-stdlib:{}".format(_KOTLIN_COMPILER_VERSION), | ||
"androidx.core:core-ktx:1.3.2", | ||
"androidx.appcompat:appcompat:1.2.0", | ||
"com.google.android.material:material:1.2.1", | ||
"androidx.compose.material:material:1.0.0-alpha09", | ||
"androidx.compose.ui:ui:1.0.0-alpha09", | ||
"androidx.compose.ui:ui-tooling:1.0.0-alpha09", | ||
"androidx.compose.compiler:compiler:1.0.0-alpha09", | ||
"androidx.core:core-ktx:1.6.0", | ||
"androidx.appcompat:appcompat:1.3.0", | ||
"androidx.activity:activity-compose:1.3.0", | ||
"androidx.compose.material:material:{}".format(_COMPOSE_VERSION), | ||
"androidx.compose.ui:ui:{}".format(_COMPOSE_VERSION), | ||
"androidx.compose.ui:ui-tooling:{}".format(_COMPOSE_VERSION), | ||
"androidx.compose.compiler:compiler:{}".format(_COMPOSE_VERSION), | ||
"androidx.compose.runtime:runtime:{}".format(_COMPOSE_VERSION), | ||
], | ||
override_targets = { | ||
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm": "@//:kotlinx_coroutines_core_jvm", | ||
}, | ||
repositories = [ | ||
"https://maven.google.com", | ||
"https://repo1.maven.org/maven2", | ||
], | ||
) | ||
|
||
## Stardoc | ||
|
||
_STARDOC_VERSION = "0.4.0" | ||
|
||
_STARDOC_SHA = "36b8d6c2260068b9ff82faea2f7add164bf3436eac9ba3ec14809f335346d66a" | ||
|
||
http_archive( | ||
name = "io_bazel_stardoc", | ||
sha256 = _STARDOC_SHA, | ||
strip_prefix = "stardoc-{}".format(_STARDOC_VERSION), | ||
urls = [ | ||
"https://github.com/bazelbuild/stardoc/archive/{}.zip".format(_STARDOC_VERSION), | ||
# Secondary maven repository used mainly for workarounds | ||
maven_install( | ||
name = "maven_secondary", | ||
artifacts = [ | ||
# Workaround to add missing 'sun.misc' dependencies to 'kotlinx-coroutines-core-jvm' artifact | ||
# Check root BUILD file and 'override_targets' arg of a primary 'maven_install' | ||
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.2", | ||
], | ||
fetch_sources = True, | ||
repositories = ["https://repo1.maven.org/maven2"], | ||
) | ||
|
||
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") | ||
|
||
stardoc_repositories() | ||
|
||
## Import Skylib | ||
|
||
_SKYLIB_VERSION = "1.0.2" | ||
|
||
_SKYLIB_SHA = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44" | ||
|
||
http_archive( | ||
name = "bazel_skylib", | ||
sha256 = _SKYLIB_SHA, | ||
urls = [ | ||
"https://github.com/bazelbuild/bazel-skylib/releases/download/{0}/bazel-skylib-{0}.tar.gz".format(_SKYLIB_VERSION), | ||
], | ||
) | ||
|
||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") | ||
|
||
bazel_skylib_workspace() | ||
|
||
## Protobuf | ||
|
||
_PROTOBUF_VERSION = "3.14.0" | ||
|
||
_PROTOBUF_SHA = "bf0e5070b4b99240183b29df78155eee335885e53a8af8683964579c214ad301" | ||
|
||
http_archive( | ||
name = "com_google_protobuf", | ||
sha256 = _PROTOBUF_SHA, | ||
strip_prefix = "protobuf-{}".format(_PROTOBUF_VERSION), | ||
urls = [ | ||
"https://github.com/protocolbuffers/protobuf/archive/v{}.zip".format(_PROTOBUF_VERSION), | ||
], | ||
) | ||
|
||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") | ||
|
||
protobuf_deps() | ||
|
||
## Rules PKG | ||
|
||
_RULES_PKG_VERSION = "0.2.4" | ||
|
||
_RULES_PKG_SHA = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a" | ||
|
||
http_archive( | ||
name = "rules_pkg", | ||
sha256 = _RULES_PKG_SHA, | ||
urls = [ | ||
"https://github.com/bazelbuild/rules_pkg/releases/download/{0}/rules_pkg-{0}.tar.gz".format(_RULES_PKG_VERSION), | ||
], | ||
sha256 = versions.SKYLIB_SHA, | ||
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/%s/bazel-skylib-%s.tar.gz" % ( | ||
versions.SKYLIB_VERSION, | ||
versions.SKYLIB_VERSION, | ||
)], | ||
) | ||
|
||
## Android | ||
|
||
_RULES_ANDROID_VERSION = "0.1.1" | ||
|
||
_RULES_ANDROID_SHA = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806" | ||
|
||
http_archive( | ||
name = "build_bazel_rules_android", | ||
sha256 = _RULES_ANDROID_SHA, | ||
strip_prefix = "rules_android-{}".format(_RULES_ANDROID_VERSION), | ||
urls = [ | ||
"https://github.com/bazelbuild/rules_android/archive/v{}.zip".format(_RULES_ANDROID_VERSION), | ||
], | ||
name = "rules_android", | ||
sha256 = versions.ANDROID.SHA, | ||
strip_prefix = "rules_android-%s" % versions.ANDROID.VERSION, | ||
urls = ["https://github.com/bazelbuild/rules_android/archive/v%s.zip" % versions.ANDROID.VERSION], | ||
) | ||
|
||
load("@build_bazel_rules_android//android:rules.bzl", "android_sdk_repository") | ||
load("@rules_android//android:rules.bzl", "android_sdk_repository") | ||
|
||
android_sdk_repository( | ||
name = "androidsdk", | ||
api_level = 29, | ||
build_tools_version = versions.ANDROID.BUILD_TOOLS, # versions > 30.0.3 do not have the dx.jar anymore. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might wanna link to bazelbuild/bazel#13989 for some context |
||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="cm.ben.android.bazel.compose.example"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we change the package name to something closer to the Kotlin rules' package? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm ok with it. |
||
|
||
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="29" /> | ||
</manifest> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="cm.ben.android.bazel.compose.example.ui"> | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="cm.ben.android.bazel.compose.example.ui"> | ||
|
||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" /> | ||
<uses-sdk | ||
android:minSdkVersion="24" | ||
android:targetSdkVersion="29" /> | ||
|
||
<application | ||
android:label="Bazel Jetpack Compose Example" | ||
android:theme="@style/Theme.AppCompat.Light"> | ||
android:label="Bazel Jetpack Compose Example" | ||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="Bazel Jetpack Compose Example"> | ||
android:name=".MainActivity" | ||
android:label="Bazel Jetpack Compose Example"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<!-- Resolve a conflict issue while building with Bazel. --> | ||
<provider | ||
android:name="androidx.startup.InitializationProvider" | ||
android:authorities="${applicationId}.androidx-startup" | ||
tools:node="remove" /> | ||
</application> | ||
</manifest> | ||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
package cm.ben.android.bazel.compose.example.ui | ||
|
||
import android.os.Bundle | ||
import androidx.activity.compose.setContent | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.platform.setContent | ||
import androidx.compose.ui.tooling.preview.Preview | ||
|
||
class MainActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
Greeting("world") | ||
} | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
Greeting("world") | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this actually work with Android Studio and Bazel? I never got the previews to work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sigh We've got some work to do before we have a complete working system. |
||
@Composable | ||
fun Greeting(name: String) = Text(text = "Hello $name!") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
load("@rules_java//java:defs.bzl", "java_library") | ||
|
||
java_library( | ||
name = "sun_misc", | ||
srcs = [ | ||
"sun/misc/Signal.java", | ||
"sun/misc/SignalHandler.java", | ||
], | ||
neverlink = True, | ||
visibility = ["//visibility:public"], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package sun.misc; | ||
|
||
public final class Signal { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package sun.misc; | ||
|
||
public interface SignalHandler { | ||
} |
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.
I don't have a strong opinion on this, but should we maybe target the last stable instead?
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.
It's complicated because they are tied to the Kotlin compiler. I made note of that in the description. We can pass the compiler plugin flags to ignore these Kotlin/Compose version checks, but that might bring some instability.