Apply script to repositories and dependencies in buildscript block

I develop gradle plugins for the rest of the firm to consume, the way how user consume my plugins is by applying a script in their project’s build.gradle:

buildscript {
    apply from: 'init.gradle', to: buildscript
}

Now I need to separate my init.gradle script into repo.gradle and deps.gradle for some reason, so it actually apply other 2 scripts, as a demo:

build.gradle
===========================
buildscript {
    apply from: 'init.gradle', to: buildscript
}
  apply plugin: 'java'
  init.gradle
===========================
apply from: 'repo.gradle', to: repositories
apply from: 'deps.gradle', to: dependencies
  repo.gradle
===========================
repositories {
    ivy {
        ivyPattern "//path/to/repo//[organization]/[module]/ivys/ivy-[revision].xml"
        artifactPattern "//path/to/repo//[organisation]/[module]/[revision]/common/lib/[artifact].[ext]"
    }
}
  deps.gradle
===========================
classpath group: 'ossjava', name: 'freemarker', version: '2.3.19', configuration: 'runtime'

The example above actually works, but it is not clear to me how the scope work here, namely: repositories and dependencies: * apply from: ‘repo.gradle’, to: repositories, I apply repo.gradle to target repositories, but in repo.gradle, I still need to have repositories {} closure, or else it won’t work * apply from: ‘deps.gradle’, to: dependencies, I apply deps.gradle to target dependencies, but in deps.gradle, I must not have dependencies {} closure, but directly specify classpath for the dependencies.

So what is the rule here? the target or scope here is inconsistent with repositories and dependencies.

The reason I ask is I don’t want to rely on an non-official supported solution that works by coincidence.

Thanks very much.