Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to dotnet core 2.2 #73

Merged
merged 15 commits into from
Jul 23, 2019
Merged

Upgrade to dotnet core 2.2 #73

merged 15 commits into from
Jul 23, 2019

Conversation

milbrandt
Copy link
Collaborator

@milbrandt milbrandt commented Jul 6, 2019

see discussion in Issue #26

FsSonarRunner upgraded to self-contained dotnet Core 2.2 application. Build contains runners for

  • Windows x64 - tested with 1.2.204-ci
  • Linux x64
  • Os-X x 64

As I have only Windows build servers would be good if someone could also test Linux or Os-X environment.

Update: OX-X canceled after first Tests and to shrink jar.

@milbrandt milbrandt self-assigned this Jul 6, 2019
@milbrandt milbrandt added this to the Update to dotnet Core milestone Jul 6, 2019
@milbrandt milbrandt requested a review from jmecosta July 6, 2019 12:43
<include>*.exe</include>
<include>*.config</include>
<include>*/FSharp.Core.resources.dll</include>
<include>win-x86/**</include>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plugin is now quiet large - about 100MB. That's because of 3 self-contained dotnet runners.
On out server the next largest is Cfamily-plugin with only 27MB.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was my concern! most likely this will be a problem if uploading the plugin to marketplace. 100MB might also affect analysis times.

the alternative as I mentioned, would be to force users to have a dot net core runtime. What is your opinion?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also could be considerer to be create as a dotnet global tool.

Ex: dotnet tool install --global --add-source . OpenCoverPathConverter => https://github.com/jmecsoftware/OpenCover2SonarConverter/releases

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either require users to have dotnet core installed or have different budles depending on OS.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now configured it as Framework-dependent executables (FDE). This includes all except the dotnet core runtime.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jar file is about 20MB for all 3 operating systems

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

@milbrandt

This comment has been minimized.

@milbrandt milbrandt force-pushed the feature/dotnetCore branch from b2fdd08 to ff69c5e Compare July 7, 2019 20:23
@milbrandt

This comment has been minimized.

@jmecosta

This comment has been minimized.

@milbrandt

This comment has been minimized.

@jmecosta

This comment has been minimized.

@milbrandt

This comment has been minimized.

@jmecosta
Copy link
Owner

[22:25:12]
[Step 1/1] ERROR: Error during SonarQube Scanner execution
[22:25:12]
[Step 1/1] ERROR: java.io.IOException: Cannot run program "/opt/teamcity_1/work/eb0e872d80a5add3/.scannerwork/ProjectTools/linux-x86/FsSonarRunner": error=13, Permission denied
[22:25:12]
[Step 1/1] ERROR: Caused by: Cannot run program "/opt/teamcity_1/work/eb0e872d80a5add3/.scannerwork/ProjectTools/linux-x86/FsSonarRunner": error=13, Permission denied
[22:25:12]
[Step 1/1] ERROR: Caused by: error=13, Permission denied
[22:25:12]
[Step 1/1] ERROR:
[22:25:12]
[Step 1/1] ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
[22:25:12]
[Step 1/1] [CxxSonarQubeMsbuidRunner] Failed analyze project, check log

Seems the FsSonarRunner is being packaged without execution permissions.

@jmecosta
Copy link
Owner

[22:30:57]
[Step 1/1] ERROR: java.io.IOException: Cannot run program "/buildAgent/work/eb0e872d80a5add3/.scannerwork/ProjectTools/osx-x86/FsSonarRunner": error=2, No such file or directory
[22:30:57]
[Step 1/1] ERROR: Caused by: Cannot run program "/buildAgent/work/eb0e872d80a5add3/.scannerwork/ProjectTools/osx-x86/FsSonarRunner": error=2, No such file or directory
[22:30:57]
[Step 1/1] ERROR: Caused by: error=2, No such file or directory

@jmecosta

This comment has been minimized.

@milbrandt

This comment has been minimized.

@milbrandt

This comment has been minimized.

Copy link
Owner

@jmecosta jmecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Did you use the build from appveyor on your machines for sonar execution or your local build?

* In the log I can see the three dotnet-publish steps. Are the results available in `FsSonarRunner\FsSonarRunner\publish? In the log is unfortunately only Maven output, not the dotnet Output to console included.

yep, all 3 targets were created. But still it did fail

<include>*.exe</include>
<include>*.config</include>
<include>*/FSharp.Core.resources.dll</include>
<include>win-x86/**</include>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was my concern! most likely this will be a problem if uploading the plugin to marketplace. 100MB might also affect analysis times.

the alternative as I mentioned, would be to force users to have a dot net core runtime. What is your opinion?

<include>*.exe</include>
<include>*.config</include>
<include>*/FSharp.Core.resources.dll</include>
<include>win-x86/**</include>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also could be considerer to be create as a dotnet global tool.

Ex: dotnet tool install --global --add-source . OpenCoverPathConverter => https://github.com/jmecsoftware/OpenCover2SonarConverter/releases

@milbrandt

This comment has been minimized.

@milbrandt

This comment has been minimized.

@jmecosta

This comment has been minimized.

@jmecosta

This comment has been minimized.

@milbrandt

This comment has been minimized.

@milbrandt
Copy link
Collaborator Author

milbrandt commented Jul 13, 2019

Wouldn't "to be create as a dotnet global tool" also require an Installation on the build server of dotnet Core? I'm reluctant as I just failed with FDE deployment - where only .NET Core 2.1 was installed.

@milbrandt
Copy link
Collaborator Author

f you can figure out Linux and/or OS-X issues just push in this PR.

dotnet/cli#6286

Tried to set executable flag from Java. Can you please test if this works?

@jmecosta
Copy link
Owner

Wouldn't "to be create as a dotnet global tool" also require an Installation on the build server of dotnet Core? I'm reluctant as I just failed with FDE deployment - where only .NET Core 2.1 was installed.

yeah your are right! so lets get the flags working

@jmecosta
Copy link
Owner

f you can figure out Linux and/or OS-X issues just push in this PR.
dotnet/cli#6286

Tried to set executable flag from Java. Can you please test if this works?

works now, however the hack https://github.com/jmecsoftware/sonar-fsharp-plugin/blob/8025038c0431444e4311eca378f0da512e4b6da7/FsSonarRunner/FsSonarRunner/Program.fs#L70 that ive made now is cutting one extra /, so it can find any file. Do u know how to pass absolute path from java side directly? the hack was done originally because i was not able to find a way to pass absolute path from java side since they change quite a bit the api.

# Conflicts:
#	README.md
#	appveyor.yml
#	sonar-communityfsharp-plugin/src/main/java/org/sonar/plugins/fsharp/FSharpSensor.java
#	sonar-communityfsharp-plugin/src/main/java/org/sonar/plugins/fsharp/utils/OSInfo.java
@milbrandt
Copy link
Collaborator Author

milbrandt commented Jul 16, 2019

works now, however the hack
sonar-fsharp-plugin/FsSonarRunner/FsSonarRunner/Program.fs

     Line 70
       |> Seq.iter (fun file -> handleFileToAnalyse(file.Replace("file:///", ""))) 

that ive made now is cutting one extra /, so it can find any file. Do u know how to pass absolute path from java side directly? the hack was done originally because i was not able to find a way to pass absolute path from java side since they change quite a bit the api.

SonarQube gves the hint, it might be not an file URI. But otherwise, a not so elegant solution would be

      Paths.get(file.uri()).toAbsolutePath()

Update: As this is Independent of this PR I'll make a small separate PR #77 for this.

milbrandt added a commit that referenced this pull request Jul 16, 2019
@jmecosta
Copy link
Owner

i still do a quick test, see if everything works in linuyx and osx

@jmecosta
Copy link
Owner

Linux ok

OSx nok,
[21:50:28]
[Step 1/1] ERROR: Error during SonarQube Scanner execution
[21:50:28]
[Step 1/1] ERROR: java.io.IOException: Cannot run program "/buildAgent/work/eb0e872d80a5add3/.scannerwork/ProjectTools/osx-x86/FsSonarRunner": error=13, Permission denied
[21:50:28]
[Step 1/1] ERROR: Caused by: Cannot run program "/buildAgent/work/eb0e872d80a5add3/.scannerwork/ProjectTools/osx-x86/FsSonarRunner": error=13, Permission denied
[21:50:28]
[Step 1/1] ERROR: Caused by: error=13, Permission denied

Supose we could for now just release windows and linux suport, leave OSx for another time

@milbrandt
Copy link
Collaborator Author

Linux ok
OSx nok,
...
[Step 1/1] ERROR: Caused by: error=13, Permission denied
Supose we could for now just release windows and linux suport, leave OSx for another time

I'll go and evaluate if changing permissions was successful. For me it's ok to remove OS-X, the jar will get smaller. But we should then do a quick retest on the systems again.

@jmecosta
Copy link
Owner

linux ok
osx nok

@jmecosta jmecosta closed this Jul 19, 2019
@milbrandt
Copy link
Collaborator Author

@jmecosta Did you close this PR by intend without merging?

@milbrandt
Copy link
Collaborator Author

milbrandt commented Jul 20, 2019

As proposed I removed Thursday evening OS-X from the build (which shrunk the jar).

As I never ever worked with Apple products: Can we build self-contained .NET Core for OS-X on Windows? As far as I remember it was not possible for Xamarin.
Other .NET Core builds are working on your OS-X? The requirements are satisfied, especially OpenSSL installed?

@jmecosta jmecosta reopened this Jul 21, 2019
@jmecosta
Copy link
Owner

Not sure what happen, was supose to be an approve

@milbrandt
Copy link
Collaborator Author

Not sure what happen, was supose to be an approve

Seems like current build 248 is running for me on windows. If you can approve it for Linux, it's good. On OS-X the build should still work. I saw there is some possibility to add an warning when an analysis was not executed, maybe we can include something like that in the furture. Personally I would like to merge this first.

@jmecosta
Copy link
Owner

Go ahead then. All ok for me

@milbrandt milbrandt merged commit 1f58a4c into master Jul 23, 2019
@milbrandt milbrandt deleted the feature/dotnetCore branch August 3, 2019 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants