<commit_before>Framework "4.0"

###################### Properties ##############################################################

properties {
	$project_name = "TeamcityTestSite"
	$company_name = "<NAME>"
	$base_dir = resolve-path .
	
	$build_dir = "$base_dir\build"
	$test_dir = "$build_dir\test"
	$test_copy_ignore_path = "_ReSharper"
	$tools_path = "$base_dir\tools"
	$packages_path = "$base_dir\src\packages"
	#$7zip_path = "$tools_path\7zip\7za.exe"
	#$nuget_path = "$tools_path\nuget\nuget.exe"
	$xunit_path = "$packages_path\xunit.runner.console.2.0.0\tools\xunit.console.exe"
	$unit_test_source_dir = "$base_dir\src\UnitTests\bin\$project_config"
	$unit_test_dll = "$test_dir\UnitTests.dll"
	$integration_test_source_dir = "$base_dir\src\IntegrationTests\bin\$project_config"
	#$integration_test_dll = "$test_dir\IntegrationTests.dll"
	#$integration_test_config = "$test_dir\IntegrationTests.dll.config"
	$source_dir = "$base_dir\src"	
	#$ftp_base_dir = "\\files.praeses.com\FileTransfers\Projects\HII-Labor Collection"
	#$ftp_dir = "$ftp_base_dir\$project_config"
	#$now = [System.DateTime]::Now
	#$now_year = $now.Year
	#$now_version_1 = $now_year
	#$now_version_2 = $now.ToString("MMdd")
	#$now_version_3 = $now.ToString("HHmm")
	#$version = "$now_version_1.$now_version_2.$now_version_3"
	$iis_deploy_username = "$project_name-Deploy"
	$iis_deploy_password = "<PASSWORD>"
}

##################### Tasks ####################################################################

#task default -depends Init, CommonAssemblyInfo, Compile, UnitTest, IntegrationTest
task default -depends Init, Compile, UnitTest, IntegrationTest

task Init {	
	msbuild /t:clean /v:q /nologo /p:configuration=$project_config $source_dir\$project_name.sln
	delete_directory $build_dir
	create_directory $build_dir
	create_directory $test_dir
}

#task CommonAssemblyInfo -depends Init {  
#    create-commonAssemblyInfo "$version" $projectName "$source_dir\CommonAssemblyInfo.cs"
#}

#task Compile -depends CommonAssemblyInfo {	
task Compile -depends Init {	
	#exec {
	#	& $nuget_path restore $source_dir\$project_name.sln
	#}
	Write-Host "Compiling version: $version"
	msbuild /t:build /v:q /nologo /p:configuration=$project_config $source_dir\$project_name.sln
}

#task UnitTest -depends Compile {
#	copy_all_assemblies_for_test $unit_test_source_dir $test_dir
#	exec {
#		& $xunit_path $unit_test_dll /nunit results-unit.xml
#	}
#}

#task IntegrationTest -depends Compile {
#	copy_all_assemblies_for_test $integration_test_source_dir $test_dir
#	ensure_db_is_migrated $integration_test_config	
#	exec {
#		& $xunit_path $integration_test_dll /nunit results-integration.xml
#	}
#}

task Publish -depends Compile { 
	Remove-Item $build_dir -Recurse -Force -ErrorAction SilentlyContinue  #Cleanup the build directory
	exec { 
		#PortersCleaners-Deploy is an IIS Manager User
		msbuild $source_dir\$project_name.sln /property:DeployOnBuild=true /property:PublishProfile=$project_config /property:UserName=$iis_deploy_username /property:Password=$iis_deploy_username /property:AllowUntrustedCertificate=true /v:q /nologo /clp:ErrorsOnly 
	}
}

