Skip to content

Commit 1bb6338

Browse files
committed
Remove Gradle in favor of Bazel
1 parent 8dcd508 commit 1bb6338

200 files changed

Lines changed: 16573 additions & 362 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ rules_jvm_external++maven+maven_install.json
2323
compile_commands.json
2424
.compilation_database
2525

26-
.gradle
27-
/build/
28-
29-
# Ignore Gradle GUI config
30-
gradle-app.setting
31-
32-
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
33-
!gradle-wrapper.jar
34-
35-
# Cache of project
36-
.gradletasknamecache
37-
3826
dependencies
3927
bin/
4028

README.md

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,69 @@
11
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2-
![Java CI with Gradle](https://github.com/williamfiset/Algorithms/workflows/Java%20CI%20with%20Gradle/badge.svg)
32
![README Checker](https://github.com/williamfiset/Algorithms/workflows/README%20URL%20Checker/badge.svg)
43
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate?hosted_button_id=JUP2HZ6JUPB5C)
54

65
# Algorithms & data structures project
76

87
Algorithms and data structures are fundamental to efficient code and good software design. Creating and designing excellent algorithms is required for being an exemplary programmer. This repository's goal is to demonstrate how to correctly implement common data structures and algorithms in the simplest and most elegant ways.
98

10-
### Other programming languages?
11-
12-
This repository provides algorithm implementations in Java, however, there are other forks that provide implementations in other languages, most notably:
13-
14-
* **C++/Python**: https://github.com/akzare/Algorithms
15-
* **Rust**: https://github.com/TianyiShi2001/Algorithms
16-
179
# Running an algorithm implementation
1810

19-
To compile and run any of the algorithms here, you need at least JDK version 8. Gradle can make things more convenient for you, but it is not required.
20-
21-
## Running with Gradle (recommended)
11+
To compile and run any of the algorithms here, you need at least JDK version 8 and [Bazel](https://bazel.build/).
2212

23-
This project supports the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html). The Gradle wrapper automatically downloads Gradle the first time it runs, so expect a delay when running the first command below.
13+
## Running with Bazel (recommended)
2414

25-
If you are on Windows, use `gradlew.bat` instead of `./gradlew` below.
15+
This project uses [Bazel](https://bazel.build/) as its build system. Install Bazel by following the [official installation guide](https://bazel.build/install).
2616

2717
Run a single algorithm like this:
2818

19+
```bash
20+
bazel run //src/main/java/com/williamfiset/algorithms/<subpackage>:<ClassName>
2921
```
30-
./gradlew run -Palgorithm=<algorithm-subpackage>.<algorithm-class>
31-
```
32-
33-
Alternatively, you can run a single algorithm specifying the full class name
3422

35-
```
36-
./gradlew run -Pmain=<algorithm-fully-qualified-class-name>
23+
For instance:
3724

25+
```bash
26+
bazel run //src/main/java/com/williamfiset/algorithms/search:BinarySearch
3827
```
3928

40-
For instance:
29+
Run all tests:
4130

42-
```
43-
./gradlew run -Palgorithm=search.BinarySearch
31+
```bash
32+
bazel test //src/test/...
4433
```
4534

46-
or
35+
Run tests for a specific package:
4736

48-
```
49-
./gradlew run -Pmain=com.williamfiset.algorithms.search.BinarySearch
37+
```bash
38+
bazel test //src/test/java/com/williamfiset/algorithms/sorting:all
5039
```
5140

5241
## Compiling and running with only a JDK
5342

43+
If you don't want to use Bazel, you can compile and run with just the JDK:
44+
5445
### Create a classes folder
5546

56-
```
47+
```bash
5748
cd Algorithms
5849
mkdir classes
5950
```
6051

6152
### Compile the algorithm
6253

63-
```
64-
javac -sourcepath src/main/java -d classes src/main/java/ <relative-path-to-java-source-file>
54+
```bash
55+
javac -sourcepath src/main/java -d classes src/main/java/<relative-path-to-java-source-file>
6556
```
6657

6758
### Run the algorithm
6859

69-
```
60+
```bash
7061
java -cp classes <class-fully-qualified-name>
7162
```
7263

7364
### Example
7465

75-
```
66+
```bash
7667
$ javac -d classes -sourcepath src/main/java src/main/java/com/williamfiset/algorithms/search/BinarySearch.java
7768
$ java -cp classes com.williamfiset.algorithms.search.BinarySearch
7869
```

build.gradle

Lines changed: 0 additions & 86 deletions
This file was deleted.

build/distributions/Algorithms.tar

609 KB
Binary file not shown.

build/distributions/Algorithms.zip

530 KB
Binary file not shown.

build/libs/Algorithms.jar

593 KB
Binary file not shown.

0 commit comments

Comments
 (0)