From 6c94686a14c32f812411a910b4f4d2bc729ef760 Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Fri, 24 Nov 2023 17:45:21 +0100 Subject: [PATCH] feat: add distinction between input and output net specfication --- build.sh | 21 +++++++++++++++------ template.beyondnetgen.android.config.json | 2 +- template.beyondnetgen.ios.config.json | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index 2bc85fb..0b143df 100755 --- a/build.sh +++ b/build.sh @@ -27,7 +27,8 @@ help() { echo " --ndk Android NDK path (default: ANDROID_NDK_HOME environment variable)" echo " --no-android Disable Android build (default: false)" echo " --no-ios Disable iOS build (default: false)" - echo " --spec Net spec (default: net8.0)" + echo " --input-spec Input project .NET spec (default: net8.0)" + echo " --output-spec Output project .NET spec (default: net8.0)" } # Function to log a message to the console and log file @@ -51,7 +52,8 @@ command_exists() { replace_project_names() { sed -i '' "s/INPUT_PROJECT_NAME/$input_project_name/g" $1 sed -i '' "s/GENERATED_PROJECT_NAME/$generated_project_name/g" $1 - sed -i '' "s/NET_SPEC/$input_project_net_spec/g" $1 + sed -i '' "s/INPUT_NET_SPEC/$input_project_net_spec/g" $1 + sed -i '' "s/OUTPUT_NET_SPEC/$output_project_net_spec/g" $1 } # Function to ask for confirmation before continuing @@ -108,7 +110,7 @@ build_android() { # Copy the generated library to the output directory mkdir -p $output_dir/${abis[$arch]} - cp $generated_project_dir/bin/Release/$input_project_net_spec/linux-bionic-$arch/native/$generated_project_name.so $output_dir/${abis[$arch]}/lib$input_project_name.so + cp $generated_project_dir/bin/Release/$output_project_net_spec/linux-bionic-$arch/native/$generated_project_name.so $output_dir/${abis[$arch]}/lib$input_project_name.so done # Copy the generated headers to the output directory @@ -130,7 +132,7 @@ build_ios() { # Copy $input_project_dir/bin/Release/net8.0/*.xcframework to output directory log "Copying iOS libraries to output directory" - cp $input_project_dir/bin/Release/$input_project_net_spec/*.xcframework $output_dir + cp $input_project_dir/bin/Release/$output_project_net_spec/*.xcframework $output_dir # Copy the generated headers to the output directory log "Copying header to output directory" @@ -171,17 +173,20 @@ while [ "$1" != "" ]; do output=$1 ;; -y) - shift assume_yes=true ;; --ndk) shift export ANDROID_NDK_HOME=$1 ;; - --spec) + --input-spec) shift input_project_net_spec=$1 ;; + --output-spec) + shift + output_project_net_spec=$1 + ;; --no-android) WANT_TO_BUILD_ANDROID=false ;; @@ -213,6 +218,10 @@ if [ -z "$input_project_net_spec" ]; then input_project_net_spec="net8.0" fi +if [ -z "$output_project_net_spec" ]; then + output_project_net_spec="net8.0" +fi + if [ -z "$output" ]; then output="libs" fi diff --git a/template.beyondnetgen.android.config.json b/template.beyondnetgen.android.config.json index 111cead..02fdf44 100644 --- a/template.beyondnetgen.android.config.json +++ b/template.beyondnetgen.android.config.json @@ -1,5 +1,5 @@ { - "AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/NET_SPEC/INPUT_PROJECT_NAME.dll", + "AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/INPUT_NET_SPEC/INPUT_PROJECT_NAME.dll", "CSharpUnmanagedOutputPath": "GENERATED_PROJECT_NAME/Generated.cs", "COutputPath": "GENERATED_PROJECT_NAME/Generated.h", "ExcludedTypeNames": [ diff --git a/template.beyondnetgen.ios.config.json b/template.beyondnetgen.ios.config.json index 0ada82b..c0ea71c 100644 --- a/template.beyondnetgen.ios.config.json +++ b/template.beyondnetgen.ios.config.json @@ -1,5 +1,5 @@ { - "AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/NET_SPEC/INPUT_PROJECT_NAME.dll", + "AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/INPUT_NET_SPEC/INPUT_PROJECT_NAME.dll", "CSharpUnmanagedOutputPath": "GENERATED_PROJECT_NAME/Generated.cs", "COutputPath": "GENERATED_PROJECT_NAME/Generated.h", "AssemblySearchPaths": [