diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 1b1e0e8..21d4780 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -27,4 +27,48 @@ jobs:
Write-Host "Java_HOME: $JAVA_HOME"
Get-Command mvn
displayName: 'Check Maven is installed'
- - pwsh: '& .\build.ps1'
\ No newline at end of file
+
+ - pwsh: |
+ Invoke-WebRequest 'https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
+ ./dotnet-install.ps1 -InstallDir "$env:ProgramFiles/dotnet" -Version "6.0.100-rc.2.21505.57" -Channel 'release'
+ displayName: 'Install the .Net version used by the Core Tools for Windows'
+ condition: eq( variables['Agent.OS'], 'Windows_NT' )
+ - bash: |
+ curl -sSL https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh | bash /dev/stdin -v '6.0.100-rc.2.21505.57' -c 'release' --install-dir /usr/share/dotnet
+ displayName: 'Install the .Net version used by the Core Tools for Linux'
+ condition: eq( variables['Agent.OS'], 'Linux' )
+
+ - pwsh: '& .\build.ps1'
+ displayName: 'Build project with java core library'
+ - pwsh: |
+ $currDir = Get-Location
+ $Env:Path = $Env:Path+";$currDir\Azure.Functions.Cli"
+ ls $currDir\Azure.Functions.Cli
+ func --version
+ cd ./azure-functions-java-worker/endtoendtests
+ mvn clean package `-Dmaven`.javadoc`.skip=true `-Dmaven`.test`.skip `-Dorg`.slf4j`.simpleLogger`.log`.org`.apache`.maven`.cli`.transfer`.Slf4jMavenTransferListener=warn `-B
+ Copy-Item "confluent_cloud_cacert.pem" ".\target\azure-functions\azure-functions-java-endtoendtests"
+ displayName: 'Package Java for E2E'
+ - task: DotNetCoreCLI@2
+ inputs:
+ command: 'test'
+ projects: |
+ azure-functions-java-worker\endtoendtests\Azure.Functions.Java.Tests.E2E\Azure.Functions.Java.Tests.E2E\Azure.Functions.Java.Tests.E2E.csproj
+ env:
+ AzureWebJobsStorage: $(AzureWebJobsStorage)
+ AzureWebJobsCosmosDBConnectionString: $(AzureWebJobsCosmosDBConnectionString)
+ AzureWebJobsServiceBus: $(AzureWebJobsServiceBus)
+ AzureWebJobsEventHubReceiver: $(AzureWebJobsEventHubReceiver)
+ AzureWebJobsEventHubSender_2: $(AzureWebJobsEventHubSender_2)
+ AzureWebJobsEventHubSender: $(AzureWebJobsEventHubSender)
+ AzureWebJobsEventHubPath: $(AzureWebJobsEventHubPath)
+ SBTopicName: $(SBTopicName)
+ SBTopicSubName: $(SBTopicSubName)
+ CosmosDBDatabaseName: $(CosmosDBDatabaseName)
+ SBQueueName: $(SBQueueName)
+ BrokerList": $(BrokerList)
+ ConfluentCloudUsername: $(ConfluentCloudUsername)
+ ConfluentCloudPassword: $(ConfluentCloudPassword)
+ AzureWebJobsEventGridOutputBindingTopicUriString: $(AzureWebJobsEventGridOutputBindingTopicUriString)
+ AzureWebJobsEventGridOutputBindingTopicKeyString: $(AzureWebJobsEventGridOutputBindingTopicKeyString)
+ displayName: 'Build & Run tests for java 8'
\ No newline at end of file
diff --git a/build.ps1 b/build.ps1
index 9e3ebd6..ec28881 100644
--- a/build.ps1
+++ b/build.ps1
@@ -40,16 +40,34 @@ if ([string]::IsNullOrEmpty($pluginVersion))
StopOnFailedExecution
-# Get azure-functions-library
-Write-Host "Build and install azure-functions-java-library"
+# Get azure-functions-core-library
+Write-Host "Build and install azure-functions-java-core-library"
+cmd.exe /c '.\mvnBuild.bat'
+StopOnFailedExecution
+$coreLibraryPom = Get-Content "pom.xml" -Raw
+$coreLibraryPom -match "(.*)"
+$coreLibraryVersion = $matches[1]
+Write-Host "coreLibraryVersion: " $coreLibraryVersion
+
+# Get azure-functions-library
+git clone https://github.com/Azure/azure-functions-java-library.git -b dev
+Push-Location -Path "./azure-functions-java-library" -StackName libraryDir
+Write-Host "Updating azure-functions-java-library to use current version of azure-functions-java-core-library"
+cmd.exe /c .\..\updateVersions.bat $coreLibraryVersion
+Write-Host "Building azure-functions-java-library"
cmd.exe /c '.\mvnBuild.bat'
StopOnFailedExecution
$libraryPom = Get-Content "pom.xml" -Raw
$libraryPom -match "(.*)"
$libraryVersion = $matches[1]
Write-Host "libraryVersion: " $libraryVersion
+Pop-Location -StackName "libraryDir"
# Download azure-functions-core-tools
+$FUNC_RUNTIME_VERSION = '4'
+$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant()
+$os = if ($IsWindows) { "win" } else { if ($IsMacOS) { "osx" } else { "linux" } }
+
$currDir = Get-Location
$skipCliDownload = $false
if($args[0])
@@ -64,11 +82,11 @@ Remove-Item -Force ./Azure.Functions.Cli.zip -ErrorAction Ignore
Remove-Item -Recurse -Force ./Azure.Functions.Cli -ErrorAction Ignore
Write-Host "Downloading Functions Core Tools...."
-Invoke-RestMethod -Uri 'https://functionsclibuilds.blob.core.windows.net/builds/2/latest/version.txt' -OutFile version.txt
+Invoke-RestMethod -Uri "https://functionsclibuilds.blob.core.windows.net/builds/$FUNC_RUNTIME_VERSION/latest/version.txt" -OutFile version.txt
Write-Host "Using Functions Core Tools version: $(Get-Content -Raw version.txt)"
Remove-Item version.txt
-$url = "https://functionsclibuilds.blob.core.windows.net/builds/2/latest/Azure.Functions.Cli.win-x86.zip"
+$url = "https://functionsclibuilds.blob.core.windows.net/builds/$FUNC_RUNTIME_VERSION/latest/Azure.Functions.Cli.$os-$arch.zip"
$output = "$currDir\Azure.Functions.Cli.zip"
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $output)
@@ -78,32 +96,30 @@ Expand-Archive ".\Azure.Functions.Cli.zip" -DestinationPath ".\Azure.Functions.C
}
$Env:Path = $Env:Path+";$currDir\Azure.Functions.Cli"
-# Generate HttpTrigger Function via archetype version built above
-md -Name ciTestDir
-Push-Location -Path "./ciTestDir" -StackName libraryDir
-Write-Host "Generating project with archetype"
-cmd.exe /c '.\..\mvnGenerateArchetype.bat' $atchetypeVersion
-Pop-Location -StackName "libraryDir"
-
-#Build HttpTrigger Function
-
-Push-Location -Path "./ciTestDir/e2etestproject" -StackName libraryDir
-Remove-Item -Recurse -Force "src/test" -ErrorAction Ignore
-cmd.exe /c .\..\..\updateVersions.bat $libraryVersion $pluginVersion
-StopOnFailedExecution
-#Update versions in the HttpTrigger pom.xml
-cmd.exe /c '.\..\..\mvnBuild.bat'
-StopOnFailedExecution
-Pop-Location -StackName "libraryDir"
-
# Clone and build azure-functions-java-worker
git clone https://github.com/azure/azure-functions-java-worker -b dev
Push-Location -Path "./azure-functions-java-worker" -StackName libraryDir
-Write-Host "Updating azure-functions-java-worker to use current version of library"
+Write-Host "Updating azure-functions-java-worker to use current version of the java core library"
-cmd.exe /c .\..\updateVersions.bat $libraryVersion
+cmd.exe /c .\..\updateVersions.bat $coreLibraryVersion
Write-Host "Building azure-functions-java-worker"
cmd.exe /c '.\mvnBuild.bat'
StopOnFailedExecution
Pop-Location -StackName "libraryDir"
+# Update core tools with the new Java worker
+Write-Host "Replacing Java worker binaries in the Core Tools..."
+Get-ChildItem -Path "./azure-functions-java-worker/target/*" -Include 'azure*' -Exclude '*shaded.jar','*tests.jar' | ForEach-Object {
+ Copy-Item $_.FullName "./Azure.Functions.Cli/workers/java/azure-functions-java-worker.jar" -Force -Verbose
+}
+Copy-Item -Path ".\Azure.Functions.Cli" -Destination ".\azure-functions-java-worker\Azure.Functions.Cli" -Recurse
+
+# Updating end to end tests with the new library
+Push-Location -Path "./azure-functions-java-worker/endtoendtests" -StackName libraryDir
+Write-Host "Updating azure-functions-java-worker endtoendtests to use current version of the java core library"
+
+cmd.exe /c .\..\..\updateVersions.bat $coreLibraryVersion $libraryVersion $pluginVersion
+Write-Host "Building azure-functions-java-worker end to end tests"
+cmd.exe /c '.\..\..\mvnBuild.bat'
+StopOnFailedExecution
+Pop-Location -StackName "libraryDir"
diff --git a/updateVersions.bat b/updateVersions.bat
index e8317f7..ecb1345 100644
--- a/updateVersions.bat
+++ b/updateVersions.bat
@@ -1,7 +1,12 @@
-set libraryVersion=%1
-set pluginVersion=%2
+set coreLibraryVersion=%1
+set libraryVersion=%2
+set pluginVersion=%3
+echo setting azure.functions.java.core.library.version to %coreLibraryVersion%
+call mvn versions:set-property -Dproperty=azure.functions.java.core.library.version -DnewVersion=%coreLibraryVersion% -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
+IF DEFINED libraryVersion (
echo setting azure.functions.java.library.version to %libraryVersion%
call mvn versions:set-property -Dproperty=azure.functions.java.library.version -DnewVersion=%libraryVersion% -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
+)
IF DEFINED pluginVersion (
echo setting azure.functions.maven.plugin.version to %pluginVersion%
call mvn versions:set-property -Dproperty=azure.functions.maven.plugin.version -DnewVersion=%pluginVersion% -U -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B