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