Skip to content

Commit

Permalink
fix: Removed unnecessary files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankit Mahato authored and Ankit Mahato committed Aug 5, 2024
1 parent 7bd90a7 commit 01b2f9f
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 184 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ test_logs
.cargo
# pre-commit config
.pre-commit-config.yaml
.cargo
.cargo

#java client
clients/java/.gradle
clients/java/build
12 changes: 0 additions & 12 deletions clients/java/.gitattributes

This file was deleted.

5 changes: 0 additions & 5 deletions clients/java/.gitignore

This file was deleted.

43 changes: 0 additions & 43 deletions clients/java/app/build.gradle.kts

This file was deleted.

12 changes: 0 additions & 12 deletions clients/java/app/src/main/java/org/example/App.java

This file was deleted.

8 changes: 0 additions & 8 deletions clients/java/app/src/test/java/org/example/AppTest.java

This file was deleted.

2 changes: 1 addition & 1 deletion clients/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ dependencies {
}

application {
mainClassName = 'helloworld.JavaRustFFI'
mainClassName = 'CAC.CacClient'
}

188 changes: 94 additions & 94 deletions clients/java/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,94 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
1 change: 0 additions & 1 deletion clients/java/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ plugins {
}

rootProject.name = "ffi"
include("app")
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package helloworld;
package CAC;

import java.io.File;
import java.io.IOException;

public class JavaRustFFI {
public class CacClient {

public static void main(String[] args) {
String dylib = "cac_client";
Expand All @@ -14,7 +14,7 @@ public static void main(String[] args) {
System.out.println("---------------------");

// Create an instance of the wrapper class
RustLibraryWrapper wrapper = new RustLibraryWrapper(libraryPath, dylib);
CacClientWrapper wrapper = new CacClientWrapper(libraryPath, dylib);

int newClient;
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package helloworld;
package CAC;

import java.io.IOException;

import jnr.ffi.LibraryLoader;
import jnr.ffi.Pointer;

public class RustLibraryWrapper {
public class CacClientWrapper {

public interface RustLib {
String cac_last_error_message();
Expand All @@ -31,11 +31,11 @@ public interface RustLib {

private static RustLib rustLib;

public RustLibraryWrapper(String libraryPath, String libraryName) {
public CacClientWrapper(String libraryPath, String libraryName) {
System.setProperty("jnr.ffi.library.path", libraryPath);

// Load the Rust library
RustLibraryWrapper.rustLib = LibraryLoader.create(RustLib.class).load(libraryName);
CacClientWrapper.rustLib = LibraryLoader.create(RustLib.class).load(libraryName);
}

public int wrappedCacNewClient(String tenant, long updateFrequency, String hostname) throws IOException {
Expand Down

0 comments on commit 01b2f9f

Please sign in to comment.