Skip to content

Move to bzlmod #91

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
7 changes: 4 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
test --sandbox_tmpfs_path=/tmp

build --java_runtime_version=remotejdk_11
build --tool_java_runtime_version=remotejdk_11
build --java_language_version=11
common --java_language_version=17
common --java_runtime_version=remotejdk_17
common --tool_java_language_version=17
common --tool_java_runtime_version=remotejdk_17

test --build_tests_only
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.0
7.4.1
31 changes: 19 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
---
name: CI

on:
push:
branches:
- master
- main
pull_request:
branches:
- '*'
paths-ignore:
- '**.md'


env:
TERM: dumb
TMPDIR: "/tmp"

jobs:
checks:
runs-on: ubuntu-22.04
container: ghcr.io/menny/android_bazel:1.17.0
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3.5.0
- uses: actions/checkout@v4.2.2
- uses: bazel-contrib/setup-bazel@0.9.1
with:
fetch-depth: 1
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true

- name: build
run: ./scripts/ci_build.sh
- name: buildifier
run: ./scripts/ci_buildifier.sh
- name: formating
run: bazel run //tools:format
- name: test
run: ./scripts/ci_test.sh
- name: verify-rules-generation
run: ./scripts/ci_verify_rules_generation.sh
examples:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: [checks]
container: ghcr.io/menny/android_bazel:1.17.0
strategy:
matrix:
example_name: [plain_java, java_plugin, android, kotlin, android-kotlin]
fail-fast: false
steps:
- uses: actions/checkout@v3.5.0
with:
fetch-depth: 1
- uses: actions/checkout@v4.2.2
- uses: bazel-contrib/setup-bazel@0.9.1
- name: build-examples
run: ./scripts/ci_build_examples.sh ${{ matrix.example_name }}
- name: regenerate-examples
Expand Down
8 changes: 8 additions & 0 deletions .yamlfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
gitignore_excludes: true
indent: 2
exclude:
- pnpm-lock.yaml
formatter:
type: basic
include_document_start: true
30 changes: 8 additions & 22 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")

alias(
name = "buildifier_bin",
actual = select({
"//platforms:darwin_arm64": "@buildifier_darwin_arm64//file",
"//platforms:darwin_x86": "@buildifier_darwin_amd64//file",
"//platforms:linux_arm64": "@buildifier_linux_arm64//file",
"//platforms:linux_x86": "@buildifier_linux_amd64//file",
"//platforms:windows_x86": "@buildifier_windows_amd64//file",
}),
)
package(default_visibility = ["//visibility:public"])

buildifier(
name = "buildifier_fix",
buildifier = ":buildifier_bin",
lint_mode = "fix",
lint_warnings = ["all"],
copy_to_bin(
name = "gitignore",
srcs = [".gitignore"],
)

buildifier(
name = "buildifier",
buildifier = ":buildifier_bin",
lint_mode = "warn",
lint_warnings = ["all"],
mode = "check",
copy_to_bin(
name = "yamlfmt.yml",
srcs = [".yamlfmt.yml"],
)
16 changes: 16 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""bzlmod configuration for Mabel"""

module(name = "mabel")

bazel_dep(name = "aspect_bazel_lib", version = "2.9.4")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_multitool", version = "1.0.0")
bazel_dep(name = "rules_java", version = "8.6.3")
bazel_dep(name = "platforms", version = "0.0.10")

multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
multitool.hub(lockfile = "//tools:multitool.lock.json")
use_repo(multitool, "multitool")

bazel_dep(name = "aspect_rules_lint", version = "1.0.7")
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1")
1,385 changes: 1,385 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

42 changes: 0 additions & 42 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,42 +0,0 @@
workspace(name = "mabel")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_java",
sha256 = "bcfabfb407cb0c8820141310faa102f7fb92cc806b0f0e26a625196101b0b57e",
urls = [
"https://github.com/bazelbuild/rules_java/releases/download/5.5.0/rules_java-5.5.0.tar.gz",
],
)

load("@rules_java//java:repositories.bzl", "remote_jdk19_repos", "rules_java_dependencies", "rules_java_toolchains")

rules_java_dependencies()

remote_jdk19_repos()

rules_java_toolchains()

load("@//:init_rules.bzl", "init_mabel_rules")

init_mabel_rules()

http_archive(
name = "platforms",
sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
],
)

load("@//:buildifier.bzl", "init_buildifier")

init_buildifier()

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains(version = "1.17.2")
17 changes: 17 additions & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")

http_jar(
name = "google-java-format",
sha256 = "25157797a0a972c2290b5bc71530c4f7ad646458025e3484412a6e5a9b8c9aa6",
url = "https://github.com/google/google-java-format/releases/download/v1.25.2/google-java-format-1.25.2-all-deps.jar",
)

http_jar(
name = "com_puppycrawl_tools_checkstyle",
url = "https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.17.0/checkstyle-10.17.0-all.jar",
sha256 = "51c34d738520c1389d71998a9ab0e6dabe0d7cf262149f3e01a7294496062e42",
)

load("@//:init_rules.bzl", "init_mabel_rules")

init_mabel_rules()
69 changes: 0 additions & 69 deletions buildifier.bzl

This file was deleted.

2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
codecov:
notify:
require_ci_to_pass: yes

ignore:
- "examples/.*"
- "rules/.*"
Expand Down
20 changes: 9 additions & 11 deletions examples/android-kotlin/program/HelloActivity.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package net.evendanan.bazel.mvn.example;

import android.app.Activity;
import android.widget.TextView;
import android.content.Intent;
import android.os.Bundle;

import android.widget.TextView;
import androidx.annotation.Nullable;

public class HelloActivity extends Activity {

@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.main_activity);
setContentView(R.layout.main_activity);

TextView t = findViewById(R.id.root_content);
t.setText(new StringFormat().hello("mabel"));
}
}
TextView t = findViewById(R.id.root_content);
t.setText(new StringFormat().hello("mabel"));
}
}
14 changes: 6 additions & 8 deletions examples/android/program/HelloActivity.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package net.evendanan.bazel.mvn.example;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

public class HelloActivity extends Activity {

@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.main_activity);
}
}
setContentView(R.layout.main_activity);
}
}
6 changes: 3 additions & 3 deletions examples/java_plugin/program/HelloWorld.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package examples.java_plugin.program;

public class HelloWorld {
public static void main(String[] args) throws Exception {
System.out.println(Program.create("Hello World!").output());
}
public static void main(String[] args) throws Exception {
System.out.println(Program.create("Hello World!").output());
}
}
8 changes: 4 additions & 4 deletions examples/java_plugin/program/Program.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

@AutoValue
public abstract class Program {
static Program create(String output) {
return new examples.java_plugin.program.AutoValue_Program(output);
}
static Program create(String output) {
return new examples.java_plugin.program.AutoValue_Program(output);
}

abstract String output();
abstract String output();
}
8 changes: 3 additions & 5 deletions examples/plain_java/program/HelloWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import com.google.common.base.Joiner;

public class HelloWorld {
public static void main(String[] args) throws Exception {
System.out.println(
Joiner.on(" ").join("Hello", "World!")
);
}
public static void main(String[] args) throws Exception {
System.out.println(Joiner.on(" ").join("Hello", "World!"));
}
}
Loading
Loading