Skip to content

Commit

Permalink
Merge pull request #225 from salesforce/plaird/bzlmod
Browse files Browse the repository at this point in the history
BZLMOD: move repo to use bzlmod for everything, delete WORKSPACE
  • Loading branch information
plaird authored Dec 9, 2024
2 parents a45ea20 + 2cb197d commit 168362d
Show file tree
Hide file tree
Showing 13 changed files with 4,672 additions and 8,471 deletions.
62 changes: 58 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,19 +1,73 @@
module(
name = "rules_spring",
version = "2.4.2",
compatibility_level = 1,
version = "2.5.0",
compatibility_level = 2,
repo_name = "rules_spring",
)

bazel_dep(name = "rules_python", version = "0.40.0")

# For Dupe Class checking support
# Python for dupe class checking support
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
is_default = True,
python_version = "3.11",
ignore_root_user_error = True, # https://github.com/bazelbuild/rules_python/issues/1169
)

# For License support
bazel_dep(name = "rules_license", version = "1.0.0")


# DEV DEPENDENCIES

# Maven dependencies for the examples
bazel_dep(name = "rules_jvm_external", version = "6.6", dev_dependency = True)
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
artifacts = [
"org.slf4j:slf4j-api:2.0.13",
"org.springframework.boot:spring-boot:3.3.5",
"org.springframework.boot:spring-boot-actuator:3.3.5",
"org.springframework.boot:spring-boot-actuator-autoconfigure:3.3.5",
"org.springframework.boot:spring-boot-autoconfigure:3.3.5",
"org.springframework.boot:spring-boot-configuration-processor:3.3.5",
"org.springframework.boot:spring-boot-loader:3.3.5",
"org.springframework.boot:spring-boot-loader-tools:3.3.5",
"org.springframework.boot:spring-boot-starter:3.3.5",
"org.springframework.boot:spring-boot-starter-actuator:3.3.5",
"org.springframework.boot:spring-boot-starter-freemarker:3.3.5",
"org.springframework.boot:spring-boot-starter-jdbc:3.3.5",
"org.springframework.boot:spring-boot-starter-jetty:3.3.5",
"org.springframework.boot:spring-boot-starter-logging:3.3.5",
"org.springframework.boot:spring-boot-starter-security:3.3.5",
"org.springframework.boot:spring-boot-starter-test:3.3.5",
"org.springframework.boot:spring-boot-starter-web:3.3.5",
"org.springframework.boot:spring-boot-test:3.3.5",
"org.springframework.boot:spring-boot-test-autoconfigure:3.3.5",
"org.springframework.boot:spring-boot-starter-thymeleaf:3.3.5",

"org.springframework:spring-aop:6.1.14",
"org.springframework:spring-aspects:6.1.14",
"org.springframework:spring-beans:6.1.14",
"org.springframework:spring-context:6.1.14",
"org.springframework:spring-context-support:6.1.14",
"org.springframework:spring-core:6.1.14",
"org.springframework:spring-expression:6.1.14",
"org.springframework:spring-jdbc:6.1.14",
"org.springframework:spring-test:6.1.14",
"org.springframework:spring-tx:6.1.14",
"org.springframework:spring-web:6.1.14",
"org.springframework:spring-webmvc:6.1.14",

# intentionally ancient version annotation-api; in demoapp we use
# a filter to exclude this dependency
"javax.annotation:javax.annotation-api:1.3.2",

# test deps
"junit:junit:4.13.2",
"org.hamcrest:hamcrest-core:2.2",
],
lock_file = "//:maven_install.json",
)

use_repo(maven, "maven")
6 changes: 4 additions & 2 deletions MODULE.bazel.lock

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

62 changes: 0 additions & 62 deletions WORKSPACE

This file was deleted.

12 changes: 8 additions & 4 deletions examples/demoapp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ springboot_deps = [

# bring in same dep again as above, but through a different maven_install
# rule: the springboot rule does not package duplicate deps, first one wins
"@spring_boot_starter_jetty//:org_springframework_boot_spring_boot_starter_jetty",
#"@spring_boot_starter_jetty//:org_springframework_boot_spring_boot_starter_jetty",
]

# Sometimes you have a transitive that you don't want. The unwanted_classes.md doc
Expand All @@ -39,9 +39,13 @@ deps_filter_transitive(
name = "filtered_deps",
deps = springboot_deps + deps, # the input list
deps_exclude = [
# note that deps_exclude is no longer recommended, use an exclusion filter instead
# see unwanted_classes.md
"@maven//:javax_annotation_javax_annotation_api", # exclude this transitive
# tomcat comes in transitively, but we want to use jetty
"@maven//:org_apache_tomcat_embed_tomcat_embed_core",
"@maven//:org_apache_tomcat_embed_tomcat_embed_el",
"@maven//:org_apache_tomcat_embed_tomcat_embed_websocket",

# just a demo of excluding a transitive
"@maven//:javax_annotation_javax_annotation_api",
],
exclude_transitives = True,
)
Expand Down
11 changes: 1 addition & 10 deletions makerelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,13 @@ echo ""
echo "You have entered $release_version, are you good with this version? Enter to continue, ctrl-c to abort."
read DOTHETHING

# write the MODULE.bazel file
echo "module(" > MODULE.bazel
echo " name = \"rules_spring\"," >> MODULE.bazel
echo " version = \"$release_version\"," >> MODULE.bazel
echo " repo_name = \"rules_spring\"," >> MODULE.bazel
echo " compatibility_level = 1," >> MODULE.bazel
echo ")" >> MODULE.bazel

# remove/relocate local build artifacts and tools
rm -rf bazel-*

# move some dev directories out, so they don't get zipped up in the archive
tmpdir=/tmp/rules-spring-release
mkdir $tmpdir 2>/dev/null
mv examples $tmpdir 2>/dev/null
mv tools/python_interpreter $tmpdir 2>/dev/null

rm -rf coverage-reports
rm -rf springboot/tests/__pycache__
Expand All @@ -44,7 +35,6 @@ jar -cvf $release_zip *

# restore the dev directories
mv $tmpdir/examples examples 2>/dev/null
mv $tmpdir/python_interpreter tools/python_interpreter 2>/dev/null

rm -rf $tmpdir

Expand All @@ -57,6 +47,7 @@ echo ""
echo "Remember to complete these tasks to make the official release:"
echo " 1. Create a new release on GitHub and upload the zip file to it. Look at previous releases and use the same doc conventions. Make sure you tag the release."
echo " 2. Update the http_archive stanza in the top level README.md to refer to the latest release."
echo " 3. Update the version identifier in MODULE.bazel"
echo ""
echo "!!! Hey, did you see the task list above, that is work you need to do !!!"
read YESIDID
Expand Down
Loading

0 comments on commit 168362d

Please sign in to comment.