Exemple #1
0
def register_goals():
  NodeResolve.register_resolver_for_type(ScalaJSBinary, ScalaJSPlatform)
  # NB: These task/goal assignments are pretty nuts, but are necessary in order to
  # prevent product-graph cycles between the JVM and node.js.
  #   see https://github.com/pantsbuild/pants/labels/engine
  task(name='scala-js-compile', action=ScalaJSZincCompile).install('resolve')
  task(name='scala-js-link', action=ScalaJSLink).install('resolve')
Exemple #2
0
def register_goals():
    NodeResolve.register_resolver_for_type(ScalaJSBinary, ScalaJSPlatform)
    # NB: These task/goal assignments are pretty nuts, but are necessary in order to
    # prevent product-graph cycles between the JVM and node.js.
    #   see https://github.com/pantsbuild/pants/labels/engine
    task(name='scala-js-compile', action=ScalaJSZincCompile).install('resolve')
    task(name='scala-js-link', action=ScalaJSLink).install('resolve')
Exemple #3
0
 def register_options(cls, register):
     super(NpmResolver, cls).register_options(register)
     register('--install-optional',
              type=bool,
              default=False,
              fingerprint=True,
              help='If enabled, install optional dependencies.')
     NodeResolve.register_resolver_for_type(NodeModule, cls)
Exemple #4
0
 def register_options(cls, register):
     register(
         '--fetch-timeout-secs',
         type=int,
         advanced=True,
         default=10,
         help=
         'Timeout the fetch if the connection is idle for longer than this value.'
     )
     super(NodePreinstalledModuleResolver, cls).register_options(register)
     NodeResolve.register_resolver_for_type(NodePreinstalledModule, cls)
Exemple #5
0
    def test_register_resolver_for_type(self):
        NodeResolve._clear_resolvers()

        self.assertIsNone(NodeResolve._resolver_for_target(NodePreinstalledModule))
        self.assertIsNone(NodeResolve._resolver_for_target(NodeModule))

        node_preinstalled__module_target = self.make_target(
            spec=":empty_fake_node_preinstalled_module_target", target_type=NodePreinstalledModule
        )
        NodeResolve.register_resolver_for_type(NodePreinstalledModule, NodePreinstalledModuleResolver)
        self.assertEqual(
            NodePreinstalledModuleResolver, NodeResolve._resolver_for_target(node_preinstalled__module_target)
        )

        node_module_target = self.make_target(spec=":empty_fake_node_module_target", target_type=NodeModule)
        NodeResolve.register_resolver_for_type(NodeModule, NpmResolver)
        self.assertEqual(NpmResolver, NodeResolve._resolver_for_target(node_module_target))
Exemple #6
0
  def test_register_resolver_for_type(self):
    NodeResolve._clear_resolvers()

    self.assertIsNone(NodeResolve._resolver_for_target(NodePreinstalledModule))
    self.assertIsNone(NodeResolve._resolver_for_target(NodeModule))

    node_preinstalled__module_target = self.make_target(
      spec=':empty_fake_node_preinstalled_module_target',
      target_type=NodePreinstalledModule)
    NodeResolve.register_resolver_for_type(NodePreinstalledModule, NodePreinstalledModuleResolver)
    self.assertEqual(NodePreinstalledModuleResolver,
                     NodeResolve._resolver_for_target(node_preinstalled__module_target))

    node_module_target = self.make_target(spec=':empty_fake_node_module_target',
                                          target_type=NodeModule)
    NodeResolve.register_resolver_for_type(NodeModule, NpmResolver)
    self.assertEqual(NpmResolver,
                     NodeResolve._resolver_for_target(node_module_target))
Exemple #7
0
    def register_options(cls, register):
        super().register_options(register)
        register(
            "--install-optional",
            type=bool,
            default=False,
            fingerprint=True,
            help="If enabled, install optional dependencies.",
        )
        register(
            "--install-production",
            type=bool,
            default=False,
            fingerprint=True,
            help="If enabled, do not install devDependencies.",
        )
        register(
            "--force",
            type=bool,
            default=False,
            fingerprint=True,
            help="If enabled, refetch and resolve dependencies even if they are already built.",
        )
        register(
            "--frozen-lockfile",
            type=bool,
            default=True,
            fingerprint=True,
            help="If enabled, disallow automatic update of lock files.",
        )
        # There are cases where passed through options does not override hard-coded options.
        # One example is for node-install, --frozen-lockfile=False is the dominate configuration
        # as it allows the user to modify dependencies and generate a new lockfile.
        # By turning on --force-option-override, the user accepts full responsibilities.
        register(
            "--force-option-override",
            type=bool,
            default=False,
            fingerprint=True,
            advanced=True,
            help="If enabled, options will override hard-coded values. Be aware of default values.",
        )

        NodeResolve.register_resolver_for_type(NodeModule, cls)
