-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Allow binary artifact * feat: Parse Cargo.toml file to identify artifacts * review changes 1 * add missing license header --------- Co-authored-by: Adam Steffen <[email protected]>
- Loading branch information
1 parent
510a797
commit 3c321a9
Showing
11 changed files
with
545 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,8 @@ hs_err_pid* | |
|
||
# Compiler output | ||
**/target/ | ||
|
||
# Eclipse files | ||
**/.project | ||
**/.classpath | ||
**/.settings |
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
7 changes: 7 additions & 0 deletions
7
rust-maven-example/src/main/rust/str-reverse-binary/Cargo.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
rust-maven-example/src/main/rust/str-reverse-binary/Cargo.toml
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,4 @@ | ||
[package] | ||
name = "str-reverse-binary" | ||
version = "0.1.0" | ||
edition = "2021" |
42 changes: 42 additions & 0 deletions
42
rust-maven-example/src/main/rust/str-reverse-binary/src/main.rs
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,42 @@ | ||
/******************************************************************************* | ||
* ___ _ ____ ____ | ||
* / _ \ _ _ ___ ___| |_| _ \| __ ) | ||
* | | | | | | |/ _ \/ __| __| | | | _ \ | ||
* | |_| | |_| | __/\__ \ |_| |_| | |_) | | ||
* \__\_\\__,_|\___||___/\__|____/|____/ | ||
* | ||
* Copyright (c) 2014-2019 Appsicle | ||
* Copyright (c) 2019-2023 QuestDB | ||
* | ||
* 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. | ||
* | ||
******************************************************************************/ | ||
|
||
use std::env; | ||
use std::process::ExitCode; | ||
|
||
fn main() -> ExitCode { | ||
let args: Vec<String> = env::args().collect(); | ||
|
||
match args.len() { | ||
2 => { | ||
let reversed: String = args[1].chars().rev().collect(); | ||
println!("{}", reversed); | ||
ExitCode::SUCCESS | ||
}, | ||
_ => { | ||
eprintln!("Error: Must provide a single string argument."); | ||
ExitCode::FAILURE | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
rust-maven-example/src/test/java/io/questdb/example/rust/BinaryTest.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,57 @@ | ||
/******************************************************************************* | ||
* ___ _ ____ ____ | ||
* / _ \ _ _ ___ ___| |_| _ \| __ ) | ||
* | | | | | | |/ _ \/ __| __| | | | _ \ | ||
* | |_| | |_| | __/\__ \ |_| |_| | |_) | | ||
* \__\_\\__,_|\___||___/\__|____/|____/ | ||
* | ||
* Copyright (c) 2014-2019 Appsicle | ||
* Copyright (c) 2019-2023 QuestDB | ||
* | ||
* 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 io.questdb.example.rust; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.File; | ||
import java.io.InputStreamReader; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import org.junit.Test; | ||
|
||
public class BinaryTest { | ||
|
||
@Test | ||
public void testBinary() throws Exception { | ||
File binaryFile = new File("target/bin/str-reverse-binary"); | ||
|
||
Process process = new ProcessBuilder( | ||
Arrays.asList( | ||
binaryFile.getAbsolutePath(), | ||
"Hello World!")) | ||
.start(); | ||
|
||
List<String> output = new BufferedReader(new InputStreamReader(process.getInputStream())) | ||
.lines() | ||
.collect(Collectors.toList()); | ||
|
||
assertEquals(0, process.waitFor()); | ||
assertEquals(Arrays.asList("!dlroW olleH"), output); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
rust-maven-example/src/test/java/io/questdb/example/rust/LibTest.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,37 @@ | ||
/******************************************************************************* | ||
* ___ _ ____ ____ | ||
* / _ \ _ _ ___ ___| |_| _ \| __ ) | ||
* | | | | | | |/ _ \/ __| __| | | | _ \ | ||
* | |_| | |_| | __/\__ \ |_| |_| | |_) | | ||
* \__\_\\__,_|\___||___/\__|____/|____/ | ||
* | ||
* Copyright (c) 2014-2019 Appsicle | ||
* Copyright (c) 2019-2023 QuestDB | ||
* | ||
* 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 io.questdb.example.rust; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class LibTest { | ||
|
||
@Test | ||
public void testLibrary() { | ||
assertEquals("Great Scott, A reversed string!: !dlroW olleH", Main.reversedString("Hello World!")); | ||
} | ||
} |
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
Oops, something went wrong.