.NET Bindings: Create nuget package for LO SDK
This patch includes: 1. CustomTarget to build and place the LibreOffice.Bindings NuGet package in <sdk>/dotnet/ 2. net_bridge (.NET library) to declare bootstrap() on the C# side, and net_bootstrap (C++ library) to wrap bootstrap() on the native side 3. Changes to LO SDK scripts to find .NET SDK and DOTNET_ROOT on the users machine Change-Id: Ia29ae56a2ad0f808f1563ef6167a3bd7c476642e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170172 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
This commit is contained in:
parent
26fd88df80
commit
074714fab8
18 changed files with 423 additions and 2 deletions
|
@ -603,6 +603,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_URE,ure, \
|
|||
$(if $(filter MSC,$(COM)),$(if $(filter-out AARCH64_TRUE,$(CPUNAME)_$(CROSS_COMPILING)),cli_uno)) \
|
||||
) \
|
||||
i18nlangtag \
|
||||
$(if $(ENABLE_DOTNET),net_bootstrap) \
|
||||
$(if $(ENABLE_JAVA), \
|
||||
java_uno \
|
||||
jpipe \
|
||||
|
@ -897,6 +898,9 @@ $(eval $(call gb_Helper_register_packages_for_install,ure,\
|
|||
net_basetypes \
|
||||
net_uretypes \
|
||||
net_oootypes \
|
||||
net_bridge \
|
||||
net_nuget_pkg \
|
||||
net_nuget_config \
|
||||
) \
|
||||
$(if $(ENABLE_JAVA),\
|
||||
jvmfwk_jvmfwk3_ini \
|
||||
|
|
|
@ -73,6 +73,7 @@ if test -d $DESTDIR$INSTALLDIR/sdk ; then
|
|||
-e "s,@OO_SDK_CPP_HOME@,$(dirname $(command -v cpp))," \
|
||||
-e "s,@OO_SDK_SED_HOME@,$(dirname $(command -v sed))," \
|
||||
-e "s,@OO_SDK_CAT_HOME@,$(dirname $(command -v cat))," \
|
||||
-e "s,@OO_SDK_DOTNET_ROOT@,$DOTNET_ROOT," \
|
||||
-e "s,@OO_SDK_JAVA_HOME@,$JAVA_HOME," \
|
||||
-e "s,@OO_SDK_OUTPUT_DIR@,\$HOME," \
|
||||
-e "s,@SDK_AUTO_DEPLOYMENT@,NO," \
|
||||
|
|
51
net_ure/CustomTarget_net_nuget_pkg.mk
Normal file
51
net_ure/CustomTarget_net_nuget_pkg.mk
Normal file
|
@ -0,0 +1,51 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
$(eval $(call gb_CustomTarget_CustomTarget,net_ure/net_uretypes))
|
||||
|
||||
net_nuget_pkg_DIR := $(gb_CustomTarget_workdir)/net_ure/net_nuget_pkg
|
||||
net_nuget_pkg_ID := LibreOffice.Bindings
|
||||
net_nuget_pkg_VERSION := 0.1.0
|
||||
net_nuget_pkg_PROJECT := $(net_nuget_pkg_DIR)/nuget_pkg.csproj
|
||||
net_nuget_pkg_FILE := $(net_nuget_pkg_DIR)/$(net_nuget_pkg_ID).$(net_nuget_pkg_VERSION).nupkg
|
||||
|
||||
$(call gb_CustomTarget_get_target,net_ure/net_nuget_pkg) : $(net_nuget_pkg_FILE)
|
||||
|
||||
$(net_nuget_pkg_PROJECT) : \
|
||||
$(call gb_DotnetLibrary_get_target,net_bridge) \
|
||||
$(call gb_DotnetLibrary_get_target,net_oootypes) \
|
||||
| $(net_nuget_pkg_DIR)/.dir
|
||||
$(file >$@,<Project Sdk="Microsoft.NET.Sdk">)
|
||||
$(file >>$@,<PropertyGroup>)
|
||||
$(file >>$@,<TargetFramework>netstandard2.0</TargetFramework>)
|
||||
$(file >>$@,<PackageId>$(net_nuget_pkg_ID)</PackageId>)
|
||||
$(file >>$@,<Version>$(net_nuget_pkg_VERSION)</Version>)
|
||||
$(file >>$@,<Company>LibreOffice</Company>)
|
||||
$(file >>$@,<Description>Libraries for the new .NET language bindings for UNO.</Description>)
|
||||
$(file >>$@,<IncludeBuildOutput>false</IncludeBuildOutput>)
|
||||
$(file >>$@,</PropertyGroup>)
|
||||
$(file >>$@,<ItemGroup>)
|
||||
$(file >>$@,<Content Include="$(call gb_DotnetLibrary_get_target,net_basetypes)" Pack="true" PackagePath="lib/$$(TargetFramework)"/>)
|
||||
$(file >>$@,<Content Include="$(call gb_DotnetLibrary_get_target,net_uretypes)" Pack="true" PackagePath="lib/$$(TargetFramework)"/>)
|
||||
$(file >>$@,<Content Include="$(call gb_DotnetLibrary_get_target,net_oootypes)" Pack="true" PackagePath="lib/$$(TargetFramework)"/>)
|
||||
$(file >>$@,<Content Include="$(call gb_DotnetLibrary_get_target,net_bridge)" Pack="true" PackagePath="lib/$$(TargetFramework)"/>)
|
||||
$(file >>$@,</ItemGroup>)
|
||||
$(file >>$@,</Project>)
|
||||
|
||||
$(net_nuget_pkg_FILE) : $(net_nuget_pkg_PROJECT)
|
||||
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),NET,4)
|
||||
$(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),NET)
|
||||
|
||||
$(call gb_Helper_abbreviate_dirs,\
|
||||
$(call gb_Helper_print_on_error,\
|
||||
"$(DOTNET)" pack $< -o $(dir $@),\
|
||||
$(net_nuget_pkg_DIR)/log))
|
||||
|
||||
$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),NET)
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 noexpandtab:
|
27
net_ure/DotnetLibrary_net_bridge.mk
Normal file
27
net_ure/DotnetLibrary_net_bridge.mk
Normal file
|
@ -0,0 +1,27 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
$(eval $(call gb_DotnetLibrary_DotnetLibrary,net_bridge,$(gb_DotnetLibrary_CS)))
|
||||
|
||||
$(eval $(call gb_DotnetLibrary_add_sources,net_bridge,\
|
||||
net_ure/source/bridge/NativeBootstrap \
|
||||
))
|
||||
|
||||
$(eval $(call gb_DotnetLibrary_add_properties,net_bridge,\
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> \
|
||||
))
|
||||
|
||||
$(eval $(call gb_DotnetLibrary_link_library,net_bridge,net_uretypes))
|
||||
|
||||
$(eval $(call gb_DotnetLibrary_add_properties,net_bridge,\
|
||||
<Version>0.1.0</Version> \
|
||||
<Company>LibreOffice</Company> \
|
||||
<Description>Interprocess bridge for the .NET language UNO binding.</Description> \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
25
net_ure/Library_net_bootstrap.mk
Normal file
25
net_ure/Library_net_bootstrap.mk
Normal file
|
@ -0,0 +1,25 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
$(eval $(call gb_Library_Library,net_bootstrap))
|
||||
|
||||
$(eval $(call gb_Library_use_udk_api,net_bootstrap))
|
||||
|
||||
$(eval $(call gb_Library_use_libraries,net_bootstrap,\
|
||||
cppu \
|
||||
cppuhelper \
|
||||
sal \
|
||||
salhelper \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_exception_objects,net_bootstrap,\
|
||||
net_ure/source/bootstrap/bootstrap \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
|
@ -10,14 +10,20 @@ $(eval $(call gb_Module_Module,net_ure))
|
|||
|
||||
ifeq ($(ENABLE_DOTNET)_$(filter ODK,$(BUILD_TYPE)),TRUE_ODK)
|
||||
$(eval $(call gb_Module_add_targets,net_ure,\
|
||||
Library_net_bootstrap \
|
||||
CustomTarget_net_uretypes \
|
||||
CustomTarget_net_oootypes \
|
||||
DotnetLibrary_net_basetypes \
|
||||
DotnetLibrary_net_uretypes \
|
||||
DotnetLibrary_net_oootypes \
|
||||
DotnetLibrary_net_bridge \
|
||||
CustomTarget_net_nuget_pkg \
|
||||
Package_net_basetypes \
|
||||
Package_net_uretypes \
|
||||
Package_net_oootypes \
|
||||
Package_net_bridge \
|
||||
Package_net_nuget_pkg \
|
||||
Package_net_nuget_config \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Module_add_subsequentcheck_targets,net_ure,\
|
||||
|
|
18
net_ure/Package_net_bridge.mk
Normal file
18
net_ure/Package_net_bridge.mk
Normal file
|
@ -0,0 +1,18 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
$(eval $(call gb_Package_Package,net_bridge,$(gb_DotnetLibrary_workdir)/net_bridge))
|
||||
|
||||
$(gb_DotnetLibrary_workdir)/net_bridge/net_bridge.runtimeconfig.json : $(call gb_DotnetLibrary_get_target,net_bridge)
|
||||
|
||||
$(eval $(call gb_Package_add_files,net_bridge,$(LIBO_SHARE_DOTNET_FOLDER),\
|
||||
net_bridge.dll \
|
||||
net_bridge.runtimeconfig.json \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
13
net_ure/Package_net_nuget_config.mk
Normal file
13
net_ure/Package_net_nuget_config.mk
Normal file
|
@ -0,0 +1,13 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
$(eval $(call gb_Package_Package,net_nuget_config,$(SRCDIR)/net_ure/source))
|
||||
|
||||
$(eval $(call gb_Package_add_files,net_nuget_config,$(SDKDIRNAME)/dotnet,nuget.config))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
13
net_ure/Package_net_nuget_pkg.mk
Normal file
13
net_ure/Package_net_nuget_pkg.mk
Normal file
|
@ -0,0 +1,13 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
$(eval $(call gb_Package_Package,net_nuget_pkg,$(gb_CustomTarget_workdir)/net_ure/net_nuget_pkg))
|
||||
|
||||
$(eval $(call gb_Package_add_files,net_nuget_pkg,$(SDKDIRNAME)/dotnet,LibreOffice.Bindings.0.1.0.nupkg))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
|
@ -1,5 +1,9 @@
|
|||
# .NET UNO Runtime Environment
|
||||
|
||||
Support assemblies and tools for the newer cross-platform .NET UNO binding.
|
||||
.NET assemblies for the newer cross-platform .NET UNO binding.
|
||||
|
||||
Currently only contains code for the `net_basetypes` assembly in the source/basetypes subdirectory, as well as Makefiles to build the `net_uretypes` (for `udkapi`) and `net_oootypes` (for `offapi`) assemblies, using `netmaker` from the codemaker/ module
|
||||
Contains code for the `net_basetypes` assembly, `net_bridge` assembly, and `net_bootstrap` native library, along with unit tests.
|
||||
Includes scripts to build the `net_uretypes` and `net_oootypes` assemblies from IDL, using `netmaker` from the codemaker/ module.
|
||||
Also includes scripts to build the `LibreOffice.Bindings` nuget package for the SDK.
|
||||
|
||||
The assemblies compile and can be consumed against .NET Standard 2.0, although the build requirement is set to .NET SDK 8.0 or higher for tests and examples, and to ensure cross platform uniformity.
|
49
net_ure/source/bootstrap/bootstrap.cxx
Normal file
49
net_ure/source/bootstrap/bootstrap.cxx
Normal file
|
@ -0,0 +1,49 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include <cppuhelper/bootstrap.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
#include <rtl/bootstrap.hxx>
|
||||
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
|
||||
extern "C" {
|
||||
|
||||
SAL_DLLPUBLIC_EXPORT void* bootstrap(const sal_Unicode* sParams)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sParams)
|
||||
{
|
||||
OUString paramsStr(sParams);
|
||||
for (size_t i = 0; i != std::u16string_view::npos;)
|
||||
{
|
||||
std::u16string_view name(o3tl::getToken(paramsStr, u'=', i));
|
||||
OUString key(name.substr(0, name.find_first_of('|')));
|
||||
OUString val(name.substr(key.getLength() + 1));
|
||||
::rtl::Bootstrap::set(key, val);
|
||||
}
|
||||
}
|
||||
|
||||
Reference<XComponentContext> xContext(::cppu::bootstrap());
|
||||
return xContext.get();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
32
net_ure/source/bridge/NativeBootstrap.cs
Normal file
32
net_ure/source/bridge/NativeBootstrap.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
|
||||
namespace com.sun.star.uno
|
||||
{
|
||||
public static class NativeBootstrap
|
||||
{
|
||||
public static XComponentContext bootstrap()
|
||||
{
|
||||
Interop.bootstrap(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class Interop
|
||||
{
|
||||
private const string BOOTSTRAP_LIBRARY = "net_bootstrap";
|
||||
|
||||
[DllImport(BOOTSTRAP_LIBRARY, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr bootstrap([MarshalAs(UnmanagedType.LPWStr)] string sParams);
|
||||
}
|
||||
}
|
||||
}
|
6
net_ure/source/nuget.config
Normal file
6
net_ure/source/nuget.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="LibreOfficeSDK" value="%OO_SDK_HOME%" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -67,6 +67,7 @@ $(gb_CustomTarget_workdir)/$(1)/setsdkenv: \
|
|||
-e 's!@OFFICE_HOME@!$(INSTROOTBASE)!' -e 's!@OO_SDK_MAKE_HOME@!!' \
|
||||
-e 's!@OO_SDK_ZIP_HOME@!!' -e 's!@OO_SDK_CAT_HOME@!!' \
|
||||
-e 's!@OO_SDK_SED_HOME@!!' -e 's!@OO_SDK_CPP_HOME@!!' \
|
||||
-e 's!@OO_SDK_DOTNET_ROOT@!"$(DOTNET_ROOT)"!' \
|
||||
-e 's!@OO_SDK_JAVA_HOME@!$(JAVA_HOME)!' \
|
||||
-e 's!@OO_SDK_OUTPUT_DIR@!$(gb_CustomTarget_workdir)/$(1)/out!' \
|
||||
-e 's!@SDK_AUTO_DEPLOYMENT@!YES!' $$< > $$@
|
||||
|
|
|
@ -62,6 +62,7 @@ var oo_sdk_manifest_used="";
|
|||
var oo_sdk_windowssdk="";
|
||||
var oo_sdk_cpp_home=getCppHome();
|
||||
var oo_sdk_cli_home=getCliHome();
|
||||
var oo_sdk_dotnet_root=getDotnetRoot();
|
||||
var oo_sdk_java_home=getJavaHome();
|
||||
var oo_sdk_out=getOutputDir();
|
||||
var sdk_auto_deployment=getAutoDeployment();
|
||||
|
@ -634,6 +635,78 @@ function getCliHome()
|
|||
}
|
||||
}
|
||||
|
||||
function getDotnetRoot()
|
||||
{
|
||||
var sSuggestedHome = WshSysEnv("OO_SDK_DOTNET_ROOT");
|
||||
if (sSuggestedHome.length == 0)
|
||||
{
|
||||
try {
|
||||
var sWhereResult = WshShell.Exec("where.exe dotnet.exe").StdOut.ReadLine();
|
||||
if (sWhereResult.length > 0)
|
||||
{
|
||||
sSuggestedHome = sWhereResult;
|
||||
if (!aFileSystemObject.FolderExists(sSuggestedHome))
|
||||
sSuggestedHome = "";
|
||||
}
|
||||
} catch (exc) {}
|
||||
}
|
||||
|
||||
var bSkip = false;
|
||||
while(true)
|
||||
{
|
||||
stdout.Write("\n Enter .NET SDK (8 or higher) installation directory (optional) [" + sSuggestedHome + "]:");
|
||||
var sHome = stdin.ReadLine();
|
||||
if (sHome.length == 0)
|
||||
{
|
||||
//No user input, check OO_SDK_DOTNET_ROOT or suggested value
|
||||
if ( sSuggestedHome.length == 0 ) {
|
||||
bSkip = true;
|
||||
} else {
|
||||
if ( !aFileSystemObject.FolderExists(sSuggestedHome) )
|
||||
{
|
||||
stdout.WriteLine("\n Error: Could not find directory \"" +
|
||||
sSuggestedHome + "\".");
|
||||
sSuggestedHome = "";
|
||||
bSkip=true;
|
||||
}
|
||||
}
|
||||
|
||||
sHome = sSuggestedHome;
|
||||
} else
|
||||
{
|
||||
//validate the user input
|
||||
if ( ! aFileSystemObject.FolderExists(sHome))
|
||||
{
|
||||
stdout.WriteLine("\n Error: The directory \"" + sHome +
|
||||
"\" does not exist.");
|
||||
bSkip = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bSkip) {
|
||||
//Check if this is an sdk folder by looking for the dotnet executable
|
||||
var dotnetExe = sHome + "\\dotnet.exe";
|
||||
if (! aFileSystemObject.FileExists(dotnetExe))
|
||||
{
|
||||
stdout.WriteLine("\n Error: Could not find \"" +
|
||||
dotnetExe + "\".");
|
||||
bSkip = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( bSkip ) {
|
||||
if ( skipChoice("the .NET SDK") ) {
|
||||
return "";
|
||||
} else {
|
||||
bSkip = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return sHome;
|
||||
}
|
||||
}
|
||||
|
||||
function getJavaHome()
|
||||
{
|
||||
var sSuggestedHome = WshSysEnv("OO_SDK_JAVA_HOME");
|
||||
|
@ -879,6 +952,10 @@ function writeBatFile(fdir, file)
|
|||
"REM Example:set OO_SDK_CLI_HOME=C:\\WINXP\\Microsoft.NET\\Framework\\v1.0.3705\n" +
|
||||
"set OO_SDK_CLI_HOME=" + oo_sdk_cli_home +
|
||||
"\n\n" +
|
||||
"REM .NET SDK installation directory.\n" +
|
||||
"REM Example: set OO_SDK_DOTNET_ROOT=C:\\Program Files\\Java\\jdk1.6.0_05\n" +
|
||||
"set OO_SDK_DOTNET_ROOT=" + oo_sdk_dotnet_root +
|
||||
"\n\n" +
|
||||
"REM Java SDK installation directory.\n" +
|
||||
"REM Example: set OO_SDK_JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_05\n" +
|
||||
"set OO_SDK_JAVA_HOME=" + oo_sdk_java_home +
|
||||
|
@ -948,9 +1025,11 @@ function writeBatFile(fdir, file)
|
|||
"set OO_SDK_URE_BIN_DIR=%OFFICE_PROGRAM_PATH%\n" +
|
||||
"set OO_SDK_URE_LIB_DIR=%OFFICE_PROGRAM_PATH%\n" +
|
||||
"set OO_SDK_URE_JAVA_DIR=%OFFICE_PROGRAM_PATH%\\classes\n" +
|
||||
"set OO_SDK_URE_DOTNET_DIR=%OFFICE_PROGRAM_PATH%\\dotnet\n" +
|
||||
"set OO_SDK_OFFICE_BIN_DIR=%OFFICE_PROGRAM_PATH%\n" +
|
||||
"set OO_SDK_OFFICE_LIB_DIR=%OFFICE_PROGRAM_PATH%\n" +
|
||||
"set OO_SDK_OFFICE_JAVA_DIR=%OFFICE_PROGRAM_PATH%\\classes\n" +
|
||||
"set OO_SDK_OFFICE_DOTNET_DIR=%OFFICE_PROGRAM_PATH%\\dotnet\n" +
|
||||
"\n" +
|
||||
"REM Set classpath\n" +
|
||||
"set CLASSPATH=%OO_SDK_URE_JAVA_DIR%\\libreoffice.jar;%OO_SDK_URE_JAVA_DIR%\\unoloader.jar\n" +
|
||||
|
@ -983,6 +1062,9 @@ function writeBatFile(fdir, file)
|
|||
"REM Add directory of the C# and VB.NET compilers to the path, if necessary.\n" +
|
||||
"if defined OO_SDK_CLI_HOME set PATH=%OO_SDK_CLI_HOME%;%PATH%\n" +
|
||||
"\n" +
|
||||
"REM Add directory of the dotnet command-line tool to the path, if necessary.\n" +
|
||||
"if defined OO_SDK_DOTNET_ROOT set PATH=%OO_SDK_DOTNET_ROOT%;%PATH%\n" +
|
||||
"\n" +
|
||||
"REM Add directory of the Java tools to the path, if necessary.\n" +
|
||||
"if defined OO_SDK_JAVA_HOME set PATH=%OO_SDK_JAVA_HOME%\\bin;%OO_SDK_JAVA_HOME%\\jre\\bin;%PATH%\n" +
|
||||
"\n" +
|
||||
|
@ -1005,6 +1087,7 @@ function writeBatFile(fdir, file)
|
|||
"echo * sed = %OO_SDK_SED_HOME%\n" +
|
||||
"echo * C++ Compiler = %OO_SDK_CPP_HOME%\n" +
|
||||
"echo * C# and VB.NET compilers = %OO_SDK_CLI_HOME%\n" +
|
||||
"echo * Dotnet = %OO_SDK_DOTNET_ROOT%\n" +
|
||||
"echo * Java = %OO_SDK_JAVA_HOME%\n" +
|
||||
"echo * Special Output directory = %OO_SDK_OUT%\n" +
|
||||
"echo * Auto deployment = %SDK_AUTO_DEPLOYMENT%\n" +
|
||||
|
|
|
@ -73,6 +73,10 @@ $main::cppName = "gcc";
|
|||
$main::cppVersion = "4.0.1";
|
||||
$main::OO_SDK_CPP_HOME_SUGGESTION = searchprog($main::cppName);
|
||||
|
||||
$main::OO_SDK_DOTNET_ROOT = "";
|
||||
$main::OO_SDK_DOTNET_ROOT_SUGGESTION = dotnetToRoot(searchprog("dotnet") . "/dotnet");
|
||||
$main::dotnetSdkVersion = "8";
|
||||
|
||||
$main::OO_SDK_JAVA_HOME = "";
|
||||
$main::OO_SDK_JAVA_HOME_SUGGESTION = searchprog("javac");
|
||||
$main::javaVersion = "1.6";
|
||||
|
@ -378,6 +382,52 @@ while ( (!$main::correctVersion) &&
|
|||
}
|
||||
}
|
||||
|
||||
# prepare .NET SDK path
|
||||
$main::correctVersion = 0;
|
||||
while ( (!$main::correctVersion) &&
|
||||
((! -d "$main::OO_SDK_DOTNET_ROOT" ) ||
|
||||
((-d "$main::OO_SDK_DOTNET_ROOT") && (! -e "$main::OO_SDK_DOTNET_ROOT/dotnet"))) )
|
||||
{
|
||||
print " Enter .NET SDK (8 or higher) installation directory (optional) [$main::OO_SDK_DOTNET_ROOT_SUGGESTION]: ";
|
||||
$main::OO_SDK_DOTNET_ROOT = readStdIn();
|
||||
chop($main::OO_SDK_DOTNET_ROOT);
|
||||
if ( $main::OO_SDK_DOTNET_ROOT eq "" )
|
||||
{
|
||||
$main::OO_SDK_DOTNET_ROOT = $main::OO_SDK_DOTNET_ROOT_SUGGESTION;
|
||||
}
|
||||
if ( ! $main::OO_SDK_DOTNET_ROOT eq "" )
|
||||
{
|
||||
if ( (! -d "$main::OO_SDK_DOTNET_ROOT") ||
|
||||
((-d "$main::OO_SDK_DOTNET_ROOT") && (! -e "$main::OO_SDK_DOTNET_ROOT/dotnet")) )
|
||||
{
|
||||
print " Error: Could not find directory '$main::OO_SDK_DOTNET_ROOT' or '$main::OO_SDK_DOTNET_ROOT/dotnet'.\n";
|
||||
if ( skipChoice(".NET SDK") == 1 )
|
||||
{
|
||||
$main::correctVersion = 1;
|
||||
}
|
||||
$main::OO_SDK_DOTNET_ROOT = "";
|
||||
} else
|
||||
{
|
||||
#check version
|
||||
my $testVersion = `"$main::OO_SDK_DOTNET_ROOT/dotnet" --version | awk -F. '{ print $1 }'`;
|
||||
|
||||
$main::correctVersion = testVersion($main::dotnetSdkVersion, $testVersion, "$main::OO_SDK_DOTNET_ROOT/dotnet", 1);
|
||||
if ( !$main::correctVersion )
|
||||
{
|
||||
print " The 'dotnet' command found at '$main::OO_SDK_DOTNET_ROOT' has a wrong version\n";
|
||||
if ( skipChoice(".NET SDK") == 1 )
|
||||
{
|
||||
$main::correctVersion = 1;
|
||||
}
|
||||
$main::OO_SDK_DOTNET_ROOT = "";
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
# the .NET SDK is optional
|
||||
$main::correctVersion = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# prepare Java path
|
||||
$main::correctVersion = 0;
|
||||
|
@ -694,7 +744,31 @@ sub searchoffice
|
|||
return $officepath;
|
||||
}
|
||||
|
||||
sub dotnetToRoot
|
||||
{
|
||||
my $dotnetExe = shift;
|
||||
|
||||
if (! -e "$dotnetExe")
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
my $dotnetSdkVer = `"$dotnetExe" --version`;
|
||||
chomp($dotnetSdkVer);
|
||||
|
||||
my $dotnetSdkDir = `"$dotnetExe" --list-sdks | grep $dotnetSdkVer | awk -F'[][]' '{print \$2}'`;
|
||||
chomp($dotnetSdkDir);
|
||||
|
||||
my $dotnetRootDir = `dirname "$dotnetSdkDir"`;
|
||||
chomp($dotnetRootDir);
|
||||
|
||||
if (! -d "$dotnetRootDir")
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return $dotnetRootDir;
|
||||
}
|
||||
|
||||
sub testVersion
|
||||
{
|
||||
|
@ -765,6 +839,7 @@ sub prepareScriptFile()
|
|||
$_ =~ s#\@OO_SDK_CAT_HOME\@#$main::OO_SDK_CAT_HOME#go;
|
||||
$_ =~ s#\@OO_SDK_SED_HOME\@#$main::OO_SDK_SED_HOME#go;
|
||||
$_ =~ s#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go;
|
||||
$_ =~ s#\@OO_SDK_DOTNET_ROOT\@#"$main::OO_SDK_DOTNET_ROOT"#go;
|
||||
$_ =~ s#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go;
|
||||
$_ =~ s#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go;
|
||||
$_ =~ s#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go;
|
||||
|
|
|
@ -54,6 +54,10 @@ OO_SDK_SED_HOME=@OO_SDK_SED_HOME@
|
|||
# Example: OO_SDK_CPP_HOME=/usr/bin
|
||||
OO_SDK_CPP_HOME=@OO_SDK_CPP_HOME@
|
||||
|
||||
# Directory of the .NET SDK.
|
||||
# Example: OO_SDK_DOTNET_ROOT=/usr/lib/dotnet
|
||||
OO_SDK_DOTNET_ROOT=@OO_SDK_DOTNET_ROOT@
|
||||
|
||||
# Directory of the Java SDK.
|
||||
# Example: OO_SDK_JAVA_HOME=/usr/jdk/jdk1.6.0_10
|
||||
OO_SDK_JAVA_HOME=@OO_SDK_JAVA_HOME@
|
||||
|
@ -239,6 +243,13 @@ then
|
|||
export OO_SDK_CPP_HOME
|
||||
fi
|
||||
|
||||
# Add directory of the dotnet command-line tool to the path, if necessary.
|
||||
if [ -n "${OO_SDK_DOTNET_ROOT}" ]
|
||||
then
|
||||
PATH=${OO_SDK_DOTNET_ROOT}:${PATH}
|
||||
export OO_SDK_DOTNET_ROOT
|
||||
fi
|
||||
|
||||
# Add directory of the Java tools to the path, if necessary.
|
||||
if [ -n "${OO_SDK_JAVA_HOME}" ]
|
||||
then
|
||||
|
@ -293,6 +304,7 @@ echo " * Zip = $OO_SDK_ZIP_HOME"
|
|||
echo " * cat = $OO_SDK_CAT_HOME"
|
||||
echo " * sed = $OO_SDK_SED_HOME"
|
||||
echo " * C++ Compiler = $OO_SDK_CPP_HOME"
|
||||
echo " * Dotnet = $OO_SDK_DOTNET_ROOT"
|
||||
echo " * Java = $OO_SDK_JAVA_HOME"
|
||||
echo " * SDK Output directory = $OO_SDK_OUT"
|
||||
echo " * Auto deployment = $SDK_AUTO_DEPLOYMENT"
|
||||
|
|
|
@ -70,6 +70,7 @@ endif
|
|||
endif
|
||||
|
||||
DEPLOYTOOL="$(OFFICE_PROGRAM_PATH)$(PS)unopkg" add -f
|
||||
SDK_DOTNET="$(OO_SDK_DOTNET_ROOT)/dotnet"
|
||||
SDK_JAVA="$(OO_SDK_JAVA_HOME)/bin/java" $(JAVA_OPTIONS)
|
||||
SDK_JAVAC="$(OO_SDK_JAVA_HOME)/bin/javac"
|
||||
SDK_JAR="$(OO_SDK_JAVA_HOME)/bin/jar"
|
||||
|
|
Loading…
Reference in a new issue