Exemple #8
0
  def register_options(cls, register):
    super(NpmResolver, cls).register_options(register)
    register(
      '--install-optional', type=bool, default=False, fingerprint=True,
      help='If enabled, install optional dependencies.')
    register(
      '--install-production', type=bool, default=False, fingerprint=True,
      help='If enabled, do not install devDependencies.')
    register(
      '--force', type=bool, default=False, fingerprint=True,
      help='If enabled, refetch and resolve dependencies even if they are already built.')
    register(
      '--frozen-lockfile', type=bool, default=True, fingerprint=True,
      help='If enabled, disallow automatic update of lock files.')
    # There are cases where passed through options does not override hard-coded options.
    # One example is for node-install, --frozen-lockfile=False is the dominate configuration
    # as it allows the user to modify dependencies and generate a new lockfile.
    # By turning on --force-option-override, the user accepts full responsibilities.
    register(
      '--force-option-override', type=bool, default=False, fingerprint=True, advanced=True,
      help='If enabled, options will override hard-coded values. Be aware of default values.')

    NodeResolve.register_resolver_for_type(NodeModule, cls)
 def test_product_types(self):
   self.assertEqual([NodePaths], NodeResolve.product_types())
 def tearDown(self):
   super(NodeResolveSourceDepsTest, self).tearDown()
   NodeResolve._clear_resolvers()
 def setUp(self):
   super(NodeResolveSourceDepsTest, self).setUp()
   NodeResolve.register_resolver_for_type(NodePreinstalledModule, NodePreinstalledModuleResolver)
   NodeResolve.register_resolver_for_type(NodeModule, NpmResolver)
Exemple #12
0
 def register_options(cls, register):
   NodeResolve.register_resolver_for_type(WebPackModule, cls)
   NodeResolve.register_resolver_for_type(NpmResource, cls)
   super(WebPackResolver, cls).register_options(register)
Exemple #13
0
 def register_options(cls, register):
   super(NpmResolver, cls).register_options(register)
   register(
     '--install-optional', type=bool, default=False, fingerprint=True,
     help='If enabled, install optional dependencies.')
   NodeResolve.register_resolver_for_type(NodeModule, cls)
Exemple #14
0
 def setUp(self):
   super(NodeTestTest, self).setUp()
   NodeResolve.register_resolver_for_type(NodeModule, NpmResolver)
Exemple #15
0
 def tearDown(self):
   super().tearDown()
   NodeResolve._clear_resolvers()
Exemple #16
0
 def test_product_types(self):
     self.assertEqual([NodePaths], NodeResolve.product_types())
Exemple #17
0
 def register_options(cls, register):
   NodeResolve.register_resolver_for_type(WebPackModule, cls)
   NodeResolve.register_resolver_for_type(NpmResource, cls)
   super(WebPackResolver, cls).register_options(register)
 def register_options(cls, register):
     super(NodePreinstalledModuleResolver, cls).register_options(register)
     NodeResolve.register_resolver_for_type(NodePreinstalledModule, cls)
Exemple #19
0
 def tearDown(self):
     super(NodeTestTest, self).tearDown()
     NodeResolve._clear_resolvers()
Exemple #20
0
 def setUp(self):
     super(NodeTestTest, self).setUp()
     NodeResolve.register_resolver_for_type(NodeModule, NpmResolver)
Exemple #21
0
 def setUp(self):
   super().setUp()
   NodeResolve.register_resolver_for_type(NodePreinstalledModule, NodePreinstalledModuleResolver)
   NodeResolve.register_resolver_for_type(NodeModule, NpmResolver)
Exemple #22
0
 def register_options(cls, register):
   super(NpmResolver, cls).register_options(register)
   NodeResolve.register_resolver_for_type(NodeModule, cls)
 def register_options(cls, register):
   super(NodePreinstalledModuleResolver, cls).register_options(register)
   NodeResolve.register_resolver_for_type(NodePreinstalledModule, cls)
 def register_options(cls, register):
   register('--fetch-timeout-secs', type=int, advanced=True, default=10,
            help='Timeout the fetch if the connection is idle for longer than this value.')
   super(NodePreinstalledModuleResolver, cls).register_options(register)
   NodeResolve.register_resolver_for_type(NodePreinstalledModule, cls)
Exemple #25
0
 def tearDown(self):
   super(NodeTestTest, self).tearDown()
   NodeResolve._clear_resolvers()
Exemple #26
0
 def register_options(cls, register):
     super(NpmResolver, cls).register_options(register)
     NodeResolve.register_resolver_for_type(NodeModule, cls)