Skip to content

Commit

Permalink
Remove analytics and all references to it (#6)
Browse files Browse the repository at this point in the history
While its nice, the current implemtation is broken (Relies on old
osinfo) and I don't want to waste time fixing it

Should also make it faster since it wont be reporting anymore
  • Loading branch information
ire4ever1190 committed Jan 23, 2024
1 parent db64a40 commit ebcd902
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 316 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
tags:
- "v*"

env:
ZIG_SYSTEM_LINKER_HACK: 1

jobs:
build:
timeout-minutes: 45
Expand Down Expand Up @@ -39,11 +42,11 @@ jobs:
# MacOS builds
- os: macos-latest
target: aarch64-macos-none
suffix: macos_arm64
suffix: macosx_arm64
cpu: arm64
- os: macos-latest
target: x86_64-macos-none
suffix: macos_amd64
suffix: macosx_amd64
cpu: amd64
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.target }}
Expand All @@ -68,7 +71,7 @@ jobs:
nimble -y build -d:noBuildProxy -d:zig.target="${{ matrix.target }}" --cpu:"${{ matrix.cpu }}" -d:release --opt:size
- name: Update file name
if: ${{ matrix.os == 'ubuntu-latest' || matrix == 'macos-latest' }}
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
run: mv bin/choosenim bin/choosenim-${{ github.ref_name }}_${{ matrix.suffix }}
- name: Update file name
if: ${{ matrix.os == 'windows-latest' }}
Expand Down Expand Up @@ -104,21 +107,13 @@ jobs:
with:
path: site/

# https://stackoverflow.com/questions/1500204/how-do-i-remove-specific-characters-from-file-names-using-bash
- name: Remove enclosing folder and fix names
working-directory: site
run: |
for file in *; do
mv "${file}/${file}" "${file/${{ github.ref_name }}/latest}";
done
- name: Add latest version
run: echo "${{ github.ref_name }}" >> site/stable

- name: Setup Nim
uses: jiro4989/setup-nim-action@v1
with:
version: devel
nim-version: devel
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Create index
Expand Down
98 changes: 0 additions & 98 deletions analytics.md

This file was deleted.

4 changes: 1 addition & 3 deletions choosenim.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ skipExt = @["nim"]

# Note: https://github.com/dom96/choosenim/issues/233 (need to resolve when updating Nimble)
requires "nim >= 1.2.6", "nimble#8f7af86"
when defined(macosx):
requires "libcurl >= 1.0.0"
requires "analytics >= 0.3.0"
requires "libcurl >= 1.0.0"
requires "https://github.com/ire4ever1190/osinfo#aa7d296"
requires "zippy >= 0.7.2"
when defined(windows):
Expand Down
9 changes: 9 additions & 0 deletions config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ if target != "":
let targetArgs = "-target " & target
switch("passL", targetArgs)
switch("passC", targetArgs)

