Skip to content

Commit a46293d

Browse files
Add back inline-java.cabal
1 parent c2f1f3f commit a46293d

File tree

8 files changed

+207
-87
lines changed

8 files changed

+207
-87
lines changed

BUILD.bazel

Lines changed: 103 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ exports_files(["nixpkgs.nix"])
66
load(
77
"@rules_haskell//haskell:defs.bzl",
88
"ghc_plugin",
9+
"haskell_binary",
910
"haskell_library",
11+
"haskell_test",
1012
)
1113

1214
cc_library(
@@ -16,25 +18,63 @@ cc_library(
1618
strip_include_prefix = "cbits",
1719
)
1820

21+
ghc_plugin(
22+
name = "inline-java-plugin",
23+
args = ["$(JAVABASE)/bin/javac"],
24+
module = "Language.Java.Inline.Plugin",
25+
toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
26+
tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
27+
visibility = ["//visibility:public"],
28+
deps = [":inline-java"],
29+
)
30+
31+
load(
32+
"@bazel_gazelle//:def.bzl",
33+
"DEFAULT_LANGUAGES",
34+
"gazelle",
35+
"gazelle_binary",
36+
)
37+
38+
gazelle(
39+
name = "gazelle",
40+
gazelle = ":gazelle_binary",
41+
)
42+
43+
gazelle_binary(
44+
name = "gazelle_binary",
45+
languages = DEFAULT_LANGUAGES + ["@io_tweag_gazelle_cabal//gazelle_cabal"],
46+
)
47+
48+
# rule generated from inline-java.cabal by gazelle_cabal
1949
haskell_library(
2050
name = "inline-java",
2151
# cbits/bctable.h is included here so it can be found by Plugin.hs
2252
# at the same location when building with bazel as with stack.
23-
srcs = glob([
24-
"src/**/*.hs",
25-
"src/**/*.hsc",
26-
"cbits/bctable.h",
27-
]),
53+
srcs = [
54+
"cbits/bctable.h", # keep
55+
"src/GhcPlugins/Extras.hs",
56+
"src/Language/Java/Inline.hs",
57+
"src/Language/Java/Inline/Internal.hs",
58+
"src/Language/Java/Inline/Internal/Magic.hsc",
59+
"src/Language/Java/Inline/Internal/QQMarker.hs",
60+
"src/Language/Java/Inline/Internal/QQMarker/Names.hs",
61+
"src/Language/Java/Inline/Internal/QQMarker/Safe.hs",
62+
"src/Language/Java/Inline/Plugin.hs",
63+
"src/Language/Java/Inline/Safe.hs",
64+
"src/Language/Java/Inline/Unsafe.hs",
65+
],
66+
ghcopts = ["-DVERSION_inline_java=\"0.10.0\""],
67+
hidden_modules = ["GhcPlugins.Extras"],
68+
version = "0.10.0",
2869
visibility = ["//visibility:public"],
2970
deps = [
30-
":bctable",
71+
":bctable", # keep
3172
"//jni",
3273
"//jvm",
3374
"@stackage//:Cabal",
3475
"@stackage//:base",
3576
"@stackage//:bytestring",
3677
"@stackage//:directory",
37-
"@stackage//:filemanip",
3878
"@stackage//:filepath",
3979
"@stackage//:ghc",
4080
"@stackage//:language-java",
@@ -47,29 +87,63 @@ haskell_library(
4787
],
4888
)
4989

50-
ghc_plugin(
51-
name = "inline-java-plugin",
52-
args = ["$(JAVABASE)/bin/javac"],
53-
module = "Language.Java.Inline.Plugin",
54-
toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
55-
tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
90+
# rule generated from inline-java.cabal by gazelle_cabal
91+
haskell_test(
92+
name = "spec",
93+
srcs = [
94+
"tests/Language/Java/Inline/SafeSpec.hs",
95+
"tests/Language/Java/InlineSpec.hs",
96+
"tests/Main.hs",
97+
"tests/SafeSpec.hs",
98+
"tests/Spec.hs",
99+
],
100+
extra_srcs = ["@openjdk//:rpath"], # keep
101+
ghcopts = [
102+
"-optl-Wl,@$(location @openjdk//:rpath)", # keep
103+
"-DVERSION_inline_java=\"0.10.0\"",
104+
"-threaded",
105+
"-DHSPEC_DISCOVER_HSPEC_DISCOVER_PATH=$(location @stackage-exe//hspec-discover)",
106+
],
107+
main_file = "tests/Main.hs",
108+
plugins = [":inline-java-plugin"],
109+
tools = ["@stackage-exe//hspec-discover"],
110+
version = "0.10.0",
56111
visibility = ["//visibility:public"],
57-
deps = [":inline-java"],
58-
)
59-
60-
load(
61-
"@bazel_gazelle//:def.bzl",
62-
"DEFAULT_LANGUAGES",
63-
"gazelle",
64-
"gazelle_binary",
65-
)
66-
67-
gazelle(
68-
name = "gazelle",
69-
gazelle = ":gazelle_binary",
112+
deps = [
113+
"//:inline-java", # keep
114+
"//jni",
115+
"//jvm",
116+
"@stackage//:QuickCheck",
117+
"@stackage//:base",
118+
"@stackage//:hspec",
119+
"@stackage//:linear-base",
120+
"@stackage//:quickcheck-unicode",
121+
"@stackage//:text",
122+
"@stackage//:vector",
123+
],
70124
)
71125

72-
gazelle_binary(
73-
name = "gazelle_binary",
74-
languages = DEFAULT_LANGUAGES + ["@io_tweag_gazelle_cabal//gazelle_cabal"],
126+
# rule generated from inline-java.cabal by gazelle_cabal
127+
haskell_binary(
128+
name = "micro-benchmarks",
129+
srcs = ["benchmarks/micro/Main.hs"],
130+
extra_srcs = ["@openjdk//:rpath"], # keep
131+
ghcopts = [
132+
"-optl-Wl,@$(location @openjdk//:rpath)", # keep
133+
"-DVERSION_inline_java=\"0.10.0\"",
134+
"-threaded",
135+
],
136+
main_file = "benchmarks/micro/Main.hs",
137+
plugins = [":inline-java-plugin"],
138+
version = "0.10.0",
139+
visibility = ["//visibility:public"],
140+
deps = [
141+
"//:inline-java", # keep
142+
"//jni",
143+
"//jvm",
144+
"@stackage//:base",
145+
"@stackage//:criterion",
146+
"@stackage//:deepseq",
147+
"@stackage//:singletons",
148+
],
75149
)

Setup.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

benchmarks/micro/BUILD.bazel

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

inline-java.cabal

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: inline-java
2+
version: 0.10.0
3+
synopsis: Java interop via inline Java code in Haskell modules.
4+
description: Please see README.md.
5+
homepage: http://github.com/tweag/inline-java#readme
6+
license: BSD3
7+
license-file: LICENSE
8+
author: Tweag I/O
9+
maintainer: [email protected]
10+
copyright: 2015-2016 EURL Tweag.
11+
category: FFI, JVM, Java
12+
build-type: Simple
13+
cabal-version: 2.0
14+
extra-source-files:
15+
CHANGELOG.md
16+
README.md
17+
18+
source-repository head
19+
type: git
20+
location: https://github.com/tweag/inline-java
21+
22+
library
23+
hs-source-dirs: src
24+
c-sources: cbits/bctable.c
25+
cc-options: -std=c99 -Wall -Werror
26+
include-dirs: cbits/
27+
includes: bctable.h
28+
install-includes: bctable.h
29+
exposed-modules:
30+
Language.Java.Inline
31+
Language.Java.Inline.Safe
32+
Language.Java.Inline.Internal
33+
Language.Java.Inline.Internal.Magic
34+
Language.Java.Inline.Internal.QQMarker
35+
Language.Java.Inline.Internal.QQMarker.Names
36+
Language.Java.Inline.Internal.QQMarker.Safe
37+
Language.Java.Inline.Plugin
38+
Language.Java.Inline.Unsafe
39+
other-modules:
40+
GhcPlugins.Extras
41+
build-depends:
42+
base >=4.14.0.0 && <5,
43+
bytestring >=0.10,
44+
Cabal >=1.24.2,
45+
directory >=1.2,
46+
filepath >=1,
47+
ghc >=9.0.2 && <9.2,
48+
jni >=0.8 && <0.9,
49+
jvm >=0.6 && <0.7,
50+
language-java >=0.2,
51+
linear-base ==0.1.1,
52+
mtl >=2.2.1,
53+
process >=1.2,
54+
text >=1.2,
55+
template-haskell >=2.10,
56+
temporary >=1.2
57+
default-language: Haskell2010
58+
59+
test-suite spec
60+
type:
61+
exitcode-stdio-1.0
62+
hs-source-dirs: tests
63+
main-is: Main.hs
64+
other-modules:
65+
SafeSpec
66+
Spec
67+
Language.Java.Inline.SafeSpec
68+
Language.Java.InlineSpec
69+
build-depends:
70+
base,
71+
jni,
72+
jvm,
73+
hspec,
74+
inline-java,
75+
linear-base,
76+
QuickCheck,
77+
quickcheck-unicode,
78+
text,
79+
vector
80+
default-language: Haskell2010
81+
ghc-options: -threaded
82+
cpp-options: -DHSPEC_DISCOVER_HSPEC_DISCOVER_PATH=hspec-discover
83+
build-tool-depends:
84+
hspec-discover:hspec-discover
85+
86+
benchmark micro-benchmarks
87+
type: exitcode-stdio-1.0
88+
main-is: Main.hs
89+
hs-source-dirs: benchmarks/micro
90+
build-depends:
91+
base >=4.8 && <5,
92+
criterion,
93+
deepseq >=1.4.2,
94+
inline-java,
95+
jni,
96+
jvm,
97+
singletons
98+
default-language: Haskell2010
99+
ghc-options: -threaded

stack.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ resolver: lts-19.30
33
packages:
44
- jni
55
- jvm
6+
- .
67

78
extra-deps:
89
- github: tweag/distributed-closure

tests/BUILD.bazel

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

tests/SafeSpec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{-# LANGUAGE CPP #-}
2-
{-# OPTIONS_GHC -F -pgmF HSPEC_DISCOVER -optF --module-name=SafeSpec #-}
2+
{-# OPTIONS_GHC -F -pgmF HSPEC_DISCOVER_HSPEC_DISCOVER_PATH -optF --module-name=SafeSpec #-}

tests/Spec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{-# LANGUAGE CPP #-}
2-
{-# OPTIONS_GHC -F -pgmF HSPEC_DISCOVER -optF --module-name=Spec #-}
2+
{-# OPTIONS_GHC -F -pgmF HSPEC_DISCOVER_HSPEC_DISCOVER_PATH -optF --module-name=Spec #-}

0 commit comments

Comments
 (0)