File tree 11 files changed +119
-23
lines changed
11 files changed +119
-23
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -13,3 +13,7 @@ TEST-io.ipfs.api.APITest.*
13
13
.idea /*
14
14
api.iml
15
15
16
+ # Bazel
17
+ /bazel- *
18
+ /.ijwb /
19
+
Original file line number Diff line number Diff line change
1
+ java_library (
2
+ name = "maven_deps" ,
3
+ visibility = ["//visibility:public" ],
4
+ exports = [
5
+ "@maven//:com_github_multiformats_java_multiaddr" ,
6
+ "@maven//:com_github_multiformats_java_multihash" ,
7
+ "@maven//:com_github_multiformats_java_multibase" ,
8
+ "@maven//:com_github_ipld_java_cid" ,
9
+ ],
10
+ )
Original file line number Diff line number Diff line change
1
+ load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
2
+
3
+ RULES_JVM_EXTERNAL_TAG = "4.5"
4
+ RULES_JVM_EXTERNAL_SHA = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"
5
+
6
+ http_archive (
7
+ name = "rules_jvm_external" ,
8
+ strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG ,
9
+ sha256 = RULES_JVM_EXTERNAL_SHA ,
10
+ url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG ,
11
+ )
12
+
13
+ load ("@rules_jvm_external//:repositories.bzl" , "rules_jvm_external_deps" )
14
+
15
+ rules_jvm_external_deps ()
16
+
17
+ load ("@rules_jvm_external//:setup.bzl" , "rules_jvm_external_setup" )
18
+
19
+ rules_jvm_external_setup ()
20
+
21
+ load ("@rules_jvm_external//:defs.bzl" , "maven_install" )
22
+
23
+ maven_install (
24
+ artifacts = [
25
+ "junit:junit:4.13.2" ,
26
+ "org.hamcrest:hamcrest:2.2" ,
27
+ "com.github.multiformats:java-multiaddr:v1.4.10" ,
28
+ ],
29
+ repositories = [
30
+ # Private repositories are supported through HTTP Basic auth
31
+ "https://jitpack.io" ,
32
+ "https://repo1.maven.org/maven2" ,
33
+ ],
34
+ )
Original file line number Diff line number Diff line change
1
+ java_library (
2
+ name = "core" ,
3
+ visibility = ["//visibility:public" ],
4
+ srcs = glob (["*.java" ]),
5
+ deps = [
6
+ "//src/main/java/io/ipfs/api/cbor:cbor" ,
7
+ "//:maven_deps" ,
8
+ ],
9
+ )
10
+
11
+ #TODO generate a distribution JAR with all the classes and the manifest
Original file line number Diff line number Diff line change
1
+ java_library (
2
+ name = "cbor" ,
3
+ visibility = ["//visibility:public" ],
4
+ srcs = glob (["*.java" ]),
5
+ deps = [
6
+ "//:maven_deps" ,
7
+ ],
8
+ )
Original file line number Diff line number Diff line change 7
7
*/
8
8
9
9
import java .io .*;
10
+ import java .util .Arrays ;
10
11
11
12
import static io .ipfs .api .cbor .CborConstants .*;
12
13
import static io .ipfs .api .cbor .CborType .*;
@@ -30,7 +31,7 @@ public CborDecoder(InputStream is) {
30
31
}
31
32
32
33
private static void fail (String msg , Object ... args ) throws IOException {
33
- throw new IOException (msg + args );
34
+ throw new IOException (msg + Arrays . toString ( args ) );
34
35
}
35
36
36
37
private static String lengthToString (int len ) {
Original file line number Diff line number Diff line change
1
+ java_binary (
2
+ name = "demo" ,
3
+ srcs = glob (["*.java" ]),
4
+ main_class = "io.ipfs.api.demo.UsageMFSFilesAPI" ,
5
+ deps = [
6
+ "//src/main/java/io/ipfs/api:core" ,
7
+ "//:maven_deps" ,
8
+ ],
9
+ )
Original file line number Diff line number Diff line change
1
+ load (":test_utils.bzl" , "junit_test" )
2
+
3
+ filegroup (
4
+ name = "test-resources" ,
5
+ srcs = glob ([
6
+ "resources/**" ,
7
+ ]),
8
+ )
9
+
10
+ junit_test (test_class = "io.ipfs.api.AddTest" )
11
+ junit_test (test_class = "io.ipfs.api.APITest" )
12
+ junit_test (test_class = "io.ipfs.api.RecursiveAddTest" )
13
+ junit_test (test_class = "io.ipfs.api.SimpleAddTest" )
14
+ junit_test (test_class = "io.ipfs.api.VersionsTest" )
15
+
Original file line number Diff line number Diff line change
1
+ java_library (
2
+ name = "test-core" ,
3
+ visibility = ["//visibility:public" ],
4
+ srcs = glob (["*.java" ]),
5
+ deps = [
6
+ "//src/main/java/io/ipfs/api:core" ,
7
+ "//src/main/java/io/ipfs/api/cbor:cbor" ,
8
+ "//:maven_deps" ,
9
+ "@maven//:junit_junit" ,
10
+ "@maven//:org_hamcrest_hamcrest" ,
11
+ ],
12
+ )
Original file line number Diff line number Diff line change
1
+ def junit_test (test_class ):
2
+ native .java_test (
3
+ name = test_class ,
4
+ test_class = test_class ,
5
+ runtime_deps = [
6
+ "//src/test/java/io/ipfs/api:test-core" ,
7
+ ],
8
+ data = [
9
+ "//src/test:test-resources" ,
10
+ ],
11
+ jvm_flags = [
12
+ "-Djava.security.manager=allow" ,
13
+ ]
14
+ )
You can’t perform that action at this time.
0 commit comments