<commit_before>/*
 * Copyright 2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.nativebinaries.toolchain.internal;

import org.gradle.internal.hash.HashUtil;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class SingleSourceCompileArgTransformer<T extends NativeCompileSpec> implements ArgsTransformer<T> {
    private final ArgsTransformer<T> delegate;
    private final String objectFileName;
    private final File sourceFile;
    private final boolean usingVisualCToolChain;

    public SingleSourceCompileArgTransformer(File sourceFile, String objectFileName, ArgsTransformer<T> delegate, boolean usingVisualCToolChain) {
        this.sourceFile = sourceFile;
        this.delegate = delegate;
        this.objectFileName = objectFileName;
        this.usingVisualCToolChain = usingVisualCToolChain;
    }

    public List<String> transform(T spec) {
        List<String> args = new ArrayList<String>();
        args.addAll(delegate.transform(spec));
        args.add(sourceFile.getAbsolutePath());

        File outputFileDir = getOutputFileDir(sourceFile, spec.getObjectFileDir());
        if(outputFileDir.exists()){
            outputFileDir.mkdir();<commit_msg>generate parent dir for obj file if it does _NOT_ yet exist.<commit_after>/*
 * Copyright 2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.nativebinaries.toolchain.internal;

import org.gradle.internal.hash.HashUtil;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class SingleSourceCompileArgTransformer<T extends NativeCompileSpec> implements ArgsTransformer<T> {
    private final ArgsTransformer<T> delegate;
    private final String objectFileName;
    private final File sourceFile;
    private final boolean usingVisualCToolChain;

    public SingleSourceCompileArgTransformer(File sourceFile, String objectFileName, ArgsTransformer<T> delegate, boolean usingVisualCToolChain) {
        this.sourceFile = sourceFile;
        this.delegate = delegate;
        this.objectFileName = objectFileName;
        this.usingVisualCToolChain = usingVisualCToolChain;
    }

    public List<String> transform(T spec) {
        List<String> args = new ArrayList<String>();
        args.addAll(delegate.transform(spec));
        args.add(sourceFile.getAbsolutePath());

        File outputFileDir = getOutputFileDir(sourceFile, spec.getObjectFileDir());
        if(!outputFileDir.exists()){
            outputFileDir.mkdir();
{'fraction_non_alphanumeric': 0.07927829414980864, 'fraction_numerical': 0.004373974849644614, 'mean_word_length': 4.033012379642366, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7326962', 'n_tokens_mistral': 948, 'n_tokens_neox': 925, 'n_words': 318}