Skip to content
Open
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
6 changes: 5 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ common --remote_cache_compression --remote_cache_async
# Python config
common --incompatible_default_to_explicit_init_py

# CI Config
# Java config - use remote JDK since CI doesn't have a local one
common --java_runtime_version=remotejdk_21
common --tool_java_runtime_version=remotejdk_21

# CI Config
common:ci --build_metadata=ROLE=CI
common:ci --local_resources=cpu=4
common:ci --local_resources=memory=8000
Expand Down
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ commands:
- setup_auth
- run: echo "//registry.npmjs.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: echo -e $GPG_KEY | gpg --import --batch
- run: echo -e "pinentry-mode loopback\npassphrase $DEPLOY_MAVEN_GPG_PASSPHRASE" > ~/.gnupg/gpg.conf
- run: |
source ~/.bashrc
npx auto shipit --only-graduate-with-release-label -vv
Expand Down Expand Up @@ -101,7 +102,7 @@ jobs:
at: ~/xlr

- run: |
bazel coverage --config=ci -- $(bazel query "kind(js_test, //...) + kind(py_test, //...)" --output label 2>/dev/null | tr '\n' ' ')
bazel coverage --config=ci -- $(bazel query "kind(js_test, //...) + kind(py_test, //...) + kind(kt_jvm_test, //...) + kind(_ktlint_test, //...)" --output label 2>/dev/null | tr '\n' ' ')

- run:
when: always
Expand Down
7 changes: 7 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@aspect_rules_ts//ts:defs.bzl", "ts_config")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//:tsconfig-to-swcconfig/package_json.bzl", tsconfig_to_swcconfig = "bin")
load("@rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -97,3 +98,9 @@ tsconfig_to_swcconfig.t2s(
stdout = ".swcrc",
visibility = ["//:__subpackages__"],
)

kt_kotlinc_options(
name = "kt_opts",
jvm_target = "21",
visibility = ["//visibility:public"],
)
32 changes: 32 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,40 @@ pip.parse(

use_repo(pip, "pypi")

####### Kotlin #########
bazel_dep(name = "rules_kotlin", version = "2.2.1")
bazel_dep(name = "rules_jvm_external", version = "6.9")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
artifacts = [
"org.jetbrains.kotlin:kotlin-stdlib:2.3.0",
"org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0",
"org.jetbrains.kotlin:kotlin-test:2.3.0",
"org.jetbrains.kotlin:kotlin-test-junit5:2.3.0",
"org.junit.jupiter:junit-jupiter-api:5.7.2",
"org.junit.jupiter:junit-jupiter-engine:5.7.2",
"org.junit.jupiter:junit-jupiter-params:5.7.2",
"org.junit.platform:junit-platform-commons:1.7.2",
"org.junit.platform:junit-platform-console:1.7.2",
"org.junit.platform:junit-platform-engine:1.7.2",
"org.junit.platform:junit-platform-launcher:1.7.2",
"org.junit.platform:junit-platform-suite-api:1.7.2",
"org.apiguardian:apiguardian-api:1.0.0",
"org.opentest4j:opentest4j:1.1.1",
],
repositories = [
"https://repo1.maven.org/maven2",
],
)
use_repo(maven, "maven")
########################

build_constants = use_repo_rule("@rules_player//distribution:defs.bzl", "build_constants")
build_constants(
name = "build_constants",
constants = {
"GROUP": "com.intuit.playerui.xlr",
},
version_file = "//:VERSION",
)
99 changes: 6 additions & 93 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# See https://github.com/bazelbuild/rules_nodejs/blob/stable/scripts/publish_release.sh

set -u -o pipefail
set -eu -o pipefail

