mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-24 09:32:34 +03:00
refactor: translateFinal -> finalTranslate to make it more consistent with naming from nixpkgs and home-manager
This commit is contained in:
parent
22d09979c1
commit
33b93b20e9
@ -54,7 +54,7 @@ in
|
|||||||
if [ ! -e "$bin" ]; then
|
if [ ! -e "$bin" ]; then
|
||||||
echo "building executable for translator $translator"
|
echo "building executable for translator $translator"
|
||||||
${callNixWithD2N} build -o "$bin" "
|
${callNixWithD2N} build -o "$bin" "
|
||||||
dream2nix.framework.translators.$translator.translateBinFinal
|
dream2nix.framework.translators.$translator.finalTranslateBin
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -51,7 +51,7 @@ utils.writePureShellScriptBin
|
|||||||
translateBin="$TRANSLATOR_DIR/$translator"
|
translateBin="$TRANSLATOR_DIR/$translator"
|
||||||
else
|
else
|
||||||
translateBin=$(${callNixWithD2N} build --print-out-paths --no-link "
|
translateBin=$(${callNixWithD2N} build --print-out-paths --no-link "
|
||||||
dream2nix.framework.translators.$translator.translateBinFinal
|
dream2nix.framework.translators.$translator.finalTranslateBin
|
||||||
")
|
")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ in let
|
|||||||
l.forEach projectsPureUnresolved
|
l.forEach projectsPureUnresolved
|
||||||
(proj: let
|
(proj: let
|
||||||
translator = getTranslator proj.translator;
|
translator = getTranslator proj.translator;
|
||||||
dreamLock'' = translator.translateFinal {
|
dreamLock'' = translator.finalTranslate {
|
||||||
inherit source tree discoveredProjects;
|
inherit source tree discoveredProjects;
|
||||||
project = proj;
|
project = proj;
|
||||||
};
|
};
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
(builtins.fromJSON
|
(builtins.fromJSON
|
||||||
(builtins.unsafeDiscardStringContext (builtins.readFile '''$1''')));
|
(builtins.unsafeDiscardStringContext (builtins.readFile '''$1''')));
|
||||||
dreamLock' =
|
dreamLock' =
|
||||||
dream2nix.framework.translatorsBySubsystem.${subsystem}.${name}.translateFinal
|
dream2nix.framework.translatorsBySubsystem.${subsystem}.${name}.finalTranslate
|
||||||
translatorArgs;
|
translatorArgs;
|
||||||
# simpleTranslate2 puts dream-lock in result
|
# simpleTranslate2 puts dream-lock in result
|
||||||
dreamLock = dreamLock'.result or dreamLock';
|
dreamLock = dreamLock'.result or dreamLock';
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
config = {
|
config = {
|
||||||
translateFinal = args:
|
finalTranslate = args:
|
||||||
if config.translate != null
|
if config.translate != null
|
||||||
then
|
then
|
||||||
config.translate
|
config.translate
|
||||||
@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
else null;
|
else null;
|
||||||
translateBinFinal =
|
finalTranslateBin =
|
||||||
if config.translate != null
|
if config.translate != null
|
||||||
then
|
then
|
||||||
framework.functions.translators.wrapPureTranslator
|
framework.functions.translators.wrapPureTranslator
|
||||||
|
@ -46,7 +46,7 @@ in {
|
|||||||
type = t.nullOr (t.functionTo t.attrs);
|
type = t.nullOr (t.functionTo t.attrs);
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
translateFinal = lib.mkOption {
|
finalTranslate = lib.mkOption {
|
||||||
type = t.nullOr (t.functionTo t.attrs);
|
type = t.nullOr (t.functionTo t.attrs);
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
description = ''
|
description = ''
|
||||||
@ -57,7 +57,7 @@ in {
|
|||||||
type = t.nullOr t.package;
|
type = t.nullOr t.package;
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
translateBinFinal = lib.mkOption {
|
finalTranslateBin = lib.mkOption {
|
||||||
type = t.nullOr t.package;
|
type = t.nullOr t.package;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
popd
|
popd
|
||||||
|
|
||||||
# execute cabal-plan translator
|
# execute cabal-plan translator
|
||||||
${translators.cabal-plan.translateBinFinal} $TMPDIR/newJsonInput
|
${translators.cabal-plan.finalTranslateBin} $TMPDIR/newJsonInput
|
||||||
|
|
||||||
# finalize dream-lock. Add source and export default package
|
# finalize dream-lock. Add source and export default package
|
||||||
# set correct package version under `packages`
|
# set correct package version under `packages`
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
popd
|
popd
|
||||||
|
|
||||||
# call package-lock translator
|
# call package-lock translator
|
||||||
${translators.package-lock.translateBinFinal} $TMPDIR/newJsonInput
|
${translators.package-lock.finalTranslateBin} $TMPDIR/newJsonInput
|
||||||
|
|
||||||
# get resolved package version
|
# get resolved package version
|
||||||
export version=$(npm view $candidate version)
|
export version=$(npm view $candidate version)
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
jq ".source = \"$newSource\"" -c -r $jsonInput > $TMPDIR/newJsonInput
|
jq ".source = \"$newSource\"" -c -r $jsonInput > $TMPDIR/newJsonInput
|
||||||
|
|
||||||
popd
|
popd
|
||||||
${translators.package-lock.translateBinFinal} $TMPDIR/newJsonInput
|
${translators.package-lock.finalTranslateBin} $TMPDIR/newJsonInput
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# inherit options from package-lock translator
|
# inherit options from package-lock translator
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
jq ".source = \"$newSource\"" -c -r $jsonInput > $TMPDIR/newJsonInput
|
jq ".source = \"$newSource\"" -c -r $jsonInput > $TMPDIR/newJsonInput
|
||||||
popd
|
popd
|
||||||
${translators.composer-lock.translateBinFinal} $TMPDIR/newJsonInput
|
${translators.composer-lock.finalTranslateBin} $TMPDIR/newJsonInput
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# inherit options from composer-lock translator
|
# inherit options from composer-lock translator
|
||||||
|
@ -61,10 +61,10 @@
|
|||||||
if [ -f $TMPDIR/source/composer.lock ]
|
if [ -f $TMPDIR/source/composer.lock ]
|
||||||
then
|
then
|
||||||
echo 'Translating with composer-lock'
|
echo 'Translating with composer-lock'
|
||||||
${translators.composer-lock.translateBinFinal} $TMPDIR/newJsonInput
|
${translators.composer-lock.finalTranslateBin} $TMPDIR/newJsonInput
|
||||||
else
|
else
|
||||||
echo 'Translating with composer-json'
|
echo 'Translating with composer-json'
|
||||||
${translators.composer-json.translateBinFinal} $TMPDIR/newJsonInput
|
${translators.composer-json.finalTranslateBin} $TMPDIR/newJsonInput
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add main package source info to dream-lock.json
|
# add main package source info to dream-lock.json
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
popd
|
popd
|
||||||
|
|
||||||
if [ $cargoResult -eq 0 ]; then
|
if [ $cargoResult -eq 0 ]; then
|
||||||
${translators.cargo-lock.translateBinFinal} $TMPDIR/newJsonInput
|
${translators.cargo-lock.finalTranslateBin} $TMPDIR/newJsonInput
|
||||||
else
|
else
|
||||||
echo "cargo failed to generate the lockfile"
|
echo "cargo failed to generate the lockfile"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -55,9 +55,9 @@
|
|||||||
|
|
||||||
# we don't need to run cargo-toml translator if Cargo.lock exists
|
# we don't need to run cargo-toml translator if Cargo.lock exists
|
||||||
if [ -f "$TMPDIR/source/Cargo.lock" ]; then
|
if [ -f "$TMPDIR/source/Cargo.lock" ]; then
|
||||||
${translators.cargo-lock.translateBinFinal} $TMPDIR/newJsonInput
|
${translators.cargo-lock.finalTranslateBin} $TMPDIR/newJsonInput
|
||||||
else
|
else
|
||||||
${translators.cargo-toml.translateBinFinal} $TMPDIR/newJsonInput
|
${translators.cargo-toml.finalTranslateBin} $TMPDIR/newJsonInput
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add main package source info to dream-lock.json
|
# add main package source info to dream-lock.json
|
||||||
|
@ -206,7 +206,7 @@ in
|
|||||||
''
|
''
|
||||||
dreamLockPath="${project.dreamLockPath}"
|
dreamLockPath="${project.dreamLockPath}"
|
||||||
|
|
||||||
${translator.translateBinFinal} ${argsJsonFile}
|
${translator.finalTranslateBin} ${argsJsonFile}
|
||||||
|
|
||||||
# aggregate source hashes
|
# aggregate source hashes
|
||||||
if [ "${l.toJSON aggregate}" == "true" ]; then
|
if [ "${l.toJSON aggregate}" == "true" ]; then
|
||||||
|
@ -65,7 +65,7 @@ def check_format_sourceSpec(sourceSpec):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_packageName(p):
|
def test_packageName(p):
|
||||||
defaultPackage = nix_ffi.eval(
|
defaultPackage = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
@ -81,7 +81,7 @@ def test_packageName(p):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_exportedPackages(p):
|
def test_exportedPackages(p):
|
||||||
exportedPackages = nix_ffi.eval(
|
exportedPackages = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
@ -97,7 +97,7 @@ def test_exportedPackages(p):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_extraObjects(p):
|
def test_extraObjects(p):
|
||||||
extraObjects = nix_ffi.eval(
|
extraObjects = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
@ -121,7 +121,7 @@ def test_extraObjects(p):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_location(p):
|
def test_location(p):
|
||||||
location = nix_ffi.eval(
|
location = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
@ -136,7 +136,7 @@ def test_location(p):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_serializedRawObjects(p):
|
def test_serializedRawObjects(p):
|
||||||
serializedRawObjects = nix_ffi.eval(
|
serializedRawObjects = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
@ -159,7 +159,7 @@ def test_serializedRawObjects(p):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_subsystemName(p):
|
def test_subsystemName(p):
|
||||||
subsystemName = nix_ffi.eval(
|
subsystemName = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
@ -175,7 +175,7 @@ def test_subsystemName(p):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_subsystemAttrs(p):
|
def test_subsystemAttrs(p):
|
||||||
subsystemAttrs = nix_ffi.eval(
|
subsystemAttrs = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
@ -191,7 +191,7 @@ def test_subsystemAttrs(p):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_translatorName(p):
|
def test_translatorName(p):
|
||||||
translatorName = nix_ffi.eval(
|
translatorName = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
@ -207,7 +207,7 @@ def test_translatorName(p):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_extractors(p):
|
def test_extractors(p):
|
||||||
finalObjects = nix_ffi.eval(
|
finalObjects = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
@ -241,7 +241,7 @@ def test_extractors(p):
|
|||||||
@pytest.mark.parametrize("p", projects)
|
@pytest.mark.parametrize("p", projects)
|
||||||
def test_keys(p):
|
def test_keys(p):
|
||||||
objectsByKey = nix_ffi.eval(
|
objectsByKey = nix_ffi.eval(
|
||||||
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.translateFinal",
|
f"framework.translatorsBySubsystem.{p['subsystem']}.{p['translator']}.finalTranslate",
|
||||||
params=dict(
|
params=dict(
|
||||||
project=p['project'],
|
project=p['project'],
|
||||||
source=p['source'],
|
source=p['source'],
|
||||||
|
Loading…
Reference in New Issue
Block a user