From 80fdf5bd795322553aee5ce99e7a07a7366d6e31 Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Wed, 15 Nov 2023 14:34:01 +0100 Subject: [PATCH] feat: net spec selection --- README.md | 1 + build.sh | 14 ++++++++++++-- template.beyondnetgen.android.config.json | 2 +- template.beyondnetgen.ios.config.json | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b175981..24f3cdd 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Options: --ndk Android NDK path (default: ANDROID_NDK_HOME environment variable) --no-android Disable Android build (default: false) --no-ios Disable iOS build (default: false) + --spec Net spec (default: net8.0) ``` ## What is this? diff --git a/build.sh b/build.sh index ed15deb..2303a80 100755 --- a/build.sh +++ b/build.sh @@ -26,6 +26,7 @@ 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)" } # Function to log a message to the console and log file @@ -49,6 +50,7 @@ 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 } # Function to ask for confirmation before continuing @@ -94,7 +96,7 @@ build_android() { # Copy the generated library to the output directory mkdir -p $output_dir/${abis[$arch]} - cp $generated_project_dir/bin/Release/net8.0/linux-bionic-$arch/native/$generated_project_name.so $output_dir/${abis[$arch]}/lib$input_project_name.so + 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 done # Copy the generated headers to the output directory @@ -116,7 +118,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/net8.0/*.xcframework $output_dir + cp $input_project_dir/bin/Release/$input_project_net_spec/*.xcframework $output_dir # Copy the generated headers to the output directory log "Copying header to output directory" @@ -159,6 +161,10 @@ while [ "$1" != "" ]; do shift export ANDROID_NDK_HOME=$1 ;; + --spec) + shift + input_project_net_spec=$1 + ;; --no-android) WANT_TO_BUILD_ANDROID=false ;; @@ -186,6 +192,10 @@ if [ -z "$generated_project_name" ]; then generated_project_name="$input_project_name.Generated" fi +if [ -z "$input_project_net_spec" ]; then + input_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 99ea814..cf68a75 100644 --- a/template.beyondnetgen.android.config.json +++ b/template.beyondnetgen.android.config.json @@ -1,5 +1,5 @@ { - "AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/net8.0/INPUT_PROJECT_NAME.dll", + "AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/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 3b96211..0388327 100644 --- a/template.beyondnetgen.ios.config.json +++ b/template.beyondnetgen.ios.config.json @@ -1,5 +1,5 @@ { - "AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/net8.0/INPUT_PROJECT_NAME.dll", + "AssemblyPath": "INPUT_PROJECT_NAME/bin/Release/NET_SPEC/INPUT_PROJECT_NAME.dll", "CSharpUnmanagedOutputPath": "GENERATED_PROJECT_NAME/Generated.cs", "COutputPath": "GENERATED_PROJECT_NAME/Generated.h", "Build": { -- 2.47.2