Skip to content

Commit

Permalink
Ensure JAVA_HOME gets set properly
Browse files Browse the repository at this point in the history
  • Loading branch information
sd234678 committed Oct 26, 2023
1 parent 0d15c8e commit 9eb28df
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .last-exported-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Last exported commit from parent repo: b756d20b45f7ae3390d942dcdfef45f2678b8bf6
Last exported commit from parent repo: 8eae127411b0436d01a8c9a17f0d842078487999
2 changes: 1 addition & 1 deletion nix-bootstrap.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 2.0
-- see: https://github.com/sol/hpack

name: nix-bootstrap
version: 1.5.1.1
version: 1.5.2.0
author: gchquser
maintainer: [email protected]
copyright: Crown Copyright
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
name: nix-bootstrap
version: 1.5.1.1
version: 1.5.2.0
author: gchquser
maintainer: [email protected]
copyright: Crown Copyright
Expand Down
6 changes: 5 additions & 1 deletion src/Bootstrap/Nix/Expr/MkShell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Bootstrap.Data.PreCommitHook
)
import Bootstrap.Data.ProjectType
( HasProjectSuperType (projectSuperType),
ProjectSuperType (PSTRust),
ProjectSuperType (PSTJava, PSTRust),
)
import Bootstrap.Nix.Expr
( Binding,
Expand Down Expand Up @@ -38,11 +38,14 @@ mkShell buildInputSpec@BuildInputSpec {bisPreCommitHooksConfig, bisProjectType}

data ShellHook
= ShellHookFromPreCommit
| ShellHookJava
| ShellHookRust
| ShellHookCombined (NonEmpty ShellHook)

shellHookFor :: HasProjectSuperType t => PreCommitHooksConfig -> t -> Maybe ShellHook
shellHookFor pchc pt = case (pchc, projectSuperType pt) of
(PreCommitHooksConfig True, PSTJava) -> Just $ ShellHookCombined (ShellHookJava :| [ShellHookFromPreCommit])
(PreCommitHooksConfig False, PSTJava) -> Just ShellHookJava
(PreCommitHooksConfig True, PSTRust) -> Just $ ShellHookCombined (ShellHookRust :| [ShellHookFromPreCommit])
(PreCommitHooksConfig False, PSTRust) -> Just ShellHookRust
(PreCommitHooksConfig True, _) -> Just ShellHookFromPreCommit
Expand All @@ -61,5 +64,6 @@ shellHookBinding = \case
shellHookComponentBinding :: ShellHook -> [Text]
shellHookComponentBinding = \case
ShellHookFromPreCommit -> ["${preCommitHooks.allHooks.shellHook}"]
ShellHookJava -> ["export JAVA_HOME=\"${nixpkgs.jdk}\""]
ShellHookRust -> ["export RUST_SRC_PATH=${nixpkgs.rustPlatform.rustLibSrc}"]
ShellHookCombined xs -> sconcat $ shellHookComponentBinding <$> xs

0 comments on commit 9eb28df

Please sign in to comment.