Custom Parameters for Custom Operations

Do you want to request a feature, report a bug, or improve documentation?
This is a new feature that will add the ability to add custom parameters for custom operations.
For example, I currently have
/Medication/:id/$sig?code=AgeInDays|2200

with the config being
{
	name: 'sig-by-ndc',
	route: '/:id/$sig',
	method: 'GET'
}

I would like to be able to support
/Medication/:id/$sig?AgeInDays=2200

Currently the metadata configuration is only supported at the route level and not the operation level.

I had assumed custom searchParams would work on operations as well. Inability to add custom params really handicaps the Custom Operations feature.
Hello @jtravan3 , any thoughts on target release/timeline for this feature or how hard it is to implement given metadata config is already available for Resource routes (I'm new to this project. Trying things out since 2 weeks).
Thanks!

Not exactly related.. Custom Operations defined for individual Resources are not being listed under their corresponding Resource in CapabilityStatement of /metdata response.
Example:
My profiles' config looks like this
		[RESOURCES.PATIENT]: {
			service: './app/services/patient/patient.service.js',
			versions: [ VERSIONS['4_0_0'], VERSIONS['3_0_1'] ],
			metadata: path.resolve('./app/services/patient/patient.metadata.js'),
			operation: [{
				name: 'everything',
				route: '/$everything',
				method: 'GET',
				reference: 'https://www.hl7.org/fhir/patient-operation-everything-inline.html'
			}, {
				name: 'everything-by-id',
				route: '/:id/$everything',
				method: 'GET',
				reference: 'https://www.hl7.org/fhir/patient-operation-everything-inline.html'
			}]
		},

Response from http://localhost:3000/4_0_0/metadata
{
    "resourceType": "CapabilityStatement",
    "status": "active",
    "date": "2019-05-13T12:31:41-04:00",
    "publisher": "Not provided",
    "kind": "instance",
    "software": {
        "name": "FHIR Server",
        "version": "1.4.0"
    },
    "implementation": {
        "description": "FHIR Test Server (R4)"
    },
    "fhirVersion": "4.0.0",
    "format": [
        "application/fhir+json"
    ],
    "rest": [{
        "mode": "server",
        "resource": [{
                "type": "Patient",
                "profile": {},// snipped
                "interaction": [],// snipped
                "searchInclude": [],// snipped
                "searchParam": []// snipped
            },
            {} // snipped
        ],
        "operation": [{
                "name": "everything",
                "definition": {
                    "reference": "https://www.hl7.org/fhir/patient-operation-everything-inline.html"
                }
            },
            {
                "name": "everything-by-id",
                "definition": {
                    "reference": "https://www.hl7.org/fhir/patient-operation-everything-inline.html"
                }
            }
        ]
    }]
}

I was expecting the operations everything and everything-by-id to be listed at rest.resource.[x].operation but they are available at rest.operation instead. Is this expected behaviour?
Thanks

It shouldn't be a huge effort to get this added. I planned to work on it as soon as this issue was agreed upon. I would say less than a week once I got started.

Did you mean you have added this feature already? Is this available on some branch?

No, this is not added yet but I can begin working on a PR.

Hey @jtravan3, this sounds pretty good to me. Would you be able to fork off the feat/version_2_0_0 branch. We have two PR's up now and have a review to get these and released tomorrow morning.  2.0.0 has significant changes and we would prefer new features start in that branch (we do plan to maintain non 2.0.0 branches so we can retrofit it there as well if people do not want to upgrade to 2.0.0).
We have even been internally thinking of ways we can support this. One was to pass in optional arguments in the config and then just mixing them in with the defaults.
Another, which works currently in 2.0.0 by default, is that 2.0.0 now passes the original request through to services, meaning you can use our sanitized args, or, you can grab the raw args from the request.  So for example, in 2.0.0, you can do the following for your use case where your config looks like this:
{
  name: 'sig-by-ndc',
  route: '/:id/$sig',
  method: 'GET'
}

Your service could looks something like this:
module.exports.sigByNdc = (args, context) => {
  let { req } = context;
  let AgeInDays = req.query.AgeInDays; // for GET, for a POST, use req.body.AgeInDays instead
};

However in 2.0.0, this would allow you to access any parameters you desire, but there would need to be more work to ensure it shows up in the capability statement in the appropriate section.
@navndn As for the capability statement, I will need to check on that and get back to you. I have been a little pre occupied trying to get everything ready for Seattle dev days, new releases, and some infrastructure related items.

If that is supported in 2.0.0 then we will probably wait and upgrade when released.

@Robert-W , Got it. Thanks.

We have even been internally thinking of ways we can support this. One was to pass in optional arguments in the config and then just mixing them in with the defaults.

Assuming you are referring to possibility of configuring custom args in Operations config and mixing them  with core-server's default searchParams.  Shouldn't these new args be mixed with the custom metadata (which overrides server-core's), instead?

@navndn It would need to be able to work in both cases. If a developer is not providing custom metadata functionality, I would still like the additional custom parameters to be visible in the default capability statement in the appropriate place so the server can still be conformant.
If they added a handler for custom metadata, custom arguments should be added to that as well. Internally we may need to shuffle things around to make it easier to implement the custom makeResource case, where they can pull in all the default and configured parameters.  Although, I think the original case for custom makeResource was to document custom params.  Allowing custom params to be configurable and populating the capability statement may alleviate the need for makeResource functionality.

@jtravan3 2.0.0 will be released tomorrow am.

Ok it's released, feel free to check it out. There is a migration guide here, https://github.com/Asymmetrik/node-fhir-server-core/blob/master/docs/MIGRATION_2.0.0.md

I had to mess with this a little bit, so I think its worth looking into a better solution for this.
Consider this code, a bit hacky, but it works:
in my metadata file:
import { resolveSchema } from '@asymmetrik/node-fhir-server-core'
import { getSearchParams } from<EMAIL_ADDRESS>
export const makeResource = args => {
  const Resource = require(resolveSchema(args.base_version, args.key))
  const searchParams = getSearchParams(args.key, args.base_version)

  // Return our conformance statement
  return {
    type: Resource.resourceType,
    profile: {
      reference: `http://hl7.org/fhir/${args.key}.html`
    },
    conditionalDelete: 'not-supported',
    searchParam: searchParams.concat([
      {
        name: '_count',
        type: 'number',
        documentation: 'The number of results to return'
      },
      {
        name: 'AgeInDays',
        type: 'number',
        documentation: 'Age in days'
      }
    ])
  }
}

My profile:
    patient: {
      service: path.resolve(__dirname, '../logic/fhir/patient.ts'),
      versions: [VERSIONS[FHIRVERSION]],
      metadata: path.resolve(__dirname, '../logic/fhir/metadata/patient.ts'),
      operation: [
        {
          name: 'everything',
          route: '/$everything',
          method: 'GET',
          reference:
            'https://www.hl7.org/fhir/patient-operation-everything-inline.html'
        }
      ]
    },

Both the custom operation and search allowed the custom params. Specifically, it would be nice if either getSearchParams was available in the project root, or there was an appendResource method instead of makeResource
Thoughts on this implementation?

Yea so I think currently this is the only way to actually achieve this and it is a bit hacky.  I also agree the name can be a little misleading but I am hesitant to change the name since that would break any current implementations (simple change but would be annoying none the less). We do plan to expose a simple way to require arguments used, e.g. move getSearchParams to top level export, so that should be coming soon.
We are definitely open to suggestions but would really like to do things in a backwards compatible way, and preferably in a way that can reduce the amount of code written by the end developer and/or be useful for generic tools built on top of this library.
One idea we played with was to pass args in the config, so something like this:
let config = {
  // Global, applies to all resources
  args: {
    _count: {
      type: 'number',
      // we use fhirtype because we generate this code for mulitple targets, type
      // refers to the type for the target and fhirtype is what is in the spec, for JS,
      // this does not matter, but in GraphQL, you'll see things like,
      // type: GraphQLString, fhirtype: 'string'
      fhirtype: 'number',
      definition: '<uri-to-definition>',
      description: 'The number of results to return'
    }
  },
  profiles: {
    patient: {
      // Only applies to patient resources
      args: {
        AgeInDays: {
          type: 'number',
          fhirtype: 'number',
          definition: '<uri-to-definition>',
          description: 'The patients age in days'
        }
      }
    }
  }
};

With this approach, the idea is that a user specifies them here for all profiles or individual ones. Then, in core, we would add these to the appropriate places in the metadata. We also could do sanitization/type checking on these, so the sanitized args coming through would contain your custom args. This would also work with some of the query builders (we have a mongo one but will add more in the future).

I like the idea of it being at the config level

Closing stale issue. Please raise a new issue if this is still a problem

when run yarn i got issue like
@asymmetrik/fhir-gql-schema-utils:test

i install this package ,but still showing this issue
Cannot find module 'graphql' from 'index.test.js'<
Cannot find module 'sequelize' from 'index.js'
Can you this issue how to resolve


Custom Command Service not working properly on lampsmart_pro v3 ?

Hi there, and thank you immensely for your work !
I have random Amazon ceiling lights that I'm able to control perfectly with this component, and lately I've been looking into adding RGB functionality through the Custom Command Service + a template light (I'll share the commands and args if this ends up working, if you want to add this to the component directly).
Only problem is, whichever parameters I use for the service call, I always get the same error in my node's logs:
[W][ble_adv_controller:116]: Unsupported command received: 3. Aborted.
And here's how my controller is configured:
# Ceiling Lights
ble_adv_controller:
  - id: ceiling_light_controller
    encoding: lampsmart_pro
    variant: v3
    forced_id: 1
    reversed: true
    show_config: false

Do you think this is a bug with the lampsmart_pro encoding, or did I miss something obvious ?

It seems that only commands that are already supported in code can be used. This feature is useful for sending arbitrary argument values, not arbitrary (unsupported) commands.
However, I agree that allowing arbitrary commands could be useful for extending support for additional devices/features. If you feel like adding such a capability via a pull request, that could be great!

Thanks for the quick reply !
Unless I'm doing something wrong, none of the commands work and they all result in the error code I copied, even the supported ones :thinking:
I tried switching to fanlamp_pro encoding as well as different variants, but the behavior is always the same.
It feels like something is just broken on the receiving end, as the error code seems to report a cmd value of 3 no matter what I input.
It seems like this service was implemented by @NicoIIT in https://github.com/aronsky/esphome-components/pull/17, I'll try and see if a later commit breaks it !
(as a side note, in case it might be interesting to someone else, I was able to find that the RGB command on my device is 0x22 with args 1..3 as red, green and blue)

Hi guys, I think I broke that in one of the last changes included in https://github.com/aronsky/esphome-components/pull/17.
Let me check if I repaired it already in my dev branch or if it is pending on my side.

Merci copain t'es trop fort c:
Everything works great, I just had to explicitly add ble_adv_handler to the external_components call using your fork, since you separated them.
Here's my ESPHome configuration:
external_components:
  - source: github://NicoIIT/esphome-components@main
    components: [ ble_adv_controller, ble_adv_handler ]

# Ceiling Lights
ble_adv_controller:
  - id: ceiling_light_controller
    encoding: lampsmart_pro
    variant: v3
    forced_id: 1
    reversed: true
    show_config: false

light:
  - platform: ble_adv_controller
    ble_adv_controller_id: ceiling_light_controller
    name: "Ceiling Light"

And in my configuration.yaml:
light:
  - platform: template
    lights:
      rgb_bedroom_ceiling_light:
        friendly_name: "Bedroom Ceiling Light"
        turn_on:
          - service: light.turn_on
            data:
              entity_id: light.bedroom_ceiling_light
        turn_off:
          - service: light.turn_off
            data:
              entity_id: light.bedroom_ceiling_light
        set_level:
          - service: light.turn_on
            data:
              entity_id: light.bedroom_ceiling_light
              brightness: "{{ brightness }}"
        set_temperature:
          - service: light.turn_on
            data:
              entity_id: light.bedroom_ceiling_light
              color_temp: "{{ color_temp }}"
        set_rgb:
          - service: esphome.bedroom_cmd_ceiling_light_controller
            data:
              cmd: 0x22
              param: "{{ r }}"
              arg0: "{{ g }}"
              arg1: "{{ b }}"
              arg2: 0

I also found commands to enable (0x1E) and disable (0x1F) a very ugly RGB animation, in case anyone wants to hurt their eyes !
I'll leave this issue open because it still exists on this repo :relaxed:


Nuclei Template Issue - [FTL] Could not run nuclei: no valid templates were found

Describe the bug
[FTL] Could not run nuclei: no valid templates were found
To Reproduce
Steps to reproduce the behavior:
./reconftw.sh -d testphp.vulnweb.com -a
#######################################################################
#######################################################################
Templates based web scanner
Running : Nuclei info
[FTL] Could not run nuclei: no valid templates were found
Running : Nuclei low
[FTL] Could not run nuclei: no valid templates were found
Running : Nuclei medium
[FTL] Could not run nuclei: no valid templates were found
Running : Nuclei high
[FTL] Could not run nuclei: no valid templates were found
Running : Nuclei critical
[FTL] Could not run nuclei: no valid templates were found
Expected behavior
Nuclei should run and show the results
Screenshots
Attached
Desktop (please complete the following information):
VPS

Update to the latest version and make sure you have sudo permissions (if you're not running as root you should run this command echo "${USERNAME}  ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/reconFTW)

Yes I'm running as a root "sudo ./reconftw.sh -d testphp.vulnweb.com -a"
I have updated reconftw to the latest version using ./install.sh and still that error is showing.
Please support!
Running : Nuclei info
[FTL] Could not run nuclei: no valid templates were found
Running : Nuclei low
[FTL] Could not run nuclei: no valid templates were found
Running : Nuclei medium
[FTL] Could not run nuclei: no valid templates were found
Running : Nuclei high
[FTL] Could not run nuclei: no valid templates were found
Running : Nuclei critical
[FTL] Could not run nuclei: no valid templates were found

It's already fixed, upgrade and reinstall


Declaration order confuses CFE's notion of sealed when mixins involved

The following program is accepted by both the CFE and the analyzer:
main() {
  f(B());
}

f(A a) {
  switch (a) {
    case B():
      print("It's a B");
  }
}

sealed class A {}

class B extends A with M {
  B();
}

mixin M {}

However, if you swap the order of declaration of classes A and B, i.e.:
main() {
  f(B());
}

f(A a) {
  switch (a) {
    case B():
      print("It's a B");
  }
}

class B extends A with M {
  B();
}

sealed class A {}

mixin M {}

Then you get the following error from the CFE:
../../tmp/proj/test.dart:6:11: Error: The type 'A' is not exhaustively matched by the switch cases since it doesn't match '_B&A&M()'.
 - 'A' is from '../../tmp/proj/test.dart'.
Try adding a default case or cases that match '_B&A&M()'.
  switch (a) {
          ^

Reproduced as of 90d84c849472b375e0fbb7321f800208180cd14b.
If we can fix this before the release, I suspect it will be worth cherry-picking to stable.
CC @johnniwinther

If this is just restricted to mixing in things onto a sealed class (why do we even have that lever?) I think I'm on the fence about cherry picking, it doesn't feel likely to be a widespread problem.  Definitely worth fixing though, and we can then consider.  Separately, the error message there is pretty terrible.

@leafpetersen

If this is just restricted to mixing in things onto a sealed class (why do we even have that lever?)...

I guess our intuitions disagree about how useful it is to do that.  That's fine--to each their own.
But for what it's worth, I didn't find this bug by deliberately poking at edge cases.  I found it because I was trying out patterns in a side project over the weekend, and it arose naturally from a genuine attempt to write a useful program 😃
(The details of what I was trying to do, if you're curious: I had a sealed class with several derived classes, and I had a mixin (in a different library) that I could use to add some extra debugging functionality to a class.  I wanted to add the extra debugging functionality to some of the derived classes but not all of them.  I was using the standard "sort declarations" feature in the IDE to keep my file organized, and so I happened to hit on the sort order that provoked the bug.)

This should fix it: https://dart-review.googlesource.com/c/sdk/+/297901


pixi: Add missing feature "cpp" to "wheel-test" environment

What
Should fix red main.
The cpp feature was missing from the wheels-test environment.
Since the “cpp” feature is now part of both the “cpp” environment and the “wheel-test” environment, we have to disambiguate with -e cpp
Checklist

[x] I have read and agree to Contributor Guide and the
[x] I've checked that https://github.com/rerun-io/rerun/actions/runs/9871678286 is green

To run all checks from main, comment on the PR with @rerun-bot full-check.

@rerun-bot full-check

@rerun-bot full-check

I'm merging this in the interest of unblocking other PRs and making main green again

Can you explain why wheel-test needs a dep on the cpp feature? What was the problem that this was trying to fix?


document.registerElement is deprecated and will be removed in M80

As i see registerElement will be removed on february  2020, what is the alternative of registerElement?
[Deprecation] document.registerElement is deprecated and will be removed in M80, around February 2020. Please use window.customElements.define instead. See https://www.chromestatus.com/features/4642138092470272 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.
I tried use window.customElements.define but get this error:
Uncaught TypeError: Failed to execute 'define' on 'CustomElementRegistry': The callback provided as parameter 2 is not a function.

It's going to require few changes but here is a snippet:
class LocalizedTextElement extends HTMLElement {
    constructor() {
        super();
    }

    connectedCallback() {
        var key = this.hasAttribute('key') ? this.getAttribute('key') : '';
        this.innerHTML = getLocalizedText(key); // implement your own getLocalizedText function to fetch localized text from a dict
    }
}

customElements.define('localized-text', LocalizedTextElement);

In your HTML page:
<localized-text text="my_localized_text"></localized-text>

Fixed with last commit removing dependency with Electron and registerElement deprecated API.


fix(performance): optimize ModuleEnvironmentSandbox.getSubTypeIdentifier

Always use the class's fully-qualified Java class name as its type identifier, as ReflectionsSandbox does.
The previous implementation led to calling loadClass on all of Component's subclasses every time the serializer asked for this type identifier. We encountered scalability problems with that in #4126.
How to test
This changes identifiers used by serializers for pretty much everything, which could be a big deal!
Those are used for networking and save games.
So while it could break everything, if some things seem to be working, I don't have ideas of particular edge cases to test for.
Ideas welcome here.

Can confirm that this seems to resolve the performance issue, nice work @keturn! 🎉
In host/client + client multiplayer I noticed no lag at all for either client but it still took a full 2 minutes for player 2 to join the first time, so there's still something squirrely going on somewhere.
Player 1 could craft perfectly fine both in-hand and via workbench. Player 2 hit a known issue where crafting a crude weapon in a workbench leaves the output item invisible until picked up. Also the durability overlay on an item appears to have gone buggy and takes up way more space (down from the usual space, roughly a full inventory slot's size total) than it is meant to.
On trying to relog player 2 I hit the other issue where I logged in with the camera stuck at 0,0,0. Still was actually in the right location, could break blocks there and everything, but on the 2nd client itself you're stuck in the ground helplessly.

Not sure why GitHub didn't notice me merging this - even shows the related merge commit in the activity list 🤔
Closing this as merged - tested several additional rounds of multiplayer separately with CoreSampleGameplay, ManualLabor, and JoshariasSurvival and submitted two new issues to cover any leftovers: #4152 and #4154
Many thanks @keturn ! Blocker resolved, but sure more stuff we can fix. I didn't see the spawn at 0,0,0 even once during testing at least :-)

Looks like I was missing the move commit locally for some reason despite having fetched 🤔 Okay trying to merge a second time, maybe then this will auto-close as merged.


add (explicit) Jaccard for two RAIs

inspired from https://github.com/CellTrackingChallenge/CTC-FijiPlugins/tree/Jaccard

fixed in commit fc42afaec059e297f2124ae32e53ead8fa7a4457


Add Redis datasource

It would be great if we can add Redis datasource into this extension.

Hey, thanks for the suggestion - I think this extension needs a lot of love :)


cmd works but doesnt appear anything on the screen

[ ] I have read the FAQ.
[ ] I have searched in existing issues.

Environment

OS: [linux mint.]
scrcpy version: [1.12]
installation method: [Snap]
device model:redmi note 8pro
Android version: [9]

Describe the bug
the adb is working device is authorized ...
This is scrcpy info
summary: Display and control your Android device
publisher: sisco311
store-url: https://snapcraft.io/scrcpy
contact: https://github.com/sisco311/scrcpy-snap/issues
license: Apache-2.0
description: |
This application provides display and control of Android devices connected on USB (or over
TCP/IP). It does not require any root access. It works on GNU/Linux, Windows and MacOS.
This is an unofficial snap. The code of scrcpy can be found at:
https://github.com/Genymobile/scrcpy
commands:
scrcpy.adb
scrcpy
snap-id: M7yvgnqOvyQj64bolfpawIAEwHv7dQ5G
tracking: latest/stable
refresh-date: today at 20:46 IST
channels:
latest/stable: v1.12 2020-03-26 (211) 85MB -
latest/candidate: ^
latest/beta: v1.12.1-10-g7bb9163 2020-03-27 (214) 85MB -
latest/edge: v1.12-1-g71df317 2019-12-10 (202) 81MB -
installed: v1.12 (211) 85MB -

When i run the cmd scrcpy i got this and nothing appers on the screen
    2020/04/14 22:55:21.816933 cmd_run.go:893: WARNING: cannot start document portal: write unix @->@/tmp/dbus-JrtrgGH41M: write: broken pipe
    INFO: scrcpy 1.12 https://github.com/Genymobile/scrcpy
    /usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 5.8 MB/s (26196 bytes in 0.004s)
    No protocol specified
    Segmentation fault
    root@Flight-X:/home/stelph# java.io.FileNotFoundException: /data/system/theme_config/theme_compatibility.xml (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:231)
    at java.io.FileInputStream.(FileInputStream.java:165)
    at java.io.FileInputStream.(FileInputStream.java:112)
    at java.io.FileReader.(FileReader.java:58)
    at miui.content.res.ThemeCompatibilityLoader.getVersion(ThemeCompatibilityLoader.java:108)
    at miui.content.res.ThemeCompatibilityLoader.getConfigDocumentTree(ThemeCompatibilityLoader.java:126)
    at miui.content.res.ThemeCompatibilityLoader.loadConfig(ThemeCompatibilityLoader.java:59)
    at miui.content.res.ThemeCompatibility.(ThemeCompatibility.java:31)
    at miui.content.res.ThemeCompatibility.isThemeEnabled(ThemeCompatibility.java:111)
    at android.content.res.MiuiResourcesImpl.(MiuiResourcesImpl.java:41)
    at android.content.res.Resources.(Resources.java:267)
    at android.content.res.MiuiResources.(MiuiResources.java:49)
    at android.content.res.Resources.getSystem(Resources.java:190)
    at android.app.LoadedApk.(LoadedApk.java:211)
    at android.app.ContextImpl.createSystemContext(ContextImpl.java:2332)
    at android.app.ActivityThread.getSystemContext(ActivityThread.java:2199)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.genymobile.scrcpy.Workarounds.fillAppInfo(Workarounds.java:66)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:56)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:34)
    at com.genymobile.scrcpy.Server.main(Server.java:163)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at `com.android.internal.os.RuntimeInit.main(RuntimeInit.java:388)

Now It Giving me this  2020/04/15 00:57:20.557499 cmd_run.go:893: WARNING: cannot start document portal: write unix @->@/tmp/dbus-JrtrgGH41M: write: broken pipe INFO: scrcpy 1.12 <https://github.com/Genymobile/scrcpy> /usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 5.7 MB/s (26196 bytes in 0.004s) bind: Address already in use ERROR: Could not listen on port 27183
Wht should i do

WARNING: cannot start document portal: write unix

Looks like a snap problem.
Please try the manual installation :/

sir, When i tried to execute cmd
ninja -Cx install i Got an error
ninja: Entering directory x'
[1/2] Generating scrcpy-server with a custom command.
(not invoking gradle, since we are root)
[1/2] Installing files.
Installing app/scrcpy to /usr/local/bin/scrcpy
Stripping target 'app/scrcpy'
Installing server/scrcpy-server to /usr/local/share/scrcpy/scrcpy-server
Traceback (most recent call last):
File "/usr/bin/meson", line 26, in
sys.exit(main())
File "/usr/bin/meson", line 23, in main
return mesonmain.run(sys.argv[1:], launcher)
File "/usr/share/meson/mesonbuild/mesonmain.py", line 318, in run
sys.exit(run_script_command(args[1:]))
File "/usr/share/meson/mesonbuild/mesonmain.py", line 274, in run_script_command
return cmdfunc(cmdargs)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 393, in run
do_install(datafilename)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 212, in do_install
install_targets(d)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 332, in install_targets
raise RuntimeError('File {!r} could not be found'.format(fname))
RuntimeError: File 'server/scrcpy-server' could not be found
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 145, in apport_excepthook
os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640), 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_share_meson_meson.0.crash'
Original exception was:
Traceback (most recent call last):
File "/usr/bin/meson", line 26, in
sys.exit(main())
File "/usr/bin/meson", line 23, in main
return mesonmain.run(sys.argv[1:], launcher)
File "/usr/share/meson/mesonbuild/mesonmain.py", line 318, in run
sys.exit(run_script_command(args[1:]))
File "/usr/share/meson/mesonbuild/mesonmain.py", line 274, in run_script_command
return cmdfunc(cmdargs)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 393, in run
do_install(datafilename)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 212, in do_install
install_targets(d)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 332, in install_targets
raise RuntimeError('File {!r} could not be found'.format(fname))
RuntimeError: File 'server/scrcpy-server' could not be found
FAILED: meson-install
/usr/bin/python3 /usr/bin/meson --internal install /home/stelph/Downloads/scrcpyFiles/scrcpy/x/meson-private/install.dat
ninja: build stopped: subcommand failed.
`

Sir,
**i got this **
`ollecting guiscrcpy
Downloading https://files.pythonhosted.org/packages/e3/1b/1a323892550b3c1914fa6bd4f16419b6c17e8c325243dfe445e42a998285/guiscrcpy-3.5-py3-none-any.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 252kB/s
Collecting gitpython (from guiscrcpy)
Downloading https://files.pythonhosted.org/packages/19/1a/0df85d2bddbca33665d2148173d3281b290ac054b5f50163ea735740ac7b/GitPython-3.1.1-py3-none-any.whl (450kB)
100% |████████████████████████████████| 460kB 192kB/s
Collecting fonttools (from guiscrcpy)
Downloading https://files.pythonhosted.org/packages/c9/81/1b00432d8f5536c09dca00f6f5306be26c477d1c0390a0fb993f8ebf1c64/fonttools-4.7.0-py3-none-any.whl (749kB)
100% |████████████████████████████████| 757kB 187kB/s
Collecting PyQt5==5.14.1 (from guiscrcpy)
Downloading https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz (3.2MB)
100% |████████████████████████████████| 3.2MB 225kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-756abdaf/PyQt5/
`

(not invoking gradle, since we are root)

You must execute ninja -Cx as non-root, and sudo ninja -Cx install as root: 4c49b27e9f6be02b8e63b508b60535426bd0291a
Remove your x directory and retry.

@rom1v
it says permission error
all the previos step  i did it all as root
ninja -Cx
ninja: Entering directory `x'
ninja: error: opening build log: Permission denied

That's why I said you must remove your x directory:
sudo rm -rf x
meson x …
ninja -Cx
sudo ninja -Cx install

@rom1v
sir tried all over again
in the step of ninja -Cx
i got this
ninja: Entering directory x'
[26/26] Generating scrcpy-server with a custom command.
FAILED: server/scrcpy-server
/home/stelph/project/scrcpy/server/./scripts/build-wrapper.sh /home/stelph/project/scrcpy/server server/scrcpy-server release
Downloading https://services.gradle.org/distributions/gradle-5.5.1-all.zip
..................................................................................................................................
Welcome to Gradle 5.5.1!
Here are the highlights of this release:

Kickstart Gradle plugin development with gradle init
Distribute organization-wide Gradle properties in custom Gradle distributions
Transform dependency artifacts on resolution

For more details see https://docs.gradle.org/5.5.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.

What went wrong:
A problem occurred configuring project ':server'.

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/home/stelph/project/scrcpy/local.properties'.

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 8m 32s
ninja: build stopped: subcommand failed.
`

@Flight-X you may try the second method of installing scrcpy from source, aka using the prebuilt server.
https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#prebuilt-server