readonly PKG_NPM_LABELS=`bazel query --output=label 'kind("npm_package rule", //...) - attr("tags", "\[.*do-not-publish.*\]", //...)'`
NPM_TAG=canary
Expand Down Expand Up @@ -29,4 +29,14 @@ readonly PKG_PYPI_LABELS=`bazel query --output=label 'kind("py_wheel rule", //..

for pkg in $PKG_PYPI_LABELS ; do
TWINE_USERNAME=$PYPI_USER TWINE_PASSWORD=$PYPI_TOKEN bazel run --config=release ${pkg}.publish --
done
done

# Maven Central Publishing
MVN_RELEASE_TYPE=snapshot
if [ "$RELEASE_TYPE" == "release" ] && [ "$CURRENT_BRANCH" == "main" ]; then
MVN_RELEASE_TYPE=release
fi

echo "Publishing Maven Packages with release type: ${MVN_RELEASE_TYPE} on branch: ${CURRENT_BRANCH}"
bazel build --config=release @rules_player//distribution:staged-maven-deploy
bazel run --config=release @rules_player//distribution:staged-maven-deploy -- "$MVN_RELEASE_TYPE" --package-group=com.intuit.playerui.xlr --client-timeout=600 --connect-timeout=600
32 changes: 32 additions & 0 deletions types/kotlin/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# EditorConfig for Kotlin code style
# https://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true

[*.kt]
# ktlint specific rules
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_package-name = disabled

# Allow trailing commas
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled

# Function signature - allow multi-line
ktlint_standard_function-signature = disabled

# Disable some strict rules for DSL-style code
ktlint_standard_parameter-list-wrapping = disabled
ktlint_standard_argument-list-wrapping = disabled

[*.kts]
ktlint_standard_no-wildcard-imports = disabled
53 changes: 53 additions & 0 deletions types/kotlin/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
load("@rules_player//kotlin:defs.bzl", "kt_jvm")
load("@rules_kotlin//kotlin:core.bzl", "kt_compiler_plugin")
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_kotlin//kotlin:lint.bzl", "ktlint_config")
load("@build_constants//:constants.bzl", "GROUP", "VERSION")

package(default_visibility = ["//visibility:public"])

ktlint_config(
name = "lint_config",
editorconfig = ".editorconfig",
)

kt_compiler_plugin(
name = "serialization_plugin",
compile_phase = True,
id = "org.jetbrains.kotlin.serialization",
stubs_phase = True,
deps = [
"@rules_kotlin//kotlin/compiler:kotlin-serialization-compiler-plugin",
],
)

kt_jvm_library(
name = "kotlin_serialization",
srcs = [],
exported_compiler_plugins = [":serialization_plugin"],
exports = [
"@maven//:org_jetbrains_kotlinx_kotlinx_serialization_json",
],
)

kt_jvm(
name = "xlr-types",
group = GROUP,
version = VERSION,
lint_config = ":lint_config",
main_opts = "//:kt_opts",
main_deps = [
":kotlin_serialization",
"@maven//:org_jetbrains_kotlin_kotlin_stdlib",
],
test_package = "com.intuit.playerui.xlr",
test_opts = "//:kt_opts",
test_deps = [
"@maven//:org_jetbrains_kotlin_kotlin_test",
"@maven//:org_jetbrains_kotlin_kotlin_test_junit5",
"@maven//:org_jetbrains_kotlinx_kotlinx_serialization_json",
],
test_resources = glob(["src/test/resources/**/*"]),
test_resource_strip_prefix = "types/kotlin/src/test/resources",
pom_template = ":pom.tpl",
)
44 changes: 44 additions & 0 deletions types/kotlin/pom.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<name>XLR - {artifactId}</name>
<description>Kotlin XLR type definitions, serializer and deserializer</description>
<url>https://github.com/player-ui/xlr</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<id>rafbcampos</id>
<name>Rafael Campos</name>
</developer>
<developer>
<id>sugarmanz</id>
<name>Jeremiah Zucker</name>
</developer>
<developer>
<id>brocollie08</id>
<name>Tony Lin</name>
</developer>
</developers>
<scm>
<connection>https://github.com/player-ui/xlr.git</connection>
<developerConnection>https://github.com/player-ui/xlr.git</developerConnection>
<tag>v{version}</tag>
<url>https://github.com/player-ui/xlr.git</url>
</scm>

<groupId>{groupId}</groupId>
<artifactId>{artifactId}</artifactId>
<version>{version}</version>
<packaging>{type}</packaging>

<dependencies>
{dependencies}
</dependencies>
</project>
Loading