when defined(macosx):
# We need to define extra search paths
# Found via the default paths here
# https://discussions.apple.com/thread/2390561?sortBy=best#11330927022
switch("passL", "-F/Library/Frameworks -F/System/Library/Frameworks -F/System/Library/Frameworks/Security.framework -L/usr/lib -L/usr/local/lib")
switch("passL", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")

switch("d", "zippyNoSimd")
6 changes: 0 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ Options:
--firstInstall Used by install script.
```

## Analytics

Check out the
[analytics](https://github.com/dom96/choosenim/blob/master/analytics.md)
document for details.

## License

MIT
10 changes: 1 addition & 9 deletions src/choosenim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import nimblepkg/common as nimbleCommon
from nimblepkg/packageinfo import getNameVersion

import choosenimpkg/[download, builder, switcher, common, cliparams, versions]
import choosenimpkg/[utils, channel, telemetry]
import choosenimpkg/[utils, channel]

when defined(windows):
import choosenimpkg/env
Expand Down Expand Up @@ -55,8 +55,6 @@ proc safeSwitchTo(version: Version, params: CliParams, wasInstalled: bool) =
except Exception as exc:
display("Warning:", "Cleaning failed: " & exc.msg, Warning)

# Report telemetry.
report(initEvent(ErrorEvent, label=exc.msg), params)
raise newException(ChooseNimError, "Installation failed")

proc chooseVersion(version: string, params: CliParams) =
Expand Down Expand Up @@ -328,8 +326,6 @@ proc remove(params: CliParams) =


proc performAction(params: CliParams) =
# Report telemetry.
report(initEvent(ActionEvent), params)

case params.command.normalize
of "update":
Expand All @@ -350,14 +346,10 @@ when isMainModule:
try:
parseCliParams(params)
createDir(params.chooseNimDir)
discard loadAnalytics(params)
performAction(params)
except NimbleError:
let currentExc = (ref NimbleError)(getCurrentException())
(error, hint) = getOutputInfo(currentExc)
# Report telemetry.
report(currentExc, params)
report(initEvent(ErrorEvent, label=currentExc.msg), params)

if error.len > 0:
displayTip()
Expand Down
11 changes: 1 addition & 10 deletions src/choosenimpkg/builder.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import os, times
import nimblepkg/[version, cli]
import nimblepkg/common as nimble_common

import cliparams, download, utils, common, telemetry
import cliparams, download, utils, common

when defined(windows):
import switcher
Expand Down Expand Up @@ -109,7 +109,6 @@ proc setPermissions() =

proc build*(extractDir: string, version: Version, params: CliParams) =
# Report telemetry.
report(initEvent(BuildEvent), params)
let startTime = epochTime()

let currentDir = getCurrentDir()
Expand Down Expand Up @@ -161,10 +160,6 @@ proc build*(extractDir: string, version: Version, params: CliParams) =
except Exception as exc:
display("Warning:", "Cleaning c_code failed: " & exc.msg, Warning)

# Report telemetry.
report(initEvent(BuildSuccessEvent), params)
report(initTiming(BuildTime, $version, startTime, $LabelSuccess), params)

if not success and not params.skipClean:
# Perform clean up.
display("Cleaning", "failed build", priority = HighPriority)
Expand All @@ -174,7 +169,3 @@ proc build*(extractDir: string, version: Version, params: CliParams) =
removeDir(extractDir)
except Exception as exc:
display("Warning:", "Cleaning failed: " & exc.msg, Warning)

# Report telemetry.
report(initEvent(BuildFailureEvent), params)
report(initTiming(BuildTime, $version, startTime, $LabelFailure), params)
2 changes: 1 addition & 1 deletion src/choosenimpkg/channel.nim
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ proc setCurrentChannel*(channel: string, params: CliParams) =
proc getCurrentChannel*(params: CliParams): string =
if not fileExists(params.getCurrentChannelFile()):
return ""
return readFile(params.getCurrentChannelFile()).strip()
return readFile(params.getCurrentChannelFile()).strip()
2 changes: 0 additions & 2 deletions src/choosenimpkg/cliparams.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import parseopt, strutils, os

import nimblepkg/[cli, options, config]
import nimblepkg/common as nimble_common
import analytics

import common

Expand All @@ -13,7 +12,6 @@ type
choosenimDir*: string
firstInstall*: bool
nimbleOptions*: Options
analytics*: PuppyAnalytics
pendingReports*: int ## Count of pending telemetry reports.
force*: bool
latest*: bool
Expand Down
5 changes: 1 addition & 4 deletions src/choosenimpkg/download.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import nimblepkg/[version, cli]
when defined(curl):
import libcurl except Version

import cliparams, common, telemetry, utils
import cliparams, common, utils

const
githubTagReleasesUrl = "https://api.github.com/repos/nim-lang/Nim/tags"
Expand Down Expand Up @@ -218,16 +218,13 @@ proc downloadFile*(url, outputPath: string, params: CliParams) =
let msg = "Couldn't download file from $1.\nResponse was: $2" %
[url, getCurrentExceptionMsg()]
display("Info:", msg, Warning, MediumPriority)
report(initTiming(DownloadTime, url, startTime, $LabelFailure), params)
raise

moveFile(tempOutputPath, outputPath)

showBar(1, 0)
echo("")

report(initTiming(DownloadTime, url, startTime, $LabelSuccess), params)

proc needsDownload(params: CliParams, downloadUrl: string,
outputPath: var string): bool =
## Returns whether the download should commence.
Expand Down
3 changes: 2 additions & 1 deletion src/choosenimpkg/switcher.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ proc compileProxyexe() =
let (output, exitCode) = gorgeEx(cmd)
doAssert exitCode == 0, $(output, cmd)

static: compileProxyexe()
when not defined(noBuildProxy):
static: compileProxyexe()

const
proxyExe = staticRead("proxyexe".addFileExt(ExeExt))
Expand Down
Loading

0 comments on commit ebcd902

Please sign in to comment.