-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BazelProfile] Make
BazelVersion
available in `BazelProfile
The functionality provided by `BazelProfile` may need to take the Bazel version into consideration. Therefore, this PR makes the version available within and through the `BazelProfile`, while `BazelVersionDataProvider` stays in place to provide easier access, as well as memoization. Contributes to #109. Signed-off-by: Sara Adams <[email protected]>
- Loading branch information
Showing
10 changed files
with
153 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
analyzer/javatests/com/engflow/bazel/invocation/analyzer/dataproviders/BazelVersionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2023 EngFlow Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.engflow.bazel.invocation.analyzer.dataproviders; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
import org.junit.Test; | ||
|
||
public class BazelVersionTest { | ||
@Test | ||
public void parseReturnsEmpty() { | ||
assertThat(BazelVersion.parse("").isEmpty()).isTrue(); | ||
assertThat(BazelVersion.parse("1.2.3").isEmpty()).isTrue(); | ||
assertThat(BazelVersion.parse("1.2.3-foo").isEmpty()).isTrue(); | ||
assertThat(BazelVersion.parse("release 1").isEmpty()).isTrue(); | ||
assertThat(BazelVersion.parse("release 1.2").isEmpty()).isTrue(); | ||
assertThat(BazelVersion.parse("release 1.2.3foo").isEmpty()).isTrue(); | ||
} | ||
|
||
@Test | ||
public void parseReturnsNonempty() { | ||
assertThat(BazelVersion.parse("release 1.23.4")).isEqualTo(new BazelVersion(1, 23, 4, "")); | ||
assertThat(BazelVersion.parse("release 12.3.45-foo")) | ||
.isEqualTo(new BazelVersion(12, 3, 45, "-foo")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters