<commit_before>// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.intellij.build.impl

import groovy.transform.CompileStatic
import org.jetbrains.intellij.build.BuildContext

@CompileStatic
class DependenciesProperties {
  private final BuildContext context

  DependenciesProperties(BuildContext context) {
    this.context = context
  }

  @Lazy
  private File directory = {
    new File(context.paths.communityHome, 'build/dependencies')
  }()

  @Lazy
  File file = {
    new File(directory, 'build/dependencies.properties')
  }()

  @Lazy
  private Properties properties = {
    context.gradle.run('Preparing dependencies file', 'dependenciesFile')
    file.newInputStream().withStream {
      Properties properties = new Properties()
      properties.load(it)
      properties
    }
  }()

  String property(String name) {
    def value = properties.get(name)
    if (value == null) {
      context.messages.error("`$name` is not defined in `$directory/gradle.properties`")
    }
    return value
  }
}<commit_msg>IJI-360 ZKM.jar is downloaded into Gradle build dir without renaming to perform up-to-date checks without JetBrains network check: fix lazy value initialization<commit_after>// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.intellij.build.impl

import groovy.transform.CompileStatic
import org.jetbrains.intellij.build.BuildContext

@CompileStatic
class DependenciesProperties {
  private final BuildContext context

  DependenciesProperties(BuildContext context) {
    this.context = context
  }

  @Lazy
  private File directory = {
    new File(context.paths.communityHome, 'build/dependencies')
  }()

  @Lazy
  File file = {
    if (properties.isEmpty()) throw new IllegalStateException('Dependencies properties are empty')
    new File(directory, 'build/dependencies.properties')
  }()

  @Lazy
  private Properties properties = {
    context.gradle.run('Preparing dependencies file', 'dependenciesFile')
    file.newInputStream().withStream {
      Properties properties = new Properties()
      properties.load(it)
      properties
    }
  }()

  String property(String name) {
    def value = properties.get(name)
    if (value == null) {
      context.messages.error("`$name` is not defined in `$directory/gradle.properties`")
    }
    return value
  }
}
{'fraction_non_alphanumeric': 0.09482071713147411, 'fraction_numerical': 0.009163346613545816, 'mean_word_length': 3.801147227533461, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '538926', 'n_tokens_mistral': 748, 'n_tokens_neox': 684, 'n_words': 203}