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

CIs: attempt to use csources_v1 #16282

Merged
merged 10 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .builds/freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ environment:
tasks:
- setup: |
cd Nim
git clone --depth 1 -q https://github.com/nim-lang/csources.git
git clone --depth 1 -q https://github.com/nim-lang/csources_v1.git csources

This comment was marked as outdated.

gmake -C csources -j $(sysctl -n hw.ncpu)
bin/nim c --skipUserCfg --skipParentCfg koch
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
Expand Down
2 changes: 1 addition & 1 deletion .builds/openbsd_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ environment:
tasks:
- setup: |
cd Nim
git clone --depth 1 -q https://github.com/nim-lang/csources.git
git clone --depth 1 -q https://github.com/nim-lang/csources_v1.git csources
gmake -C csources -j $(sysctl -n hw.ncpuonline)
bin/nim c koch
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
Expand Down
2 changes: 1 addition & 1 deletion .builds/openbsd_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ environment:
tasks:
- setup: |
cd Nim
git clone --depth 1 -q https://github.com/nim-lang/csources.git
git clone --depth 1 -q https://github.com/nim-lang/csources_v1.git csources
gmake -C csources -j $(sysctl -n hw.ncpuonline)
bin/nim c koch
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
id: csources-version
shell: bash
run: |
sha=$(git ls-remote https://github.com/nim-lang/csources master | cut -f 1)
sha=$(git ls-remote https://github.com/nim-lang/csources_v1 master | cut -f 1)
echo "::set-output name=sha::$sha"

- name: 'Get prebuilt csources from cache'
Expand All @@ -99,7 +99,7 @@ jobs:
if: steps.csources-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: nim-lang/csources
repository: nim-lang/csources_v1
path: csources

- name: 'Build 1-stage compiler from csources'
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
echo $commitMsg | grep -v '\[skip ci\]' # fails if [skip ci] not in commit msg
displayName: 'Check whether to skip CI'

- bash: git clone --depth 1 https://github.com/nim-lang/csources
- bash: git clone --depth 1 https://github.com/nim-lang/csources_v1 csources
displayName: 'Checkout Nim csources'

- task: NodeTool@0
Expand Down
2 changes: 1 addition & 1 deletion ci/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ REM Some debug info
echo "Running on %CI_RUNNER_ID% (%CI_RUNNER_DESCRIPTION%) with tags %CI_RUNNER_TAGS%."
gcc -v

git clone --depth 1 https://github.com/nim-lang/csources.git
git clone --depth 1 https://github.com/nim-lang/csources_v1.git csources
cd csources
call build64.bat
cd ..
Expand Down
2 changes: 1 addition & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sh ci/deps.sh

# Build from C sources.
git clone --depth 1 https://github.com/nim-lang/csources.git
git clone --depth 1 https://github.com/nim-lang/csources_v1.git csources
cd csources
sh build.sh
cd ..
Expand Down
2 changes: 1 addition & 1 deletion ci/nsis_build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Rem Build csources
koch csources -d:release || exit /b

rem Grab C sources and nimsuggest
git clone --depth 1 https://github.com/nim-lang/csources.git
git clone --depth 1 https://github.com/nim-lang/csources_v1.git csources

set PATH=%CD%\bin;%PATH%

Expand Down
2 changes: 1 addition & 1 deletion compiler/extccomp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import ropes, platform, condsyms, options, msgs, lineinfos, pathutils

import std/[os, strutils, osproc, sha1, streams, sequtils, times, strtabs, json]
import os, strutils, osproc, std/sha1, streams, sequtils, times, strtabs, json

type
TInfoCCProp* = enum # properties of the C compiler:
Expand Down
6 changes: 3 additions & 3 deletions compiler/ic/cbackend.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
## also doing cross-module dependency tracking and DCE that we don't need
## anymore. DCE is now done as prepass over the entire packed module graph.

import std/[packedsets, algorithm, tables]
# std/intsets would give `UnusedImport`, pending https://github.com/nim-lang/Nim/issues/14246
import std/packedsets, algorithm, tables

import ".."/[ast, options, lineinfos, modulegraphs, cgendata, cgen,
pathutils, extccomp, msgs]

Expand Down Expand Up @@ -70,7 +70,7 @@ proc addFileToLink(config: ConfigRef; m: PSym) =
addFileToCompile(config, cf)

when defined(debugDce):
import std / [os, packedsets]
import os, std/packedsets

proc storeAliveSymsImpl(asymFile: AbsoluteFile; s: seq[int32]) =
var f = rodfiles.create(asymFile.string)
Expand Down
2 changes: 1 addition & 1 deletion compiler/ic/dce.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Dead code elimination (=DCE) for IC.

import std / [intsets, tables]
import intsets, tables
Copy link
Member

@timotheecour timotheecour Apr 20, 2021

Choose a reason for hiding this comment

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

why? compiler/ic/dce.nim and intsets are not in the same nimble package

likewise everywhere inside compiler/

Copy link
Member Author

Choose a reason for hiding this comment

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

Bootstrapping on the BSDs doesn't work otherwise.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we need csources_v1_2 instead but then I need to go through all the testing trouble again.

Copy link
Member

Choose a reason for hiding this comment

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

Bootstrapping on the BSDs doesn't work otherwise.

is a --lib:lib missing from compilation command in bootstrap? this should be fixable, at least i don't see why it couldn't work; i can take a look if needed;

Maybe we need csources_v1_2 instead

I'm still strongly arguing in favor of latest stable release (1.4.4), (see sample reasons in timotheecour#251) and I'm ready to help if that's what it takes to make it happen. But 1_2 is still better than 1_0 at least.

This PR has tons of unrelated changes to the csources_v1 topic, can't it be 2 PRs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Every change is related to bootstrapping on the BSDs. I presume there is a regression for the 1.0 line where it's pickier about 'std' than even 0.9.x is.

Copy link
Member Author

@Araq Araq Apr 20, 2021

Choose a reason for hiding this comment

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

Also, Nim v1.0 can compile 1.2, 1.4, etc, whereas Nim 1.4 cannot even compile Nim 1.2, last time I checked. We need a csources that can continue to compile the 1.0.x and 1.2.x lines which are still supported and receive backports on a regular basis.

Copy link
Member

@timotheecour timotheecour Apr 20, 2021

Choose a reason for hiding this comment

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

Also, Nim v1.0 can compile 1.2, 1.4, etc

at the price of contorsions like the above comment and many others that prevent code simplifications or using newer features that aid in development of new features/bug fixes;

many times the obvious way to write things didn't work because of boostrap. All that's needed is that each version of nim can be bootstrapped from a deterministic csources version (determined by a stored hash, see #16282 (comment))

Copy link
Member

Choose a reason for hiding this comment

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

Every change is related to bootstrapping on the BSDs. I presume there is a regression for the 1.0 line where it's pickier about 'std' than even 0.9.x is.

see #17801, how do i make bsd CI run in that PR?

Copy link
Member

@timotheecour timotheecour Apr 30, 2021

Choose a reason for hiding this comment

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

indeed, as I suspected, this is fixable simply by passing --lib:lib during bootstrap, see
#17902 for the fix + explanation

how do i make bsd CI run in that PR?

to run bsd CI, the PR I send must originate from nim-lang org, not my own fork; then it works as shown in #17902

import ".." / [ast, options, lineinfos, types]

import packed_ast, ic, bitabs
Expand Down
6 changes: 3 additions & 3 deletions compiler/ic/ic.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# distribution, for details about the copyright.
#

import std / [hashes, tables, intsets, sha1]
import hashes, tables, intsets, std/sha1
import packed_ast, bitabs, rodfiles
import ".." / [ast, idents, lineinfos, msgs, ropes, options,
pathutils, condsyms]
#import ".." / [renderer, astalgo]
from std / os import removeFile, isAbsolute
from os import removeFile, isAbsolute

type
PackedConfig* = object
Expand Down Expand Up @@ -143,7 +143,7 @@ const
debugConfigDiff = defined(debugConfigDiff)

when debugConfigDiff:
import std / [hashes, tables, intsets, sha1, strutils, sets]
import hashes, tables, intsets, sha1, strutils, sets

proc configIdentical(m: PackedModule; config: ConfigRef): bool =
result = m.definedSymbols == definedSymbolsAsString(config)
Expand Down
2 changes: 1 addition & 1 deletion compiler/ic/integrity.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## Integrity checking for a set of .rod files.
## The set must cover a complete Nim project.

import std / sets
import sets
import ".." / [ast, modulegraphs]
import packed_ast, bitabs, ic

Expand Down
2 changes: 1 addition & 1 deletion compiler/ic/navigator.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## IDE-like features. It uses the set of .rod files to accomplish
## its task. The set must cover a complete Nim project.

import std / sets
import sets

from os import nil
from std/private/miscdollars import toLocation
Expand Down
2 changes: 1 addition & 1 deletion compiler/ic/packed_ast.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
## use this representation directly in all the transformations,
## it is superior.

import std / [hashes, tables, strtabs]
import hashes, tables, strtabs
import bitabs
import ".." / [ast, options]

Expand Down
4 changes: 2 additions & 2 deletions compiler/int128.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## hold all from `low(BiggestInt)` to `high(BiggestUInt)`, This
## type is for that purpose.

from std/math import trunc
from math import trunc

type
Int128* = object
Expand Down Expand Up @@ -378,7 +378,7 @@ proc `*`*(lhs, rhs: Int128): Int128 =
proc `*=`*(a: var Int128, b: Int128) =
a = a * b

import std/bitops
import bitops

proc fastLog2*(a: Int128): int =
if a.udata[3] != 0:
Expand Down
2 changes: 1 addition & 1 deletion compiler/jsgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import
cgmeth, lowerings, sighashes, modulegraphs, lineinfos, rodutils,
transf, injectdestructors, sourcemap

import std/[json, sets, math, tables, intsets, strutils]
import json, sets, math, tables, intsets, strutils

from modulegraphs import ModuleGraph, PPassContext

Expand Down
2 changes: 1 addition & 1 deletion compiler/lookups.nim
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ when false:
of 'a'..'z': result = getIdent(c.cache, toLowerAscii(x.s[0]) & x.s.substr(1))
else: result = x

import std/[editdistance, heapqueue]
import std/editdistance, heapqueue

type SpellCandidate = object
dist: int
Expand Down
2 changes: 1 addition & 1 deletion compiler/modulegraphs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## represents a complete Nim project. Single modules can either be kept in RAM
## or stored in a rod-file.

import std / [intsets, tables, hashes, md5]
import intsets, tables, hashes, md5
import ast, astalgo, options, lineinfos,idents, btrees, ropes, msgs, pathutils
import ic / [packed_ast, ic]

Expand Down
2 changes: 1 addition & 1 deletion compiler/nilcheck.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#

import ast, renderer, intsets, tables, msgs, options, lineinfos, strformat, idents, treetab, hashes
import sequtils, strutils, std / sets
import sequtils, strutils, sets

# IMPORTANT: notes not up to date, i'll update this comment again
#
Expand Down
2 changes: 1 addition & 1 deletion compiler/nim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import
idents, lineinfos, cmdlinehelper,
pathutils, modulegraphs

from std/browsers import openDefaultBrowser
from browsers import openDefaultBrowser
from nodejs import findNodeJs

when hasTinyCBackend:
Expand Down
2 changes: 1 addition & 1 deletion compiler/nimpaths.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interpolation variables:
Unstable API
]##

import std/[os,strutils]
import os, strutils

const
docCss* = "$nimr/doc/nimdoc.css"
Expand Down
2 changes: 1 addition & 1 deletion compiler/rodutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#

## Serialization utilities for the compiler.
import std/[strutils, math]
import strutils, math

# bcc on windows doesn't have C99 functions
when defined(windows) and defined(bcc):
Expand Down
2 changes: 1 addition & 1 deletion compiler/semdata.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## This module contains the data structures for the semantic checking phase.

import std / tables
import tables

import
intsets, options, ast, astalgo, msgs, idents, renderer,
Expand Down
2 changes: 1 addition & 1 deletion compiler/semtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# this module does the semantic checking of type declarations
# included from sem.nim

import std/math
import math

const
errStringOrIdentNodeExpected = "string or ident node expected"
Expand Down
2 changes: 1 addition & 1 deletion compiler/vmdef.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## This module contains the type definitions for the new evaluation engine.
## An instruction is 1-3 int32s in memory, it is a register based VM.

import std / tables
import tables

import ast, idents, options, modulegraphs, lineinfos

Expand Down
2 changes: 1 addition & 1 deletion compiler/vmgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# solves the opcLdConst vs opcAsgnConst issue. Of course whether we need
# this copy depends on the involved types.

import std / tables
import tables

import
strutils, ast, types, msgs, renderer, vmdef,
Expand Down
16 changes: 8 additions & 8 deletions compiler/vmops.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@

# Unfortunately this cannot be a module yet:
#import vmdeps, vm
from std/math import sqrt, ln, log10, log2, exp, round, arccos, arcsin,
from math import sqrt, ln, log10, log2, exp, round, arccos, arcsin,
arctan, arctan2, cos, cosh, hypot, sinh, sin, tan, tanh, pow, trunc,
floor, ceil, `mod`, cbrt, arcsinh, arccosh, arctanh, erf, erfc, gamma,
lgamma

when declared(math.copySign):
from std/math import copySign
from math import copySign

when declared(math.signbit):
from std/math import signbit
from math import signbit

from std/os import getEnv, existsEnv, dirExists, fileExists, putEnv, walkDir,
from os import getEnv, existsEnv, dirExists, fileExists, putEnv, walkDir,
getAppFilename, raiseOSError, osLastError

from std/md5 import getMD5
from std/times import cpuTime
from std/hashes import hash
from std/osproc import nil
from md5 import getMD5
from times import cpuTime
from hashes import hash
from osproc import nil

from sighashes import symBodyDigest

Expand Down
Loading