Skip to content

Commit

Permalink
dotnet: rework input files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Jul 13, 2018
1 parent 46ab823 commit 496be16
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ ortools/fsharp/**/packages
examples/dotnet/**/bin
examples/dotnet/**/obj

ortools/dotnet/OrTools/*.csproj
ortools/dotnet/OrTools.FSharp/*.fsproj
ortools/dotnet/*.nuspec
ortools/dotnet/**/bin
ortools/dotnet/**/obj
ortools/dotnet/**/packages
Expand Down
68 changes: 46 additions & 22 deletions makefiles/Makefile.dotnet.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ CLR_KEYFILE_PATH = $(subst /,$S,$(CLR_KEYFILE))

# relative to the project root folder
TEMP_DOTNET_TEST_DIR=temp_dotnet_test
TEMP_DOTNET_DIR=temp_dotnet

# Check for required build tools
ifeq ($(SYSTEM), win)
Expand Down Expand Up @@ -252,6 +251,11 @@ $(CLR_KEYFILE): | $(BIN_DIR)
"$(DOTNET_BIN)" run --project tools$Sdotnet$SCreateSigningKey$SCreateSigningKey.csproj $S$(CLR_KEYFILE_PATH)

# Main DLL
.PHONY: dotnet # Build OrTools for .NET
dotnet: ortoolslibs csharp_dotnet fsharp_dotnet

BUILT_LANGUAGES +=, dotnet \(netstandard2.0\)

$(BIN_DIR)/$(CLR_ORTOOLS_DLL_NAME)$D: \
$(SRC_DIR)/ortools/dotnet/$(ORTOOLS_DLL_NAME)/$(ORTOOLS_DLL_NAME).csproj \
$(OR_TOOLS_LIBS) \
Expand Down Expand Up @@ -300,6 +304,15 @@ else
$(COPY) ortools$Sdotnet$S$(ORTOOLS_DLL_NAME)$Sbin$SDebug$Snetstandard2.0$S*.* $(BIN_DIR)
endif

$(SRC_DIR)/ortools/dotnet/$(ORTOOLS_DLL_NAME)/$(ORTOOLS_DLL_NAME).csproj: \
$(SRC_DIR)/ortools/dotnet/$(ORTOOLS_DLL_NAME)/$(ORTOOLS_DLL_NAME).csproj.in
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
ortools$Sdotnet$S$(ORTOOLS_DLL_NAME)$S$(ORTOOLS_DLL_NAME).csproj.in \
>ortools$Sdotnet$S$(ORTOOLS_DLL_NAME)$S$(ORTOOLS_DLL_NAME).csproj

##############
## FSHARP ##
##############
.PHONY: fsharp_dotnet # Build F# OR-Tools
fsharp_dotnet: $(BIN_DIR)/$(CLR_ORTOOLS_FSHARP_DLL_NAME)$D

Expand All @@ -314,6 +327,12 @@ else
$(COPY) ortools$Sdotnet$S$(ORTOOLS_FSHARP_DLL_NAME)$Sbin$SDebug$Snetstandard2.0$S*.* $(BIN_DIR)
endif

$(SRC_DIR)/ortools/dotnet/$(ORTOOLS_FSHARP_DLL_NAME)/$(ORTOOLS_FSHARP_DLL_NAME).fsproj: \
$(SRC_DIR)/ortools/dotnet/$(ORTOOLS_FSHARP_DLL_NAME)/$(ORTOOLS_FSHARP_DLL_NAME).fsproj.in
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
ortools$Sdotnet$S$(ORTOOLS_FSHARP_DLL_NAME)$S$(ORTOOLS_FSHARP_DLL_NAME).fsproj.in \
>ortools$Sdotnet$S$(ORTOOLS_FSHARP_DLL_NAME)$S$(ORTOOLS_FSHARP_DLL_NAME).fsproj

.PHONY: clean_dotnet # Clean files
clean_dotnet:
-$(DELREC) tools$Sdotnet$SCreateSigningKey$Sbin
Expand Down Expand Up @@ -375,28 +394,32 @@ test_dotnet: dotnet
-o "..$S..$S..$S$(TEMP_DOTNET_TEST_DIR)" \
"ortools$Sdotnet$S$(ORTOOLS_FSHARP_TEST_DLL_NAME)"