task Package-Service -depends Publish {
	$bin = "$source_dir\WindowsService\bin\$project_config"<commit_msg>Uncommenting out the UnitTest task<commit_after>Framework "4.0"

###################### Properties ##############################################################

properties {
	$project_name = "TeamcityTestSite"
	$company_name = "<NAME>"
	$base_dir = resolve-path .
	
	$build_dir = "$base_dir\build"
	$test_dir = "$build_dir\test"
	$test_copy_ignore_path = "_ReSharper"
	$tools_path = "$base_dir\tools"
	$packages_path = "$base_dir\src\packages"
	#$7zip_path = "$tools_path\7zip\7za.exe"
	#$nuget_path = "$tools_path\nuget\nuget.exe"
	$xunit_path = "$packages_path\xunit.runner.console.2.0.0\tools\xunit.console.exe"
	$unit_test_source_dir = "$base_dir\src\UnitTests\bin\$project_config"
	$unit_test_dll = "$test_dir\UnitTests.dll"
	$integration_test_source_dir = "$base_dir\src\IntegrationTests\bin\$project_config"
	#$integration_test_dll = "$test_dir\IntegrationTests.dll"
	#$integration_test_config = "$test_dir\IntegrationTests.dll.config"
	$source_dir = "$base_dir\src"	
	#$ftp_base_dir = "\\files.praeses.com\FileTransfers\Projects\HII-Labor Collection"
	#$ftp_dir = "$ftp_base_dir\$project_config"
	#$now = [System.DateTime]::Now
	#$now_year = $now.Year
	#$now_version_1 = $now_year
	#$now_version_2 = $now.ToString("MMdd")
	#$now_version_3 = $now.ToString("HHmm")
	#$version = "$now_version_1.$now_version_2.$now_version_3"
	$iis_deploy_username = "$project_name-Deploy"
	$iis_deploy_password = "<PASSWORD>"
}

##################### Tasks ####################################################################

#task default -depends Init, CommonAssemblyInfo, Compile, UnitTest, IntegrationTest
task default -depends Init, Compile, UnitTest, IntegrationTest

task Init {	
	msbuild /t:clean /v:q /nologo /p:configuration=$project_config $source_dir\$project_name.sln
	delete_directory $build_dir
	create_directory $build_dir
	create_directory $test_dir
}

#task CommonAssemblyInfo -depends Init {  
#    create-commonAssemblyInfo "$version" $projectName "$source_dir\CommonAssemblyInfo.cs"
#}

#task Compile -depends CommonAssemblyInfo {	
task Compile -depends Init {	
	#exec {
	#	& $nuget_path restore $source_dir\$project_name.sln
	#}
	Write-Host "Compiling version: $version"
	msbuild /t:build /v:q /nologo /p:configuration=$project_config $source_dir\$project_name.sln
}

task UnitTest -depends Compile {
	copy_all_assemblies_for_test $unit_test_source_dir $test_dir
	exec {
		& $xunit_path $unit_test_dll -nunit results-unit.xml
	}
}

#task IntegrationTest -depends Compile {
#	copy_all_assemblies_for_test $integration_test_source_dir $test_dir
#	ensure_db_is_migrated $integration_test_config	
#	exec {
#		& $xunit_path $integration_test_dll /nunit results-integration.xml
#	}
#}

task Publish -depends Compile { 
	Remove-Item $build_dir -Recurse -Force -ErrorAction SilentlyContinue  #Cleanup the build directory
	exec { 
		#PortersCleaners-Deploy is an IIS Manager User
		msbuild $source_dir\$project_name.sln /property:DeployOnBuild=true /property:PublishProfile=$project_config /property:UserName=$iis_deploy_username /property:Password=$<PASSWORD> /property:AllowUntrustedCertificate=true /v:q /nologo /clp:ErrorsOnly 
	}
}

task Package-Service -depends Publish {
	$bin = "$source_dir\WindowsService\bin\$project_config"
{'fraction_non_alphanumeric': 0.17119901112484548, 'fraction_numerical': 0.004326328800988875, 'mean_word_length': 6.431687715269804, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1581930', 'n_tokens_mistral': 2377, 'n_tokens_neox': 2278, 'n_words': 367}