.PHONY: dotnet # Build OrTools for .NET
dotnet: ortoolslibs csharp_dotnet fsharp_dotnet
$(SED) -i -e "s/<Version>.*<\/Version>/<Version>$(OR_TOOLS_VERSION)<\/Version>/" ortools$Sdotnet$S$(ORTOOLS_DLL_NAME)$S$(ORTOOLS_DLL_NAME).csproj
$(SED) -i -e "s/<AssemblyVersion>.*<\/AssemblyVersion>/<AssemblyVersion>$(OR_TOOLS_VERSION)<\/AssemblyVersion>/" ortools$Sdotnet$S$(ORTOOLS_DLL_NAME)$S$(ORTOOLS_DLL_NAME).csproj
$(SED) -i -e "s/<FileVersion>.*<\/FileVersion>/<FileVersion>$(OR_TOOLS_VERSION)<\/FileVersion>/" ortools$Sdotnet$S$(ORTOOLS_DLL_NAME)$S$(ORTOOLS_DLL_NAME).csproj
$(SED) -i -e "s/<Version>.*<\/Version>/<Version>$(OR_TOOLS_VERSION)<\/Version>/" ortools$Sdotnet$S$(ORTOOLS_FSHARP_DLL_NAME)$S$(ORTOOLS_FSHARP_DLL_NAME).fsproj
$(SED) -i -e "s/<AssemblyVersion>.*<\/AssemblyVersion>/<AssemblyVersion>$(OR_TOOLS_VERSION)<\/AssemblyVersion>/" ortools$Sdotnet$S$(ORTOOLS_FSHARP_DLL_NAME)$S$(ORTOOLS_FSHARP_DLL_NAME).fsproj
$(SED) -i -e "s/<FileVersion>.*<\/FileVersion>/<FileVersion>$(OR_TOOLS_VERSION)<\/FileVersion>/" ortools$Sdotnet$S$(ORTOOLS_FSHARP_DLL_NAME)$S$(ORTOOLS_FSHARP_DLL_NAME).fsproj
"$(DOTNET_BIN)" build -c Release -o $(BIN_DIR) ortools$Sdotnet$S$(ORTOOLS_DLL_NAME)$S$(ORTOOLS_DLL_NAME).csproj
"$(DOTNET_BIN)" build -c Release -o $(BIN_DIR) ortools$Sdotnet$S$(ORTOOLS_FSHARP_DLL_NAME)$S$(ORTOOLS_FSHARP_DLL_NAME).fsproj
$(MKDIR_P) $(TEMP_DOTNET_DIR)
"$(DOTNET_BIN)" publish -c Release -o "..$S..$S..$S$(TEMP_DOTNET_DIR)" -f netstandard2.0 ortools$Sdotnet$S$(ORTOOLS_DLL_NAME)$S$(ORTOOLS_DLL_NAME).csproj
"$(DOTNET_BIN)" publish -c Release -o "..$S..$S..$S$(TEMP_DOTNET_DIR)" -f netstandard2.0 ortools$Sdotnet$S$(ORTOOLS_FSHARP_DLL_NAME)$S$(ORTOOLS_FSHARP_DLL_NAME).fsproj

BUILT_LANGUAGES +=, dotnet \(netstandard2.0\)
#####################
## Nuget artifact ##
#####################
TEMP_DOTNET_DIR=temp_dotnet

.PHONY: pkg_dotnet # Build Nuget Package
pkg_dotnet:
$(warning Not Implemented)
$(TEMP_DOTNET_DIR):
$(MKDIR_P) $(TEMP_DOTNET_DIR)

.PHONY: pkg_dotnet-upload # Upload Nuget Package
pkg_dotnet-upload: nuget_archive
.PHONY: nuget_archive # Build .Net "Google.OrTools" Nuget Package
nuget_archive: dotnet $(SRC_DIR)/ortools/dotnet/$(ORTOOLS_NUSPEC_FILE).in | $(TEMP_DOTNET_DIR)
"$(DOTNET_BIN)" publish -c Release --no-dependencies --no-restore -f netstandard2.0 \
-o "..$S..$S..$S$(TEMP_DOTNET_DIR)" \
ortools$Sdotnet$S$(ORTOOLS_DLL_NAME)$S$(ORTOOLS_DLL_NAME).csproj
"$(DOTNET_BIN)" publish -c Release --no-dependencies --no-restore -f netstandard2.0 \
-o "..$S..$S..$S$(TEMP_DOTNET_DIR)" \
ortools$Sdotnet$S$(ORTOOLS_FSHARP_DLL_NAME)$S$(ORTOOLS_FSHARP_DLL_NAME).fsproj
$(SED) -e "s/MMMM/$(CLR_ORTOOLS_DLL_NAME)/" \
ortools$Sdotnet$S$(ORTOOLS_NUSPEC_FILE).in \
>ortools$Sdotnet$S$(ORTOOLS_NUSPEC_FILE)
$(SED) -i -e "s/VVVV/$(OR_TOOLS_VERSION)/" \
ortools$Sdotnet$S$(ORTOOLS_NUSPEC_FILE)
"$(NUGET_BIN)" pack ortools$Sdotnet$S$(ORTOOLS_NUSPEC_FILE)

.PHONY: nuget_upload # Upload Nuget Package
nuget_upload: nuget_archive
@echo Uploading Nuget package for "netstandard2".
$(warning Not Implemented)

.PHONY: detect_dotnet # Show variables used to build dotnet OR-Tools.
Expand All @@ -405,14 +428,15 @@ detect_dotnet:
@echo PROTOC = $(PROTOC)
@echo DOTNET_BIN = $(DOTNET_BIN)
@echo CLR_KEYFILE = $(CLR_KEYFILE)
@echo NUGET_BIN = $(NUGET_BIN)
@echo SWIG_PYTHON_LIB_SUFFIX = $(SWIG_PYTHON_LIB_SUFFIX)
@echo CLR_PROTOBUF_DLL_NAME = $(CLR_PROTOBUF_DLL_NAME)
@echo CLR_ORTOOLS_IMPORT_DLL_NAME = $(CLR_ORTOOLS_IMPORT_DLL_NAME)
@echo CLR_ORTOOLS_DLL_NAME = $(CLR_ORTOOLS_DLL_NAME)
@echo CLR_ORTOOLS_FSHARP_DLL_NAME = $(CLR_ORTOOLS_FSHARP_DLL_NAME)
@echo CLR_ORTOOLS_TEST_DLL_NAME = $(CLR_ORTOOLS_TEST_DLL_NAME)
@echo CLR_ORTOOLS_FSHARP_TEST_DLL_NAME = $(CLR_ORTOOLS_FSHARP_TEST_DLL_NAME)
@echo NUGET_BIN = $(NUGET_BIN)
@echo ORTOOLS_NUSPEC_FILE = $(ORTOOLS_NUSPEC_FILE)
ifeq ($(SYSTEM),win)
@echo off & echo(
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

<Version>6.7.5238</Version>
<AssemblyVersion>6.7.5238</AssemblyVersion>
<FileVersion>6.7.5238</FileVersion>
<Version>@PROJECT_VERSION@</Version>
<AssemblyVersion>@PROJECT_VERSION@</AssemblyVersion>
<FileVersion>@PROJECT_VERSION@</FileVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@
<description>.NET wrapper for the Operations Research Tools project</description>
<copyright>Copyright 2018 Google, Inc</copyright>
<tags>Operations Research Math Linear Constraint Programming C# F# .NETStandard</tags>
<references>
<reference file="Google.OrTools.dll" />
<reference file="Google.OrTools.FSharp.dll" />
</references>
</metadata>
<files>
<file src="../../examples/dotnet/**" target="examples" exclude="**/obj/**;**/bin/**"/>
<file src="../../bin/Google.Protobuf.dll" target="lib/netstandard2.0"/> + <file src="../../temp_dotnet/**" target="lib"/>
<file src="../../lib/*.*" target="lib/netstandard2.0"/>
<file src="../../bin/Google.Protobuf.dll" target="lib/netstandard2.0"/>
<file src="OrTools/bin/Release/netstandard2.0/*.*" target="lib/netstandard2.0"/>
<file src="OrTools.FSharp/bin/Release/netstandard2.0/Google.OrTools.FSharp.*" target="lib/netstandard2.0"/>
<file src="../../LICENSE-2.0.txt"/>
</files>
</package>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

<Version>6.7.5238</Version>
<AssemblyVersion>6.7.5238</AssemblyVersion>
<FileVersion>6.7.5238</FileVersion>
<Version>@PROJECT_VERSION@</Version>
<AssemblyVersion>@PROJECT_VERSION@</AssemblyVersion>
<FileVersion>@PROJECT_VERSION@</FileVersion>

<RootNamespace>Google.OrTools</RootNamespace>

Expand Down

0 comments on commit 496be16

Please sign in to comment.